Skip to content

chore: remove apis deprecated in solana v2.3 #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

thlorenz
Copy link
Contributor

@thlorenz thlorenz commented Jul 19, 2025

Summary

Modernizes the delegation program codebase by removing APIs deprecated in Solana v2.3 and updating dependencies to use their current replacements.

Since we use 2.2 as version this allows upgrades for minors, such that 2.3 is pulled in when cargo lock is removed.
I saw 55 of warnings when using this as a dependency with the cloning pipeline codebase since that upgraded to the latest solana.

Mostly changes needed are due to agave separating code into multiple crates.

Mergability

This is not compatible with our validator (mainly sdk is used there) until we also use solana-v2.3 in there (removing Cargo.lock and rebuilding would do that upgrade).
However there we still are locked on a particular revision of the delegation-program so should be fine at any rate to merge into main.

Otherwise we can keep this PR open until we are ready.

Original Warning Count

From cargo check (regular code):

33 total warnings consisting of:

  • 29 system_program warnings (various import and usage patterns)
  • 4 realloc method warnings (deprecated method calls)
  • 4 bpf_loader_upgradeable warnings (deprecated module imports)
  • 2 system_instruction warnings (deprecated module imports)

Additional from cargo check --tests (test code):

22 additional warnings consisting of:

  • 21 Keypair::from_bytes warnings (across multiple test files)
  • 1 additional system_program warning (in test module)

Total Original Warnings: 55 warnings

Final Result:

  • Before all fixes: 55 total warnings
  • After all fixes: 0 warnings ✅

All 55 deprecation warnings were successfully resolved by updating to the current Solana SDK APIs and best practices.

Details

Dependency Updates

Updated imports and function calls to use the modern Solana SDK structure:

  • System Program References: Replaced solana_program::system_program imports with solana_sdk_ids::system_program for consistent system program ID access
  • BPF Loader References: Updated solana_program::bpf_loader_upgradeable imports to use solana_sdk_ids::bpf_loader_upgradeable
  • System Instructions: Migrated from deprecated solana_program::system_instruction to solana_system_interface::instruction for system operations like transfers, account creation, and allocation

API Modernization

  • Account Resizing: Replaced deprecated realloc() calls with the modern resize() method for account data management
  • Program Assignment: Updated system program assignment calls to use the new SDK structure

Additional Improvements

  • Dependency Alignment: Added missing dependencies (solana-sdk-ids, solana-system-interface) to Cargo.toml to support the modernized imports
  • Code Consistency: Standardized import formatting and ensured consistent use of modern Solana SDK patterns throughout the codebase

These changes ensure compatibility with Solana v2.3+ while maintaining all existing functionality. The updates primarily affect internal API usage without changing the program's external interface or behavior.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing changes made in this pull request

@thlorenz thlorenz requested a review from GabrielePicco July 19, 2025 10:59
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