Skip to content

Commit 6352438

Browse files
committed
Changes based on PR comments
1 parent d14b36c commit 6352438

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

core/state/statedb.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ func (s *StateDB) commit(deleteEmptyObjects bool) (*stateUpdate, error) {
13261326

13271327
origin := s.originalRoot
13281328
s.originalRoot = root
1329-
return newStateUpdate(origin, root, deletes, updates, nodes), nil
1329+
return newStateUpdate(origin, root, deletes, updates, nodes, s.arbExtraData.activatedWasms), nil
13301330
}
13311331

13321332
// commitAndFlush is a wrapper of commit which also commits the state mutations
@@ -1347,10 +1347,10 @@ func (s *StateDB) commitAndFlush(block uint64, deleteEmptyObjects bool) (*stateU
13471347
}
13481348
}
13491349

1350-
if db := s.db.WasmStore(); db != nil && len(s.arbExtraData.activatedWasms) > 0 {
1350+
if db := s.db.WasmStore(); db != nil && len(ret.activatedWasms) > 0 {
13511351
batch := db.NewBatch()
13521352
// Arbitrum: write Stylus programs to disk
1353-
for moduleHash, asmMap := range s.arbExtraData.activatedWasms {
1353+
for moduleHash, asmMap := range ret.activatedWasms {
13541354
rawdb.WriteActivation(batch, moduleHash, asmMap)
13551355
}
13561356
s.arbExtraData.activatedWasms = make(map[common.Hash]ActivatedWasm)

core/state/stateupdate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type stateUpdate struct {
5757
storages map[common.Hash]map[common.Hash][]byte // storages stores mutated slots in 'prefix-zero-trimmed' RLP format
5858
storagesOrigin map[common.Address]map[common.Hash][]byte // storagesOrigin stores the original values of mutated slots in 'prefix-zero-trimmed' RLP format
5959
codes map[common.Address]contractCode // codes contains the set of dirty codes
60+
activatedWasms map[common.Hash]ActivatedWasm // newly activated WASMs
6061
nodes *trienode.MergedNodeSet // Aggregated dirty nodes caused by state changes
6162
}
6263

@@ -68,7 +69,7 @@ func (sc *stateUpdate) empty() bool {
6869
// newStateUpdate constructs a state update object, representing the differences
6970
// between two states by performing state execution. It aggregates the given
7071
// account deletions and account updates to form a comprehensive state update.
71-
func newStateUpdate(originRoot common.Hash, root common.Hash, deletes map[common.Hash]*accountDelete, updates map[common.Hash]*accountUpdate, nodes *trienode.MergedNodeSet) *stateUpdate {
72+
func newStateUpdate(originRoot common.Hash, root common.Hash, deletes map[common.Hash]*accountDelete, updates map[common.Hash]*accountUpdate, nodes *trienode.MergedNodeSet, activatedWasms map[common.Hash]ActivatedWasm) *stateUpdate {
7273
var (
7374
destructs = make(map[common.Hash]struct{})
7475
accounts = make(map[common.Hash][]byte)
@@ -128,6 +129,7 @@ func newStateUpdate(originRoot common.Hash, root common.Hash, deletes map[common
128129
storages: storages,
129130
storagesOrigin: storagesOrigin,
130131
codes: codes,
132+
activatedWasms: activatedWasms,
131133
nodes: nodes,
132134
}
133135
}

0 commit comments

Comments
 (0)