Geth 1.13 (Deneb/Cancun) update #5

Merged
roysc merged 14 commits from update-geth-1.13 into v5 2024-05-29 10:00:13 +00:00
2 changed files with 9 additions and 7 deletions
Showing only changes of commit a95948bcd6 - Show all commits

View File

@ -19,7 +19,6 @@ package trie
import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/cerc-io/ipld-eth-statedb/trie_by_cid/trie/triestate"
"github.com/cerc-io/ipld-eth-statedb/trie_by_cid/triedb/database"
@ -35,12 +34,12 @@ type trieReader struct {
// newTrieReader initializes the trie reader with the given node reader.
func newTrieReader(stateRoot, owner common.Hash, db database.Database) (*trieReader, error) {
if stateRoot == (common.Hash{}) || stateRoot == types.EmptyRootHash {
if stateRoot == (common.Hash{}) {
log.Error("Zero state root hash!")
}
if stateRoot == types.EmptyRootHash {
return &trieReader{owner: owner}, nil
}
// Originally, passing a zero state root also caused the reader to not be set
// We allow it for storage tries for simplicity (ipld-eth-statedb change)
reader, err := db.Reader(stateRoot)
if err != nil {
return nil, &MissingNodeError{Owner: owner, NodeHash: stateRoot, err: err}

View File

@ -641,8 +641,11 @@ func (db *Database) Scheme() string {
// Reader retrieves a node reader belonging to the given state root.
// An error will be returned if the requested state is not available.
func (db *Database) Reader(root common.Hash) (*reader, error) {
if _, err := db.node(root, internal.StateTrieCodec); err != nil {
return nil, fmt.Errorf("state %#x is not available, %v", root, err)
// (ipld-eth-statedb change) Allow zero state roots for storage tries
if root != (common.Hash{}) {
if _, err := db.node(root, internal.StateTrieCodec); err != nil {
return nil, fmt.Errorf("state %#x is not available, %v", root, err)
}
}
return &reader{db: db}, nil
}