Since EIP-3298 gas refunds works for storage restores only inside the same transaction. For example ERC-20
transferFrom flow between 2 smart contracts according to EIP-2200 and EIP-2929 will cost nearly to
21600 gas with gas refund counter
20000. But in case of reverting this subcall (containing both
transferForm) gas refund will be erased, while smart contract storage will remain unmodified. I think it should keep storage access costs, but still refund modification costs.
Сurrent full cancelling of gas refunds on internal reverts is too unfair. Users pay for non-modification same cost as for modification.
Let's consider all reverted SSTOREs as SLOADs (access) costs. This requires to remember (SSTORE - SLOAD) costs for each SSTORE inside every internal call excluding its subcalls and on revert let's update gas refund counter in the following manner:
tx.gas_refund_counter = tx.gas_refund_counter - call.gas_refund_counter + call.sstores_sloads_diff_counter;
# Backwards Compatibility
No known backward incompatibilities.
# Test Cases
# Reference Implementation
# Security Considerations
Copyright and related rights waived via CC0 (opens new window).