Skip to content

Commit

Permalink
Merge pull request #2331 from OffchainLabs/replay_run_mode
Browse files Browse the repository at this point in the history
Replay run mode
  • Loading branch information
tsahee authored May 31, 2024
2 parents 4b303e0 + e6f39da commit 7928b81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions arbos/tx_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (p *TxProcessor) StartTxHook() (endTxNow bool, gasUsed uint64, err error, r
effectiveBaseFee := evm.Context.BaseFee
usergas := p.msg.GasLimit

if p.msg.TxRunMode != core.MessageCommitMode && p.msg.GasFeeCap.BitLen() == 0 {
if !p.msg.TxRunMode.ExecutedOnChain() && p.msg.GasFeeCap.BitLen() == 0 {
// In gas estimation or eth_call mode, we permit a zero gas fee cap.
// This matches behavior with normal tx gas estimation and eth_call.
effectiveBaseFee = common.Big0
Expand Down Expand Up @@ -436,13 +436,13 @@ func (p *TxProcessor) GasChargingHook(gasRemaining *uint64) (common.Address, err
basefee := p.evm.Context.BaseFee

var poster common.Address
if p.msg.TxRunMode != core.MessageCommitMode {
if !p.msg.TxRunMode.ExecutedOnChain() {
poster = l1pricing.BatchPosterAddress
} else {
poster = p.evm.Context.Coinbase
}

if p.msg.TxRunMode == core.MessageCommitMode {
if p.msg.TxRunMode.ExecutedOnChain() {
p.msg.SkipL1Charging = false
}
if basefee.Sign() > 0 && !p.msg.SkipL1Charging {
Expand Down Expand Up @@ -509,7 +509,7 @@ func (p *TxProcessor) EndTxHook(gasLeft uint64, success bool) {
if underlyingTx != nil && underlyingTx.Type() == types.ArbitrumRetryTxType {
inner, _ := underlyingTx.GetInner().(*types.ArbitrumRetryTx)
effectiveBaseFee := inner.GasFeeCap
if p.msg.TxRunMode == core.MessageCommitMode && !arbmath.BigEquals(effectiveBaseFee, p.evm.Context.BaseFee) {
if p.msg.TxRunMode.ExecutedOnChain() && !arbmath.BigEquals(effectiveBaseFee, p.evm.Context.BaseFee) {
log.Error(
"ArbitrumRetryTx GasFeeCap doesn't match basefee in commit mode",
"txHash", underlyingTx.Hash(),
Expand Down Expand Up @@ -659,7 +659,7 @@ func (p *TxProcessor) ScheduledTxes() types.Transactions {
effectiveBaseFee := p.evm.Context.BaseFee
chainID := p.evm.ChainConfig().ChainID

if p.msg.TxRunMode != core.MessageCommitMode && p.msg.GasFeeCap.BitLen() == 0 {
if !p.msg.TxRunMode.ExecutedOnChain() && p.msg.GasFeeCap.BitLen() == 0 {
// In gas estimation or eth_call mode, we permit a zero gas fee cap.
// This matches behavior with normal tx gas estimation and eth_call.
effectiveBaseFee = common.Big0
Expand Down Expand Up @@ -739,7 +739,7 @@ func (p *TxProcessor) GetPaidGasPrice() *big.Int {
version := p.state.ArbOSVersion()
if version != 9 {
gasPrice = p.evm.Context.BaseFee
if p.msg.TxRunMode != core.MessageCommitMode && p.msg.GasFeeCap.Sign() == 0 {
if !p.msg.TxRunMode.ExecutedOnChain() && p.msg.GasFeeCap.Sign() == 0 {
gasPrice = common.Big0
}
}
Expand Down
3 changes: 1 addition & 2 deletions execution/nodeInterface/NodeInterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,11 @@ func (n NodeInterface) EstimateRetryableTicket(
}

// ArbitrumSubmitRetryableTx is unsigned so the following won't panic
msg, err := core.TransactionToMessage(types.NewTx(submitTx), types.NewArbitrumSigner(nil), nil)
msg, err := core.TransactionToMessage(types.NewTx(submitTx), types.NewArbitrumSigner(nil), nil, core.MessageGasEstimationMode)
if err != nil {
return err
}

msg.TxRunMode = core.MessageGasEstimationMode
*n.returnMessage.message = *msg
*n.returnMessage.changed = true
return nil
Expand Down

0 comments on commit 7928b81

Please sign in to comment.