mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
fix fee logic in TransitionDb (#887)
update fee_vault logic in TransitionDb
This commit is contained in:
parent
b5dee527c4
commit
72577219c0
1 changed files with 6 additions and 6 deletions
|
|
@ -490,19 +490,19 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
|
||||||
effectiveTip = cmath.BigMin(msg.GasTipCap, new(big.Int).Sub(msg.GasFeeCap, st.evm.Context.BaseFee))
|
effectiveTip = cmath.BigMin(msg.GasTipCap, new(big.Int).Sub(msg.GasFeeCap, st.evm.Context.BaseFee))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The L2 Fee is the same as the fee that is charged in the normal geth codepath.
|
||||||
|
fee := big.NewInt(0)
|
||||||
if st.evm.Config.NoBaseFee && msg.GasFeeCap.Sign() == 0 && msg.GasTipCap.Sign() == 0 {
|
if st.evm.Config.NoBaseFee && msg.GasFeeCap.Sign() == 0 && msg.GasTipCap.Sign() == 0 {
|
||||||
// Skip fee payment when NoBaseFee is set and the fee fields
|
// Skip fee payment when NoBaseFee is set and the fee fields
|
||||||
// are 0. This avoids a negative effectiveTip being applied to
|
// are 0. This avoids a negative effectiveTip being applied to
|
||||||
// the coinbase when simulating calls.
|
// the coinbase when simulating calls.
|
||||||
} else {
|
} else {
|
||||||
// The L2 Fee is the same as the fee that is charged in the normal geth
|
fee = new(big.Int).SetUint64(st.gasUsed())
|
||||||
// codepath. Add the L1DataFee to the L2 fee for the total fee that is sent
|
|
||||||
// to the sequencer.
|
|
||||||
fee := new(big.Int).SetUint64(st.gasUsed())
|
|
||||||
fee.Mul(fee, effectiveTip)
|
fee.Mul(fee, effectiveTip)
|
||||||
fee.Add(fee, st.l1DataFee)
|
|
||||||
st.state.AddBalance(st.evm.Context.Coinbase, fee) // TODO: change to `st.evm.FeeRecipient()`
|
|
||||||
}
|
}
|
||||||
|
//Add the L1DataFee to the L2 fee for the total fee that is sent to the sequencer.
|
||||||
|
totalFee := fee.Add(fee, st.l1DataFee)
|
||||||
|
st.state.AddBalance(st.evm.FeeRecipient(), totalFee)
|
||||||
|
|
||||||
return &ExecutionResult{
|
return &ExecutionResult{
|
||||||
L1DataFee: st.l1DataFee,
|
L1DataFee: st.l1DataFee,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue