Skip to content

Commit

Permalink
t9n: refactor instrinsic and floordatagas checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lightclient committed Jan 29, 2025
1 parent 4ea656a commit d088b4e
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions cmd/evm/internal/t8ntool/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,35 @@ func Transaction(ctx *cli.Context) error {
r.Address = sender
}
// Check intrinsic gas
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil,
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int), 0)); err != nil {
rules := chainConfig.Rules(common.Big0, true, 0)
gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai)
if err != nil {
r.Error = err
results = append(results, r)
continue
} else {
r.IntrinsicGas = gas
if tx.Gas() < gas {
r.Error = fmt.Errorf("%w: have %d, want %d", core.ErrIntrinsicGas, tx.Gas(), gas)
}
r.IntrinsicGas = gas
if tx.Gas() < gas {
r.Error = fmt.Errorf("%w: have %d, want %d", core.ErrIntrinsicGas, tx.Gas(), gas)
results = append(results, r)
continue
}
// For Prague txs, validate the floor data gas.
if rules.IsPrague {
floorDataGas, err := core.FloorDataGas(tx.Data())
if err != nil {
r.Error = err
results = append(results, r)
continue
}
<<<<<<< Updated upstream

Check failure on line 157 in cmd/evm/internal/t8ntool/transaction.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected <<, expected }

Check failure on line 157 in cmd/evm/internal/t8ntool/transaction.go

View workflow job for this annotation

GitHub Actions / Lint

expected statement, found '<<' (typecheck)

Check failure on line 157 in cmd/evm/internal/t8ntool/transaction.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected <<, expected }
=======

Check failure on line 158 in cmd/evm/internal/t8ntool/transaction.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected ==, expected }

Check failure on line 158 in cmd/evm/internal/t8ntool/transaction.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected ==, expected }
if tx.Gas() < floorDataGas {
r.Error = fmt.Errorf("%w: have %d, want %d", core.ErrFloorDataGas, tx.Gas(), floorDataGas)
results = append(results, r)
continue
}
>>>>>>> Stashed changes

Check failure on line 164 in cmd/evm/internal/t8ntool/transaction.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected >>, expected } (typecheck)

Check failure on line 164 in cmd/evm/internal/t8ntool/transaction.go

View workflow job for this annotation

GitHub Actions / Lint

expected statement, found '>>' (typecheck)

Check failure on line 164 in cmd/evm/internal/t8ntool/transaction.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected >>, expected }) (typecheck)
}
// Validate <256bit fields
switch {
Expand Down

0 comments on commit d088b4e

Please sign in to comment.