Skip to content

Commit

Permalink
Add empty fee-currency context to tools and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ezdac committed Jul 31, 2024
1 parent d2b9c93 commit 36ce29a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion cmd/evm/internal/t8ntool/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,14 @@ func Transaction(ctx *cli.Context) error {
r.Address = sender
}
// Check intrinsic gas
// NOTE: we can't provide specific intrinsic gas costs
// for fee-currencies here, since those are written to the
// FeeCurrencyDirectory contract and are chain-specific.
// When a Celo transaction with specified fee-currency is validated with this tool,
// this will thus result in a ErrNonWhitelistedFeeCurrency error for now.
var feeIntrinsic common.IntrinsicGasCosts
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil,
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int), 0), tx.FeeCurrency()); err != nil {
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int), 0), tx.FeeCurrency(), feeIntrinsic); err != nil {
r.Error = err
results = append(results, r)
continue
Expand Down
3 changes: 2 additions & 1 deletion core/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ func genValueTx(nbytes int) func(int, *BlockGen) {
return func(i int, gen *BlockGen) {
toaddr := common.Address{}
data := make([]byte, nbytes)
gas, _ := IntrinsicGas(data, nil, false, false, false, false, nil)
var feeIntrinsic common.IntrinsicGasCosts
gas, _ := IntrinsicGas(data, nil, false, false, false, false, nil, feeIntrinsic)
signer := gen.Signer()
gasPrice := big.NewInt(0)
if gen.header.BaseFee != nil {
Expand Down
3 changes: 2 additions & 1 deletion tests/transaction_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ func (tt *TransactionTest) Run(config *params.ChainConfig) error {
return nil, nil, err
}
// Intrinsic gas
requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil, isHomestead, isIstanbul, false, nil)
var feeIntrinsic common.IntrinsicGasCosts
requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil, isHomestead, isIstanbul, false, nil, feeIntrinsic)
if err != nil {
return nil, nil, err
}
Expand Down

0 comments on commit 36ce29a

Please sign in to comment.