Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replay run mode #2331

Merged
merged 6 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading