Skip to content

Commit

Permalink
recordingDB: use wasmStore
Browse files Browse the repository at this point in the history
  • Loading branch information
tsahee committed May 9, 2024
1 parent 3f06931 commit 9ddbd57
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions arbitrum/recordingdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ var (
type RecordingKV struct {
inner *trie.Database
diskDb ethdb.KeyValueStore
wasmDb ethdb.KeyValueStore
readDbEntries map[common.Hash][]byte
enableBypass bool
}

func newRecordingKV(inner *trie.Database, diskDb ethdb.KeyValueStore) *RecordingKV {
return &RecordingKV{inner, diskDb, make(map[common.Hash][]byte), false}
func newRecordingKV(inner *trie.Database, diskDb ethdb.KeyValueStore, wasmDb ethdb.KeyValueStore) *RecordingKV {
return &RecordingKV{inner, diskDb, wasmDb, make(map[common.Hash][]byte), false}
}

func (db *RecordingKV) Has(key []byte) (bool, error) {
Expand All @@ -57,10 +58,10 @@ func (db *RecordingKV) Get(key []byte) ([]byte, error) {
res, err = db.diskDb.Get(key)
} else if ok, _ := rawdb.IsActivatedAsmKey(key); ok {
// Arbitrum: the asm is non-consensus
return db.diskDb.Get(key)
return db.wasmDb.Get(key)
} else if ok, _ := rawdb.IsActivatedModuleKey(key); ok {
// Arbitrum: the module is non-consensus (only its hash is)
return db.diskDb.Get(key)
return db.wasmDb.Get(key)
} else {
err = fmt.Errorf("recording KV attempted to access non-hash key %v", hex.EncodeToString(key))
}
Expand Down Expand Up @@ -273,7 +274,7 @@ func (r *RecordingDatabase) PrepareRecording(ctx context.Context, lastBlockHeade
}
finalDereference := lastBlockHeader // dereference in case of error
defer func() { r.Dereference(finalDereference) }()
recordingKeyValue := newRecordingKV(r.db.TrieDB(), r.db.DiskDB())
recordingKeyValue := newRecordingKV(r.db.TrieDB(), r.db.DiskDB(), r.db.WasmStore())

recordingStateDatabase := state.NewDatabase(rawdb.NewDatabase(recordingKeyValue))
var prevRoot common.Hash
Expand Down

0 comments on commit 9ddbd57

Please sign in to comment.