diff --git a/contracts/fee_currencies.go b/contracts/fee_currencies.go index 06003f837f..429b872ea7 100644 --- a/contracts/fee_currencies.go +++ b/contracts/fee_currencies.go @@ -20,7 +20,6 @@ const ( // Default intrinsic gas cost of transactions paying for gas in alternative currencies. // Calculated to estimate 1 balance read, 1 debit, and 4 credit transactions. IntrinsicGasForAlternativeFeeCurrency uint64 = 50 * Thousand - // TODO(pl): where top put this best ) var ( @@ -52,29 +51,16 @@ func DebitFees(evm *vm.EVM, address common.Address, amount *big.Int, feeCurrency if amount.Cmp(big.NewInt(0)) == 0 { return nil } - - // Run only primary evm.Call() with tracer - // if evm.GetDebug() { - // evm.SetDebug(false) - // defer func() { evm.SetDebug(true) }() - // } - - // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. - // - // Solidity: function transfer(address to, uint256 amount) returns(bool) - // transferSelector := hexutil.MustDecode("0xa9059cbb") - // transferData := common.GetEncodedAbi(transferSelector, [][]byte{common.AddressToAbi(tmpAddress), common.AmountToAbi(amount)}) - abi, err := abigen.FeeCurrencyMetaData.GetAbi() if err != nil { return err } + // Solidity: function transfer(address to, uint256 amount) returns(bool) input, err := abi.Pack("transfer", tmpAddress, amount) if err != nil { return err } - // create account ref caller := vm.AccountRef(address) _, leftoverGas, err := evm.Call(caller, *feeCurrency, input, maxGasForDebitGasFeesTransactions, big.NewInt(0)) @@ -92,23 +78,14 @@ func CreditFees( tipTxFee *big.Int, baseTxFee *big.Int, feeCurrency *common.Address) error { - // Run only primary evm.Call() with tracer - // if evm.GetDebug() { - // evm.SetDebug(false) - // defer func() { evm.SetDebug(true) }() - // } - caller := vm.AccountRef(tmpAddress) - // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. - // - // Solidity: function transfer(address to, uint256 amount) returns(bool) - // transferSelector := hexutil.MustDecode("0xa9059cbb") abi, err := abigen.FeeCurrencyMetaData.GetAbi() if err != nil { return err } + // Solidity: function transfer(address to, uint256 amount) returns(bool) transfer1Data, err := abi.Pack("transfer", from, refund) if err != nil { return err diff --git a/core/state_transition.go b/core/state_transition.go index d6a93df9bb..6ef5331851 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -536,9 +536,8 @@ func (st *StateTransition) innerTransitionDb() (*ExecutionResult, error) { contractCreation = msg.To == nil ) - // TODO(pl) Decide if we want to read this from the chain? - gasForAlternativeCurrency := uint64(0) // If the fee currency is nil, do not retrieve the intrinsic gas adjustment from the chain state, as it will not be used. + gasForAlternativeCurrency := uint64(0) if msg.FeeCurrency != nil { gasForAlternativeCurrency = fee_currencies.IntrinsicGasForAlternativeFeeCurrency } @@ -661,12 +660,6 @@ func (st *StateTransition) blobGasUsed() uint64 { // distributeTxFees calculates the amounts and recipients of transaction fees and credits the accounts. func (st *StateTransition) distributeTxFees() error { - // TODO(pl): check tracing - // Run only primary evm.Call() with tracer - // if st.evm.GetDebug() { - // st.evm.SetDebug(false) - // defer func() { st.evm.SetDebug(true) }() - // } if st.evm.Config.NoBaseFee && st.msg.GasFeeCap.Sign() == 0 && st.msg.GasTipCap.Sign() == 0 { // Skip fee payment when NoBaseFee is set and the fee fields // are 0. This avoids a negative effectiveTip being applied to