Skip to content

feat: redirect to to ephemeral system program calls associated with ephemeral accounts - #254

Open
taco-paco wants to merge 2 commits into
mainfrom
feat/redirect-to-esp
Open

feat: redirect to to ephemeral system program calls associated with ephemeral accounts#254
taco-paco wants to merge 2 commits into
mainfrom
feat/redirect-to-esp

Conversation

@taco-paco

@taco-paco taco-paco commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Validator moved out handling of ephemeral accounts into separate builtin. Here we update sdk accordingly

Summary by CodeRabbit

  • New Features

    • Added support for interacting with the ephemeral system program.
    • Added a public identifier for the ephemeral system program.
    • Updated ephemeral account creation, resizing, and closing operations to use the new system program interface.
  • Documentation

    • Updated ephemeral account usage examples and account-handling guidance to reflect the new interface.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Rust dependency now references a fixed revision of the validator repository. A public ephemeral system program ID constant was added. Pinocchio ephemeral account builders now accept and target an ESP account, with updated operation discriminators. The SDK now uses EphemeralSystemInstruction variants for create, resize, and close operations and targets the exported ephemeral system program ID.

Suggested reviewers: bmuddha, dodecahedr0x, jonasxchen

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/redirect-to-esp

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.

@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 `@rust/pinocchio/src/ephemeral_accounts.rs`:
- Around line 52-54: Document the serialization contract beside
CREATE_EPHEMERAL_ACCOUNT_DISCRIMINATOR, RESIZE_EPHEMERAL_ACCOUNT_DISCRIMINATOR,
and CLOSE_EPHEMERAL_ACCOUNT_DISCRIMINATOR: these 4-byte little-endian values
must remain aligned with the u32 bincode variant indices of
EphemeralSystemInstruction. Note that reordering the enum or changing its
serialization requires updating these constants.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a7cf04cb-50c1-498a-8ab3-407c14b3da12

📥 Commits

Reviewing files that changed from the base of the PR and between ca0ee3c and 6989cda.

⛔ Files ignored due to path filters (1)
  • rust/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • rust/Cargo.toml
  • rust/pinocchio/src/consts.rs
  • rust/pinocchio/src/ephemeral_accounts.rs
  • rust/sdk/src/ephemeral_accounts.rs

Comment on lines +52 to +54
const CREATE_EPHEMERAL_ACCOUNT_DISCRIMINATOR: u32 = 0;
const RESIZE_EPHEMERAL_ACCOUNT_DISCRIMINATOR: u32 = 1;
const CLOSE_EPHEMERAL_ACCOUNT_DISCRIMINATOR: u32 = 2;

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Document the implicit bincode discriminator coupling.

The Pinocchio layer manually constructs 4-byte LE discriminators (0/1/2) while the SDK layer relies on bincode's u32 enum variant serialization via EphemeralSystemInstruction. These happen to match because bincode serializes enum variant indices as u32, but this coupling is implicit. If the EphemeralSystemInstruction enum is reordered or the serialization changes, the Pinocchio layer will silently break.

Consider adding a comment documenting this contract, or deriving the discriminators from the enum to eliminate the manual duplication.

🤖 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 `@rust/pinocchio/src/ephemeral_accounts.rs` around lines 52 - 54, Document the
serialization contract beside CREATE_EPHEMERAL_ACCOUNT_DISCRIMINATOR,
RESIZE_EPHEMERAL_ACCOUNT_DISCRIMINATOR, and
CLOSE_EPHEMERAL_ACCOUNT_DISCRIMINATOR: these 4-byte little-endian values must
remain aligned with the u32 bincode variant indices of
EphemeralSystemInstruction. Note that reordering the enum or changing its
serialization requires updating these constants.

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