Skip to content

Commit

Permalink
Add minor code improvements
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Lange <[email protected]>
  • Loading branch information
ezdac and palango committed Aug 5, 2024
1 parent ba82b0d commit 410be53
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions common/celo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func MaxAllowedIntrinsicGasCost(i IntrinsicGasCosts, feeCurrency *Address) (uint
// during execution
return intrinsicGas * 3, true
}

func CurrencyIntrinsicGasCost(i IntrinsicGasCosts, feeCurrency *Address) (uint64, bool) {
if feeCurrency == nil {
return 0, true
Expand Down
4 changes: 2 additions & 2 deletions contracts/fee_currencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func GetRegisteredCurrencies(caller *abigen.FeeCurrencyDirectoryCaller) ([]commo
return currencies, nil
}

// GetExchangeRates returns the exchange rates for the provided gas currencies from CELO
// GetExchangeRates returns the exchange rates for the provided gas currencies
func GetExchangeRates(caller bind.ContractCaller) (common.ExchangeRates, error) {
exchangeRates := map[common.Address]*big.Rat{}
directory, err := abigen.NewFeeCurrencyDirectoryCaller(addresses.FeeCurrencyDirectoryAddress, caller)
Expand All @@ -150,7 +150,7 @@ func GetExchangeRates(caller bind.ContractCaller) (common.ExchangeRates, error)
}
currencies, err := GetRegisteredCurrencies(directory)
if err != nil {
return map[common.Address]*big.Rat{}, err
return common.ExchangeRates{}, err
}
return getExchangeRatesForTokens(directory, currencies)
}
Expand Down
3 changes: 1 addition & 2 deletions core/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ func genValueTx(nbytes int) func(int, *BlockGen) {
return func(i int, gen *BlockGen) {
toaddr := common.Address{}
data := make([]byte, nbytes)
var feeIntrinsic common.IntrinsicGasCosts
gas, _ := IntrinsicGas(data, nil, false, false, false, false, nil, feeIntrinsic)
gas, _ := IntrinsicGas(data, nil, false, false, false, false, nil, common.IntrinsicGasCosts{})
signer := gen.Signer()
gasPrice := big.NewInt(0)
if gen.header.BaseFee != nil {
Expand Down
3 changes: 1 addition & 2 deletions tests/transaction_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ func (tt *TransactionTest) Run(config *params.ChainConfig) error {
return nil, nil, err
}
// Intrinsic gas
var feeIntrinsic common.IntrinsicGasCosts
requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil, isHomestead, isIstanbul, false, nil, feeIntrinsic)
requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil, isHomestead, isIstanbul, false, nil, common.IntrinsicGasCosts{})
if err != nil {
return nil, nil, err
}
Expand Down

0 comments on commit 410be53

Please sign in to comment.