Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: don't add basefee to treasury in system transaction in tracing #24

Merged
merged 1 commit into from
Feb 27, 2025
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
36 changes: 15 additions & 21 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,33 +489,27 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
// After EIP-3529: refunds are capped to gasUsed / 5
gasRefund = st.refundGas(params.RefundQuotientEIP3529)
}
}

effectiveTip := st.gasPrice
if st.evm.Config.IsSystemTransaction {
// System transaction is not affected by basefee rule
// and tip is always 0.
effectiveTip = common.Big0
} else {
effectiveTip := st.gasPrice
if rules.IsLondon {
effectiveTip = cmath.BigMin(st.gasTipCap, new(big.Int).Sub(st.gasFeeCap, st.evm.Context.BaseFee))
}
}

// if currentBlock is ConsortiumV2 then add balance to system address
newEffectiveTip := new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip)
if st.evm.ChainConfig().IsConsortiumV2(st.evm.Context.BlockNumber) {
st.state.AddBalance(consensus.SystemAddress, newEffectiveTip)
} else {
st.state.AddBalance(st.evm.Context.Coinbase, newEffectiveTip)
}
// if currentBlock is ConsortiumV2 then add balance to system address
newEffectiveTip := new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip)
if st.evm.ChainConfig().IsConsortiumV2(st.evm.Context.BlockNumber) {
st.state.AddBalance(consensus.SystemAddress, newEffectiveTip)
} else {
st.state.AddBalance(st.evm.Context.Coinbase, newEffectiveTip)
}

// After Venoki the base fee is non-zero and the fee is transferred to treasury
if rules.IsVenoki {
treasuryAddress := st.evm.ChainConfig().RoninTreasuryAddress
if treasuryAddress != nil {
fee := new(big.Int).Mul(big.NewInt(int64(st.gasUsed())), st.evm.Context.BaseFee)
st.state.AddBalance(*treasuryAddress, fee)
// After Venoki the base fee is non-zero and the fee is transferred to treasury
if rules.IsVenoki {
treasuryAddress := st.evm.ChainConfig().RoninTreasuryAddress
if treasuryAddress != nil {
fee := new(big.Int).Mul(big.NewInt(int64(st.gasUsed())), st.evm.Context.BaseFee)
st.state.AddBalance(*treasuryAddress, fee)
}
}
}

Expand Down