Skip to content

Commit

Permalink
Refactor gas refund logic based on EIP-3529 and anchor status
Browse files Browse the repository at this point in the history
  • Loading branch information
johntaiko committed Dec 9, 2023
1 parent b796265 commit a9d7c28
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,14 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
st.state.SetNonce(msg.From, st.state.GetNonce(sender.Address())+1)
ret, st.gasRemaining, vmerr = st.evm.Call(sender, st.to(), msg.Data, st.gasRemaining, msg.Value)
}

if !rules.IsLondon {
// Before EIP-3529: refunds were capped to gasUsed / 2
st.refundGas(params.RefundQuotient)
} else {
// After EIP-3529: refunds are capped to gasUsed / 5
st.refundGas(params.RefundQuotientEIP3529)
if !st.msg.IsAnchor {
if !rules.IsLondon {
// Before EIP-3529: refunds were capped to gasUsed / 2
st.refundGas(params.RefundQuotient)
} else {
// After EIP-3529: refunds are capped to gasUsed / 5
st.refundGas(params.RefundQuotientEIP3529)
}
}
effectiveTip := msg.GasPrice
if rules.IsLondon {
Expand Down

0 comments on commit a9d7c28

Please sign in to comment.