-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ChainSyncClient: No BlockNo
when tip is genesis
#1585
Conversation
The `Tip` data-type was ```haskell data Tip b = Tip { tipPoint :: !(Point b) , tipBlockNo :: !BlockNo } ``` where `Point` uses `WithOrigin`. This is not correct. When `tipPoint` is `Origin`, then there _is_ no `tipBlockNo` (`genesisBlockNo` is the block number of the first block on the chain). In this commit we change this to ```haskell data Tip b = -- | The tip is genesis TipGenesis -- | The tip is not genesis | Tip !SlotNo !(HeaderHash b) !BlockNo ``` It doesn't, however, make any real changes, providing instead some "legacy" API that pretends that we _do_ always have a `BlockNo`. This primarily affects consensus only, in networking this only appears in examples and tests. We also use this legacy format to avoid changing the binary presentation of `Tip`, so that this PR does _not_ break backwards compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Do we have a ticket for this TODO? If not lets make one.
bors r+ |
Will create the ticket. |
1585: ChainSyncClient: No `BlockNo` when tip is genesis r=edsko a=edsko The `Tip` data-type was ```haskell data Tip b = Tip { tipPoint :: !(Point b) , tipBlockNo :: !BlockNo } ``` where `Point` uses `WithOrigin`. This is not correct. When `tipPoint` is `Origin`, then there _is_ no `tipBlockNo` (`genesisBlockNo` is the block number of the first block on the chain). In this commit we change this to ```haskell data Tip b = -- | The tip is genesis TipGenesis -- | The tip is not genesis | Tip !SlotNo !(HeaderHash b) !BlockNo ``` It doesn't, however, make any real changes, providing instead some "legacy" API that pretends that we _do_ always have a `BlockNo`. This primarily affects consensus only, in networking this only appears in examples and tests. We also use this legacy format to avoid changing the binary presentation of `Tip`, so that this PR does _not_ break backwards compatibility. Co-authored-by: Edsko de Vries <[email protected]>
#1587 is the ticket. |
LGTM. Used to be we had to have a block number for some reason, and we chose 0 for the genesis, and each EBB would have the same block number as the 0th block number of its epoch. If this isn't needed anymore then good riddance! |
This might still be needed, but if so, it should be Byron specific, and not live in the general infrastructure. The addition to of |
The
Tip
data-type waswhere
Point
usesWithOrigin
. This is not correct. WhentipPoint
isOrigin
, then there is notipBlockNo
(genesisBlockNo
is the block number of the first block on the chain). In this commit we change this toIt doesn't, however, make any real changes, providing instead some "legacy" API that pretends that we do always have a
BlockNo
. This primarily affects consensus only, in networking this only appears in examples and tests.We also use this legacy format to avoid changing the binary presentation of
Tip
, so that this PR does not break backwards compatibility.