Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,30 +954,29 @@ func (st *stateTransition) innerExecute() (*ExecutionResult, error) {

amtU256 = st.collectNativeBalance(amtU256)
st.state.AddBalance(params.OptimismBaseFeeRecipient, amtU256, tracing.BalanceIncreaseRewardTransactionFee)
if l1Cost := st.evm.Context.L1CostFunc(st.msg.RollupCostData, st.evm.Context.Time); l1Cost != nil {
amtU256, overflow = uint256.FromBig(l1Cost)
if overflow {
return nil, fmt.Errorf("optimism l1 cost overflows U256: %d", l1Cost)
}
if shouldCheckGasFormula {
if shouldCheckGasFormula {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can put all shouldCheckGasFormula checks in one condition check rather than multiple ones.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done!

if l1Cost := st.evm.Context.L1CostFunc(st.msg.RollupCostData, st.evm.Context.Time); l1Cost != nil {
amtU256, overflow = uint256.FromBig(l1Cost)
if overflow {
return nil, fmt.Errorf("optimism l1 cost overflows U256: %d", l1Cost)
}
st.l1Fee = amtU256.Clone()
}

amtU256 = st.collectNativeBalance(amtU256)
st.state.AddBalance(params.OptimismL1FeeRecipient, amtU256, tracing.BalanceIncreaseRewardTransactionFee)
}
amtU256 = st.collectNativeBalance(amtU256)
st.state.AddBalance(params.OptimismL1FeeRecipient, amtU256, tracing.BalanceIncreaseRewardTransactionFee)
}

if rules.IsOptimismIsthmus {
// Operator Fee refunds are only applied if Isthmus is active and the transaction is *not* a deposit.
st.refundIsthmusOperatorCost()
if rules.IsOptimismIsthmus {
// Operator Fee refunds are only applied if Isthmus is active and the transaction is *not* a deposit.
// Skip during gas estimation (when shouldCheckGasFormula is false) since operator cost wasn't pre-charged.
st.refundIsthmusOperatorCost()

operatorFeeCost := st.evm.Context.OperatorCostFunc(st.gasUsed(), st.evm.Context.Time)
st.operatorFee = operatorFeeCost.Clone()
operatorFeeCost = st.collectNativeBalance(operatorFeeCost)
st.state.AddBalance(params.OptimismOperatorFeeRecipient, operatorFeeCost, tracing.BalanceIncreaseRewardTransactionFee)
}
operatorFeeCost := st.evm.Context.OperatorCostFunc(st.gasUsed(), st.evm.Context.Time)
st.operatorFee = operatorFeeCost.Clone()
operatorFeeCost = st.collectNativeBalance(operatorFeeCost)
st.state.AddBalance(params.OptimismOperatorFeeRecipient, operatorFeeCost, tracing.BalanceIncreaseRewardTransactionFee)
}

if shouldCheckGasFormula {
if st.l1Fee == nil {
st.l1Fee = new(uint256.Int)
}
Expand Down
Loading