-
Notifications
You must be signed in to change notification settings - Fork 185
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
[Malleability] Header #7100
base: feature/malleability
Are you sure you want to change the base?
[Malleability] Header #7100
Conversation
e9419ef
to
cff44df
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/malleability #7100 +/- ##
========================================================
+ Coverage 41.12% 41.15% +0.03%
========================================================
Files 2097 2135 +38
Lines 184820 188801 +3981
========================================================
+ Hits 76008 77709 +1701
- Misses 102473 104585 +2112
- Partials 6339 6507 +168
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Prepare for creation of new "Proposal" type used to store the ProposerSigData
cff44df
to
a11f637
Compare
I've determined at least some of the failing tests are due to a missing proposer signature in the
The blocks that are requested and synced then go through all the same logic as new block proposals, so their proposer signature is checked and found to be missing. Appears in logs as |
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.
Very nice, great work. I think there are some open questions how do we deal with syncing of blocks and recovery, most likely we will need to store the signature either way but I think we should leave this for another PR and have a separate discussion about this.
Co-authored-by: Yurii Oleksyshyn <[email protected]>
Condense fingerprint code (as part of ID generation). Apparent use case of fingerprint test now covered by the Malleability test. see #7100 (comment) Co-authored-by: Yurii Oleksyshyn <[email protected]>
proposal := messages.NewClusterBlockProposal(&block) | ||
hotstuffProposal := model.SignedProposalFromFlow(block.Header) | ||
proposal := unittest.ClusterProposalFromBlock(&block) | ||
proposalMsg := messages.ClusterBlockProposalFrom(proposal) // TODO(tim) - unittest naming |
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.
Just adding a comment so we don't lost the TODO in a big diff
@@ -48,7 +48,6 @@ func BlockHeaderToMessage( | |||
ParentVoterIds: parentVoterIds, | |||
ParentVoterSigData: h.ParentVoterSigData, | |||
ProposerId: h.ProposerID[:], | |||
ProposerSigData: h.ProposerSigData, |
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.
Removing the signature field is a breaking API change.
We should minimally mark it as deprecated in the API docs (here is an example PR doing that: onflow/flow#1558). May need a more considered plan on how to deal with this if there is any substantial use of this field in the API already. If we end up merging this PR without fully addressing this, could you make an issue to address this under the Malleability tracker please.
fyi @peterargue
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 have decided to store the proposer signature for all node roles, at least for this round of changes. Given that, we can simply include the proposer signature here again.
Updates the
Header
type to make it non-malleable, by movingProposerSigData
field out of the Header to the newProposal
/BlockProposal
types.Header.ID()
will continue to return the same values as before this change.Proposal
is a new distinct type, used for proposing new blocks and receiving/verifying incoming proposed blocks from the network. It is an internal type corresponding tomessages.BlockProposal
/messages.ClusterBlockProposal
, containing the header/block and associatedProposerSigData
. The main changes associated with this are in the Compliance Core, consensus/collection Builder, and MessageHub; as well as adding some new conversion functions and unit test fixtures.This PR preserves the "body" intermediate type used to calculate the Header ID, which converts the Timestamp to unix time (necessary because
time.Time
is not RLP-encodable and therefore malleable) and flattensLastViewTC
into an ID, and splits it out into an explicit type so that it can be used in tests (TestHeaderFingerprint
).Various serialization methods and their tests are also preserved (TODO: discuss whether to remove JSON and/or Msgpack), as well as the Fingerprint method which is used to test RLP marshaling/unmarshaling.
Closes #6656