Skip to content

feat: choose sdk path#61

Merged
Dodecahedr0x merged 1 commit into
mainfrom
dode/fix-sdk
Jun 12, 2026
Merged

feat: choose sdk path#61
Dodecahedr0x merged 1 commit into
mainfrom
dode/fix-sdk

Conversation

@Dodecahedr0x

@Dodecahedr0x Dodecahedr0x commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Adds a feature to select which VRF SDK to use, so that the macros reexported by the ephemeral_rollups_sdk work

Summary by CodeRabbit

  • Chores
    • Improved VRF macro compatibility for use within rollups SDK builds, allowing consumers to avoid direct dependencies on the standalone VRF SDK when integrated through rollups environments.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The pull request adds a rollups Cargo feature to the VRF procedural macro crate that allows generated code to reference the VRF SDK through the rollups SDK's re-export instead of directly. A new feature-gated helper selects the module path, and both the #[vrf] and #[vrf_callback] macros are updated to use this resolved path throughout their generated code.

Changes

VRF SDK path resolution

Layer / File(s) Summary
Feature flag and path resolution helper
sdk/vrf-macro/Cargo.toml, sdk/vrf-macro/src/lib.rs
A rollups Cargo feature is declared with documentation. A new vrf_sdk_path() helper returns the appropriate SDK module path (::ephemeral_rollups_sdk::vrf when rollups is enabled, ::ephemeral_vrf_sdk otherwise) as a proc_macro2::TokenStream.
VRF macro SDK path integration
sdk/vrf-macro/src/lib.rs
The #[vrf] macro uses the resolved SDK path in generated vrf_program and slot_hashes fields, and rewrites invoke_signed_vrf to accept #vrf::compat::Instruction and route invocation through #vrf::compat::anchor_lang::solana_program::program::invoke_signed with seeds from #vrf::consts::IDENTITY.
VRF callback macro SDK path integration
sdk/vrf-macro/src/lib.rs
The #[vrf_callback] macro initializes the resolved SDK path and uses it in the vrf_program_identity account constraint via #vrf::consts::scoped_vrf_identity(&crate::ID).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 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 "feat: choose sdk path" accurately reflects the main change: adding a feature to select which VRF SDK path the macros use (either ephemeral_vrf_sdk or ephemeral_rollups_sdk).
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dode/fix-sdk

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 and usage tips.

@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: 1

🤖 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 `@sdk/vrf-macro/src/lib.rs`:
- Around line 16-22: The vrf_sdk_path() proc-macro uses cfg!(feature =
"rollups") inside ephemeral-vrf-sdk-vrf-macro but the parent SDK crate does not
forward that feature, so consumers can't activate the rollups branch; fix by
adding a forwarding feature named "rollups" in the parent SDK crate's Cargo.toml
that maps to the proc-macro crate's feature (e.g., add a feature "rollups" =
["ephemeral-vrf-sdk-vrf-macro/rollups"]) and ensure the dependency entry for
ephemeral-vrf-sdk-vrf-macro is present so enabling sdk's "rollups" toggles the
macro crate's feature used by vrf_sdk_path().
🪄 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: aa5c3528-7e73-4841-8c13-ed09d6eb8c61

📥 Commits

Reviewing files that changed from the base of the PR and between a4736be and e70665f.

📒 Files selected for processing (2)
  • sdk/vrf-macro/Cargo.toml
  • sdk/vrf-macro/src/lib.rs

Comment thread sdk/vrf-macro/src/lib.rs
@Dodecahedr0x Dodecahedr0x merged commit ba5f648 into main Jun 12, 2026
4 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jun 16, 2026
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