Skip to content

Commit f891743

Browse files
committed
recordingKV uses separate wasmDB
1 parent e9b2c95 commit f891743

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

arbitrum/recordingdb.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ var (
3232
type RecordingKV struct {
3333
inner *trie.Database
3434
diskDb ethdb.KeyValueStore
35-
wasmDb ethdb.KeyValueStore
3635
readDbEntries map[common.Hash][]byte
3736
enableBypass bool
3837
}
3938

40-
func newRecordingKV(inner *trie.Database, diskDb ethdb.KeyValueStore, wasmDb ethdb.KeyValueStore) *RecordingKV {
41-
return &RecordingKV{inner, diskDb, wasmDb, make(map[common.Hash][]byte), false}
39+
func newRecordingKV(inner *trie.Database, diskDb ethdb.KeyValueStore) *RecordingKV {
40+
return &RecordingKV{inner, diskDb, make(map[common.Hash][]byte), false}
4241
}
4342

4443
func (db *RecordingKV) Has(key []byte) (bool, error) {
@@ -56,12 +55,6 @@ func (db *RecordingKV) Get(key []byte) ([]byte, error) {
5655
// Retrieving code
5756
copy(hash[:], key[len(rawdb.CodePrefix):])
5857
res, err = db.diskDb.Get(key)
59-
} else if ok, _ := rawdb.IsActivatedAsmKey(key); ok {
60-
// Arbitrum: the asm is non-consensus
61-
return db.wasmDb.Get(key)
62-
} else if ok, _ := rawdb.IsActivatedModuleKey(key); ok {
63-
// Arbitrum: the module is non-consensus (only its hash is)
64-
return db.wasmDb.Get(key)
6558
} else {
6659
err = fmt.Errorf("recording KV attempted to access non-hash key %v", hex.EncodeToString(key))
6760
}
@@ -274,9 +267,9 @@ func (r *RecordingDatabase) PrepareRecording(ctx context.Context, lastBlockHeade
274267
}
275268
finalDereference := lastBlockHeader // dereference in case of error
276269
defer func() { r.Dereference(finalDereference) }()
277-
recordingKeyValue := newRecordingKV(r.db.TrieDB(), r.db.DiskDB(), r.db.WasmStore())
270+
recordingKeyValue := newRecordingKV(r.db.TrieDB(), r.db.DiskDB())
278271

279-
recordingStateDatabase := state.NewDatabase(rawdb.NewDatabase(recordingKeyValue))
272+
recordingStateDatabase := state.NewDatabase(rawdb.WrapDatabaseWithWasm(rawdb.NewDatabase(recordingKeyValue), r.db.WasmStore()))
280273
var prevRoot common.Hash
281274
if lastBlockHeader != nil {
282275
prevRoot = lastBlockHeader.Root

0 commit comments

Comments
 (0)