Skip to content

fix(fees): add exact quote and decision parity - #214

Merged
MuncleUscles merged 8 commits into
v2-devfrom
fix/v06-fee-appeal-parity
Sep 2, 2026
Merged

fix(fees): add exact quote and decision parity#214
MuncleUscles merged 8 commits into
v2-devfrom
fix/v06-fee-appeal-parity

Conversation

@MuncleUscles

@MuncleUscles MuncleUscles commented Aug 31, 2026

Copy link
Copy Markdown
Member

Delivery context

Depends-On: genlayerlabs/genlayer-consensus#1526

Base #212 is merged; this PR is restacked directly on v2-dev at d7d32627e036cf57600558a099bb589ccc5c8d2a.
Cross-stack qualification is carried by genlayerlabs/genlayer-e2e#756 against genlayerlabs/genlayer-studio#1748.

Problem and outcome

Build the exact fee-quote and Studio decision-binding layer on the already-landed resolution-kernel SDK surface.

This layer mirrors Consensus deposit quoting, binds Studio lifecycle actions to the active decision, encodes the complete internal-message fee tuple, and treats Studio writes/lifecycle calls as mined EVM envelopes. It now waits for the receipt on every backend and surfaces Studio's additive revert reason instead of returning rejected writes or top-ups as successful submissions. Ordinary top-ups use the schedule-free Consensus delta shape (appealRounds: 0, rotations: []), while an explicit complete schedule remains available only for first-time fee initialization. Studio receipt lookup also receives a bounded 60-second indexing window beyond viem's insufficient default retry budget. Triggered-child discovery now follows the parent decision receipt and accepts InternalMessageProcessed from the actual MessagePayments emitter instead of incorrectly requiring ConsensusMain.

The public appealTransaction path now uses topUpAndSubmitAppeal with the active decision and normalized compatibility tuple. That entry point is valid for both pre-funded and unfunded appeal rounds; direct submitAppeal remains an explicit low-level conformance surface. This closes the AppealRoundNotPermitted failure exposed by diagnostic E2E run 33631876345 when the authoritative quote contained bond plus induced-work funding but the next appeal round was not pre-funded.

Implementation and validation

  • Eight commits on v2-dev: exact deposit quoting, decision-bound Studio lifecycle actions, the complete eight-field Consensus internal-message fee tuple including all price caps, mined-envelope failure handling, schedule-free ordinary top-ups, cross-contract child-message event discovery, configured contract routing, and safe public appeal admission.
  • Full Vitest/typecheck suite: 185 tests passed with no type errors.
  • Type declarations and CJS/ESM builds pass.
  • ESLint on the changed implementation and regression tests passes.
  • Regression coverage proves the schedule-extending selector, active decision, normalized tuple, authoritative quoted value, and caller-provided value on deployed Consensus and Studio.
  • Current head: 2f8122e81862bd5f6cf0daabcfa34b99a1bb0600 (synthetic merge df9e835665e3553d20fc870cd6e3ed9f31760c99).
  • Stack-relative diff and working tree checks are clean.

Risk and rollback

This layer belongs to the fee/Studio parity train with Consensus #1526. The receipt wait is intentionally stricter: a mined status-0 envelope is an error on Studio just as it is on deployed Consensus. Older Studio versions without additive revertReason remain compatible and produce a generic revert error. The public appeal action intentionally uses the schedule-extending entry point even for pre-funded rounds because Consensus treats it as a no-op extension in that case. Rollback is this fee layer; #212 is already landed.

@coderabbitai

coderabbitai Bot commented Aug 31, 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: Team

Run ID: da4625cc-868c-4603-830f-85368c4b682a

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.

Use Studio's lifecycle and appeal-charge RPCs to bind appeal, combined top-up/appeal, and finalization to the active decision. Keep Studio ABI exports aligned with the v0.6 consensus surface and cover quoting and guarded selectors.
@MuncleUscles
MuncleUscles force-pushed the fix/v06-fee-appeal-parity branch from c878429 to b9a7bb2 Compare August 31, 2026 22:40
@MuncleUscles
MuncleUscles changed the base branch from fix/consensus-train-surface to v2-dev August 31, 2026 22:40
Verify that canAppeal reads the active decision from the separately configured Appeals contract at the lifecycle snapshot. This catches local-chain interface drift before cross-stack E2E.
Route the public appeal action through topUpAndSubmitAppeal, whose consensus-derived schedule extension is valid for both pre-funded and unfunded rounds. Keep the direct submitAppeal selector out of the high-level path so a full bond-plus-funding quote cannot still fail AppealRoundNotPermitted.\n\nCover quoted and caller-provided values on deployed Consensus and Studio, and refresh generated API docs.
@MuncleUscles
MuncleUscles merged commit b79622d into v2-dev Sep 2, 2026
11 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.

1 participant