Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #10 . This PR adds the following functionality:
BlockHash
toInternalHash
and makesInternalHash
private.InternalHash
:BlockHash
(hash of implementors ofBlockContents
),LeafHash
(hash ofLeaf
),TransactionHash
(hash ofBlockContents::Transaction
),VerifyHash
(special case used to verifyQuorumCertificate
s),StateHash
(hash of implementors ofState
). This is done via the macrogen_hash_wrapper_type
since I couldn't seem to think of an easier way to sidestep boilerplate code without exposing the innerInternalHash
type.serde_bytes
to hash the underlying array during serialization. Note thatserde_bytes
does not seem to support const generics, so I directly copied in the wrapper given in that issue.Debug
implementation toInternalHash
and its wrapper types.@nmccarty if this is too large, I'm happy to split this in several smaller PRs.
I'm also uncertain if the types I've added make sense. This spot in particular was causing me a bit of confusion. It seems like in
extends_from
, we track the leaf hashes up the tree. Soparent
is aLeafHash
. And we compareparent
tonode
, which makesnode
also aLeafHash
. I changed theextends_from
invocation to reflect that by passing inlocked_qc.leaf_hash
instead oflocked_qc.block_hash
. The tests still pass after this change.