ChainSafe / ChainSafe/gossamer

dot/state: `headerHashKey` should accept a `uint` instead of `uint64`

Open
#2,436 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
454
Forks
144
PR merge metrics
No merged PRs in 30d

Description

## Task summary

- `encodeBlockNumber` should be changed to encode a `uint` to a dynamically sized byte slice using `common.UintToBytes` to save space
- `headerHashKey` should accept a `uint` instead of `uint64`
- This will break existing database storage, so we should definitely do this before a v1 release.

Contributor guide

Open the contributing guide

Research direction

Locate encodeBlockNumber and headerHashKey in the dot/state implementation, then inspect their callers and database-related tests. Read common.UintToBytes and verify how encoded block numbers are stored and retrieved. Done means both functions use uint consistently, dynamic encoding is covered by tests, and the intentional pre-v1 storage break is understood.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
database
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.