core/vm: in selfdestruct gas calculation, return early if there isn't enough gas to cover cold account access costs#33450
Conversation
… enough gas to cover cold account access costs
|
Our gas calculation mechanism is somewhat awkward, in my opinion. For stateless opcodes such as arithmetic operations, gas accounting is straightforward. However, gas calculation becomes significantly more complex once state is involved, such as with CALL. In these cases, we often need to determine how much gas is available and skip unnecessary state retrieval when the remaining gas is insufficient for performance reasons. For SELFDESTRUCT, the required gas depends on state related information, and the target address must be tracked accordingly in BALs
For CALL* opcodes, the target address must not be included if the opcode is not actually executed, even if state has already been resolved during gas calculation. In such cases, we must explicitly filter out the related states from the BALs. It's very hard to fully align the requirement of EIP-7928 |
|
Sorry, I should have shortened the title some. |
There's no need to perform the subsequent state access on the target if we already know that we are out of gas.
This aligns the state access behavior of selfdestruct with EIP-7928