mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
Fix fee conversion
This commit is contained in:
parent
fc319f7bcb
commit
f9f774f8a4
3 changed files with 6 additions and 6 deletions
|
|
@ -199,7 +199,7 @@ func BigMinUint256(x, y *uint256.Int) *uint256.Int {
|
|||
|
||||
// todo: @anshalshukla - check implementation correctness
|
||||
func BigIntToUint256Int(x *big.Int) *uint256.Int {
|
||||
return new(uint256.Int).SetUint64(x.Uint64())
|
||||
return new(uint256.Int).SetBytes(x.Bytes())
|
||||
}
|
||||
|
||||
// FirstBitSet returns the index of the first 1 bit in v, counting from LSB.
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
cmath "github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/consensus/misc"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/tracing"
|
||||
|
|
@ -29,7 +30,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
||||
// StateProcessor is a basic Processor, which takes care of transitioning
|
||||
|
|
@ -160,11 +160,11 @@ func ApplyTransactionWithEVM(msg *Message, config *params.ChainConfig, gp *GasPo
|
|||
statedb.SetMVHashmap(nil)
|
||||
|
||||
if evm.ChainConfig().IsLondon(blockNumber) {
|
||||
statedb.AddBalance(result.BurntContractAddress, uint256.NewInt(result.FeeBurnt.Uint64()), tracing.BalanceChangeTransfer)
|
||||
statedb.AddBalance(result.BurntContractAddress, cmath.BigIntToUint256Int(result.FeeBurnt), tracing.BalanceChangeTransfer)
|
||||
}
|
||||
|
||||
// TODO(raneet10) Double check
|
||||
statedb.AddBalance(evm.Context.Coinbase, uint256.NewInt(result.FeeTipped.Uint64()), tracing.BalanceChangeTransfer)
|
||||
statedb.AddBalance(evm.Context.Coinbase, cmath.BigIntToUint256Int(result.FeeTipped), tracing.BalanceChangeTransfer)
|
||||
output1 := new(big.Int).SetBytes(result.SenderInitBalance.Bytes())
|
||||
output2 := new(big.Int).SetBytes(coinbaseBalance.Bytes())
|
||||
|
||||
|
|
|
|||
|
|
@ -528,12 +528,12 @@ func (st *StateTransition) TransitionDb(interruptCtx context.Context) (*Executio
|
|||
burnAmount = new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee)
|
||||
|
||||
if !st.noFeeBurnAndTip {
|
||||
st.state.AddBalance(burntContractAddress, uint256.NewInt(burnAmount.Uint64()), tracing.BalanceChangeTransfer)
|
||||
st.state.AddBalance(burntContractAddress, cmath.BigIntToUint256Int(burnAmount), tracing.BalanceChangeTransfer)
|
||||
}
|
||||
}
|
||||
|
||||
if !st.noFeeBurnAndTip {
|
||||
st.state.AddBalance(st.evm.Context.Coinbase, uint256.NewInt(amount.Uint64()), tracing.BalanceIncreaseRewardTransactionFee)
|
||||
st.state.AddBalance(st.evm.Context.Coinbase, cmath.BigIntToUint256Int(amount), tracing.BalanceIncreaseRewardTransactionFee)
|
||||
|
||||
// add the coinbase to the witness iff the fee is greater than 0
|
||||
if rules.IsEIP4762 && amount.Sign() != 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue