Skip to content

Comments

BUG FIX: BlockIndex V2 serde#828

Open
idky137 wants to merge 8 commits intozingolabs:devfrom
idky137:block_index_block_height
Open

BUG FIX: BlockIndex V2 serde#828
idky137 wants to merge 8 commits intozingolabs:devfrom
idky137:block_index_block_height

Conversation

@idky137
Copy link
Contributor

@idky137 idky137 commented Feb 11, 2026

Fixes:
#787 updated the height field of the BlockIndex struct but did not implement this change as a V2 serialisation schema.

This PR brings this change into line with the database versioning strategy by:

  • Adding V2 BlockHeaderData and V2 BlockIndex serde (while keeping V1 serde valid).
  • Updates v1.0.0 -> v1.1.0 database migration and changelog entry
  • Adds new db migration test.
  • Updates ZainoVersionedSerde to enable construction of historical versions (required for checksum validation of legacy database formats)
  • Updates StoredEntry verification to work with legacy versions.
  • Adds encoding and StoredEntry unit tests.

NOTE:

Because BlockHeaderData is stored in a [StoredEntryVar], and the headers lmdb table does not use fixed length optimisations, it is possible for us to just provide the new serde implementation.

Where the new chain index database has been partially built before this update, the headers table will hold a mix of V1 and V2 BlockHeaderData structs'.

Where update to chainindex has not yet taken place, or where the database will be built fresh, V2 BlockHeaderData serde will be used.

@idky137 idky137 marked this pull request as ready for review February 11, 2026 14:44
@idky137 idky137 requested review from AloeareV and nachog00 and removed request for AloeareV February 11, 2026 15:10
@idky137 idky137 marked this pull request as draft February 12, 2026 12:40
@idky137 idky137 marked this pull request as ready for review February 13, 2026 11:42
@idky137
Copy link
Contributor Author

idky137 commented Feb 20, 2026

NOTE: If we release zaino before this PR lands it should be updated so that the database updates go into the v1.1.0->v1.2.0 migration (instead of the v1.0.0->1.1.0 migration currently on dev).

@idky137 idky137 changed the title BlockIndex V2 serde BUG FIX: BlockIndex V2 serde Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant