Skip to content

docs: add protocol randomness, tribunals, and error reference pages#436

Open
MuncleUscles wants to merge 1 commit into
mainfrom
docs/protocol-concepts
Open

docs: add protocol randomness, tribunals, and error reference pages#436
MuncleUscles wants to merge 1 commit into
mainfrom
docs/protocol-concepts

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

Description

Adds three protocol/reference documentation pages, sourced from the genlayer-consensus v0.6-dev contracts and spec, and wires them into navigation with cross-links.

New pages

  • Protocol Randomness (concept) — understand-genlayer-protocol/core-concepts/optimistic-democracy/protocol-randomness
    Explains how validator and leader selection randomness works: a seed advanced by an ECDSA signature over the current seed and hashed with keccak256 (a seed chain), maintained per recipient; stake-weighted committee selection; per-round freshness; replay-resistance; and the acknowledged grinding and initial-seed limitations. Described strictly as signature-derived pseudo-randomness — not a verifiable random function — consistent with the implementation and GAP-012.

  • Deterministic Violations & Tribunals (concept) — understand-genlayer-protocol/core-concepts/optimistic-democracy/deterministic-violations-and-tribunals
    Defines a deterministic violation (a validator's result hash disagreeing with the committee majority), distinguishes it from idleness (liveness vs. safety, handled on separate paths), walks the automatic tribunal adjudication (commit-reveal by a broader validator set), and covers consequences: slashing (leader vs. validator rates, with a delay measured in epochs) that is implemented today, and the permanent-ban outcome that is the ADR-025 design target but is noted as not yet wired into the tribunal path on this branch.

  • Error & Revert Reference (developer reference) — developers/error-reference
    A catalog of 280 custom protocol errors, each with its 4-byte selector, a one-line meaning, and a common cause/fix, grouped by area (Fees, Staking, Consensus, Governance, Access, Other). Includes guidance on decoding a raw selector and common encoding pitfalls (e.g. write-transaction calldata must be rlp.encode([calldata, leader_only]); sending raw calldata surfaces as RLP string ends with superfluous bytes).

How the error table was generated

Error signatures were read from the consensus repo's canonical scripts/utils/errorSelectors.ts (v0.6-dev). Each 4-byte selector was computed as the first four bytes of keccak256(type-only-signature) — the same method the repo's own generator uses. The set was validated against the known anchor FeeValueMustBeNonZero(uint256) = 0x632be5a1, checked for selector collisions (none), and the 11 argument-bearing signatures were independently cross-checked to confirm they were hashed from type-only signatures (not parameter-named ones).

Navigation & cross-links

  • Added protocol-randomness and deterministic-violations-and-tribunals to the Optimistic Democracy _meta.json.
  • Added error-reference to the Developers _meta.json.
  • Cross-linked the tribunals page to/from appeal-process and slashing, and linked the error reference from staking-guide.

Validation

  • node scripts/list-docs-routes.js — all three new routes resolve; full run clean (155 routes).
  • node scripts/generate-full-docs.js — runs clean (210 pages); the new pages and the 0x632be5a1 anchor appear in the generated bundle.

Content sourced from the contracts/spec; where the implementation and spec diverge (tribunal majority denominator, permanent-ban wiring, configurable strike threshold), the pages describe the behavior qualitatively and flag the design-vs-code gap rather than asserting unverified specifics.

Add three protocol/reference docs pages sourced from genlayer-consensus
v0.6-dev:

- Protocol Randomness (concept): how the seed-chained, ECDSA-signature +
  keccak256 randomness mechanism drives stake-weighted validator/leader
  selection, per-recipient seed rotation, replay-resistance, and the
  acknowledged grinding / initial-seed limitations.
- Deterministic Violations & Tribunals (concept): hash-mismatch detection
  of provably-wrong deterministic results, the liveness (idleness) vs
  safety (violation) split, the automatic tribunal adjudication, and the
  slashing (5% leader / 1% validator, 2-epoch delay) plus the ADR-025
  designed permanent-ban outcome.
- Error & Revert Reference (developer reference): the 280 custom errors
  from the consensus ABI, each with its keccak256 4-byte selector, a
  one-line meaning and cause/fix, grouped by area, plus common encoding
  pitfalls (RLP-wrapped write calldata).

Wire all three into their _meta.json files and cross-link from the
appeal-process, slashing, and staking-guide pages.
@netlify

netlify Bot commented Jul 3, 2026

Copy link
Copy Markdown

Deploy Preview for genlayer-docs ready!

Name Link
🔨 Latest commit 2536d2f
🔍 Latest deploy log https://app.netlify.com/projects/genlayer-docs/deploys/6a47967790783c0007943a07
😎 Deploy Preview https://deploy-preview-436--genlayer-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@MuncleUscles, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d8c78c8-8fb6-4f3d-b712-241fcf9994a4

📥 Commits

Reviewing files that changed from the base of the PR and between 19558ee and 2536d2f.

📒 Files selected for processing (8)
  • pages/developers/_meta.json
  • pages/developers/error-reference.mdx
  • pages/developers/staking-guide.mdx
  • pages/understand-genlayer-protocol/core-concepts/optimistic-democracy/_meta.json
  • pages/understand-genlayer-protocol/core-concepts/optimistic-democracy/appeal-process.mdx
  • pages/understand-genlayer-protocol/core-concepts/optimistic-democracy/deterministic-violations-and-tribunals.mdx
  • pages/understand-genlayer-protocol/core-concepts/optimistic-democracy/protocol-randomness.mdx
  • pages/understand-genlayer-protocol/core-concepts/optimistic-democracy/slashing.mdx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/protocol-concepts

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.

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