Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit 951e875

Browse files
ceyonurDarioush Jalali
andauthored
use verdb in accepted and metadb (#1375)
Co-authored-by: Darioush Jalali <[email protected]>
1 parent 4e0e5d2 commit 951e875

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

plugin/evm/vm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,8 +1279,8 @@ func (vm *VM) initializeDBs(avaDB database.Database) error {
12791279
// remains the same regardless of the provided baseDB type.
12801280
vm.chaindb = rawdb.NewDatabase(Database{prefixdb.NewNested(ethDBPrefix, db)})
12811281
vm.db = versiondb.New(db)
1282-
vm.acceptedBlockDB = prefixdb.New(acceptedPrefix, db)
1283-
vm.metadataDB = prefixdb.New(metadataPrefix, db)
1282+
vm.acceptedBlockDB = prefixdb.New(acceptedPrefix, vm.db)
1283+
vm.metadataDB = prefixdb.New(metadataPrefix, vm.db)
12841284
// Note warpDB is not part of versiondb because it is not necessary
12851285
// that warp signatures are committed to the database atomically with
12861286
// the last accepted block.

plugin/evm/vm_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ func setupGenesis(
189189
genesisBytes := buildGenesisTest(t, genesisJSON)
190190
ctx := NewContext()
191191

192+
baseDB := memdb.New()
193+
192194
// initialize the atomic memory
193-
atomicMemory := atomic.NewMemory(prefixdb.New([]byte{0}, memdb.New()))
195+
atomicMemory := atomic.NewMemory(prefixdb.New([]byte{0}, baseDB))
194196
ctx.SharedMemory = atomicMemory.NewSharedMemory(ctx.ChainID)
195197

196198
// NB: this lock is intentionally left locked when this function returns.
@@ -204,7 +206,8 @@ func setupGenesis(
204206
ctx.Keystore = userKeystore.NewBlockchainKeyStore(ctx.ChainID)
205207

206208
issuer := make(chan commonEng.Message, 1)
207-
return ctx, memdb.New(), genesisBytes, issuer, atomicMemory
209+
prefixedDB := prefixdb.New([]byte{1}, baseDB)
210+
return ctx, prefixedDB, genesisBytes, issuer, atomicMemory
208211
}
209212

210213
// GenesisVM creates a VM instance with the genesis test bytes and returns

0 commit comments

Comments
 (0)