Skip to content

fix: correct copy-paste breakers in session-keys, VRF, and ER quickstarts#73

Open
dhruvja wants to merge 4 commits into
mainfrom
dhruvja/fix/docs-copy-paste-breakers
Open

fix: correct copy-paste breakers in session-keys, VRF, and ER quickstarts#73
dhruvja wants to merge 4 commits into
mainfrom
dhruvja/fix/docs-copy-paste-breakers

Conversation

@dhruvja

@dhruvja dhruvja commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Changes made

Fixes the outdated code, package names, and endpoints that make several
"quickstart" snippets fail on copy-paste. Each fix is verified against the
source-of-truth example in magicblock-engine-examples (or npm/crates.io).

Session Keys

  • Crate version session-keys = "1.0.0"3.1.1 (matches the
    session-keys example's Cargo.toml).
  • useSessionKeyManager import @gumhq/react-sdk@magicblock-labs/gum-react-sdk
    (the rest of the session-keys docs already use the MagicBlock package; this was
    the one stray import).
  • "Example App" link → the actual session-keys example instead of Gum's app.

VRF

  • Migrated the roll-dice program snippet, the quickstart's inline setup, and the
    intro pages to ephemeral-rollups-sdk with the anchor,vrf features:
    create_request_randomness_ixcreate_request_scoped_randomness_ix, added
    the #[vrf_callback] macro (without it the callback is spoofable), and the
    oracle_queue constraint now accepts the devnet + local test queues.
  • Replaced the VRF test stub (which used a fixed setTimeout and never actually
    waited for the callback) with the real onLogs + seed-tag + 10s-timeout test.

Endpoints

  • ER Devnet devnet.magicblock.app → the regional endpoints
    devnet-as / devnet-eu / devnet-us (matches the validators note).

ER quickstart

  • Added a devnet airdrop/funding step before anchor build && anchor deploy.

Summary by CodeRabbit

  • Documentation

    • Updated quickstarts and guides with current deployment steps, dependency versions, and refreshed links to the latest examples.
    • Aligned VRF documentation with the latest SDK naming and constants.
    • Expanded development endpoint notes to include region-specific Devnet URLs.
  • Bug Fixes

    • Improved the randomness example flow for more reliable callback handling and clearer seed-based results.
    • Updated the test walkthrough to wait for the actual callback log instead of relying on a fixed delay.
  • New Features

    • Added an explicit Devnet SOL airdrop command to the deployment instructions.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 5 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b8627e3f-39a5-4fbf-9925-93e984e7ed83

📥 Commits

Reviewing files that changed from the base of the PR and between ebe8faf and 5adf397.

📒 Files selected for processing (2)
  • snippets/roll-dice-code/request-consume-randomness.mdx
  • snippets/roll-dice-code/test.mdx

Walkthrough

This PR updates documentation across VRF, session-keys, ephemeral rollups, and endpoint notes. VRF-related docs and code snippets migrate from ephemeral_vrf_sdk to ephemeral_rollups_sdk, introducing scoped randomness requests, an updated callback signature with client_seed, restricted oracle queue validation, and a #[vrf_callback] attribute. The roll-dice test synchronizes on callback logs instead of a fixed delay. Session-keys docs update a dependency version and import path. Minor deploy and endpoint documentation changes are also included.

Changes

VRF SDK Migration

Layer / File(s) Summary
VRF SDK reference updates across documentation
pages/verifiable-randomness-functions-vrfs/how-to-guide/quickstart.mdx, pages/verifiable-randomness-functions-vrfs/introduction/security.mdx, pages/verifiable-randomness-functions-vrfs/introduction/solana-vrf.mdx, pages/verifiable-randomness-functions-vrfs/introduction/technical-details.mdx
VRF documentation pages reference ephemeral_rollups_sdk::vrf::consts and updated import/cargo add instructions instead of ephemeral_vrf_sdk.
Roll-dice program snippet: scoped randomness and callback validation
snippets/roll-dice-code/request-consume-randomness.mdx
Imports, the randomness request call, callback signature, random number derivation, and oracle_queue/callback account constraints are updated to use ephemeral_rollups_sdk's vrf module with a client_seed parameter and #[vrf_callback] attribute.
Roll-dice test synchronization on callback logs
snippets/roll-dice-code/test.mdx
Test file adds DEFAULT_BASE_QUEUE, computes a player PDA, updates RPC options, and reworks the roll-dice test to wait for matching callback logs via onLogs and Promise.race instead of a fixed delay.

Session Keys Documentation Updates

Layer / File(s) Summary
Session-keys dependency, import, and example reference updates
pages/tools/session-keys/integrating-sessions-in-your-program.mdx, pages/tools/session-keys/use-sessionkey-manager.mdx, pages/tools/session-keys/usage-examples.mdx
Bumps session-keys dependency version, updates the useSessionKeyManager import path, and revises the Session Token implementation example reference.

Deploy and Endpoint Documentation Updates

Layer / File(s) Summary
Deploy airdrop instructions and regional endpoints
pages/ephemeral-rollups-ers/how-to-guide/quickstart.mdx, snippets/notes/endpoints.mdx
Deploy section wording and shell snippet add a Devnet airdrop example; ER Devnet endpoints note is expanded from one to three region-specific URLs.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: sporicle, jonasXchen

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the doc fixes across session-keys, VRF, and ER quickstarts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dhruvja/fix/docs-copy-paste-breakers

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.

@mintlify

mintlify Bot commented Jul 8, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
magicblock-42 🟢 Ready View Preview Jul 8, 2026, 6:40 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pages/tools/session-keys/use-sessionkey-manager.mdx (1)

66-74: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Destructure connection before passing it to useSessionKeyManager

useConnection() returns an object, so this example should extract connection first; otherwise the snippet won’t work when copied.

Fix
-  const connection = useConnection();
+  const { connection } = useConnection();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pages/tools/session-keys/use-sessionkey-manager.mdx` around lines 66 - 74,
The example in YourComponent is passing the entire useConnection() return value
into useSessionKeyManager, but that hook expects the actual connection object.
Update the snippet to destructure the connection from useConnection() before
calling useSessionKeyManager, and keep the wallet and cluster arguments
unchanged so the copied example works correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@snippets/roll-dice-code/request-consume-randomness.mdx`:
- Around line 41-47: The callback_roll_dice function is missing the seed tag
expected by the test, so the callback completes without ever logging
client_seed=<n>. Update callback_roll_dice to emit a msg! that includes the
client_seed value in the exact tag format the test waits for, alongside the
existing randomness consumption log if needed.
- Around line 62-68: The oracle_queue constraint in the account definition only
allows DEFAULT_QUEUE and DEFAULT_TEST_QUEUE, so update the same constraint to
also accept DEFAULT_EPHEMERAL_QUEUE and DEFAULT_EPHEMERAL_TEST_QUEUE used by the
ephemeral-rollup flow. Keep the fix localized to the oracle_queue validation in
this account struct so request-consume-randomness supports all documented queue
options.

In `@snippets/roll-dice-code/test.mdx`:
- Around line 29-68: Set an explicit Mocha timeout for the "Do Roll Dice!" test
because it can legitimately wait up to 10s for the callback and may exceed the
default limit. Update the test in test.mdx to use a regular async function with
this.timeout(20_000) near the start of the test, while keeping the existing
onLogs subscription and sigPromise race logic intact.

---

Outside diff comments:
In `@pages/tools/session-keys/use-sessionkey-manager.mdx`:
- Around line 66-74: The example in YourComponent is passing the entire
useConnection() return value into useSessionKeyManager, but that hook expects
the actual connection object. Update the snippet to destructure the connection
from useConnection() before calling useSessionKeyManager, and keep the wallet
and cluster arguments unchanged so the copied example works correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d4aa533b-110f-4dd2-af92-ad2756cabd65

📥 Commits

Reviewing files that changed from the base of the PR and between 25d3937 and ebe8faf.

📒 Files selected for processing (11)
  • pages/ephemeral-rollups-ers/how-to-guide/quickstart.mdx
  • pages/tools/session-keys/integrating-sessions-in-your-program.mdx
  • pages/tools/session-keys/usage-examples.mdx
  • pages/tools/session-keys/use-sessionkey-manager.mdx
  • pages/verifiable-randomness-functions-vrfs/how-to-guide/quickstart.mdx
  • pages/verifiable-randomness-functions-vrfs/introduction/security.mdx
  • pages/verifiable-randomness-functions-vrfs/introduction/solana-vrf.mdx
  • pages/verifiable-randomness-functions-vrfs/introduction/technical-details.mdx
  • snippets/notes/endpoints.mdx
  • snippets/roll-dice-code/request-consume-randomness.mdx
  • snippets/roll-dice-code/test.mdx

Comment thread snippets/roll-dice-code/request-consume-randomness.mdx
Comment thread snippets/roll-dice-code/request-consume-randomness.mdx
Comment thread snippets/roll-dice-code/test.mdx Outdated
@dhruvja dhruvja requested a review from jonasXchen July 9, 2026 07:43

@jonasXchen jonasXchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update create_request_scoped_randomness_ix to create_request_randomness_ix in our new sdk and use this as default.

We had updated to create_request_scoped_randomness_ix but this should be under the hood while keeping it simple for the user.

@dhruvja

dhruvja commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

yes that makes sense.

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