Skip to content

Commit

Permalink
Renaming for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
palango committed Nov 7, 2023
1 parent 30c0e27 commit 8b50a6d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"github.com/ethereum/go-ethereum/common"
cmath "github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
contracts "github.com/ethereum/go-ethereum/contracts"
celo "github.com/ethereum/go-ethereum/contracts/celo"
fee_currencies "github.com/ethereum/go-ethereum/contracts"
contracts "github.com/ethereum/go-ethereum/contracts/celo"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
Expand Down Expand Up @@ -283,7 +283,7 @@ func (st *StateTransition) buyGas() error {
// L1 data fee needs to be converted in fee currency
if st.msg.FeeCurrency != nil {
// Existence of the fee currency has been checked in `preCheck`
l1Cost = contracts.ConvertGoldToCurrency(st.evm.Context.ExchangeRates, st.msg.FeeCurrency, l1Cost)
l1Cost = fee_currencies.ConvertGoldToCurrency(st.evm.Context.ExchangeRates, st.msg.FeeCurrency, l1Cost)
}
}
if l1Cost != nil {
Expand Down Expand Up @@ -338,7 +338,7 @@ func (st *StateTransition) canPayFee(checkAmount *big.Int) error {
chainConfig: st.evm.ChainConfig(),
state: st.state,
}
balance, err := contracts.GetBalanceOf(backend, st.msg.From, *st.msg.FeeCurrency)
balance, err := fee_currencies.GetBalanceOf(backend, st.msg.From, *st.msg.FeeCurrency)
if err != nil {
return err
}
Expand All @@ -358,7 +358,7 @@ func (st *StateTransition) subFees(effectiveFee *big.Int) (err error) {
st.state.SubBalance(st.msg.From, effectiveFee)
return nil
} else {
return contracts.DebitFees(st.evm, st.msg.From, effectiveFee, st.msg.FeeCurrency)
return fee_currencies.DebitFees(st.evm, st.msg.From, effectiveFee, st.msg.FeeCurrency)
}
}

Expand Down Expand Up @@ -540,7 +540,7 @@ func (st *StateTransition) innerTransitionDb() (*ExecutionResult, error) {
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.
if msg.FeeCurrency != nil {
gasForAlternativeCurrency = contracts.IntrinsicGasForAlternativeFeeCurrency
gasForAlternativeCurrency = fee_currencies.IntrinsicGasForAlternativeFeeCurrency
}
// Check clauses 4-5, subtract intrinsic gas if everything is correct
gas, err := IntrinsicGas(msg.Data, msg.AccessList, contractCreation, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai, msg.FeeCurrency, gasForAlternativeCurrency)
Expand Down Expand Up @@ -686,7 +686,7 @@ func (st *StateTransition) distributeTxFees() error {
tipTxFee := new(big.Int).Sub(totalTxFee, baseTxFee)

feeCurrency := st.msg.FeeCurrency
feeHandlerAddress := celo.FeeHandlerAddress
feeHandlerAddress := contracts.FeeHandlerAddress

log.Trace("distributeTxFees", "from", from, "refund", refund, "feeCurrency", st.msg.FeeCurrency,
"coinbaseFeeRecipient", st.evm.Context.Coinbase, "coinbaseFee", tipTxFee,
Expand All @@ -696,7 +696,7 @@ func (st *StateTransition) distributeTxFees() error {
st.state.AddBalance(st.evm.Context.Coinbase, tipTxFee)
st.state.AddBalance(from, refund)
} else {
if err := contracts.CreditFees(st.evm, from, st.evm.Context.Coinbase, feeHandlerAddress, refund, tipTxFee, baseTxFee, feeCurrency); err != nil {
if err := fee_currencies.CreditFees(st.evm, from, st.evm.Context.Coinbase, feeHandlerAddress, refund, tipTxFee, baseTxFee, feeCurrency); err != nil {
log.Error("Error crediting", "from", from, "coinbase", st.evm.Context.Coinbase, "feeHandler", feeHandlerAddress)
return err
}
Expand All @@ -713,7 +713,7 @@ func (st *StateTransition) calculateGasPriceMinimum() *big.Int {

if st.msg.FeeCurrency != nil {
// Existence of the fee currency has been checked in `preCheck`
gasPriceMinimum = contracts.ConvertGoldToCurrency(st.evm.Context.ExchangeRates, st.msg.FeeCurrency, gasPriceMinimum)
gasPriceMinimum = fee_currencies.ConvertGoldToCurrency(st.evm.Context.ExchangeRates, st.msg.FeeCurrency, gasPriceMinimum)
}

return gasPriceMinimum
Expand Down

0 comments on commit 8b50a6d

Please sign in to comment.