allow zero state root when running storage trie
This commit is contained in:
parent
1bc449d036
commit
060e297c14
@ -108,11 +108,11 @@ func validateTrie() {
|
||||
WithField("storage root", storageRoot).
|
||||
Debug("Validating storage trie")
|
||||
if err = v.ValidateStorageTrie(stateRoot, addr, storageRoot); err != nil {
|
||||
logWithCommand.Fatalf("Validation failed", err)
|
||||
logWithCommand.Fatal("Validation failed", err)
|
||||
}
|
||||
logWithCommand.Infof("Storage trie for contract %s and root %s is complete", addr, storageRoot)
|
||||
default:
|
||||
logWithCommand.Fatalf("Invalid traversal level: '%s'", traversal)
|
||||
logWithCommand.Fatal("Invalid traversal level:", traversal)
|
||||
}
|
||||
|
||||
stats := v.GetCacheStats()
|
||||
|
@ -302,22 +302,22 @@ var _ = Describe("PG-IPFS Validator", func() {
|
||||
err = ResetTestDB(db)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
It("Returns an error the storage root node is missing", func() {
|
||||
loadTrie(trieStateNodes, missingRootStorageNodes)
|
||||
err = v.ValidateStorageTrie(stateRoot, contractAddr, storageRoot)
|
||||
It("Returns an error if the storage root node is missing", func() {
|
||||
loadTrie(nil, missingRootStorageNodes)
|
||||
err = v.ValidateStorageTrie(common.Hash{}, contractAddr, storageRoot)
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.Error()).To(ContainSubstring("missing trie node"))
|
||||
})
|
||||
It("Returns an error if the entire storage trie cannot be validated", func() {
|
||||
loadTrie(trieStateNodes, missingNodeStorageNodes)
|
||||
err = v.ValidateStorageTrie(stateRoot, contractAddr, storageRoot)
|
||||
loadTrie(nil, missingNodeStorageNodes)
|
||||
err = v.ValidateStorageTrie(common.Hash{}, contractAddr, storageRoot)
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.Error()).To(ContainSubstring("missing trie node"))
|
||||
Expect(err.Error()).To(ContainSubstring("path %x", missingStorageNodePath))
|
||||
})
|
||||
It("Returns no error if the entire storage trie can be validated", func() {
|
||||
loadTrie(trieStateNodes, trieStorageNodes)
|
||||
err = v.ValidateStorageTrie(stateRoot, contractAddr, storageRoot)
|
||||
loadTrie(nil, trieStorageNodes)
|
||||
err = v.ValidateStorageTrie(common.Hash{}, contractAddr, storageRoot)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user