fix: don't use rlp in the tree for slot values (#51)

* fix: don't use rlp in the tree for slot values

* fix timeout after rebase
This commit is contained in:
Guillaume Ballet
2022-01-11 11:38:49 +01:00
committed by GitHub
parent 99f3c92361
commit 4428439fdf
2 changed files with 23 additions and 8 deletions

View File

@ -365,15 +365,15 @@ func (s *stateObject) updateTrie(db Database) Trie {
}
s.db.StorageDeleted += 1
} else {
// Encoding []byte cannot fail, ok to ignore the error.
v, _ = rlp.EncodeToBytes(common.TrimLeftZeroes(value[:]))
if !tr.IsVerkle() {
// Encoding []byte cannot fail, ok to ignore the error.
v, _ = rlp.EncodeToBytes(common.TrimLeftZeroes(value[:]))
s.setError(tr.TryUpdate(key[:], v))
} else {
k := trieUtils.GetTreeKeyStorageSlot(s.address[:], new(uint256.Int).SetBytes(key[:]))
// Update the trie, with v as a value
s.setError(tr.TryUpdate(k, v))
s.setError(tr.TryUpdate(k, value[:]))
}
s.db.StorageUpdated += 1
}