mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
t9n: refactor instrinsic and floordatagas checks
This commit is contained in:
parent
965f2bf785
commit
3ff6bad7dd
1 changed files with 19 additions and 18 deletions
|
|
@ -133,30 +133,31 @@ func Transaction(ctx *cli.Context) error {
|
||||||
r.Address = sender
|
r.Address = sender
|
||||||
}
|
}
|
||||||
// Check intrinsic gas
|
// Check intrinsic gas
|
||||||
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil,
|
rules := chainConfig.Rules(common.Big0, true, 0)
|
||||||
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int), 0)); err != nil {
|
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
|
r.Error = err
|
||||||
results = append(results, r)
|
results = append(results, r)
|
||||||
continue
|
continue
|
||||||
} else {
|
}
|
||||||
r.IntrinsicGas = gas
|
r.IntrinsicGas = gas
|
||||||
if tx.Gas() < gas {
|
if tx.Gas() < gas {
|
||||||
r.Error = fmt.Errorf("%w: have %d, want %d", core.ErrIntrinsicGas, 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)
|
results = append(results, r)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if chainConfig.IsPrague(new(big.Int), 0) {
|
if tx.Gas() < floorDataGas {
|
||||||
if floorDataGas, err := core.FloorDataGas(tx.Data()); err != nil {
|
r.Error = fmt.Errorf("%w: have %d, want %d", core.ErrFloorDataGas, tx.Gas(), floorDataGas)
|
||||||
r.Error = err
|
results = append(results, r)
|
||||||
results = append(results, r)
|
continue
|
||||||
continue
|
|
||||||
} else {
|
|
||||||
if tx.Gas() < floorDataGas {
|
|
||||||
r.Error = fmt.Errorf("%w: have %d, want %d", core.ErrFloorDataGas, tx.Gas(), floorDataGas)
|
|
||||||
results = append(results, r)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Validate <256bit fields
|
// Validate <256bit fields
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue