Skip to content

Commit

Permalink
Fixes triedb import from geth
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoximenes committed Jul 22, 2024
1 parent 2425295 commit 5993bc8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions arbos/arbosState/arbosstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/triedb/hashdb"
"github.com/ethereum/go-ethereum/trie/triedb/pathdb"
"github.com/ethereum/go-ethereum/triedb"
"github.com/ethereum/go-ethereum/triedb/hashdb"
"github.com/ethereum/go-ethereum/triedb/pathdb"

"github.com/offchainlabs/nitro/arbcompress"
"github.com/offchainlabs/nitro/arbos/addressSet"
Expand Down Expand Up @@ -119,9 +119,9 @@ func OpenSystemArbosStateOrPanic(stateDB vm.StateDB, tracingInfo *util.TracingIn
// NewArbosMemoryBackedArbOSState creates and initializes a memory-backed ArbOS state (for testing only)
func NewArbosMemoryBackedArbOSState() (*ArbosState, *state.StateDB) {
raw := rawdb.NewMemoryDatabase()
trieConfig := &trie.Config{Preimages: false, PathDB: pathdb.Defaults}
trieConfig := &triedb.Config{Preimages: false, PathDB: pathdb.Defaults}
if env.GetTestStateScheme() == rawdb.HashScheme {
trieConfig = &trie.Config{Preimages: false, HashDB: hashdb.Defaults}
trieConfig = &triedb.Config{Preimages: false, HashDB: hashdb.Defaults}
}
db := state.NewDatabaseWithConfig(raw, trieConfig)
statedb, err := state.New(common.Hash{}, db, nil)
Expand Down
9 changes: 5 additions & 4 deletions arbos/arbosState/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/triedb/hashdb"
"github.com/ethereum/go-ethereum/trie/triedb/pathdb"
"github.com/ethereum/go-ethereum/triedb"
"github.com/ethereum/go-ethereum/triedb/hashdb"
"github.com/ethereum/go-ethereum/triedb/pathdb"
"github.com/holiman/uint256"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/burn"
Expand Down Expand Up @@ -55,8 +56,8 @@ func MakeGenesisBlock(parentHash common.Hash, blockNumber uint64, timestamp uint
return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil))
}

func TriedbConfig(c *core.CacheConfig) *trie.Config {
config := &trie.Config{Preimages: c.Preimages}
func TriedbConfig(c *core.CacheConfig) *triedb.Config {
config := &triedb.Config{Preimages: c.Preimages}
if c.StateScheme == rawdb.HashScheme {
config.HashDB = &hashdb.Config{
CleanCacheSize: c.TrieCleanLimit * 1024 * 1024,
Expand Down
10 changes: 5 additions & 5 deletions arbos/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/triedb/hashdb"
"github.com/ethereum/go-ethereum/trie/triedb/pathdb"
"github.com/ethereum/go-ethereum/triedb"
"github.com/ethereum/go-ethereum/triedb/hashdb"
"github.com/ethereum/go-ethereum/triedb/pathdb"
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/arbmath"
Expand Down Expand Up @@ -87,9 +87,9 @@ func NewMemoryBacked(burner burn.Burner) *Storage {
// Only used for testing.
func NewMemoryBackedStateDB() vm.StateDB {
raw := rawdb.NewMemoryDatabase()
trieConfig := &trie.Config{Preimages: false, PathDB: pathdb.Defaults}
trieConfig := &triedb.Config{Preimages: false, PathDB: pathdb.Defaults}
if env.GetTestStateScheme() == rawdb.HashScheme {
trieConfig = &trie.Config{Preimages: false, HashDB: hashdb.Defaults}
trieConfig = &triedb.Config{Preimages: false, HashDB: hashdb.Defaults}
}
db := state.NewDatabaseWithConfig(raw, trieConfig)
statedb, err := state.New(common.Hash{}, db, nil)
Expand Down

0 comments on commit 5993bc8

Please sign in to comment.