Skip to content

doc(examples): add drand VRF lottery walkthrough#41

Open
Troublor wants to merge 20 commits intomainfrom
william/doc/vrf-drand-example
Open

doc(examples): add drand VRF lottery walkthrough#41
Troublor wants to merge 20 commits intomainfrom
william/doc/vrf-drand-example

Conversation

@Troublor
Copy link
Copy Markdown
Collaborator

Summary

Adds a runnable developer example under docs/dev/examples/vrf-drand-lottery/ demonstrating publicly-verifiable onchain randomness via drand quicknet on MegaETH Testnet.

The example covers:

  • A minimal DrandLotteryDemo.sol contract (commit-reveal, single-slot) that consumes the stateless DrandVerifier oracle via verifyNormalized.
  • A step-by-step walkthrough: open → wait → fetch drand beacon → settle → verify winner.
  • Adversarial path coverage: early settlement and wrong-round signatures are rejected onchain.
  • Gas profile on MegaETH Testnet, with a note about MegaETH's dual-gas model understating local simulation (~50x) for contract creation, and guidance to use `eth_estimateGas` directly for deploys.
  • Deployed addresses on MegaETH Testnet (chain 6343):
    • DrandOracleQuicknet: `0x4e1673dcAA38136b5032F27ef93423162aF977Cc`
    • DrandLotteryDemo: `0x0Eed2baF5a317D8C20a20dc51E6a6BBb8390f4e5`

docs/SUMMARY.md gets a new "Examples" subsection under "Developer Docs".

Test plan

  • `mise run lint` passes (markdownlint, prettier, lychee).
  • New page appears in `docs/SUMMARY.md` and renders from the site root.
  • Every code block has a language tag; internal links use `.md` extensions.
  • The deployed contracts referenced in the walkthrough were verified end-to-end against a live drand beacon before writing.

This PR was generated by an automated agent.

@Troublor Troublor requested a review from nnsgmsone as a code owner April 21, 2026 08:44
Comment thread docs/dev/examples/vrf-drand-lottery/DrandLotteryDemo.sol Outdated
Comment thread docs/dev/examples/vrf-drand-lottery/README.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Good addition overall — the walkthrough is clear, the adversarial-path section is a nice touch, and the gas-profile callout about eth_estimateGas vs. local simulation is exactly what developers need.

Two issues flagged inline:

  1. CEI violation in settle() (DrandLotteryDemo.sol lines 65–69) — settled = true is set after the external oracle.verifyNormalized() call, which contradicts the security checklist's own advice. No actual exploit is possible here because the oracle is view-only, but a reference example should model the pattern it recommends. Suggested fix is in the inline comment.

  2. verify method appears out of nowhere (README.md line 237) — the deploy sanity-check uses verify(uint64,bytes)(bool) which is not declared in IDrandOracleQuicknet. A one-line comment in the shell block would save reader confusion.

- settle() now follows checks-effects-interactions: settled = true before the oracle call
- README settle snippet matches the contract
- Clarify that verify() is a separate oracle helper from verifyNormalized
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Both previous review comments have been addressed — checks-effects-interactions is now correct in settle() and the verify() helper is documented in context.

The walkthrough, security checklist, gas profile, and adversarial-path coverage are all solid. No further issues.

…ject

- Move contract under src/, add foundry.toml, .gitignore, .env.example
- Add unit tests with a mock oracle (forge test: 8 passing)
- Add deploy/open/settle shell scripts that drive the lifecycle end-to-end
- deploy script queries eth_estimateGas on the node to work around MegaETH's
  dual-gas model
- Rewrite README with a project layout and quick-start
Comment thread docs/dev/examples/vrf-drand-lottery/README.md Outdated
Comment thread docs/dev/examples/vrf-drand-lottery/README.md Outdated
Comment thread docs/dev/examples/vrf-drand-lottery/README.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Good addition overall. The two previous review threads (checks-effects-interactions order, and the stray verify() cast call) are both resolved in the current state.

One remaining issue: four relative links to .sol files in README.md will 404 on the docs site — GitBook only renders Markdown files. Inline suggestions posted at lines 172, 201, 307–308.

Everything else looks clean:

  • One-sentence-per-line convention followed throughout.
  • All code blocks have language tags.
  • Internal links use .md extensions; gas-estimation.md target exists.
  • SUMMARY.md entry is correct.
  • Security checklist and contract invariants are consistent with each other.
  • Shell scripts correctly use eth_estimateGas for the deploy-time gas problem without misapplying it to runtime calls.

GitBook only serves .md files, so relative .sol links 404 on the live docs
site. Leave the paths as inline code instead.
Comment thread docs/dev/examples/vrf-drand-lottery/README.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Good shape. Resolved the three previous threads about .sol links — all fixed in the current diff (links replaced with inline code as suggested).

One remaining nit: the project layout code block (line 25 of README.md) is missing a language identifier; left an inline suggestion to add text.

Everything else looks correct:

  • YAML description frontmatter present
  • SUMMARY.md updated
  • Internal links use .md extensions
  • One sentence per line
  • GitBook blocks ({% hint %}, {% stepper %}) correctly paired
  • CEI ordering in settle() is correct (settled = true before the oracle call)
  • Gas estimation approach in deploy-lottery.sh is consistent with the dual-gas guidance

Clones the upstream DrandVerifier repo into .drandverifier/ (git-ignored),
builds DrandOracleQuicknet, deploys with the node's gas estimate, runs a
known-good sanity check, and writes ORACLE_ADDRESS back into .env.

Verified end-to-end on MegaETH Testnet.
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Overall this is a clean, well-structured example. The checks-effects-interactions fix, the .sol→inline-code conversions, and the verify() interface note were all applied correctly.

Two remaining issues:

1. Unresolved inline thread — missing language identifier
The project layout code block in README.md still has no language tag. The thread is open; the suggestion there is to use ```text.

2. publishTime() reverts when uninitialized
uint256(revealRound - 1) triggers a Solidity 0.8 arithmetic panic when revealRound == 0 (before the first open()). The demo flow won't hit this because settle.sh runs after open.sh, but any script or UI that reads publishTime() eagerly — or the fork-test setup before open() is called — will get a confusing revert.

function publishTime() external view returns (uint256) {
    if (revealRound == 0) return 0;
    return GENESIS + uint256(revealRound - 1) * PERIOD;
}

Comment thread docs/dev/examples/vrf-drand-lottery/script/DrandLotteryDemo.sol Outdated
Comment thread docs/dev/examples/vrf-drand-lottery/README.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Good PR overall — well-structured walkthrough, clean contract with CEI correctly applied, and all five previously-flagged issues were addressed.

One thing remaining before merge: two fenced code blocks in README.md still lack language identifiers (required by docs/dev/AGENTS.md). The open thread covers one of them; I've added a comment on the second (the timing diagram at line 182). Both should use ````text```.

Replace the hand-stripped scaffold with a verbatim copy of the upstream
DrandVerifier workspace (src/, test/, lib/bls-solidity, lib/forge-std,
lib/solady, scripts, etc.) plus shell automation for the end-to-end
lifecycle (deploy-oracle, deploy-lottery, open, settle).

`forge test` runs 123 tests in-tree. Docs repo lint configs now skip
`docs/**/examples/**/lib/**` and `dependencies/` so vendored library
markdown doesn't block CI.
Comment thread docs/dev/examples/vrf-drand-lottery/README.md Outdated
Comment thread docs/dev/examples/vrf-drand-quicknet-lottery/README.md
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Review

Overall this is well-structured — the deployed contracts were verified end-to-end and the lib/ vendor ignores in .markdownlint-cli2.yaml and .prettierignore are correctly scoped. Two inline comments above for quick fixes; one pre-existing thread still needs attention.

Still unresolved from prior review

  • Underflow in publishTime() (script/DrandLotteryDemo.sol:74): revealRound - 1 underflows when revealRound == 0. The suggestion in the open thread is correct — add an early return guard. This is code shown to readers as a reference, so the bug matters.

New inline comments

  • Missing description frontmatter — required by AGENTS.md for every new page (SEO).
  • H1 / sidebar title mismatch — page heading says DrandVerifier, sidebar says Drand VRF Lottery. Should match.

Minor (non-blocking)

  • The <p align="center"><img ...> HTML block at the top of the README is GitHub-flavored HTML; GitBook's renderer may or may not honour the align attribute. Worth checking in the GitBook preview.
  • The README is written as a library reference doc (multi-sentence paragraphs, no hint/tab blocks). The repo convention (AGENTS.md) is one sentence per line. Conforming it fully is a larger rewrite, but any new prose added for MegaETH context should follow the convention.

Replace the prior scaffold with a 1:1 copy of
/home/william/workspace/drand-lottery-demo — the dedicated demo repo with
DrandLottery.sol, forge Script-based deploys, demo.sh, soldeer-managed
deps, and the DrandVerifier submodule vendored at dependencies/DrandVerifier.

Lint excludes updated so the docs repo's markdownlint/prettier/lychee
skip the example's dependencies/ tree.
…ring

Match the upstream drand-lottery-demo layout: dependencies/DrandVerifier is
a proper git submodule pinned to the same commit (ccf2336), not vendored
files. Adds a top-level .gitmodules entry on the docs repo.

Consumers clone with:
    git submodule update --init --recursive
after which forge build / forge test work.
Comment thread docs/dev/examples/vrf-drand-quicknet-lottery/README.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

The contract rename and the previous round of fixes addressed the bulk of the earlier feedback — the .sol link removals, missing language tags, and the CEI ordering are all resolved. Resolved the stale thread about script/DrandLotteryDemo.sol as that file is gone and the underflow concern is properly handled in the rewritten code.

Two threads are still open and must be addressed before merge:

  1. Missing YAML frontmatterREADME.md has no description: field. Every new GitBook page requires one for SEO (per AGENTS.md). See the existing thread.
  2. H1 / sidebar mismatch — H1 is # drand-lottery-demo but SUMMARY.md lists it as Drand VRF Lottery. GitBook renders the H1 as the page title, so visitors land on a page headed differently from the sidebar entry. See the existing thread.

New: one-sentence-per-line throughout prose — added an inline comment on the opening paragraphs. The same 80-char hard-wrapping pattern appears in the Setup, Deploy, End-to-end demo, and Known limitations sections too; please sweep the whole file.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Three open threads still need addressing before merge, plus two new items.

Open threads (unaddressed)

  • PRRT_kwDOODfgX858c8YBREADME.md is missing YAML frontmatter. Every new page requires a description field per AGENTS.md.
  • PRRT_kwDOODfgX858c8aO — H1 is # drand-lottery-demo; SUMMARY.md calls it "Drand VRF Lottery". GitBook renders the H1 as the page title, so these must match.
  • PRRT_kwDOODfgX858cpFt — The publishTimeOf(0) underflow thread references script/DrandLotteryDemo.sol, which doesn't exist in this PR. The same bug is present in src/DrandLottery.sol:158; I've left a fresh inline comment there.

New: one-sentence-per-line rule

CLAUDE.md and docs/AGENTS.md both require each sentence on its own line for diff readability. The README.md intro (lines 3–12) and several prose sections wrap sentences mid-line. Example fix:

A minimal commit-reveal lottery that consumes [DrandOracleQuicknet](https://github.com/Zodomo/DrandVerifier) to draw a fair winner using drand quicknet randomness.

The whole point of this demo is to show what a _consumer_ contract has to add around the stateless drand verifier to make randomness safely usable.
The verifier answers one question — "is this a valid drand beacon?" — and nothing else.
Everything about **when** to consume it, **which round** to use, and **how to lock inputs** is the application's responsibility.
This contract shows the minimum correct discipline.

New: code blocks without language identifiers

Lines 23 and 209 of README.md open fences with no language tag. Both threads for these were marked resolved, but the code wasn't updated. The flow diagram should be ```text and the expected output block should also be ```text.

… rename folder to vrf-drand-quicknet-lottery
Comment thread docs/dev/examples/vrf-drand-quicknet-lottery/README.md Outdated
Comment thread docs/dev/examples/vrf-drand-quicknet-lottery/README.md Outdated
Comment thread docs/dev/examples/vrf-drand-quicknet-lottery/README.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Review

Four threads from the previous round are still open — please address them before merge:

  1. Missing YAML frontmatterREADME.md has no description field. Required by AGENTS.md for SEO.
  2. H1 / sidebar mismatch — page heading is # drand-lottery-demo but SUMMARY.md shows "Drand VRF Lottery". GitBook renders the H1 as the page title, so visitors land on a mismatched heading.
  3. Prose is hard-wrapped at ~80 chars — the repo rule is one sentence per line throughout (intro, Setup, Deploy, End-to-end demo, MegaETH gas note, etc.).
  4. publishTimeOf(0) arithmetic underflowround - 1 in src/DrandLottery.sol:159 panics when round == 0 (before any close()). Add an early return.

New inline comments added for three more fenced code blocks that are missing a language identifier (flow diagram, directory tree, expected output).

Documents DrandOracleQuicknet as MegaETH's preinstalled VRF service.
Covers what VRF is, the MegaETH service addresses, what drand is, the
verifier API surface, a minimal consumer pattern, offchain beacon
fetching (curl/cast/viem), and commit-reveal security caveats.
Links to the existing drand-lottery example as the runnable companion.
Comment thread docs/dev/examples/vrf-drand-quicknet-lottery/README.md Outdated
Comment thread docs/dev/vrf.md Outdated
Comment thread docs/dev/vrf.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Review

The VRF page (docs/dev/vrf.md) and the Foundry example project are both well-structured and technically sound. The contract, tests, and shell demo are correct. A few issues remain from previous rounds, plus two new ones in vrf.md.

Still open from previous rounds

These threads have not been addressed:

  • README.md line 1 — H1 # drand-lottery-demo doesn't match the SUMMARY.md entry "Drand VRF Lottery"; GitBook renders the H1 as the page heading.
  • README.md (multiple paragraphs) — prose hard-wrapped at ~80 chars; repo rule is one sentence per line.
  • src/DrandLottery.sol publishTimeOfround - 1 underflows when round == 0; add an early return.
  • README.md lines 23, 71, 210 — flow diagram, directory tree, and expected-output code blocks are missing language identifiers (use text).

New issues (filed inline)

  • README.md line 1 — missing YAML description frontmatter (stale thread against the old path has been resolved and re-filed here).
  • vrf.md lines 235 and 241 — two bare fenced blocks in the "Round-time math" section are missing language identifiers; use text.

…3 core pitfalls

- Drop the Chainlink-comparison table and 'MegaETH's ethos' aside; the page
  describes what the service is, not what it isn't
- Inline reference to Zodomo/DrandVerifier where DrandOracleQuicknet is
  introduced and again at the start of the how-to-use section
- Round-time math now cites the drand protocol specification as the
  authoritative source for beacon timing
- Collapse 8 caveats into 3 core pitfalls: (1) commit-to-future-round + lock
  inputs, (2) own the state the verifier doesn't (freshness, replay, encoding),
  (3) handle drand stalls
The formulas were just restating the inline math already shown in the
minimal pattern code example. Drand spec reference is preserved in the
References section.
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Review

Resolved (latest commit): The Round-time math section was dropped from vrf.md, closing the two missing-lang threads on those formulas.

Still open — 7 threads require fixes before merge:

# File Issue
1 README.md Missing YAML frontmatter (description field)
2 README.md H1 # drand-lottery-demo doesn't match SUMMARY entry "Drand VRF Lottery"
3 README.md Prose hard-wrapped at 80 chars throughout — must be one sentence per line
4 README.md Flow diagram code fence missing text lang tag
5 README.md Directory layout code fence missing text lang tag
6 README.md Expected output code fence missing text lang tag
7 src/DrandLottery.sol publishTimeOf(0) underflows (uint64 arithmetic wrap)

All seven have inline suggestions already posted in prior threads. No new issues found.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

The content and structure here are solid — good use of {% hint %} blocks, well-chosen CEI ordering in settle(), accurate drand protocol explanation, and the Foundry layout is clean. However, 9 open review threads remain unaddressed. The PR needs to resolve all of them before merge.

Outstanding items (already threaded inline):

# File Issue
1 README.md Missing YAML frontmatter (description: field)
2 README.md H1 is # drand-lottery-demo; SUMMARY.md entry is "Drand VRF Lottery" — they must match
3 README.md Prose paragraphs hard-wrapped at ~80 chars instead of one sentence per line
4–6 README.md Three code blocks missing language identifiers (flow diagram, directory tree, expected output → use text)
7 src/DrandLottery.sol publishTimeOf(0) underflows in Solidity 0.8 — add if (round == 0) return 0; guard
8–9 vrf.md Two bare code blocks missing language identifiers

All of these are covered by the existing inline threads — no new findings beyond what's already been raised.

Replace ambiguous 'key holder' language with named properties
(Correctness / Uniqueness / Unpredictability) and generic 'producer'.
Matches drand's actual trust model where no single party holds the key.
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Review

This is a clean, well-structured PR — solid VRF explainer in vrf.md, complete Foundry example project, good test coverage, and correct CEI pattern in settle(). The tooling exclusions (markdownlint, prettier, lychee) for vendored deps are correct.

9 prior threads resolved. 7 remain open and all are still applicable to the current diff. Summarizing what needs to land before merge:

Thread File Issue
#c8aO README.md H1 is # drand-lottery-demo; SUMMARY entry is "Drand VRF Lottery" — heading must match
#dqhf README.md Missing YAML frontmatter description:
#dl-C README.md Flow diagram code block missing language tag (text)
#dl_X README.md Directory tree code block missing language tag (text)
#dmBC README.md Expected output code block missing language tag (text)
#dDiw README.md Prose hard-wrapped at ~80 chars throughout; repo rule requires one sentence per line
#dHLI src/DrandLottery.sol publishTimeOf(0) underflows (Solidity 0.8 panic); needs if (round == 0) return 0; guard

No new issues to add — everything above is already tracked in the open threads.

… nav entry

- Security caveats section now scopes itself as integration-level and
  points readers to drand's own Security Model for protocol-level
  concerns (threshold, front-running, DoS).
- Stalls caveat deep-links to drand's DoS scenarios for context on
  stall duration.
- Remove Examples entry from SUMMARY.md; example content stays in-tree
  but is no longer in the docs nav.
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

The new revision restructures the example under vrf-drand-quicknet-lottery/ and adds the docs/dev/vrf.md guide — both solid additions. The tooling config changes (markdownlint, prettier, lychee excludes) are correct.

However, all 7 threads from the previous round remain open and unaddressed in this revision. Nothing new to flag beyond them, but these need to be fixed before merging:

  1. H1 heading mismatch# drand-lottery-demo should be # Drand VRF Lottery to match the SUMMARY.md entry (open thread on README.md).
  2. Hard-wrapped prose — prose paragraphs in README.md are still wrapped at ~80 chars instead of one sentence per line (repo rule).
  3. publishTimeOf(0) underflow(round - 1) in DrandLottery.sol panics when round == 0; add an early return guard (open thread on src/DrandLottery.sol).
    4–6. Three bare code fences — the ASCII flow diagram, directory tree, and expected shell output in README.md are all missing language identifiers (text).
  4. Missing YAML frontmatterREADME.md needs a description: field for SEO (per AGENTS.md "Adding a new page").

Each of these has a suggestion already written in the corresponding inline thread.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Review — round 2

Good progress: the contract reentrancy ordering, the .sol link 404s, all the vrf.md issues, and the missing frontmatter on the old paths are all resolved.

Seven threads from the previous review are still open against the new vrf-drand-quicknet-lottery/ files — they need to be addressed before merge:

Thread File Issue
PRRT_kwDOODfgX858dqhf README.md Missing YAML frontmatter (description:)
PRRT_kwDOODfgX858c8aO README.md H1 # drand-lottery-demo doesn't match any sidebar entry — also see the new SUMMARY.md comment below
PRRT_kwDOODfgX858dDiw README.md Prose hard-wrapped at ~80 chars; must be one sentence per line
PRRT_kwDOODfgX858dl-C README.md Flow diagram code block missing language tag (text)
PRRT_kwDOODfgX858dl_X README.md Directory tree code block missing language tag (text)
PRRT_kwDOODfgX858dmBC README.md Expected output code block missing language tag (text)
PRRT_kwDOODfgX858dHLI DrandLottery.sol publishTimeOf(0) underflows (Solidity 0.8 panic)

One new issue logged inline on docs/SUMMARY.md.

Comment thread docs/SUMMARY.md
- Add YAML frontmatter with description
- Rename H1 to 'Drand VRF Lottery' to match inbound links
- Reflow prose to one-sentence-per-line per repo convention
- Add 'text' language identifiers to ASCII/output code blocks
- src/DrandLottery.sol: early-return publishTimeOf(0) to avoid arithmetic underflow
Deployed at 0x7a53a6eFA81c426838fcf4824E6e207923969b36 on chain 4326
(tx 0x224796d88164397c05b071d1389ade72de5b7a8d3bd04d466d7c995f3193a3de).
Verified end-to-end against a live drand quicknet beacon.
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Good progress — 6 of the 8 previous threads are now resolved. Two remain:

1. docs/SUMMARY.md — lottery page still not listed (open thread)

vrf.md links to examples/vrf-drand-quicknet-lottery/README.md but the page has no entry in SUMMARY.md. GitBook won't render it in the sidebar and the link may 404. Add a sub-item:

```diff

2. README.md — multi-sentence bullet items (open thread: one-sentence-per-line rule)

The prose sections are now correctly formatted, but several bullet items still pack two sentences on one line. Per CLAUDE.md, every sentence should be on its own line. Examples:

  • - **Input lock** — \enter()` is rejected once `revealRound != 0`. The entrant set and pot are frozen at close.`
  • - \close()` can be called by anyone. For a real app you'd add a trusted closer, timelock, or minimum-entrants threshold.`
  • - No drand-stall fallback. If round N never gets signed (network outage), \settle()` will wait forever.`

Split each into two bullets or move the second sentence to a new indented line.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

Good revision pass — all 7 threads from the previous round have been addressed and are now resolved. One issue remains open before this is mergeable.

Still blocking: docs/SUMMARY.md is missing the lottery sub-entry (thread #8)

vrf.md links to the lottery page via a relative path, but that page has no entry in SUMMARY.md. GitBook uses this file to build navigation and resolve internal links — without it, the page won't appear in the sidebar and the link from vrf.md may 404.

Suggested fix:

-  - [Verifiable Randomness (VRF)](dev/vrf.md)
+  - [Verifiable Randomness (VRF)](dev/vrf.md)
+    - [Drand VRF Lottery](dev/examples/vrf-drand-quicknet-lottery/README.md)

Everything else — frontmatter, language identifiers, heading, one-sentence-per-line, publishTimeOf guard, CEI order — looks correct. Once the SUMMARY.md entry is added this is ready to merge.

GitBook requires every page referenced elsewhere to appear in SUMMARY.md
or relative links 404. The lottery example is linked three times from
dev/vrf.md (intro hint, 'Worked example' section, References). Adding it
as a child of the VRF page keeps the flat nav structure (no 'Examples'
heading) while making the page reachable.
Comment thread docs/dev/vrf.md
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

All 19 prior threads are resolved (the open SUMMARY.md thread was addressed by this revision and has been resolved above).

One new issue: The minimal verifyNormalized pattern in vrf.md (line 150) captures the 2nd return value as randomness, but DrandLottery.sol uses the 3rd (chainScopedHash). The chain-scoped value is the safer choice for onchain consumption — see inline comment.

Everything else looks good: YAML frontmatter, H1/sidebar alignment, code block language tags, sentence-per-line prose, .sol links removed, CEI order in settle(), and publishTimeOf underflow guard are all fixed from the prior round.

…example

verifyNormalized returns (bool, normalizedRoundHash, chainScopedHash).
The chainScopedHash binds the random value to address(this) and
block.chainid, so the same beacon can't be replayed across chains or
contracts. Match the worked example's choice in the minimal pattern.
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 21, 2026

All previous review threads are now resolved. No remaining issues found.

Checklist verified: YAML frontmatter present on both new pages, H1 matches SUMMARY.md sidebar title, all code blocks have language identifiers, one sentence per line, no broken .sol hyperlinks, SUMMARY.md updated, publishTimeOf underflow guard in place, settle() follows CEI, and the minimal pattern in vrf.md correctly uses the 3rd return value (chainScopedHash) consistent with the worked example.

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