spl: Bump token to 3.5.0 and ata to 1.1.0 (#26921)

This commit is contained in:
Jon Cinque 2022-08-05 03:05:31 +02:00 committed by GitHub
parent 300666dce7
commit b725b8617c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 175 additions and 26 deletions

13
Cargo.lock generated
View File

@ -6665,13 +6665,18 @@ dependencies = [
[[package]]
name = "spl-associated-token-account"
version = "1.0.5"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b013067447a1396303ddfc294f36e3d260a32f8a16c501c295bcdc7de39b490"
checksum = "16a33ecc83137583902c3e13c02f34151c8b2f2b74120f9c2b3ff841953e083d"
dependencies = [
"assert_matches",
"borsh",
"num-derive",
"num-traits",
"solana-program 1.10.33",
"spl-token",
"spl-token-2022",
"thiserror",
]
[[package]]
@ -6685,9 +6690,9 @@ dependencies = [
[[package]]
name = "spl-token"
version = "3.3.1"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d05653bed5932064a287340dbc8a3cb298ee717e5c7ec3353d7cdb9f8fb7e1"
checksum = "8e85e168a785e82564160dcb87b2a8e04cee9bfd1f4d488c729d53d6a4bd300d"
dependencies = [
"arrayref",
"bytemuck",

View File

@ -22,7 +22,7 @@ serde_json = "1.0.81"
solana-config-program = { path = "../programs/config", version = "=1.11.6" }
solana-sdk = { path = "../sdk", version = "=1.11.6" }
solana-vote-program = { path = "../programs/vote", version = "=1.11.6" }
spl-token = { version = "=3.3.1", features = ["no-entrypoint"] }
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
spl-token-2022 = { version = "=0.4.2", features = ["no-entrypoint"] }
thiserror = "1.0"
zstd = "0.11.2"

View File

@ -26,7 +26,7 @@ solana-sdk = { path = "../sdk", version = "=1.11.6" }
solana-streamer = { path = "../streamer", version = "=1.11.6" }
solana-transaction-status = { path = "../transaction-status", version = "=1.11.6" }
solana-version = { path = "../version", version = "=1.11.6" }
spl-token = { version = "=3.3.1", features = ["no-entrypoint"] }
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
[dev-dependencies]
solana-core = { path = "../core", version = "=1.11.6" }

View File

@ -38,10 +38,10 @@ fetch_program() {
}
fetch_program token 3.3.0 TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA BPFLoader2111111111111111111111111111111111
fetch_program token 3.5.0 TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA BPFLoader2111111111111111111111111111111111
fetch_program memo 1.0.0 Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo BPFLoader1111111111111111111111111111111111
fetch_program memo 3.0.0 MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr BPFLoader2111111111111111111111111111111111
fetch_program associated-token-account 1.0.5 ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL BPFLoader2111111111111111111111111111111111
fetch_program associated-token-account 1.1.1 ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL BPFLoader2111111111111111111111111111111111
fetch_program feature-proposal 1.0.0 Feat1YXHhH6t1juaWF74WLcfv4XoNocjXA6sPWHNgAse BPFLoader2111111111111111111111111111111111
echo "${genesis_args[@]}" > spl-genesis-args.sh

View File

@ -18,7 +18,7 @@ mod spl_associated_token_account {
}
static SPL_PROGRAMS: &[(Pubkey, &[u8])] = &[
(spl_token::ID, include_bytes!("programs/spl_token-3.3.0.so")),
(spl_token::ID, include_bytes!("programs/spl_token-3.5.0.so")),
(
spl_memo_1_0::ID,
include_bytes!("programs/spl_memo-1.0.0.so"),
@ -29,7 +29,7 @@ static SPL_PROGRAMS: &[(Pubkey, &[u8])] = &[
),
(
spl_associated_token_account::ID,
include_bytes!("programs/spl_associated_token_account-1.0.5.so"),
include_bytes!("programs/spl_associated_token_account-1.1.1.so"),
),
];

Binary file not shown.

View File

@ -5855,13 +5855,18 @@ dependencies = [
[[package]]
name = "spl-associated-token-account"
version = "1.0.5"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b013067447a1396303ddfc294f36e3d260a32f8a16c501c295bcdc7de39b490"
checksum = "16a33ecc83137583902c3e13c02f34151c8b2f2b74120f9c2b3ff841953e083d"
dependencies = [
"assert_matches",
"borsh",
"num-derive",
"num-traits",
"solana-program 1.10.33",
"spl-token",
"spl-token-2022",
"thiserror",
]
[[package]]
@ -5875,9 +5880,9 @@ dependencies = [
[[package]]
name = "spl-token"
version = "3.3.1"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d05653bed5932064a287340dbc8a3cb298ee717e5c7ec3353d7cdb9f8fb7e1"
checksum = "8e85e168a785e82564160dcb87b2a8e04cee9bfd1f4d488c729d53d6a4bd300d"
dependencies = [
"arrayref",
"bytemuck",

View File

@ -49,7 +49,7 @@ solana-streamer = { path = "../streamer", version = "=1.11.6" }
solana-transaction-status = { path = "../transaction-status", version = "=1.11.6" }
solana-version = { path = "../version", version = "=1.11.6" }
solana-vote-program = { path = "../programs/vote", version = "=1.11.6" }
spl-token = { version = "=3.3.1", features = ["no-entrypoint"] }
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
spl-token-2022 = { version = "=0.4.2", features = ["no-entrypoint"] }
stream-cancel = "0.8.1"
thiserror = "1.0"

View File

@ -27,8 +27,8 @@ solana-remote-wallet = { path = "../remote-wallet", version = "=1.11.6" }
solana-sdk = { path = "../sdk", version = "=1.11.6" }
solana-transaction-status = { path = "../transaction-status", version = "=1.11.6" }
solana-version = { path = "../version", version = "=1.11.6" }
spl-associated-token-account = { version = "=1.0.5" }
spl-token = { version = "=3.3.1", features = ["no-entrypoint"] }
spl-associated-token-account = { version = "=1.1.1" }
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
tempfile = "3.3.0"
thiserror = "1.0"

View File

@ -63,6 +63,7 @@ pub fn build_spl_token_instructions(
&spl_token_pubkey(&args.fee_payer.pubkey()),
&wallet_address,
&spl_token_pubkey(&spl_token_args.mint),
&spl_token::id(),
);
instructions.push(spl_token_instruction(
create_associated_token_account_instruction,

View File

@ -26,9 +26,9 @@ solana-metrics = { path = "../metrics", version = "=1.11.6" }
solana-runtime = { path = "../runtime", version = "=1.11.6" }
solana-sdk = { path = "../sdk", version = "=1.11.6" }
solana-vote-program = { path = "../programs/vote", version = "=1.11.6" }
spl-associated-token-account = { version = "=1.0.5", features = ["no-entrypoint"] }
spl-associated-token-account = { version = "=1.1.1", features = ["no-entrypoint"] }
spl-memo = { version = "=3.0.1", features = ["no-entrypoint"] }
spl-token = { version = "=3.3.1", features = ["no-entrypoint"] }
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
spl-token-2022 = { version = "=0.4.2", features = ["no-entrypoint"] }
thiserror = "1.0"

View File

@ -61,6 +61,35 @@ pub fn parse_associated_token(
}),
})
}
AssociatedTokenAccountInstruction::CreateIdempotent => {
check_num_associated_token_accounts(&instruction.accounts, 6)?;
Ok(ParsedInstructionEnum {
instruction_type: "createIdempotent".to_string(),
info: json!({
"source": account_keys[instruction.accounts[0] as usize].to_string(),
"account": account_keys[instruction.accounts[1] as usize].to_string(),
"wallet": account_keys[instruction.accounts[2] as usize].to_string(),
"mint": account_keys[instruction.accounts[3] as usize].to_string(),
"systemProgram": account_keys[instruction.accounts[4] as usize].to_string(),
"tokenProgram": account_keys[instruction.accounts[5] as usize].to_string(),
}),
})
}
AssociatedTokenAccountInstruction::RecoverNested => {
check_num_associated_token_accounts(&instruction.accounts, 7)?;
Ok(ParsedInstructionEnum {
instruction_type: "recoverNested".to_string(),
info: json!({
"nestedSource": account_keys[instruction.accounts[0] as usize].to_string(),
"nestedMint": account_keys[instruction.accounts[1] as usize].to_string(),
"destination": account_keys[instruction.accounts[2] as usize].to_string(),
"nestedOwner": account_keys[instruction.accounts[3] as usize].to_string(),
"ownerMint": account_keys[instruction.accounts[4] as usize].to_string(),
"wallet": account_keys[instruction.accounts[5] as usize].to_string(),
"tokenProgram": account_keys[instruction.accounts[6] as usize].to_string(),
}),
})
}
}
}
}
@ -80,8 +109,11 @@ mod test {
super::*,
solana_account_decoder::parse_token::pubkey_from_spl_token,
spl_associated_token_account::{
get_associated_token_address,
instruction::create_associated_token_account,
get_associated_token_address, get_associated_token_address_with_program_id,
instruction::{
create_associated_token_account, create_associated_token_account_idempotent,
recover_nested,
},
solana_program::{
instruction::CompiledInstruction as SplAssociatedTokenCompiledInstruction,
message::Message, pubkey::Pubkey as SplAssociatedTokenPubkey, sysvar,
@ -112,7 +144,7 @@ mod test {
}
#[test]
fn test_parse_associated_token_deprecated() {
fn test_parse_create_deprecated() {
let funder = Pubkey::new_unique();
let wallet_address = Pubkey::new_unique();
let mint = Pubkey::new_unique();
@ -154,16 +186,21 @@ mod test {
}
#[test]
fn test_parse_associated_token() {
fn test_parse_create() {
let funder = Pubkey::new_unique();
let wallet_address = Pubkey::new_unique();
let mint = Pubkey::new_unique();
let associated_account_address =
get_associated_token_address(&convert_pubkey(wallet_address), &convert_pubkey(mint));
let token_program_id = Pubkey::new_unique();
let associated_account_address = get_associated_token_address_with_program_id(
&convert_pubkey(wallet_address),
&convert_pubkey(mint),
&convert_pubkey(token_program_id),
);
let create_ix = create_associated_token_account(
&convert_pubkey(funder),
&convert_pubkey(wallet_address),
&convert_pubkey(mint),
&convert_pubkey(token_program_id),
);
let message = Message::new(&[create_ix], None);
let mut compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
@ -181,7 +218,108 @@ mod test {
"wallet": wallet_address.to_string(),
"mint": mint.to_string(),
"systemProgram": solana_sdk::system_program::id().to_string(),
"tokenProgram": spl_token::id().to_string(),
"tokenProgram": token_program_id.to_string(),
})
}
);
compiled_instruction.accounts.pop();
assert!(parse_associated_token(
&compiled_instruction,
&AccountKeys::new(&convert_account_keys(&message), None)
)
.is_err());
}
#[test]
fn test_parse_create_idempotent() {
let funder = Pubkey::new_unique();
let wallet_address = Pubkey::new_unique();
let mint = Pubkey::new_unique();
let token_program_id = Pubkey::new_unique();
let associated_account_address = get_associated_token_address_with_program_id(
&convert_pubkey(wallet_address),
&convert_pubkey(mint),
&convert_pubkey(token_program_id),
);
let create_ix = create_associated_token_account_idempotent(
&convert_pubkey(funder),
&convert_pubkey(wallet_address),
&convert_pubkey(mint),
&convert_pubkey(token_program_id),
);
let message = Message::new(&[create_ix], None);
let mut compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
assert_eq!(
parse_associated_token(
&compiled_instruction,
&AccountKeys::new(&convert_account_keys(&message), None)
)
.unwrap(),
ParsedInstructionEnum {
instruction_type: "createIdempotent".to_string(),
info: json!({
"source": funder.to_string(),
"account": associated_account_address.to_string(),
"wallet": wallet_address.to_string(),
"mint": mint.to_string(),
"systemProgram": solana_sdk::system_program::id().to_string(),
"tokenProgram": token_program_id.to_string(),
})
}
);
compiled_instruction.accounts.pop();
assert!(parse_associated_token(
&compiled_instruction,
&AccountKeys::new(&convert_account_keys(&message), None)
)
.is_err());
}
#[test]
fn test_parse_recover_nested() {
let wallet_address = Pubkey::new_unique();
let owner_mint = Pubkey::new_unique();
let nested_mint = Pubkey::new_unique();
let token_program_id = Pubkey::new_unique();
let owner_associated_account_address = get_associated_token_address_with_program_id(
&convert_pubkey(wallet_address),
&convert_pubkey(owner_mint),
&convert_pubkey(token_program_id),
);
let nested_associated_account_address = get_associated_token_address_with_program_id(
&owner_associated_account_address,
&convert_pubkey(nested_mint),
&convert_pubkey(token_program_id),
);
let destination_associated_account_address = get_associated_token_address_with_program_id(
&convert_pubkey(wallet_address),
&convert_pubkey(nested_mint),
&convert_pubkey(token_program_id),
);
let recover_ix = recover_nested(
&convert_pubkey(wallet_address),
&convert_pubkey(owner_mint),
&convert_pubkey(nested_mint),
&convert_pubkey(token_program_id),
);
let message = Message::new(&[recover_ix], None);
let mut compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
assert_eq!(
parse_associated_token(
&compiled_instruction,
&AccountKeys::new(&convert_account_keys(&message), None)
)
.unwrap(),
ParsedInstructionEnum {
instruction_type: "recoverNested".to_string(),
info: json!({
"nestedSource": nested_associated_account_address.to_string(),
"nestedMint": nested_mint.to_string(),
"destination": destination_associated_account_address.to_string(),
"nestedOwner": owner_associated_account_address.to_string(),
"ownerMint": owner_mint.to_string(),
"wallet": wallet_address.to_string(),
"tokenProgram": token_program_id.to_string(),
})
}
);