Skip to content

Commit

Permalink
remove unnecessary & uninitialized DataGasLimit from Message
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-bayardo committed May 31, 2023
1 parent ac64c44 commit 853c366
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ type Message struct {
Nonce uint64
Value *big.Int
GasLimit uint64
DataGasLimit uint64
GasPrice *big.Int
GasFeeCap *big.Int
GasTipCap *big.Int
Expand Down
8 changes: 4 additions & 4 deletions eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config
vmenv = vm.NewEVM(vmctx, txContext, statedb, chainConfig, vm.Config{})
)
statedb.SetTxContext(tx.Hash(), i)
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit).AddDataGas(msg.DataGasLimit)); err != nil {
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit).AddDataGas(params.MaxDataGasPerBlock)); err != nil {
log.Warn("Tracing intermediate roots did not complete", "txindex", i, "txhash", tx.Hash(), "err", err)
// We intentionally don't return the error here: if we do, then the RPC server will not
// return the roots. Most likely, the caller already knows that a certain transaction fails to
Expand Down Expand Up @@ -717,7 +717,7 @@ txloop:
msg, _ := core.TransactionToMessage(tx, signer, block.BaseFee())
statedb.SetTxContext(tx.Hash(), i)
vmenv := vm.NewEVM(blockCtx, core.NewEVMTxContext(msg), statedb, api.backend.ChainConfig(), vm.Config{})
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit).AddDataGas(msg.DataGasLimit)); err != nil {
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit).AddDataGas(params.MaxDataGasPerBlock)); err != nil {
failed = err
break txloop
}
Expand Down Expand Up @@ -829,7 +829,7 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
// Execute the transaction and flush any traces to disk
vmenv := vm.NewEVM(vmctx, txContext, statedb, chainConfig, vmConf)
statedb.SetTxContext(tx.Hash(), i)
_, err = core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit).AddDataGas(msg.DataGasLimit))
_, err = core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit).AddDataGas(params.MaxDataGasPerBlock))
if writer != nil {
writer.Flush()
}
Expand Down Expand Up @@ -1010,7 +1010,7 @@ func (api *API) traceTx(ctx context.Context, message *core.Message, txctx *Conte

// Call Prepare to clear out the statedb access list
statedb.SetTxContext(txctx.TxHash, txctx.TxIndex)
if _, err = core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.GasLimit).AddDataGas(message.DataGasLimit)); err != nil {
if _, err = core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.GasLimit).AddDataGas(params.MaxDataGasPerBlock)); err != nil {
return nil, fmt.Errorf("tracing failed: %w", err)
}
return tracer.GetResult()
Expand Down

0 comments on commit 853c366

Please sign in to comment.