Skip to content

Commit

Permalink
Merge pull request #237 from OffchainLabs/fix-scheduled-evm-msg
Browse files Browse the repository at this point in the history
Fix EVM for gas estimation for scheduled messages
  • Loading branch information
PlasmaPower authored Jun 22, 2023
2 parents afeb784 + 9766a42 commit f7609ee
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,11 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash
// Arbitrum: a tx can schedule another (see retryables)
scheduled := result.ScheduledTxes
for runMode == core.MessageGasEstimationMode && len(scheduled) > 0 {
// This will panic if the scheduled tx is signed, but we only schedule unsigned ones
msg, err := core.TransactionToMessage(scheduled[0], types.NewArbitrumSigner(nil), header.BaseFee)
if err != nil {
return nil, err
}
// make a new EVM for the scheduled Tx (an EVM must never be reused)
evm, vmError, err := b.GetEVM(ctx, msg, state, header, &vm.Config{NoBaseFee: true})
if err != nil {
Expand All @@ -1037,11 +1042,6 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash
evm.Cancel()
}()

// This will panic if the scheduled tx is signed, but we only schedule unsigned ones
msg, err := core.TransactionToMessage(scheduled[0], types.NewArbitrumSigner(nil), header.BaseFee)
if err != nil {
return nil, err
}
scheduledTxResult, err := core.ApplyMessage(evm, msg, gp)
if err != nil {
return nil, err // Bail out
Expand Down

0 comments on commit f7609ee

Please sign in to comment.