From 233b69b9123de9d9aa7f861dcdc49b881572bd09 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Tue, 10 Jan 2023 14:23:35 +0000 Subject: [PATCH] Apply PR feedback --- lib/runtime/storage/trie.go | 1 + lib/trie/trie.go | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/runtime/storage/trie.go b/lib/runtime/storage/trie.go index d3389c1e73e..a534718dbc6 100644 --- a/lib/runtime/storage/trie.go +++ b/lib/runtime/storage/trie.go @@ -210,6 +210,7 @@ func (s *TrieState) DeleteChildLimit(key []byte, limit *[]byte) ( // If one deletion fails, the child trie and its parent trie are then in // a bad intermediary state. Take also care of the caching of deleted Merkle // values within the tries, which is used for online pruning. + // See https://github.com/ChainSafe/gossamer/issues/3032 err = tr.Delete([]byte(k)) if err != nil { return deleted, allDeleted, fmt.Errorf("deleting from child trie located at key 0x%x: %w", key, err) diff --git a/lib/trie/trie.go b/lib/trie/trie.go index 2c76c462fb2..742e0e110cd 100644 --- a/lib/trie/trie.go +++ b/lib/trie/trie.go @@ -361,8 +361,6 @@ func (t *Trie) insert(parent *Node, key, value []byte, }, mutated, nodesCreated, nil } - // TODO ensure all values have dirty set to true - if parent.Kind() == node.Branch { newParent, mutated, nodesCreated, err = t.insertInBranch( parent, key, value, deletedMerkleValues) @@ -888,6 +886,7 @@ func (t *Trie) clearPrefixLimitChild(branch *Node, prefix []byte, limit uint32, if child == nil { const valuesDeleted, nodesRemoved = 0, 0 // TODO ensure this is the same behaviour as in substrate + // See https://github.com/ChainSafe/gossamer/issues/3033 allDeleted = true return newParent, valuesDeleted, nodesRemoved, allDeleted, nil }