Skip to content

Conversation

@sporicle
Copy link
Contributor

@sporicle sporicle commented Dec 2, 2025

Summary by CodeRabbit

  • Chores

    • Updated program identifier across configuration and deployment files.
  • Refactor

    • Simplified delegation flow by refactoring how validator accounts are passed to the delegation mechanism, removing explicit parameter passing in favor of a streamlined account-based approach.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR updates a Solana program delegation system by refactoring the delegate instruction API from explicit parameter passing to a remaining-accounts-based pattern. The program ID is updated across configuration and code, and the delegate instruction signature is simplified by removing the DelegateParams struct and deriving validator configuration from remaining accounts instead.

Changes

Cohort / File(s) Change Summary
Program ID Configuration Updates
Anchor.toml, roll-dice/app/lib/config.ts
Updated the program ID from 7JJKDgfhr5eKjijcWiMkKnEoiLXNRbjctq1D1o8PFuDx to D74Ho1cWBHgZNpVG4FnBBA4JtjX4HFZ5QqqRXXVKA8gM in configuration and exported constant for devnet and localnet environments.
Delegate API Refactoring (Client-side)
roll-dice/app/app/delegated/page.tsx, roll-dice/tests/roll-dice-delegated.ts
Changed delegate RPC invocation pattern from passing commitFrequencyMs and validator as inline parameters to using .accounts() and .remainingAccounts() chaining, with validator passed via remainingAccounts array as non-signer, non-writable account.
Delegate API Refactoring (On-chain)
roll-dice/programs/roll-dice-delegated/src/lib.rs, roll-dice/programs/roll-dice/src/lib.rs
Modified delegate instruction to remove DelegateParams parameter; validator now derived from first remaining account. Added new delegate instruction and DelegateInput account context to primary program.
IDL Schema Updates
roll-dice/app/lib/idl/random_dice_delegated.json
Updated root address constant, removed DelegateParams type definition, cleared delegate instruction arguments array, and updated owner program address within accounts list.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Remaining accounts handling: Verify that the new pattern correctly passes and validates validator pubkey through remainingAccounts, ensuring no security gaps in the account derivation
  • Cross-file consistency: Confirm all three delegate call sites (startup auto-delegation, explicit handler, main flow) in delegated/page.tsx follow the same pattern
  • IDL alignment: Validate that the updated IDL schema matches the new Rust instruction signatures and that code generators will produce correct client code
  • Program ID propagation: Ensure the new program ID is correctly referenced across both on-chain programs and client configurations

Possibly related PRs

Suggested reviewers

  • jonasXchen
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-main

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71ea8ad and b7cdee2.

📒 Files selected for processing (7)
  • roll-dice/Anchor.toml (1 hunks)
  • roll-dice/app/app/delegated/page.tsx (2 hunks)
  • roll-dice/app/lib/config.ts (1 hunks)
  • roll-dice/app/lib/idl/random_dice_delegated.json (5 hunks)
  • roll-dice/programs/roll-dice-delegated/src/lib.rs (2 hunks)
  • roll-dice/programs/roll-dice/src/lib.rs (3 hunks)
  • roll-dice/tests/roll-dice-delegated.ts (1 hunks)

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.

@vercel
Copy link

vercel bot commented Dec 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
er-rolldice Ready Ready Preview Comment Dec 2, 2025 10:15am

@sporicle sporicle merged commit 5f00fc6 into main Dec 2, 2025
3 of 5 checks passed
@sporicle sporicle deleted the fix-main branch December 2, 2025 10:16
@coderabbitai coderabbitai bot mentioned this pull request Dec 17, 2025
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