Skip to content

feat(solana): Make transceiver peers upgradable#848

Open
nvsriram wants to merge 4 commits intomainfrom
make-transceiver-peers-upgradable
Open

feat(solana): Make transceiver peers upgradable#848
nvsriram wants to merge 4 commits intomainfrom
make-transceiver-peers-upgradable

Conversation

@nvsriram
Copy link
Contributor

@nvsriram nvsriram commented Mar 23, 2026

Currently, the set_transceiver_peer instruction can only be called once since it uses init. This means if the transceiver peer needs to be modified, then the transceiver needs to be redeployed. This PR changes the set_transceiver_peer instruction to be init_if_needed so that we can update previously set transceiver peers.

This also adds unit tests for update_peer and update_transceiver_peer

Summary by CodeRabbit

  • Tests

    • Added tests for peer configuration updates
    • Added tests for transceiver peer address updates
    • Enhanced test infrastructure for on-chain account verification
  • Chores

    • Enabled mainnet feature flag in build, test, and lint targets
    • Updated dependency configuration for improved account initialization support

@nvsriram nvsriram force-pushed the make-transceiver-peers-upgradable branch from 2b80a2a to d2c012d Compare March 23, 2026 16:12
@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f277f92-ac0d-4d6a-b131-72bcd4f452d1

📥 Commits

Reviewing files that changed from the base of the PR and between f17cf77 and d2c012d.

📒 Files selected for processing (6)
  • solana/Makefile
  • solana/programs/example-native-token-transfers/tests/admin.rs
  • solana/programs/ntt-transceiver/Cargo.toml
  • solana/programs/ntt-transceiver/src/wormhole/instructions/admin.rs
  • solana/programs/ntt-transceiver/tests/admin.rs
  • solana/tests/anchor/anchor.test.ts

📝 Walkthrough

Walkthrough

This pull request enables the mainnet feature flag across Solana build and test targets, modifies the account initialization constraint for transceiver peer accounts from init to init_if_needed, and adds comprehensive tests for peer and transceiver peer update functionality.

Changes

Cohort / File(s) Summary
Build Configuration
solana/Makefile
Updated cargo-build, cargo-test, and cargo-lint make targets to consistently include --features "mainnet" flag for compilation and linting steps.
Transceiver Peer Management Infrastructure
solana/programs/ntt-transceiver/Cargo.toml, solana/programs/ntt-transceiver/src/wormhole/instructions/admin.rs
Updated anchor-lang dependency to enable init-if-needed feature and modified SetTransceiverPeer account constraint from init to init_if_needed to allow account creation if it doesn't already exist.
Admin Tests
solana/programs/example-native-token-transfers/tests/admin.rs, solana/programs/ntt-transceiver/tests/admin.rs
Added new test utilities, imports, and async test functions (test_update_peer and test_update_transceiver_peer) to verify peer and transceiver peer configuration updates with on-chain account data validation.
Test Initialization
solana/tests/anchor/anchor.test.ts
Added top-level registerDefinitions() and registerSolana() function calls to ensure required SDK definitions and Solana program registrations are initialized during test module setup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • nonergodic

Poem

🐰 Hops of joy for features bright,
Peers now update with all their might!
Init-if-needed makes paths anew,
Tests verify what accounts do! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: making transceiver peers upgradable by changing the account constraint from init to init_if_needed, allowing updates instead of requiring redeployment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 make-transceiver-peers-upgradable

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.

@nvsriram nvsriram requested review from johnsaigle and kcsongor March 23, 2026 16:36
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