File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -290,6 +290,16 @@ func (t *prestateTracer) lookupAccount(addr common.Address) {
290
290
// it to the prestate of the given contract. It assumes `lookupAccount`
291
291
// has been performed on the contract before.
292
292
func (t * prestateTracer ) lookupStorage (addr common.Address , key common.Hash ) {
293
+ // TODO: Refactor coreth test outside of eth/tracers/internal
294
+ // See https://github.com/ava-labs/coreth/pull/286 for context.
295
+ // lookupStorage assumes that lookupAccount has already been called.
296
+ // This assumption is violated for some historical blocks by the NativeAssetCall
297
+ // precompile. To fix this, we perform an extra call to lookupAccount here to ensure
298
+ // that the pre-state account is populated before attempting to read from the Storage
299
+ // map. When the invariant is maintained properly (since de-activation of the precompile),
300
+ // lookupAccount is a no-op. When the invariant is broken by the precompile, this avoids
301
+ // the panic and correctly captures the account prestate before the next opcode is executed.
302
+ t .lookupAccount (addr )
293
303
if _ , ok := t .pre [addr ].Storage [key ]; ok {
294
304
return
295
305
}
You can’t perform that action at this time.
0 commit comments