Skip to content

Commit

Permalink
Merge pull request #2152 from OffchainLabs/retryable-gas-estimation
Browse files Browse the repository at this point in the history
Test retryable gas estimation isn't too high
  • Loading branch information
PlasmaPower committed Feb 16, 2024
2 parents c55968f + 4a73e7e commit a20a1c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go-ethereum
11 changes: 10 additions & 1 deletion system_tests/retryable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ func TestSubmitRetryableImmediateSuccess(t *testing.T) {
)
Require(t, err, "failed to estimate retryable submission")
estimate := tx.Gas()
colors.PrintBlue("estimate: ", estimate)
expectedEstimate := params.TxGas + params.TxDataNonZeroGasEIP2028*4
if estimate != expectedEstimate {
t.Errorf("estimated retryable ticket at %v gas but expected %v", estimate, expectedEstimate)
}

// submit & auto redeem the retryable using the gas estimate
usertxoptsL1 := builder.L1Info.GetDefaultTransactOpts("Faucet", ctx)
Expand Down Expand Up @@ -336,6 +339,12 @@ func TestSubmitRetryableFailThenRetry(t *testing.T) {
receipt, err = builder.L2.EnsureTxSucceeded(tx)
Require(t, err)

redemptionL2Gas := receipt.GasUsed - receipt.GasUsedForL1
var maxRedemptionL2Gas uint64 = 1_000_000
if redemptionL2Gas > maxRedemptionL2Gas {
t.Errorf("manual retryable redemption used %v gas, more than expected max %v gas", redemptionL2Gas, maxRedemptionL2Gas)
}

retryTxId := receipt.Logs[0].Topics[2]

// check the receipt for the retry
Expand Down

0 comments on commit a20a1c7

Please sign in to comment.