Skip to content
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

v2.1: spl: Bump to newest SPL crates for v2.1 release (backport of #3431) #3645

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
280 changes: 198 additions & 82 deletions Cargo.lock

Large diffs are not rendered by default.

32 changes: 22 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -527,14 +527,14 @@ solana-zk-sdk = { path = "zk-sdk", version = "=2.1.1" }
solana-zk-token-proof-program = { path = "programs/zk-token-proof", version = "=2.1.1" }
solana-zk-token-sdk = { path = "zk-token-sdk", version = "=2.1.1" }
solana_rbpf = "=0.8.5"
spl-associated-token-account = "=4.0.0"
spl-instruction-padding = "0.2"
spl-memo = "=5.0.0"
spl-pod = "=0.3.0"
spl-token = "=6.0.0"
spl-token-2022 = "=4.0.0"
spl-token-group-interface = "=0.3.0"
spl-token-metadata-interface = "=0.4.0"
spl-associated-token-account = "=6.0.0"
spl-instruction-padding = "0.3"
spl-memo = "=6.0.0"
spl-pod = "=0.5.0"
spl-token = "=7.0.0"
spl-token-2022 = "=6.0.0"
spl-token-group-interface = "=0.5.0"
spl-token-metadata-interface = "=0.6.0"
static_assertions = "1.1.0"
stream-cancel = "0.8.2"
strum = "0.24"
Expand All @@ -549,7 +549,7 @@ tar = "0.4.42"
tarpc = "0.29.0"
tempfile = "3.13.0"
test-case = "3.3.1"
thiserror = "1.0.65"
thiserror = "1.0.69"
tiny-bip39 = "0.8.2"
# Update solana-tokio patch below when updating this version
tokio = "1.29.1"
Expand Down Expand Up @@ -610,9 +610,21 @@ crossbeam-epoch = { git = "https://github.com/anza-xyz/crossbeam", rev = "fd279d
# There is a similar override in `programs/sbf/Cargo.toml`. Please keep both
# comments and the overrides in sync.
solana-curve25519 = { path = "curves/curve25519" }
solana-account-info = { path = "sdk/account-info" }
solana-borsh = { path = "sdk/borsh" }
solana-cpi = { path = "sdk/cpi" }
solana-decode-error = { path = "sdk/decode-error" }
solana-hash = { path = "sdk/hash" }
solana-instruction = { path = "sdk/instruction" }
solana-msg = { path = "sdk/msg" }
solana-program = { path = "sdk/program" }
solana-program-entrypoint = { path = "sdk/program-entrypoint" }
solana-program-error = { path = "sdk/program-error" }
solana-program-option = { path = "sdk/program-option" }
solana-program-pack = { path = "sdk/program-pack" }
solana-pubkey = { path = "sdk/pubkey" }
solana-sha256-hasher = { path = "sdk/sha256-hasher" }
solana-zk-sdk = { path = "zk-sdk" }
solana-zk-token-sdk = { path = "zk-token-sdk" }

# curve25519-dalek uses the simd backend by default in v4 if possible,
# which has very slow performance on some platforms with opt-level 0,
Expand Down
15 changes: 12 additions & 3 deletions account-decoder-client-types/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ pub enum UiExtension {
GroupMemberPointer(UiGroupMemberPointer),
TokenGroup(UiTokenGroup),
TokenGroupMember(UiTokenGroupMember),
ConfidentialMintBurn(UiConfidentialMintBurn),
UnparseableExtension,
}

Expand All @@ -127,16 +128,16 @@ pub enum UiExtension {
pub struct UiTokenGroupMember {
pub mint: String,
pub group: String,
pub member_number: u32,
pub member_number: u64,
}

#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct UiTokenGroup {
pub update_authority: Option<String>,
pub mint: String,
pub size: u32,
pub max_size: u32,
pub size: u64,
pub max_size: u64,
}

#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
Expand Down Expand Up @@ -288,6 +289,14 @@ pub struct UiTokenMetadata {
pub additional_metadata: Vec<(String, String)>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct UiConfidentialMintBurn {
pub confidential_supply: String,
pub decryptable_supply: String,
pub supply_elgamal_pubkey: String,
}

#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct UiMint {
Expand Down
24 changes: 20 additions & 4 deletions account-decoder/src/parse_token_extension.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub use solana_account_decoder_client_types::token::{
UiConfidentialTransferAccount, UiConfidentialTransferFeeAmount,
UiConfidentialMintBurn, UiConfidentialTransferAccount, UiConfidentialTransferFeeAmount,
UiConfidentialTransferFeeConfig, UiConfidentialTransferMint, UiCpiGuard, UiDefaultAccountState,
UiExtension, UiGroupMemberPointer, UiGroupPointer, UiInterestBearingConfig, UiMemoTransfer,
UiMetadataPointer, UiMintCloseAuthority, UiPermanentDelegate, UiTokenGroup, UiTokenGroupMember,
Expand All @@ -12,7 +12,7 @@ use {
spl_token_2022::{
extension::{self, BaseState, BaseStateWithExtensions, ExtensionType, StateWithExtensions},
solana_program::pubkey::Pubkey,
solana_zk_token_sdk::zk_token_elgamal::pod::ElGamalPubkey,
solana_zk_sdk::encryption::pod::elgamal::PodElGamalPubkey,
},
spl_token_group_interface::state::{TokenGroup, TokenGroupMember},
spl_token_metadata_interface::state::TokenMetadata,
Expand Down Expand Up @@ -135,6 +135,12 @@ pub fn parse_extension<S: BaseState + Pack>(
.get_extension::<TokenGroupMember>()
.map(|&extension| UiExtension::TokenGroupMember(convert_token_group_member(extension)))
.unwrap_or(UiExtension::UnparseableExtension),
ExtensionType::ConfidentialMintBurn => account
.get_extension::<extension::confidential_mint_burn::ConfidentialMintBurn>()
.map(|&extension| {
UiExtension::ConfidentialMintBurn(convert_confidential_mint_burn(extension))
})
.unwrap_or(UiExtension::UnparseableExtension),
}
}

Expand Down Expand Up @@ -232,7 +238,7 @@ pub fn convert_confidential_transfer_mint(
confidential_transfer_mint: extension::confidential_transfer::ConfidentialTransferMint,
) -> UiConfidentialTransferMint {
let authority: Option<Pubkey> = confidential_transfer_mint.authority.into();
let auditor_elgamal_pubkey: Option<ElGamalPubkey> =
let auditor_elgamal_pubkey: Option<PodElGamalPubkey> =
confidential_transfer_mint.auditor_elgamal_pubkey.into();
UiConfidentialTransferMint {
authority: authority.map(|pubkey| pubkey.to_string()),
Expand All @@ -245,7 +251,7 @@ pub fn convert_confidential_transfer_fee_config(
confidential_transfer_fee_config: extension::confidential_transfer_fee::ConfidentialTransferFeeConfig,
) -> UiConfidentialTransferFeeConfig {
let authority: Option<Pubkey> = confidential_transfer_fee_config.authority.into();
let withdraw_withheld_authority_elgamal_pubkey: Option<ElGamalPubkey> =
let withdraw_withheld_authority_elgamal_pubkey: Option<PodElGamalPubkey> =
confidential_transfer_fee_config
.withdraw_withheld_authority_elgamal_pubkey
.into();
Expand Down Expand Up @@ -379,3 +385,13 @@ fn convert_token_group_member(member: TokenGroupMember) -> UiTokenGroupMember {
member_number: member.member_number.into(),
}
}

fn convert_confidential_mint_burn(
confidential_mint_burn: extension::confidential_mint_burn::ConfidentialMintBurn,
) -> UiConfidentialMintBurn {
UiConfidentialMintBurn {
confidential_supply: confidential_mint_burn.confidential_supply.to_string(),
decryptable_supply: confidential_mint_burn.decryptable_supply.to_string(),
supply_elgamal_pubkey: confidential_mint_burn.supply_elgamal_pubkey.to_string(),
}
}
Loading
Loading