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
3 changed files with 4 additions and 23 deletions
Showing only changes of commit 4ee6319567 - Show all commits

View File

@ -492,7 +492,7 @@ func (db *loggingTrieDb) GetReader(root common.Hash, codec uint64) Reader {
return &loggingNodeReader{db, codec} return &loggingNodeReader{db, codec}
} }
// hashReader is reader of hashDatabase which implements the Reader interface. // loggingNodeReader is a trie node reader that logs the number of get operations.
type loggingNodeReader struct { type loggingNodeReader struct {
db *loggingTrieDb db *loggingTrieDb
codec uint64 codec uint64
@ -561,28 +561,6 @@ func TestNodeIteratorLargeTrie(t *testing.T) {
} }
func TestIteratorNodeBlob(t *testing.T) { func TestIteratorNodeBlob(t *testing.T) {
// var (
// db = rawdb.NewMemoryDatabase()
// triedb = NewDatabase(db)
// trie = NewEmpty(triedb)
// )
// vals := []struct{ k, v string }{
// {"do", "verb"},
// {"ether", "wookiedoo"},
// {"horse", "stallion"},
// {"shaman", "horse"},
// {"doge", "coin"},
// {"dog", "puppy"},
// {"somethingveryoddindeedthis is", "myothernodedata"},
// }
// all := make(map[string]string)
// for _, val := range vals {
// all[val.k] = val.v
// trie.Update([]byte(val.k), []byte(val.v))
// }
// _, nodes := trie.Commit(false)
// triedb.Update(NewWithNodeSet(nodes))
edb := rawdb.NewMemoryDatabase() edb := rawdb.NewMemoryDatabase()
db := geth_trie.NewDatabase(edb) db := geth_trie.NewDatabase(edb)
orig := geth_trie.NewEmpty(geth_trie.NewDatabase(rawdb.NewMemoryDatabase())) orig := geth_trie.NewEmpty(geth_trie.NewDatabase(rawdb.NewMemoryDatabase()))

View File

@ -47,6 +47,7 @@ type StateTrie struct {
// trie is initially empty. Otherwise, New will panic if db is nil // trie is initially empty. Otherwise, New will panic if db is nil
// and returns MissingNodeError if the root node cannot be found. // and returns MissingNodeError if the root node cannot be found.
func NewStateTrie(id *ID, db *Database, codec uint64) (*StateTrie, error) { func NewStateTrie(id *ID, db *Database, codec uint64) (*StateTrie, error) {
// TODO: codec can be derived based on whether Owner is the zero hash
if db == nil { if db == nil {
panic("trie.NewStateTrie called without a database") panic("trie.NewStateTrie called without a database")
} }

View File

@ -64,6 +64,8 @@ func (t *Trie) Copy() *Trie {
// zero hash or the sha3 hash of an empty string, then trie is initially // zero hash or the sha3 hash of an empty string, then trie is initially
// empty, otherwise, the root node must be present in database or returns // empty, otherwise, the root node must be present in database or returns
// a MissingNodeError if not. // a MissingNodeError if not.
// The passed codec specifies whether to read state or storage nodes from the
// trie.
func New(id *ID, db NodeReader, codec uint64) (*Trie, error) { func New(id *ID, db NodeReader, codec uint64) (*Trie, error) {
reader, err := newTrieReader(id.StateRoot, id.Owner, db, codec) reader, err := newTrieReader(id.StateRoot, id.Owner, db, codec)
if err != nil { if err != nil {