Skip to content
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

Merged
merged 1 commit into from
Jun 6, 2019
Merged

Conversation

edsko
Copy link
Contributor

@edsko edsko commented Jun 6, 2019

No description provided.

@edsko edsko requested a review from mrBliss June 6, 2019 07:58
Copy link
Contributor

@mrBliss mrBliss left a 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 Readers, 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)
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

@edsko
Copy link
Contributor Author

edsko commented Jun 6, 2019

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 6, 2019

👎 Rejected by code reviews

@edsko
Copy link
Contributor Author

edsko commented Jun 6, 2019

bors r+

iohk-bors bot added a commit that referenced this pull request Jun 6, 2019
616: Introduce Header type family r=edsko a=edsko



Co-authored-by: Edsko de Vries <edsko@well-typed.com>
Co-authored-by: Thomas Winant <thomas@well-typed.com>
@mrBliss mrBliss force-pushed the edsko/introduce-BlockWithHeader branch from d9473e0 to bd28e44 Compare June 6, 2019 14:45
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 6, 2019

Canceled

Co-authored-by: Thomas Winant <thomas@well-typed.com>
@edsko edsko force-pushed the edsko/introduce-BlockWithHeader branch from bd28e44 to f7440da Compare June 6, 2019 16:13
@edsko edsko merged commit 1c291da into master Jun 6, 2019
@iohk-bors iohk-bors bot deleted the edsko/introduce-BlockWithHeader branch June 6, 2019 17:08
@edsko edsko mentioned this pull request Jun 7, 2019
@mrBliss mrBliss added the consensus issues related to ouroboros-consensus label Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus issues related to ouroboros-consensus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants