File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
crates/scroll/alloy/evm/src Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ where
183
183
// disable the nonce check
184
184
core:: mem:: swap ( & mut self . cfg . disable_nonce_check , & mut disable_nonce_check) ;
185
185
186
- let res = self . transact ( ScrollTransactionIntoTxEnv :: from ( tx) ) ;
186
+ let mut res = self . transact ( ScrollTransactionIntoTxEnv :: from ( tx) ) ;
187
187
188
188
// swap back to the previous gas limit
189
189
core:: mem:: swap ( & mut self . block . gas_limit , & mut gas_limit) ;
@@ -192,6 +192,17 @@ where
192
192
// swap back to the previous nonce check flag
193
193
core:: mem:: swap ( & mut self . cfg . disable_nonce_check , & mut disable_nonce_check) ;
194
194
195
+ // NOTE: We assume that only the contract storage is modified. Revm currently marks the
196
+ // caller and block beneficiary accounts as "touched" when we do the above transact calls,
197
+ // and includes them in the result.
198
+ //
199
+ // We're doing this state cleanup to make sure that changeset only includes the changed
200
+ // contract storage.
201
+ // Specifically prevents incorrect nonce increment for system contract caller.
202
+ if let Ok ( res) = & mut res {
203
+ res. state . retain ( |addr, _| * addr == contract) ;
204
+ }
205
+
195
206
res
196
207
}
197
208
You can’t perform that action at this time.
0 commit comments