deps: Bump all sdk and spl crates to v3 compatibility#7492
deps: Bump all sdk and spl crates to v3 compatibility#7492joncinque merged 30 commits intoanza-xyz:masterfrom
Conversation
|
If this PR represents a change to the public RPC API:
Thank you for keeping the RPC clients in sync with the server API @joncinque. |
|
The Firedancer team maintains a line-for-line reimplementation of the |
|
For your information, the |
There was a problem hiding this comment.
@Lichtso Can you take a close look at the changes here?
There was a problem hiding this comment.
@Lichtso Please check this too to make sure you're ok with the change
There was a problem hiding this comment.
@buffalojoec These changes are important, so please double-check me here
There was a problem hiding this comment.
That's funny because we did it "right" with ProgramError.
https://github.com/anza-xyz/solana-sdk/blob/252b59c04c6ad0650e1b203099af56b47aee08b8/program-error/src/lib.rs#L366-L374
The backwards compatibility change looks good to me, though.
There was a problem hiding this comment.
Yeah I was pretty surprised about that too 😅 thanks!
There was a problem hiding this comment.
@buffalojoec The error change here is important, so please double check
There was a problem hiding this comment.
@Lichtso can you look at these changes? They should be fine, but I want to be safe
|
To help with the review, the old code for converting from |
| .map(|seeds| Pubkey::create_program_address(seeds, caller_program_id)) | ||
| .collect::<Result<Vec<Pubkey>, solana_pubkey::PubkeyError>>()?; | ||
| .collect::<Result<Vec<Pubkey>, solana_pubkey::PubkeyError>>() | ||
| .map_err(|e| e as u64)?; |
There was a problem hiding this comment.
Where was this conversion originally defined? I assume there was an InstructionError::From<PubkeyError>.
There was a problem hiding this comment.
It's at https://github.com/anza-xyz/solana-sdk/blob/maintenance/v2.x/pubkey/src/lib.rs -- it was taking advantage of the conversion from any T to InstructionError that implements FromPrimitive https://github.com/anza-xyz/solana-sdk/blob/252b59c04c6ad0650e1b203099af56b47aee08b8/instruction/src/error.rs#L389
| assert_eq!(accounts[ARGUMENT_INDEX].data_len(), 100); | ||
| assert!(accounts[ARGUMENT_INDEX].is_signer); | ||
| assert!(accounts[ARGUMENT_INDEX].is_writable); | ||
| assert_eq!(accounts[ARGUMENT_INDEX].rent_epoch, u64::MAX); |
There was a problem hiding this comment.
We still must ensure that there is a deterministic value here, even if it is unused.
There was a problem hiding this comment.
Is it ok if that's 0? Because the entrypoint no longer deserializes the rent epoch at all
There was a problem hiding this comment.
The tests on the deprecated entrypoint continue to deserialize and check that the rent epoch is u64::MAX, if that helps
buffalojoec
left a comment
There was a problem hiding this comment.
Changes lgtm! Just waiting for the CI slog to add my stamp.
P. S. Thanks for taking the vote-interface plumbing off my hands!
a06ad39 to
c8578c9
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7492 +/- ##
=========================================
- Coverage 83.3% 83.3% -0.1%
=========================================
Files 811 811
Lines 364853 364984 +131
=========================================
+ Hits 304174 304241 +67
- Misses 60679 60743 +64 🚀 New features to boost your workflow:
|
* VoteState -> VoteStateV3 * VoteStateVersions::convert_to_current -> convert_to_v3 * Sysvar -> SysvarSerialize * Import StakeHistory from solana_stake_interface * BorshIoError(String) -> BorshIoError * Import ClusterType from solana_cluster_tpe * Keypair::from_bytes -> Keypair::try_from * Hash.0 -> Hash::as_bytes
AccountInfo renamed `rent_epoch` to `_unused` and the entrypoint no longer deserializes the field at all, so make sure this won't cause any divergence in the runtime.
| #[cfg_attr( | ||
| feature = "frozen-abi", | ||
| frozen_abi(digest = "5dfDCRGWPV7thfoZtLpTJAV8cC93vQUXgTm6BnrfeUsN") | ||
| frozen_abi(digest = "2mR2EKFguLhheKtDzbFxoQonSmUtM9svd8kkgeKpe2vu") |
There was a problem hiding this comment.
Looks like this was an ABI-breaking change to the serialization of the status cache (which breaks snapshots)
❯ diff -u bank__BankSlotDelta_frozen_abi__test_abi_digest_5dfDCRGWPV7thfoZtLpTJAV8cC93vQUXgTm6BnrfeUsN bank__BankSlotDelta_frozen_abi__test_abi_digest_2mR2EKFguLhheKtDzbFxoQonSmUtM9svd8kkgeKpe2vu
--- bank__BankSlotDelta_frozen_abi__test_abi_digest_5dfDCRGWPV7thfoZtLpTJAV8cC93vQUXgTm6BnrfeUsN 2025-08-15 10:38:42
+++ bank__BankSlotDelta_frozen_abi__test_abi_digest_2mR2EKFguLhheKtDzbFxoQonSmUtM9svd8kkgeKpe2vu 2025-08-15 10:53:57
@@ -139,7 +139,7 @@
variant(8) InstructionError (fields = 2)
field u8
primitive u8
- field solana_instruction::error::InstructionError
+ field solana_instruction_error::InstructionError
enum InstructionError (variants = 54)
variant(0) GenericError (unit)
variant(1) InvalidArgument (unit)
@@ -186,8 +186,7 @@
variant(41) ProgramFailedToCompile (unit)
variant(42) Immutable (unit)
variant(43) IncorrectAuthority (unit)
- variant(44) BorshIoError(alloc::string::String) (newtype)
- primitive str
+ variant(44) BorshIoError (unit)
variant(45) AccountNotRentExempt (unit)
variant(46) InvalidAccountOwner (unit)
variant(47) ArithmeticOverflow (unit)Notice that the BorshIoError variant used to be a tuple struct with a String, and now is a unit type.
More discussion on Discord here: https://discord.com/channels/428295358100013066/1027231858565586985/1405926131038683259
Just a single commit that updates us to 3.0.0: anza-xyz/agave#7492 --------- Co-authored-by: Jon C <me@jonc.dev>
Problem
Agave is about to cut its breaking v3 branch, but it's still on sdk v2 crates.
Summary of Changes
It was a bit tough to break it up logically, but here's a breakdown of the commits:
Keypair::generatesol_to_lamportsandlamports_to_solOverall breakdown of changes:
PubkeyErrorno longer implementsFromPrimitive, we had to do some conversions by hand. Note! This showed that we've been doing an incorrect conversion fromPubkeyErrortoInstructionErrorby just converting from one number to another, but I simply kept the existing behavior.unsafeThis is the last important step of https://github.com/orgs/anza-xyz/projects/27/views/1 !