Skip to content

Commit

Permalink
core/vm: remove panic when address is not present (#30414)
Browse files Browse the repository at this point in the history
Remove redundant address presence check in `makeGasSStoreFunc`.

This PR simplifies the `makeGasSStoreFunc` function by removing the
redundant check for address presence in the access list. The updated
code now only checks for slot presence, streamlining the logic and
eliminating unnecessary panic conditions.

This change removes the unnecessary address presence check, simplifying
the code and improving maintainability without affecting functionality.
The previous panic condition was intended as a canary during the testing
phases (i.e. _YOLOv2_) and is no longer needed.
  • Loading branch information
achmand authored Sep 11, 2024
1 parent c70b0a9 commit ec69830
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions core/vm/operations_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,10 @@ func makeGasSStoreFunc(clearingRefund uint64) gasFunc {
cost = uint64(0)
)
// Check slot presence in the access list
if addrPresent, slotPresent := evm.StateDB.SlotInAccessList(contract.Address(), slot); !slotPresent {
if _, slotPresent := evm.StateDB.SlotInAccessList(contract.Address(), slot); !slotPresent {
cost = params.ColdSloadCostEIP2929
// If the caller cannot afford the cost, this change will be rolled back
evm.StateDB.AddSlotToAccessList(contract.Address(), slot)
if !addrPresent {
// Once we're done with YOLOv2 and schedule this for mainnet, might
// be good to remove this panic here, which is just really a
// canary to have during testing
panic("impossible case: address was not present in access list during sstore op")
}
}
value := common.Hash(y.Bytes32())

Expand Down

0 comments on commit ec69830

Please sign in to comment.