Skip to content

Commit

Permalink
merge WasmTargetsRetriever interface into WasmDataBaseRetriever
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Aug 27, 2024
1 parent 09ca313 commit 4ca4b4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
20 changes: 10 additions & 10 deletions core/state/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ func NewDatabaseWithConfig(db ethdb.Database, config *triedb.Config) Database {
wasmdb, wasmTag := db.WasmDataBase()
cdb := &cachingDB{
// Arbitrum only
activatedAsmCache: lru.NewSizeConstrainedCache[activatedAsmCacheKey, []byte](activatedWasmCacheSize),
wasmTag: wasmTag,
wasmTargetsRetriever: db,
activatedAsmCache: lru.NewSizeConstrainedCache[activatedAsmCacheKey, []byte](activatedWasmCacheSize),
wasmTag: wasmTag,
wasmDatabaseRetriever: db,

disk: db,
wasmdb: wasmdb,
Expand All @@ -182,9 +182,9 @@ func NewDatabaseWithNodeDB(db ethdb.Database, triedb *triedb.Database) Database
wasmdb, wasmTag := db.WasmDataBase()
cdb := &cachingDB{
// Arbitrum only
activatedAsmCache: lru.NewSizeConstrainedCache[activatedAsmCacheKey, []byte](activatedWasmCacheSize),
wasmTag: wasmTag,
wasmTargetsRetriever: db,
activatedAsmCache: lru.NewSizeConstrainedCache[activatedAsmCacheKey, []byte](activatedWasmCacheSize),
wasmTag: wasmTag,
wasmDatabaseRetriever: db,

disk: db,
wasmdb: wasmdb,
Expand All @@ -202,9 +202,9 @@ type activatedAsmCacheKey struct {

type cachingDB struct {
// Arbitrum
activatedAsmCache *lru.SizeConstrainedCache[activatedAsmCacheKey, []byte]
wasmTag uint32
wasmTargetsRetriever ethdb.WasmTargetsRetriever
activatedAsmCache *lru.SizeConstrainedCache[activatedAsmCacheKey, []byte]
wasmTag uint32
wasmDatabaseRetriever ethdb.WasmDataBaseRetriever

disk ethdb.KeyValueStore
wasmdb ethdb.KeyValueStore
Expand All @@ -222,7 +222,7 @@ func (db *cachingDB) WasmCacheTag() uint32 {
}

func (db *cachingDB) WasmTargets() []ethdb.WasmTarget {
return db.wasmTargetsRetriever.WasmTargets()
return db.wasmDatabaseRetriever.WasmTargets()
}

// OpenTrie opens the main account trie at a specific root hash.
Expand Down
6 changes: 1 addition & 5 deletions ethdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,9 @@ type AncientStore interface {
io.Closer
}

type WasmTarget string
type WasmDataBaseRetriever interface {
WasmDataBase() (KeyValueStore, uint32)
}

type WasmTarget string
type WasmTargetsRetriever interface {
WasmTargets() []WasmTarget
}

Expand All @@ -199,5 +196,4 @@ type Database interface {
Snapshotter
io.Closer
WasmDataBaseRetriever
WasmTargetsRetriever
}

0 comments on commit 4ca4b4d

Please sign in to comment.