-
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
Introduce Header type family #616
Conversation
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.
Finally, the long awaited clean-up!
I'll push some commits that fix some issues. These should be squashed before merging.
The ChainDB still has to be updated. I don't mind that this is done before my work on the ChainDB is done, I'll just rebase. We need to be careful about the Reader
s, these will need to be instantiated both with blocks (node-to-client chain sync server) and headers (for the regular chain sync server).
(SimpleHeader SimpleMockCrypto ext) | ||
, ProtocolLedgerView (SimpleBlock SimpleMockCrypto ext) | ||
-- TODO: ProtocolLedgerView implies SupportedBlock already..? | ||
, SupportedBlock (SimpleBlock SimpleMockCrypto ext) |
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.
Huh, it compiles just fine if I remove this constraint.
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.
It didn't for me :-o
@@ -122,7 +122,7 @@ class ( Show (ChainState p) | |||
type family ValidationErr p :: * | |||
|
|||
-- | Blocks that the protocol can run on |
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.
Comment is out of date.
@@ -134,10 +134,10 @@ class ( Show (ChainState p) | |||
-- | |||
-- Note: we do not assume that the candidate fragments fork less than @k@ | |||
-- blocks back. | |||
preferCandidate :: HasHeader b | |||
preferCandidate :: HasHeader hdr |
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.
Should we use SupportedHeader
here too?
Could/should we include HasHeader
as a mandatory constraint for headers?
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.
We could, those we don't currently need it. But I guessthere is no reason not to add it.
@@ -122,7 +122,7 @@ class ( Show (ChainState p) | |||
type family ValidationErr p :: * | |||
|
|||
-- | Blocks that the protocol can run on | |||
type family SupportedBlock p :: * -> Constraint | |||
type family SupportedHeader p :: * -> Constraint |
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.
Is this only meant for headers or do we also use it with blocks sometimes?
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.
Perhaps we might apply it to blocks in tests (like in the model of the chain DB where we don't distinguish).
@@ -165,10 +165,10 @@ class ( Show (ChainState p) | |||
-- | Apply a block |
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.
Outdated comment.
@@ -165,10 +165,10 @@ class ( Show (ChainState p) | |||
-- | Apply a block | |||
-- | |||
-- TODO this will only be used with headers |
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.
This can be removed.
Same comment as above: is this only meant for headers or do we also use it with blocks sometimes?
-- | Extract the part of the block that the signature should be computed over | ||
blockSigned :: b -> Signed b | ||
-- | Extract the part of the header that the signature should be computed over | ||
headerSigned :: hdr -> Signed hdr | ||
|
||
-- | Signatures are computed of the serialized form | ||
-- | ||
-- NOTE: This encoding is important: it determines what the signature looks | ||
-- like. For backwards compatibility, the encoding of the parts of the block |
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.
"block" (instead of "header") is mentioned a few times in the docstring.
bors r+ |
👎 Rejected by code reviews |
bors r+ |
d9473e0
to
bd28e44
Compare
Canceled |
Co-authored-by: Thomas Winant <thomas@well-typed.com>
bd28e44
to
f7440da
Compare
No description provided.