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

chore(trie): Node HashDigest -> MerkleValue #2724

Merged
merged 2 commits into from
Aug 5, 2022

Conversation

qdm12
Copy link
Contributor

@qdm12 qdm12 commented Aug 4, 2022

Changes

Polkadot spec refers to it as merkle value, and even in the implementation it's not always a hash digest, it can also be the encoding itself if the node is not the trie root and its encoding is <= 32 bytes.

Tests

Issues

Primary Reviewer

@jimjbrettj

@qdm12 qdm12 added the PR Easy label Aug 4, 2022
@qdm12 qdm12 marked this pull request as ready for review August 4, 2022 14:42
@codecov
Copy link

codecov bot commented Aug 4, 2022

Codecov Report

Merging #2724 (3c8db26) into development (4f311a5) will decrease coverage by 0.14%.
The diff coverage is 69.81%.

@@               Coverage Diff               @@
##           development    #2724      +/-   ##
===============================================
- Coverage        62.93%   62.78%   -0.15%     
===============================================
  Files              212      212              
  Lines            27020    27020              
===============================================
- Hits             17004    16965      -39     
- Misses            8472     8511      +39     
  Partials          1544     1544              

@@ -13,8 +13,8 @@ import (
// EncodeAndHash returns the encoding of the node and
// the Merkle value of the node.
func (n *Node) EncodeAndHash() (encoding, hash []byte, err error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note hash argument is renamed to merkleValue in #2725

internal/trie/node/node.go Outdated Show resolved Hide resolved
lib/trie/database.go Outdated Show resolved Hide resolved
lib/trie/database.go Outdated Show resolved Hide resolved
lib/trie/database.go Outdated Show resolved Hide resolved
lib/trie/database.go Outdated Show resolved Hide resolved
lib/trie/database.go Outdated Show resolved Hide resolved
lib/trie/proof/verify.go Outdated Show resolved Hide resolved
@@ -101,7 +101,7 @@ func updateGeneration(currentNode *Node, trieGeneration uint64,

// The hash of the node from a previous snapshotted trie
// is usually already computed.
deletedHashBytes := currentNode.HashDigest
deletedHashBytes := currentNode.MerkleValue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note this is changed in #2725

@qdm12 qdm12 merged commit 030f1d4 into development Aug 5, 2022
@qdm12 qdm12 deleted the qdm12/trie/rename-hashdigest-merklevalue branch August 5, 2022 21:00
@github-actions
Copy link

🎉 This PR is included in version 0.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants