diff --git a/cmd/validateTrie.go b/cmd/validateTrie.go index ce378bf..f48ff7c 100644 --- a/cmd/validateTrie.go +++ b/cmd/validateTrie.go @@ -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() diff --git a/pkg/validator_test.go b/pkg/validator_test.go index a57c620..2f86aad 100644 --- a/pkg/validator_test.go +++ b/pkg/validator_test.go @@ -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()) }) })