From acf44f4bad812b7a7dfdb65121ffc3a98fdd1f36 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Wed, 2 Nov 2022 11:24:58 +0000 Subject: [PATCH] fix(state): node hashes vs merkle values - Pruners only care about node hashes - Rename variables, functions and methods only dealing with node hashes - Do not write or read inlined nodes with a non-hash Merkle value - Clarify error wrappings and comments --- dot/state/offline_pruner.go | 10 ++--- dot/state/pruner/pruner.go | 4 +- dot/state/storage.go | 6 +-- lib/runtime/storage/trie.go | 2 +- lib/trie/database.go | 70 ++++++++++++++++++++-------------- lib/trie/database_test.go | 47 +++++++++++++---------- lib/trie/proof/generate.go | 11 ++++-- lib/trie/proof/verify.go | 2 +- lib/trie/trie.go | 30 +++++++-------- lib/trie/trie_endtoend_test.go | 12 +++--- lib/trie/trie_test.go | 4 +- 11 files changed, 110 insertions(+), 88 deletions(-) diff --git a/dot/state/offline_pruner.go b/dot/state/offline_pruner.go index 62ceb7b86c..6d31745f23 100644 --- a/dot/state/offline_pruner.go +++ b/dot/state/offline_pruner.go @@ -105,7 +105,7 @@ func (p *OfflinePruner) SetBloomFilter() (err error) { } latestBlockNum := header.Number - merkleValues := make(map[string]struct{}) + nodeHashes := make(map[common.Hash]struct{}) logger.Infof("Latest block number is %d", latestBlockNum) @@ -121,7 +121,7 @@ func (p *OfflinePruner) SetBloomFilter() (err error) { return err } - trie.PopulateNodeHashes(tr.RootNode(), merkleValues) + trie.PopulateNodeHashes(tr.RootNode(), nodeHashes) // get parent header of current block header, err = p.blockState.GetHeader(header.ParentHash) @@ -131,14 +131,14 @@ func (p *OfflinePruner) SetBloomFilter() (err error) { blockNum = header.Number } - for key := range merkleValues { - err = p.bloom.put([]byte(key)) + for key := range nodeHashes { + err = p.bloom.put(key.ToBytes()) if err != nil { return err } } - logger.Infof("Total keys added in bloom filter: %d", len(merkleValues)) + logger.Infof("Total keys added in bloom filter: %d", len(nodeHashes)) return nil } diff --git a/dot/state/pruner/pruner.go b/dot/state/pruner/pruner.go index d7bd0d8298..fc61eef5bf 100644 --- a/dot/state/pruner/pruner.go +++ b/dot/state/pruner/pruner.go @@ -33,7 +33,7 @@ type Config struct { // Pruner is implemented by FullNode and ArchiveNode. type Pruner interface { - StoreJournalRecord(deletedMerkleValues, insertedMerkleValues map[string]struct{}, + StoreJournalRecord(deletedNodeHashes, insertedNodeHashes map[common.Hash]struct{}, blockHash common.Hash, blockNum int64) error } @@ -41,7 +41,7 @@ type Pruner interface { type ArchiveNode struct{} // StoreJournalRecord for archive node doesn't do anything. -func (*ArchiveNode) StoreJournalRecord(_, _ map[string]struct{}, +func (*ArchiveNode) StoreJournalRecord(_, _ map[common.Hash]struct{}, _ common.Hash, _ int64) error { return nil } diff --git a/dot/state/storage.go b/dot/state/storage.go index 0a4db11ec2..d63472c5a8 100644 --- a/dot/state/storage.go +++ b/dot/state/storage.go @@ -64,12 +64,12 @@ func (s *StorageState) StoreTrie(ts *rtstorage.TrieState, header *types.Header) s.tries.softSet(root, ts.Trie()) if header != nil { - insertedMerkleValues, deletedMerkleValues, err := ts.GetChangedNodeHashes() + insertedNodeHashes, deletedNodeHashes, err := ts.GetChangedNodeHashes() if err != nil { - return fmt.Errorf("failed to get state trie inserted keys: block %s %w", header.Hash(), err) + return fmt.Errorf("getting trie changed node hashes for block hash %s: %w", header.Hash(), err) } - err = s.pruner.StoreJournalRecord(deletedMerkleValues, insertedMerkleValues, header.Hash(), int64(header.Number)) + err = s.pruner.StoreJournalRecord(deletedNodeHashes, insertedNodeHashes, header.Hash(), int64(header.Number)) if err != nil { return err } diff --git a/lib/runtime/storage/trie.go b/lib/runtime/storage/trie.go index 55e3d9b980..7b79ff28fe 100644 --- a/lib/runtime/storage/trie.go +++ b/lib/runtime/storage/trie.go @@ -294,7 +294,7 @@ func (s *TrieState) LoadCodeHash() (common.Hash, error) { // GetChangedNodeHashes returns the two sets of hashes for all nodes // inserted and deleted in the state trie since the last block produced (trie snapshot). -func (s *TrieState) GetChangedNodeHashes() (inserted, deleted map[string]struct{}, err error) { +func (s *TrieState) GetChangedNodeHashes() (inserted, deleted map[common.Hash]struct{}, err error) { s.lock.RLock() defer s.lock.RUnlock() return s.t.GetChangedNodeHashes() diff --git a/lib/trie/database.go b/lib/trie/database.go index 1b0717c89e..fd35eceddd 100644 --- a/lib/trie/database.go +++ b/lib/trie/database.go @@ -68,9 +68,9 @@ func (t *Trie) loadNode(db Getter, n *Node) error { merkleValue := child.MerkleValue - if len(merkleValue) == 0 { + if len(merkleValue) < 32 { // node has already been loaded inline - // just set encoding + hash digest + // just set its encoding _, err := child.CalculateMerkleValue() if err != nil { return fmt.Errorf("merkle value: %w", err) @@ -78,23 +78,24 @@ func (t *Trie) loadNode(db Getter, n *Node) error { continue } - encodedNode, err := db.Get(merkleValue) + nodeHash := merkleValue + encodedNode, err := db.Get(nodeHash) if err != nil { - return fmt.Errorf("cannot find child node key 0x%x in database: %w", merkleValue, err) + return fmt.Errorf("cannot find child node key 0x%x in database: %w", nodeHash, err) } reader := bytes.NewReader(encodedNode) decodedNode, err := node.Decode(reader) if err != nil { - return fmt.Errorf("decoding node with Merkle value 0x%x: %w", merkleValue, err) + return fmt.Errorf("decoding node with hash 0x%x: %w", nodeHash, err) } - decodedNode.MerkleValue = merkleValue + decodedNode.MerkleValue = nodeHash branch.Children[i] = decodedNode err = t.loadNode(db, decodedNode) if err != nil { - return fmt.Errorf("loading child at index %d with Merkle value 0x%x: %w", i, merkleValue, err) + return fmt.Errorf("loading child at index %d with node hash 0x%x: %w", i, nodeHash, err) } if decodedNode.Kind() == node.Branch { @@ -132,7 +133,7 @@ func (t *Trie) loadNode(db Getter, n *Node) error { // all its descendant nodes as keys to the nodeHashes map. // It is assumed the node and its descendant nodes have their Merkle value already // computed. -func PopulateNodeHashes(n *Node, nodeHashes map[string]struct{}) { +func PopulateNodeHashes(n *Node, nodeHashes map[common.Hash]struct{}) { if n == nil { return } @@ -148,7 +149,8 @@ func PopulateNodeHashes(n *Node, nodeHashes map[string]struct{}) { return } - nodeHashes[string(n.MerkleValue)] = struct{}{} + nodeHash := common.NewHash(n.MerkleValue) + nodeHashes[nodeHash] = struct{}{} if n.Kind() == node.Leaf { return @@ -260,7 +262,7 @@ func getFromDBAtNode(db Getter, n *Node, key []byte) ( encodedChild, err := db.Get(childMerkleValue) if err != nil { return nil, fmt.Errorf( - "finding child node with Merkle value 0x%x in database: %w", + "finding child node with hash 0x%x in database: %w", childMerkleValue, err) } @@ -268,7 +270,7 @@ func getFromDBAtNode(db Getter, n *Node, key []byte) ( decodedChild, err := node.Decode(reader) if err != nil { return nil, fmt.Errorf( - "decoding child node with Merkle value 0x%x: %w", + "decoding child node with hash 0x%x: %w", childMerkleValue, err) } @@ -305,11 +307,19 @@ func (t *Trie) writeDirtyNode(db Putter, n *Node) (err error) { n.MerkleValue, err) } - err = db.Put(merkleValue, encoding) + if len(merkleValue) < 32 { + // Inlined node, there is no need to write it to database. + n.SetClean() + return nil + } + + nodeHash := merkleValue + + err = db.Put(nodeHash, encoding) if err != nil { return fmt.Errorf( - "putting encoding of node with Merkle value 0x%x in database: %w", - merkleValue, err) + "putting encoding of node with node hash 0x%x in database: %w", + nodeHash, err) } if n.Kind() != node.Branch { @@ -342,25 +352,20 @@ func (t *Trie) writeDirtyNode(db Putter, n *Node) (err error) { // GetChangedNodeHashes returns the two sets of hashes for all nodes // inserted and deleted in the state trie since the last snapshot. -// Returned maps are safe for mutation. -func (t *Trie) GetChangedNodeHashes() (inserted, deleted map[string]struct{}, err error) { - inserted = make(map[string]struct{}) +// Returned inserted map is safe for mutation, but deleted is not safe for mutation. +func (t *Trie) GetChangedNodeHashes() (inserted, deleted map[common.Hash]struct{}, err error) { + inserted = make(map[common.Hash]struct{}) err = t.getInsertedNodeHashesAtNode(t.root, inserted) if err != nil { return nil, nil, fmt.Errorf("getting inserted node hashes: %w", err) } - deletedNodeHashes := t.deltas.Deleted() - // TODO return deletedNodeHashes directly after changing MerkleValue -> NodeHash - deleted = make(map[string]struct{}, len(deletedNodeHashes)) - for nodeHash := range deletedNodeHashes { - deleted[string(nodeHash[:])] = struct{}{} - } + deleted = t.deltas.Deleted() return inserted, deleted, nil } -func (t *Trie) getInsertedNodeHashesAtNode(n *Node, merkleValues map[string]struct{}) (err error) { +func (t *Trie) getInsertedNodeHashesAtNode(n *Node, nodeHashes map[common.Hash]struct{}) (err error) { if n == nil || !n.Dirty { return nil } @@ -372,12 +377,19 @@ func (t *Trie) getInsertedNodeHashesAtNode(n *Node, merkleValues map[string]stru merkleValue, err = n.CalculateMerkleValue() } if err != nil { - return fmt.Errorf( - "encoding and hashing node with Merkle value 0x%x: %w", - n.MerkleValue, err) + return fmt.Errorf("calculating Merkle value: %w", err) + } + + if len(merkleValue) < 32 { + // this is an inlined node and is encoded as part of its parent node. + // Therefore it is not written to disk and the online pruner does not + // need to track it. If the node encodes to less than 32B, it cannot have + // non-inlined children so it's safe to stop here and not recurse further. + return nil } - merkleValues[string(merkleValue)] = struct{}{} + nodeHash := common.NewHash(merkleValue) + nodeHashes[nodeHash] = struct{}{} if n.Kind() != node.Branch { return nil @@ -388,7 +400,7 @@ func (t *Trie) getInsertedNodeHashesAtNode(n *Node, merkleValues map[string]stru continue } - err := t.getInsertedNodeHashesAtNode(child, merkleValues) + err := t.getInsertedNodeHashesAtNode(child, nodeHashes) if err != nil { // Note: do not wrap error since this is called recursively. return err diff --git a/lib/trie/database_test.go b/lib/trie/database_test.go index 1bd4eaadde..2300adb415 100644 --- a/lib/trie/database_test.go +++ b/lib/trie/database_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/ChainSafe/chaindb" + "github.com/ChainSafe/gossamer/lib/common" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -161,28 +162,34 @@ func Test_Trie_WriteDirty_ClearPrefix(t *testing.T) { func Test_PopulateNodeHashes(t *testing.T) { t.Parallel() - const ( - merkleValue32Zeroes = "00000000000000000000000000000000" - merkleValue32Ones = "11111111111111111111111111111111" - merkleValue32Twos = "22222222222222222222222222222222" - merkleValue32Threes = "33333333333333333333333333333333" + var ( + merkleValue32Zeroes = common.Hash{} + merkleValue32Ones = common.Hash{ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + merkleValue32Twos = common.Hash{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + merkleValue32Threes = common.Hash{ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} ) testCases := map[string]struct { node *Node - nodeHashes map[string]struct{} + nodeHashes map[common.Hash]struct{} panicValue interface{} }{ "nil_node": { - nodeHashes: map[string]struct{}{}, + nodeHashes: map[common.Hash]struct{}{}, }, "inlined_leaf_node": { node: &Node{MerkleValue: []byte("a")}, - nodeHashes: map[string]struct{}{}, + nodeHashes: map[common.Hash]struct{}{}, }, "leaf_node": { - node: &Node{MerkleValue: []byte(merkleValue32Zeroes)}, - nodeHashes: map[string]struct{}{ + node: &Node{MerkleValue: merkleValue32Zeroes.ToBytes()}, + nodeHashes: map[common.Hash]struct{}{ merkleValue32Zeroes: {}, }, }, @@ -197,34 +204,34 @@ func Test_PopulateNodeHashes(t *testing.T) { {MerkleValue: []byte("b")}, }), }, - nodeHashes: map[string]struct{}{}, + nodeHashes: map[common.Hash]struct{}{}, }, "branch_node": { node: &Node{ - MerkleValue: []byte(merkleValue32Zeroes), + MerkleValue: merkleValue32Zeroes.ToBytes(), Children: padRightChildren([]*Node{ - {MerkleValue: []byte(merkleValue32Ones)}, + {MerkleValue: merkleValue32Ones.ToBytes()}, }), }, - nodeHashes: map[string]struct{}{ + nodeHashes: map[common.Hash]struct{}{ merkleValue32Zeroes: {}, merkleValue32Ones: {}, }, }, "nested_branch_node": { node: &Node{ - MerkleValue: []byte(merkleValue32Zeroes), + MerkleValue: merkleValue32Zeroes.ToBytes(), Children: padRightChildren([]*Node{ - {MerkleValue: []byte(merkleValue32Ones)}, + {MerkleValue: merkleValue32Ones.ToBytes()}, { - MerkleValue: []byte(merkleValue32Twos), + MerkleValue: merkleValue32Twos.ToBytes(), Children: padRightChildren([]*Node{ - {MerkleValue: []byte(merkleValue32Threes)}, + {MerkleValue: merkleValue32Threes.ToBytes()}, }), }, }), }, - nodeHashes: map[string]struct{}{ + nodeHashes: map[common.Hash]struct{}{ merkleValue32Zeroes: {}, merkleValue32Ones: {}, merkleValue32Twos: {}, @@ -238,7 +245,7 @@ func Test_PopulateNodeHashes(t *testing.T) { t.Run(name, func(t *testing.T) { t.Parallel() - nodeHashes := make(map[string]struct{}) + nodeHashes := make(map[common.Hash]struct{}) if testCase.panicValue != nil { assert.PanicsWithValue(t, testCase.panicValue, func() { diff --git a/lib/trie/proof/generate.go b/lib/trie/proof/generate.go index 8f97b2661b..2fd30d9ddd 100644 --- a/lib/trie/proof/generate.go +++ b/lib/trie/proof/generate.go @@ -40,7 +40,7 @@ func Generate(rootHash []byte, fullKeys [][]byte, database Database) ( buffer := pools.DigestBuffers.Get().(*bytes.Buffer) defer pools.DigestBuffers.Put(buffer) - merkleValuesSeen := make(map[string]struct{}) + nodeHashesSeen := make(map[common.Hash]struct{}) for _, fullKey := range fullKeys { fullKeyNibbles := codec.KeyLEToNibbles(fullKey) newEncodedProofNodes, err := walkRoot(rootNode, fullKeyNibbles) @@ -56,13 +56,16 @@ func Generate(rootHash []byte, fullKeys [][]byte, database Database) ( if err != nil { return nil, fmt.Errorf("blake2b hash: %w", err) } - merkleValueString := buffer.String() + // Note: all encoded proof nodes are larger than 32B so their + // merkle value is the encoding hash digest (32B) and never the + // encoding itself. + nodeHash := common.NewHash(buffer.Bytes()) - _, seen := merkleValuesSeen[merkleValueString] + _, seen := nodeHashesSeen[nodeHash] if seen { continue } - merkleValuesSeen[merkleValueString] = struct{}{} + nodeHashesSeen[nodeHash] = struct{}{} encodedProofNodes = append(encodedProofNodes, encodedProofNode) } diff --git a/lib/trie/proof/verify.go b/lib/trie/proof/verify.go index 54d9d2073f..e38a72a75d 100644 --- a/lib/trie/proof/verify.go +++ b/lib/trie/proof/verify.go @@ -83,7 +83,7 @@ func buildTrie(encodedProofNodes [][]byte, rootHash []byte) (t *trie.Trie, err e buffer.Reset() err = node.MerkleValueRoot(encodedProofNode, buffer) if err != nil { - return nil, fmt.Errorf("calculating Merkle value: %w", err) + return nil, fmt.Errorf("calculating node hash: %w", err) } digest := buffer.Bytes() diff --git a/lib/trie/trie.go b/lib/trie/trie.go index d7a6f2ef72..5eb5a00524 100644 --- a/lib/trie/trie.go +++ b/lib/trie/trie.go @@ -69,8 +69,8 @@ func (t *Trie) Snapshot() (newTrie *Trie) { } } -// handleTrackedDeltas sets the pending deleted Merkle values in -// the trie deleted merkle values set if and only if success is true. +// handleTrackedDeltas sets the pending deleted node hashes in +// the trie deltas tracker if and only if success is true. func (t *Trie) handleTrackedDeltas(success bool, pendingDeltas DeltaDeletedGetter) { if !success || t.generation == 0 { // Do not persist tracked deleted node hashes if the operation failed or @@ -90,7 +90,7 @@ func (t *Trie) prepForMutation(currentNode *Node, // update the node generation. newNode = currentNode } else { - err = t.registerDeletedMerkleValue(currentNode, pendingDeltas) + err = t.registerDeletedNodeHash(currentNode, pendingDeltas) if err != nil { return nil, fmt.Errorf("registering deleted node: %w", err) } @@ -101,7 +101,7 @@ func (t *Trie) prepForMutation(currentNode *Node, return newNode, nil } -func (t *Trie) registerDeletedMerkleValue(node *Node, +func (t *Trie) registerDeletedNodeHash(node *Node, pendingDeltas DeltaRecorder) (err error) { err = t.ensureMerkleValueIsCalculated(node) if err != nil { @@ -796,10 +796,10 @@ func (t *Trie) clearPrefixLimitAtNode(parent *Node, prefix []byte, // TODO check this is the same behaviour as in substrate const allDeleted = true if bytes.HasPrefix(parent.PartialKey, prefix) { - err = t.registerDeletedMerkleValue(parent, pendingDeltas) + err = t.registerDeletedNodeHash(parent, pendingDeltas) if err != nil { return nil, 0, 0, false, - fmt.Errorf("registering deleted Merkle value: %w", err) + fmt.Errorf("registering deleted node hash: %w", err) } valuesDeleted, nodesRemoved = 1, 1 @@ -938,9 +938,9 @@ func (t *Trie) deleteNodesLimit(parent *Node, limit uint32, } if parent.Kind() == node.Leaf { - err = t.registerDeletedMerkleValue(parent, pendingDeltas) + err = t.registerDeletedNodeHash(parent, pendingDeltas) if err != nil { - return nil, 0, 0, fmt.Errorf("registering deleted merkle value: %w", err) + return nil, 0, 0, fmt.Errorf("registering deleted node hash: %w", err) } valuesDeleted, nodesRemoved = 1, 1 return nil, valuesDeleted, nodesRemoved, nil @@ -1086,9 +1086,9 @@ func (t *Trie) clearPrefixAtNode(parent *Node, prefix []byte, return nil, 0, fmt.Errorf("preparing branch for mutation: %w", err) } - err = t.registerDeletedMerkleValue(child, pendingDeltas) + err = t.registerDeletedNodeHash(child, pendingDeltas) if err != nil { - return nil, 0, fmt.Errorf("registering deleted merkle value for child: %w", err) + return nil, 0, fmt.Errorf("registering deleted node hash for child: %w", err) } branch.Children[childIndex] = nil @@ -1203,9 +1203,9 @@ func (t *Trie) deleteLeaf(parent *Node, key []byte, newParent = nil - err = t.registerDeletedMerkleValue(parent, pendingDeltas) + err = t.registerDeletedNodeHash(parent, pendingDeltas) if err != nil { - return nil, fmt.Errorf("registering deleted merkle value: %w", err) + return nil, fmt.Errorf("registering deleted node hash: %w", err) } return newParent, nil @@ -1324,9 +1324,9 @@ func (t *Trie) handleDeletion(branch *Node, key []byte, const branchChildMerged = true childIndex := firstChildIndex child := branch.Children[firstChildIndex] - err = t.registerDeletedMerkleValue(child, pendingDeltas) + err = t.registerDeletedNodeHash(child, pendingDeltas) if err != nil { - return nil, false, fmt.Errorf("registering deleted merkle value: %w", err) + return nil, false, fmt.Errorf("registering deleted node hash: %w", err) } if child.Kind() == node.Leaf { @@ -1364,7 +1364,7 @@ func (t *Trie) handleDeletion(branch *Node, key []byte, } } -// ensureMerkleValueIsCalculated is used before calling PopulateMerkleValues +// ensureMerkleValueIsCalculated is used before calling PopulateNodeHashes // to ensure the parent node and all its descendant nodes have their Merkle // value computed and ready to be used. This has a close to zero performance // impact if the parent node Merkle value is already computed. diff --git a/lib/trie/trie_endtoend_test.go b/lib/trie/trie_endtoend_test.go index f05ab19211..3ca189ebe5 100644 --- a/lib/trie/trie_endtoend_test.go +++ b/lib/trie/trie_endtoend_test.go @@ -315,9 +315,9 @@ func TestTrieDiff(t *testing.T) { newTrie.Put(test.key, test.value) } - deletedMerkleValues := newTrie.deltas.Deleted() - expectedDeletdMerkleValues := map[common.Hash]struct{}{ - // root branch Merkle value which was modified (by its descendants). + deletedNodeHashes := newTrie.deltas.Deleted() + expectedDeletedNodeHashes := map[common.Hash]struct{}{ + // root branch hash which was modified (by its descendants). // Other nodes result in an encoding of less than 32B so they are not // tracked since they are inlined in the branch. {0xa9, 0x76, 0xfa, 0x55, 0x6d, 0x65, 0x24, 0x3c, @@ -325,13 +325,13 @@ func TestTrieDiff(t *testing.T) { 0xe4, 0xb6, 0x8a, 0x60, 0xe5, 0x4d, 0xea, 0x68, 0x9c, 0xab, 0xbf, 0xbb, 0xc0, 0xfc, 0x72, 0x48}: {}, } - assert.Equal(t, expectedDeletdMerkleValues, deletedMerkleValues) + assert.Equal(t, expectedDeletedNodeHashes, deletedNodeHashes) err = newTrie.WriteDirty(storageDB) require.NoError(t, err) - for deletedMerkleValue := range deletedMerkleValues { - err = storageDB.Del(deletedMerkleValue[:]) + for deletedNodeHash := range deletedNodeHashes { + err = storageDB.Del(deletedNodeHash[:]) require.NoError(t, err) } diff --git a/lib/trie/trie_test.go b/lib/trie/trie_test.go index 35d785bba1..0f6544ca74 100644 --- a/lib/trie/trie_test.go +++ b/lib/trie/trie_test.go @@ -265,7 +265,7 @@ func Test_Trie_prepForMutation(t *testing.T) { } } -func Test_Trie_registerDeletedMerkleValue(t *testing.T) { +func Test_Trie_registerDeletedNodeHash(t *testing.T) { t.Parallel() someSmallNode := &Node{ @@ -327,7 +327,7 @@ func Test_Trie_registerDeletedMerkleValue(t *testing.T) { trie := testCase.trie - err := trie.registerDeletedMerkleValue(testCase.node, + err := trie.registerDeletedNodeHash(testCase.node, testCase.pendingDeltas) require.NoError(t, err)