fix: correct copy-paste breakers in session-keys, VRF, and ER quickstarts#73
fix: correct copy-paste breakers in session-keys, VRF, and ER quickstarts#73dhruvja wants to merge 4 commits into
Conversation
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis 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. ChangesVRF SDK Migration
Session Keys Documentation Updates
Deploy and Endpoint Documentation Updates
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
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 winDestructure
connectionbefore passing it touseSessionKeyManager
useConnection()returns an object, so this example should extractconnectionfirst; 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
📒 Files selected for processing (11)
pages/ephemeral-rollups-ers/how-to-guide/quickstart.mdxpages/tools/session-keys/integrating-sessions-in-your-program.mdxpages/tools/session-keys/usage-examples.mdxpages/tools/session-keys/use-sessionkey-manager.mdxpages/verifiable-randomness-functions-vrfs/how-to-guide/quickstart.mdxpages/verifiable-randomness-functions-vrfs/introduction/security.mdxpages/verifiable-randomness-functions-vrfs/introduction/solana-vrf.mdxpages/verifiable-randomness-functions-vrfs/introduction/technical-details.mdxsnippets/notes/endpoints.mdxsnippets/roll-dice-code/request-consume-randomness.mdxsnippets/roll-dice-code/test.mdx
jonasXchen
left a comment
There was a problem hiding this comment.
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.
|
yes that makes sense. |
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
session-keys = "1.0.0"→3.1.1(matches thesession-keysexample'sCargo.toml).useSessionKeyManagerimport@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).
VRF
intro pages to
ephemeral-rollups-sdkwith theanchor,vrffeatures:create_request_randomness_ix→create_request_scoped_randomness_ix, addedthe
#[vrf_callback]macro (without it the callback is spoofable), and theoracle_queueconstraint now accepts the devnet + local test queues.setTimeoutand never actuallywaited for the callback) with the real
onLogs+ seed-tag + 10s-timeout test.Endpoints
devnet.magicblock.app→ the regional endpointsdevnet-as/devnet-eu/devnet-us(matches the validators note).ER quickstart
anchor build && anchor deploy.Summary by CodeRabbit
Documentation
Bug Fixes
New Features