Skip to content

fix(fees): price receipt floor with wrapper and terminal reserve - #223

Merged
ci-core-e2e-runner[bot] merged 1 commit into
v2-devfrom
fix/receipt-fee-floor-v2
Sep 28, 2026
Merged

ci-core-e2e-runner[bot] merged 1 commit into
v2-devfrom
fix/receipt-fee-floor-v2

Conversation

@MuncleUscles

@MuncleUscles MuncleUscles commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Delivery context

Depends-On: genlayerlabs/genlayer-consensus#1692

This follows the SDK fee quote work in #214. The related qualification is genlayer-e2e #796. The paired Studio admission-floor correction is genlayer-studio #1783; these changes are qualified together through #796.

Problem and outcome

The deployed-chain fee policy fallback used a fixed 512-byte receipt when messageFeeParamsBudgetFloor() underquoted under eth_call. Consensus #1692 reserves the configured receipt wrapper plus 64 bytes of terminal output. On Nitro, a plain eth_call with zero tx.gasprice can also make both the floor view and receipt-gas view revert with InvalidRollupGasPrice. A zero chain-derived quote can incorrectly hide receipt pricing when other fees are zero.

The SDK now reads receiptWrapperBytes and useChainDerivedReceiptPrice, then calls FeeManager's gas estimate for receiptWrapperBytes + 64 with the effective receipt gas price set in the eth_call context. This respects live governance and Nitro tariff parameters without relying on a zero-price floor view. When Studio does not expose messageFeeParamsBudgetFloor, the SDK computes the same wrapper-plus-reserve floor from Studio's policy. An exposed Studio floor remains authoritative.

Implementation and validation

  • Added FeeManager selectors for the wrapper, pricing mode, and receipt-gas estimate; encoded/decoded a priced, unbatched eth_call for the gas estimate.
  • Reused one local receipt-floor formula for the Studio missing-floor path.
  • Added regressions for the default and configured wrapper, Nitro's zero-price failure path, zero chain-derived quote with a positive network price, FeeManager gas-model changes, and Studio's explicit-floor precedence.
  • npm test -- --run: 202 tests passed, no type errors.
  • npm run build: ESM, CJS, and declarations passed.
  • Changed-file ESLint and git diff --check: passed.

Risk and rollback

The deployed policy quote adds a priced FeeManager eth_call when receipt pricing is enabled. It requires the RPC to honor the transaction gasPrice field; viem's publicClient.call forwards that field. The required selectors are present in the v0.6 FeeManager. Reverting this commit restores the prior fallback behavior.

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR
  • I have set a descriptive PR title compliant with conventional commits

Reviewing tips

Review readCurrentFeePolicy and extractStudioFeePolicy in src/contracts/actions.ts, then the fee policy cases in tests/contracts-actions.test.ts.

User facing release notes

Fee estimates near the minimum execution budget now account for the configured receipt wrapper and Consensus terminal-output reserve.

@MuncleUscles MuncleUscles self-assigned this Sep 28, 2026
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 11fefcc1-e8fe-4da5-af6c-3d2c4de0e680

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Read FeeManager receiptWrapperBytes and quote propose-receipt gas with the effective gasPrice. Plain eth_call can expose tx.gasprice=0, which makes the Nitro rollup gas model revert. Avoid the zero-price messageFeeParamsBudgetFloor view and use the configured receipt wrapper plus Consensus #1692 terminal reserve. Recognize chain-derived pricing even when its plain-call quote is zero.

Mirror the same floor in Studio when its RPC omits the authoritative value. Validation: 202 Vitest tests and typecheck, production build, changed-file ESLint, and diff whitespace check.
@MuncleUscles
MuncleUscles force-pushed the fix/receipt-fee-floor-v2 branch from ac5ee56 to 9a231ae Compare September 28, 2026 10:01
@kirilaa
kirilaa self-requested a review September 28, 2026 16:17
@ci-core-e2e-runner
ci-core-e2e-runner Bot merged commit 4dabdf2 into v2-dev Sep 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants