fix(fees): align Studio with Consensus v0.6 economics - #1748
Open
MuncleUscles wants to merge 17 commits into
Open
fix(fees): align Studio with Consensus v0.6 economics#1748MuncleUscles wants to merge 17 commits into
MuncleUscles wants to merge 17 commits into
Conversation
Mirror cap-priced round quotes, configured ladder semantics, appeal profit reserves, exact 2.5x rewards, typed appeal funding, immutable top-up schedules, live appeal overlay pricing, latest appeal ABIs, decision guards, and surplus refunds. Expose the canonical quote over RPC so cross-stack tests no longer maintain a second Studio formula.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
This was referenced Aug 28, 2026
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.
Delivery context
Targets Studio
v0.123-devand the Consensus v0.6 release train.Depends-On: genlayerlabs/genlayer-consensus#1381
Depends-On: genlayerlabs/genlayer-js#212
Depends-On: genlayerlabs/genlayer-py#109
Cross-stack qualification: genlayerlabs/genlayer-e2e#756
Independent fee oracle: genlayerlabs/genlayer-fee-distribution-simulator#29 and #30
Consensus is authoritative for runtime behavior. The simulator is an independent economics oracle; TLA+ supplies input-domain and appeal-selection invariants.
Outcome
Studio now follows the v0.6 implementation across fee quoting, execution accounting, settlement, and decision-bound lifecycle behavior:
useBalance, allocated-message limits, cancellation, top-ups, overpayment refunds, penalties, vindication, and dust conservation;Selection-authority corrections
The second review wave found a deeper source-of-authority mismatch around jury identity, not just jury count:
This preserves Consensus-style transaction authority while still allowing validator removal to reduce live capacity.
Concurrency, atomicity, and failure-recovery corrections
The cross-check also found production-significant races and asynchronous failure modes that formula-only tests could not detect:
Fee-accounting mutations now lock and re-read the latest transaction state, debit/refund and accounting changes share one transaction, cancellation/settlement are single-spend, and appeal admission revalidates lifecycle and time under the row lock.
Studio forms and executes an admitted appeal asynchronously, unlike Consensus's atomic call. It now captures the exact decision-bound admission state and restores it after worker/process failure instead of resetting or canceling the transaction. That snapshot remains through a successful validator appeal's terminal recomputation and is cleared only after a real outcome, abort, cancellation, or settlement. A committee-formation or contract-not-found failure that produces no appeal outcome unwinds the admission and returns the exact bond plus typed funding. Recovery and refunds are row-locked and concurrency-tested. The Studio helper bridge now makes each parent/phase/payload emission one-shot, recovers the original child IDs on retry, and derives collision-free child IDs from the recipient issuance index; distinct appealed decisions remain independently emit-able. Finalized history now reads that same issuance ledger, and nonzero internal-message recipients must already be registered ghosts just as they must be in Consensus. Message value reservations now share the parent accounting row lock and persist their exact backed/unbacked outcome by Consensus-compatible occurrence ID, so worker retries neither charge twice nor change the emitted payload. Missing or incomplete helper receipts are fatal to the phase, never converted into locally generated child IDs; retries recover the helper's durable IDs and idempotently finish partial local insertion. Acceptance delivery is independently claimable before the appeal deadline, cannot be overtaken by finalization, cannot exhaust into cancellation, and blocks quote, appeal, finalization, and UI actions until acknowledged. A successful repair republishes the accepted status so clients refresh. Address identity comparisons are checksum-case-insensitive, matching Solidity address semantics.
Validation
Hosted two-stack execution is intentionally not claimed here; #756 contains the shared Studio/Consensus feature and must run against the exact dependency cut below.
Exact review cut
0bd2b9dad98e614c039fa256ddc64e402ff63004b51c8fd67b890a72c35db78a360147c7b8edb77058115643f733eedfa331f1b78243f4b37348270409fa7790f44a7d809eb9b429d8ca900e1b876c3895d513a8e64157a51e90c977bd9a63bda40badb6f39770cd93634e5ba0ad118f16c36e3c633e8a823f61b9d64f2f20fab0a99d7a7b3eef389d7d64693e263455d8262ccb55d621920b1a96c96554123aRelease gate
Studio must consume a published JS SDK containing #212. Released
genlayer-js@1.1.8still uses the legacy unbound appeal selector/zero fallback, so publishing Studio before the corrected SDK would reintroduce the mismatch even though this branch is correct.