feat: add flexible retryable ticket encoding primitive - #649
Open
gomesalexandre wants to merge 1 commit into
Open
feat: add flexible retryable ticket encoding primitive#649gomesalexandre wants to merge 1 commit into
gomesalexandre wants to merge 1 commit into
Conversation
Adds `ParentToChildMessageCreator.encodeRetryableTicket`, a static
primitive that encodes the Inbox `createRetryableTicket` calldata and
computes the fee math without estimating gas against the child chain.
Gas params (`gasLimit`, `maxFeePerGas`) are supplied directly, so it can
be used before the child chain is running - for example transferring
ownership during an Orbit chain deployment, where gas params are
hardcoded.
- `maxSubmissionCost` is either supplied or read from the Inbox on the
parent chain via `calculateRetryableSubmissionFee`, then padded by
`submissionFeePercentIncrease` (default 300, matching the estimator) so
the baked-in cost survives a parent base-fee rise before inclusion -
the Inbox reverts with `InsufficientSubmissionCost` otherwise
- `deposit` is either supplied or derived as
`gasLimit * maxFeePerGas + maxSubmissionCost + l2CallValue`
- handles ETH vs ERC20 native token Inbox encoding
- returns `{ data, deposit, maxSubmissionCost }`; no transaction request
`getTicketCreationRequest` is refactored to use it after estimating gas,
passing the estimated `maxSubmissionCost` and `deposit` through so the
existing behavior (including deposit overrides) is unchanged.
closes OffchainLabs#639
gomesalexandre
force-pushed
the
feat_encode_retryable_ticket
branch
from
August 18, 2026 11:35
aa5a259 to
cd34d7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #639
what
Adds
ParentToChildMessageCreator.encodeRetryableTicket, a static primitive that encodes the InboxcreateRetryableTicketcalldata and computes the fee math without estimating gas against the child chain.gasLimitandmaxFeePerGasare passed directly, so it works before the child chain is running - the ownership-transfer-during-Orbit-deployment scenario from the issue, where gas params are hardcoded.maxSubmissionCostis supplied, or read from the Inbox viacalculateRetryableSubmissionFee(passparentProvider+inbox)depositis supplied, or derived asgasLimit * maxFeePerGas + maxSubmissionCost + l2CallValue{ data, deposit, maxSubmissionCost }, no transaction requestno behavior change to
getTicketCreationRequestIt is refactored to call
encodeRetryableTicketafter estimating gas, passing the estimatedmaxSubmissionCostanddepositthrough, so the calldata/value (including theoptions.deposit.baseoverride path) are byte-identical to before.the derived submission fee is padded
When
maxSubmissionCostis read from the Inbox it is padded bysubmissionFeePercentIncrease(defaultDEFAULT_SUBMISSION_FEE_PERCENT_INCREASE= 300, the same margin the gas estimator applies). The Inbox recomputes the submission fee againstblock.basefeeat inclusion and reverts the whole ticket-creation tx withInsufficientSubmissionCostif the baked-in value is too low. Callers wanting the raw value can passsubmissionFeePercentIncrease: 0.tests + verification
Added
packages/sdk/tests/unit/encodeRetryableTicket.test.ts(ETH + ERC20 encoding decoded against the real ABI, derived deposit, caller deposit override, throw-when-underspecified).test:unit(vitest) passes;tsc,eslint,prettier --checkclean.Runtime check (offline path): deposit
1001030000000000000(=300000*100000000 + 0.001e18 + 1e18), selector0x679b6ded.Rebased onto the v4 monorepo restructure +
L1ToL2->ParentToChildrename.