Skip to content

Conversation

@ninioArtillero
Copy link
Collaborator

@ninioArtillero ninioArtillero commented Jan 7, 2026

Description

This PR fixes hashForkNo as previous behavior uniquely identified branches by fork number and the new parameterized implementation did not. This seems relevant because otherwise BlockTreeBranches forking from the same block in the trunk would end up with the same fork number. As it turns out, these fork numbers are not related to the order in which forking takes place. Related documentation was added.

This seem to be related to an apparent mismatch. On the one hand, the Test.Util.TestBlock.TestHash documentation states that multiple branches can steem from a single node in a tree and suggests that the fork number indexes branches in an orderly way. On the other hand, the implementation of GenesisTest generation in Test.Consensus.Genesis.Setup.GenChains assigns fork numbers to branches in an arbitrary way.

@ninioArtillero ninioArtillero force-pushed the ninioArtillero/chain-path-utility branch from 03ca80b to 9bee54f Compare January 7, 2026 21:10
@ninioArtillero ninioArtillero changed the title Add utility to recover path representation for any block type Amend hashForkNo and document fork number Jan 7, 2026
@ninioArtillero ninioArtillero force-pushed the ninioArtillero/chain-path-utility branch 2 times, most recently from c3142a0 to e0fa207 Compare January 7, 2026 22:40
@ninioArtillero ninioArtillero force-pushed the ninioArtillero/chain-path-utility branch from e0fa207 to 13e2f0e Compare January 7, 2026 22:45
@ninioArtillero ninioArtillero marked this pull request as ready for review January 7, 2026 23:02
@ninioArtillero ninioArtillero force-pushed the ninioArtillero/chain-path-utility branch 3 times, most recently from 648cc2b to f525394 Compare January 8, 2026 18:25
@ninioArtillero ninioArtillero force-pushed the ninioArtillero/chain-path-utility branch from f525394 to cd80cc6 Compare January 8, 2026 18:34
Copy link
Collaborator

@isovector isovector left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Copy link
Member

@nbloomf nbloomf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Thank you for tackling this and for the great documentation!

@ninioArtillero ninioArtillero merged commit 7449d2f into isovector/more-detest Jan 9, 2026
1 check passed
ninioArtillero added a commit that referenced this pull request Jan 9, 2026
isovector pushed a commit that referenced this pull request Jan 9, 2026
# Description

This PR fixes `hashForkNo` as previous behavior uniquely identified
branches by fork number and the new parameterized implementation did
not. This seems relevant because otherwise `BlockTreeBranch`es forking
from the same block in the trunk would end up with the same fork number.
As it turns out, these _fork numbers_ are not related to the order in
which forking takes place. Related documentation was added.

This seem to be related to an apparent mismatch. On the one hand, the
`Test.Util.TestBlock.TestHash` documentation states that multiple
branches can steem from a single node in a tree and _suggests_ that the
fork number indexes branches in an orderly way. On the other hand, the
implementation of `GenesisTest` generation in
`Test.Consensus.Genesis.Setup.GenChains` assigns fork numbers to
branches in an arbitrary way.
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.

4 participants