From bc79cdd7843a1dec97fbd8b565fe59b58812c176 Mon Sep 17 00:00:00 2001 From: Maximilian Langenfeld <15726643+ezdac@users.noreply.github.com> Date: Wed, 21 Aug 2024 12:50:02 +0200 Subject: [PATCH] Change 'non-whitelisted' to 'unregistered' in public error msg --- common/exchange/rates.go | 8 ++++---- contracts/fee_currencies.go | 6 +++--- core/state_transition.go | 2 +- core/txpool/celo_validation.go | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/exchange/rates.go b/common/exchange/rates.go index 8905d12e3e..8a190608fc 100644 --- a/common/exchange/rates.go +++ b/common/exchange/rates.go @@ -11,9 +11,9 @@ import ( var ( unitRate = big.NewRat(1, 1) - // ErrNonWhitelistedFeeCurrency is returned if the currency specified to use for the fees + // ErrUnregisteredFeeCurrency is returned if the currency specified to use for the fees // isn't one of the currencies whitelisted for that purpose. - ErrNonWhitelistedFeeCurrency = errors.New("non-whitelisted fee currency address") + ErrUnregisteredFeeCurrency = errors.New("unregistered fee-currency address") ) // ConvertCurrency does an exchange conversion from currencyFrom to currencyTo of the value given. @@ -35,7 +35,7 @@ func ConvertCurrencyToCelo(exchangeRates common.ExchangeRates, currencyAmount *b } exchangeRate, ok := exchangeRates[*feeCurrency] if !ok { - return nil, fmt.Errorf("could not convert from fee currency to native (fee-currency=%s): %w ", feeCurrency, ErrNonWhitelistedFeeCurrency) + return nil, fmt.Errorf("could not convert from fee currency to native (fee-currency=%s): %w ", feeCurrency, ErrUnregisteredFeeCurrency) } return new(big.Int).Div(new(big.Int).Mul(currencyAmount, exchangeRate.Denom()), exchangeRate.Num()), nil } @@ -46,7 +46,7 @@ func ConvertCeloToCurrency(exchangeRates common.ExchangeRates, feeCurrency *comm } exchangeRate, ok := exchangeRates[*feeCurrency] if !ok { - return nil, fmt.Errorf("could not convert from native to fee currency (fee-currency=%s): %w ", feeCurrency, ErrNonWhitelistedFeeCurrency) + return nil, fmt.Errorf("could not convert from native to fee currency (fee-currency=%s): %w ", feeCurrency, ErrUnregisteredFeeCurrency) } return new(big.Int).Div(new(big.Int).Mul(celoAmount, exchangeRate.Num()), exchangeRate.Denom()), nil } diff --git a/contracts/fee_currencies.go b/contracts/fee_currencies.go index 88e9771ae7..90dce268e0 100644 --- a/contracts/fee_currencies.go +++ b/contracts/fee_currencies.go @@ -47,7 +47,7 @@ func DebitFees(evm *vm.EVM, feeCurrency *common.Address, address common.Address, maxIntrinsicGasCost, ok := common.MaxAllowedIntrinsicGasCost(evm.Context.FeeCurrencyContext.IntrinsicGasCosts, feeCurrency) if !ok { - return 0, exchange.ErrNonWhitelistedFeeCurrency + return 0, exchange.ErrUnregisteredFeeCurrency } leftoverGas, err := evm.CallWithABI( @@ -93,7 +93,7 @@ func CreditFees( } maxAllowedGasForDebitAndCredit, ok := common.MaxAllowedIntrinsicGasCost(evm.Context.FeeCurrencyContext.IntrinsicGasCosts, feeCurrency) if !ok { - return exchange.ErrNonWhitelistedFeeCurrency + return exchange.ErrUnregisteredFeeCurrency } maxAllowedGasForCredit := maxAllowedGasForDebitAndCredit - gasUsedDebit @@ -123,7 +123,7 @@ func CreditFees( intrinsicGas, ok := common.CurrencyIntrinsicGasCost(evm.Context.FeeCurrencyContext.IntrinsicGasCosts, feeCurrency) if !ok { // this will never happen - return exchange.ErrNonWhitelistedFeeCurrency + return exchange.ErrUnregisteredFeeCurrency } gasUsedForDebitAndCredit := gasUsedDebit + gasUsed if gasUsedForDebitAndCredit > intrinsicGas { diff --git a/core/state_transition.go b/core/state_transition.go index f6da8efc28..896880635f 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -131,7 +131,7 @@ func IntrinsicGas(data []byte, accessList types.AccessList, isContractCreation b if feeCurrency != nil { intrinsicGasForFeeCurrency, ok := common.CurrencyIntrinsicGasCost(feeIntrinsicGas, feeCurrency) if !ok { - return 0, exchange.ErrNonWhitelistedFeeCurrency + return 0, exchange.ErrUnregisteredFeeCurrency } if (math.MaxUint64 - gas) < intrinsicGasForFeeCurrency { return 0, ErrGasUintOverflow diff --git a/core/txpool/celo_validation.go b/core/txpool/celo_validation.go index 578ae5fee1..91e2025ff5 100644 --- a/core/txpool/celo_validation.go +++ b/core/txpool/celo_validation.go @@ -53,7 +53,7 @@ func CeloValidateTransaction(tx *types.Transaction, head *types.Header, return err } if !common.IsCurrencyAllowed(currencyCtx.ExchangeRates, tx.FeeCurrency()) { - return exchange.ErrNonWhitelistedFeeCurrency + return exchange.ErrUnregisteredFeeCurrency } return nil