Skip to content

Commit

Permalink
Merge pull request #1980 from OffchainLabs/retryable-gas-usage-fix
Browse files Browse the repository at this point in the history
Fix retryable scheduling gas usage
  • Loading branch information
PlasmaPower authored Nov 27, 2023
2 parents a1cd46c + 25bcb40 commit b7e0981
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arbos/arbostypes/incomingmessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const (

const MaxL2MessageSize = 256 * 1024

const ArbosVersion_FixRedeemGas = uint64(11)

type L1IncomingMessageHeader struct {
Kind uint8 `json:"kind"`
Poster common.Address `json:"sender"`
Expand Down
13 changes: 13 additions & 0 deletions arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,19 @@ func ProduceBlockAdvanced(
}
txGasUsed := header.GasUsed - preTxHeaderGasUsed

arbosVer := types.DeserializeHeaderExtraInformation(header).ArbOSFormatVersion
if arbosVer >= arbostypes.ArbosVersion_FixRedeemGas {
// subtract gas burned for future use
for _, scheduledTx := range result.ScheduledTxes {
switch inner := scheduledTx.GetInner().(type) {
case *types.ArbitrumRetryTx:
txGasUsed = arbmath.SaturatingUSub(txGasUsed, inner.Gas)
default:
log.Warn("Unexpected type of scheduled tx", "type", scheduledTx.Type())
}
}
}

// Update expectedTotalBalanceDelta (also done in logs loop)
switch txInner := tx.GetInner().(type) {
case *types.ArbitrumDepositTx:
Expand Down

0 comments on commit b7e0981

Please sign in to comment.