chore: remove apis deprecated in solana v2.3 #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 that2.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:
Additional from cargo check --tests (test code):
22 additional warnings consisting of:
Total Original Warnings: 55 warnings
Final Result:
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:
solana_program::system_program
imports withsolana_sdk_ids::system_program
for consistent system program ID accesssolana_program::bpf_loader_upgradeable
imports to usesolana_sdk_ids::bpf_loader_upgradeable
solana_program::system_instruction
tosolana_system_interface::instruction
for system operations like transfers, account creation, and allocationAPI Modernization
realloc()
calls with the modernresize()
method for account data managementAdditional Improvements
solana-sdk-ids
,solana-system-interface
) toCargo.toml
to support the modernized importsThese 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.