Skip to content

Commit

Permalink
added fake triedb
Browse files Browse the repository at this point in the history
  • Loading branch information
lmittmann committed Oct 2, 2024
1 parent 64ec073 commit c4058c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion w3vm/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state/snapshot"
"github.com/ethereum/go-ethereum/core/types"
Expand All @@ -15,6 +16,8 @@ import (
"github.com/holiman/uint256"
)

var fakeTrieDB = triedb.NewDatabase(rawdb.NewMemoryDatabase(), &triedb.Config{})

// db implements the [state.Reader], [state.Database], and [state.Trie] interfaces.
type db struct {
fetcher Fetcher
Expand Down Expand Up @@ -86,7 +89,7 @@ func (db *db) ContractCodeSize(addr common.Address, codeHash common.Hash) (int,

func (*db) DiskDB() ethdb.KeyValueStore { panic("not implemented") }

func (db *db) TrieDB() *triedb.Database { panic("not implemented") }
func (db *db) TrieDB() *triedb.Database { return fakeTrieDB }

func (*db) PointCache() *utils.PointCache { panic("not implemented") }

Expand Down

0 comments on commit c4058c1

Please sign in to comment.