Skip to content
Merged
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
4,104 changes: 2,490 additions & 1,614 deletions Cargo.lock

Large diffs are not rendered by default.

81 changes: 40 additions & 41 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,58 +41,57 @@ edition = "2021"

[workspace.dependencies]
anyhow = "1.0.100"
borsh = "0.10.4"
borsh = "1"
bytemuck = { version = "1.25.0", features = ["derive"] }
clap = { version = "3.2.25", features = ["derive"] }
libtest-mimic = "0.8.2"
mollusk-svm = "0.4.2"
mollusk-svm-programs-token = "0.4.1"
mpl-token-metadata = "5.1.1"
mollusk-svm = "0.11.0"
mollusk-svm-programs-token = "0.11.0"
mpl-token-metadata = "5.1.2-alpha.2"
num-derive = "0.4.2"
num-traits = "0.2.19"
serde = "1.0.228"
serde_derive = "1.0.219"
serde_json = "1.0.149"
serde_with = "3.15.0"
serial_test = "3.2.0"
solana-account = "2.2.1"
solana-account-info = "2.3.0"
solana-clap-v3-utils = "2.3.1"
solana-cli-config = "2.3.1"
solana-cli-output = "2.3.1"
solana-client = "2.3.1"
solana-commitment-config = "2.2.1"
solana-cpi = "2.2.1"
solana-logger = "2.3.1"
solana-hash = "2.3.0"
solana-instruction = "2.3.0"
solana-keypair = "2.2.1"
solana-msg = "2.2.1"
solana-presigner = "2.2.1"
solana-program-entrypoint = "2.3.0"
solana-program-error = "2.2.2"
solana-program-option = "2.2.1"
solana-program-pack = "2.2.1"
solana-pubkey = "2.4.0"
solana-remote-wallet = "2.3.1"
solana-rent = "2.2.1"
solana-sdk-ids = "2.2.1"
solana-signature = "2.3.0"
solana-signer = "2.2.1"
solana-system-interface = { version = "1.0.0", features = ["bincode"] }
solana-sysvar = "2.3.0"
solana-test-validator = "2.3.1"
solana-transaction = "2.2.2"
solana-zk-sdk = "2.3.7"
spl-associated-token-account-client = "2.0.0"
spl-pod = "0.5.1"
spl-tlv-account-resolution = "0.10.0"
spl-token = { version = "8.0.0", features = ["no-entrypoint"] }
spl-token-2022 = { version = "9.0.0", features = ["no-entrypoint"] }
spl-token-metadata-interface = "0.7.0"
solana-account = "3.4.0"
solana-account-info = "3.1.1"
solana-clap-v3-utils = { version = "3.1.11", features = ["agave-unstable-api"] }
solana-cli-config = { version = "3.1.11", features = ["agave-unstable-api"] }
solana-cli-output = { version = "3.1.11", features = ["agave-unstable-api"] }
solana-client = { version = "3.1.11", features = ["agave-unstable-api"] }
solana-commitment-config = "3.1.1"
solana-cpi = "3.1.0"
solana-hash = "4.2.0"
solana-instruction = "3.0.0"
solana-keypair = "3.0.0"
solana-msg = "3.1.0"
solana-presigner = "3.0.0"
solana-program-entrypoint = "3.1.1"
solana-program-error = "3.0.1"
solana-program-option = "3.1.0"
solana-program-pack = "3.1.0"
solana-pubkey = "4.1.0"
solana-remote-wallet = { version = "3.1.11", features = ["agave-unstable-api"] }
solana-rent = "3.0.0"
solana-sdk-ids = "3.1.0"
solana-signature = "3.1.0"
solana-signer = "3.0.0"
solana-system-interface = { version = "2.0.0", features = ["bincode"] }
solana-sysvar = "3.0.0"
solana-test-validator = { version = "3.1.11", features = ["agave-unstable-api"] }
solana-transaction = "3.0.0"
solana-zk-sdk = "4.0.0"
spl-associated-token-account-interface = "2.0.0"
spl-pod = "0.7.2"
spl-tlv-account-resolution = "0.11.1"
spl-token = { version = "9.0.0", features = ["no-entrypoint"] }
spl-token-2022 = { version = "10.0.0", features = ["no-entrypoint"] }
spl-token-metadata-interface = "0.8.0"
spl-token-wrap = { version = "1.0.0", path = "program", features = ["no-entrypoint"] }
spl-transfer-hook-interface = "0.10.0"
spl-type-length-value = "0.8.0"
spl-transfer-hook-interface = "2.1.0"
spl-type-length-value = "0.9.1"
tempfile = "3.23.0"
test-case = "3.3.1"
test-metadata-owner = { path = "program/test-metadata-owner", features = ["no-entrypoint"] }
Expand Down
3 changes: 1 addition & 2 deletions clients/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ solana-commitment-config = { workspace = true }
solana-hash = { workspace = true }
solana-instruction = { workspace = true }
solana-keypair = { workspace = true }
solana-logger = { workspace = true }
solana-presigner = { workspace = true }
solana-program-pack = { workspace = true }
solana-pubkey = { workspace = true }
Expand All @@ -31,7 +30,7 @@ solana-signature = { workspace = true }
solana-signer = { workspace = true }
solana-system-interface = { workspace = true }
solana-transaction = { workspace = true }
spl-associated-token-account-client = { workspace = true }
spl-associated-token-account-interface = { workspace = true }
spl-token = { workspace = true }
spl-token-metadata-interface = { workspace = true }
spl-token-wrap = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion clients/cli/src/create_escrow_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use {
solana_signature::Signature,
solana_signer::Signer,
solana_transaction::Transaction,
spl_associated_token_account_client::instruction::create_associated_token_account,
spl_associated_token_account_interface::instruction::create_associated_token_account,
spl_token_wrap::{get_escrow_address, get_wrapped_mint_address, get_wrapped_mint_authority},
std::fmt::{Display, Formatter},
};
Expand Down
2 changes: 0 additions & 2 deletions clients/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ async fn main() -> Result<(), Error> {

let config = Config::new(cli.clone(), matches.clone(), &mut wallet_manager)?;

solana_logger::setup_with_default("solana=info");

let result = cli
.command
.execute(&config, &matches, &mut wallet_manager)
Expand Down
2 changes: 1 addition & 1 deletion clients/cli/src/wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use {
solana_signature::Signature,
solana_signer::Signer,
solana_transaction::Transaction,
spl_associated_token_account_client::address::get_associated_token_address_with_program_id,
spl_associated_token_account_interface::address::get_associated_token_address_with_program_id,
spl_token_wrap::{
get_escrow_address, get_wrapped_mint_address, get_wrapped_mint_authority, instruction::wrap,
},
Expand Down
16 changes: 9 additions & 7 deletions clients/cli/tests/common/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use {
serde_json::Value,
solana_cli_config::Config as SolanaConfig,
solana_client::nonblocking::rpc_client::RpcClient,
solana_commitment_config::CommitmentConfig,
solana_keypair::{write_keypair_file, Keypair},
solana_program_pack::Pack,
solana_pubkey::Pubkey,
Expand All @@ -13,7 +14,7 @@ use {
solana_system_interface::instruction::create_account,
solana_test_validator::{TestValidator, TestValidatorGenesis, UpgradeableProgramInfo},
solana_transaction::Transaction,
spl_associated_token_account_client::address::get_associated_token_address_with_program_id,
spl_associated_token_account_interface::address::get_associated_token_address_with_program_id,
spl_token::{self, state::Mint as SplTokenMint},
spl_token_2022::instruction::initialize_mint,
std::{error::Error, path::PathBuf, process::Command, sync::Arc},
Expand All @@ -33,7 +34,6 @@ pub struct TestEnv {
}

pub async fn start_validator() -> (TestValidator, Keypair) {
solana_logger::setup();
let mut test_validator_genesis = TestValidatorGenesis::default();

test_validator_genesis.add_upgradeable_programs_with_path(&[
Expand Down Expand Up @@ -65,20 +65,22 @@ pub async fn setup_test_env() -> TestEnv {
// Create and save CLI configuration file
let config_file = NamedTempFile::new().unwrap();
let config_file_path = config_file.path().to_str().unwrap().to_string();
let rpc_client = Arc::new(RpcClient::new_with_commitment(
validator.rpc_url(),
CommitmentConfig::confirmed(),
));
let solana_config = SolanaConfig {
json_rpc_url: validator.rpc_url(),
websocket_url: validator.rpc_pubsub_url(),
keypair_path: keypair_file_path,
commitment: rpc_client.commitment().commitment.to_string(),
..SolanaConfig::default()
};
solana_config.save(&config_file_path).unwrap();

// Wait one slot to make tests less flaky, remove this when upgrading to v3
tokio::time::sleep(std::time::Duration::from_millis(400)).await;

TestEnv {
payer: Arc::new(payer),
rpc_client: Arc::new(validator.get_async_rpc_client()),
rpc_client,
config_file_path,
_keypair_file: Arc::new(keypair_file),
_config_file: Arc::new(config_file),
Expand Down Expand Up @@ -202,7 +204,7 @@ pub async fn create_associated_token_account(
}

let instruction =
spl_associated_token_account_client::instruction::create_associated_token_account(
spl_associated_token_account_interface::instruction::create_associated_token_account(
&env.payer.pubkey(),
wallet_addr,
mint,
Expand Down
6 changes: 2 additions & 4 deletions program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ solana-rent = { workspace = true }
solana-system-interface = { workspace = true }
solana-sysvar = { workspace = true }
solana-zk-sdk = { workspace = true }
spl-associated-token-account-client = { workspace = true }
spl-associated-token-account-interface = { workspace = true }
spl-pod = { workspace = true }
spl-token = { workspace = true }
spl-token-2022 = { workspace = true }
spl-token-metadata-interface = { workspace = true }
spl-transfer-hook-interface = { workspace = true }
spl-type-length-value = { workspace = true }
thiserror = { workspace = true }

# Should depend on the next crate version after 7.0.0 when https://github.com/solana-program/token-2022/pull/253 is deployed
spl-token-2022 = { workspace = true }

[dev-dependencies]
borsh = { workspace = true }
mollusk-svm = { workspace = true }
Expand Down
5 changes: 1 addition & 4 deletions program/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ impl TryFrom<u32> for TokenWrapError {
}

impl ToStr for TokenWrapError {
fn to_str<E>(&self) -> &'static str
where
E: 'static + ToStr + TryFrom<u32>,
{
fn to_str(&self) -> &'static str {
match self {
TokenWrapError::WrappedMintMismatch => "Error: WrappedMintMismatch",
TokenWrapError::BackpointerMismatch => "Error: BackpointerMismatch",
Expand Down
2 changes: 1 addition & 1 deletion program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub mod state;

use {
solana_pubkey::Pubkey,
spl_associated_token_account_client::address::get_associated_token_address_with_program_id,
spl_associated_token_account_interface::address::get_associated_token_address_with_program_id,
};

solana_pubkey::declare_id!("TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR");
Expand Down
2 changes: 1 addition & 1 deletion program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use {
solana_rent::Rent,
solana_system_interface::instruction::{allocate, assign},
solana_sysvar::{clock::Clock, Sysvar},
spl_associated_token_account_client::address::get_associated_token_address_with_program_id,
spl_associated_token_account_interface::address::get_associated_token_address_with_program_id,
spl_token_2022::{
extension::{
transfer_fee::TransferFeeConfig, BaseStateWithExtensions, ExtensionType,
Expand Down
Binary file added program/tests/fixtures/spl_token_2022.so
Binary file not shown.
19 changes: 4 additions & 15 deletions program/tests/helpers/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,10 @@ pub fn init_mollusk() -> Mollusk {
mollusk_svm_programs_token::token::add_program(&mut mollusk);
mollusk_svm_programs_token::token2022::add_program(&mut mollusk);
mollusk_svm_programs_token::associated_token::add_program(&mut mollusk);
mollusk.add_program(
&test_transfer_hook::id(),
"test_transfer_hook",
&mollusk_svm::program::loader_keys::LOADER_V3,
);
mollusk.add_program(
&test_metadata_owner::ID,
"test_metadata_owner",
&mollusk_svm::program::loader_keys::LOADER_V3,
);
mollusk.add_program(
&mpl_token_metadata::ID,
"mpl_token_metadata",
&mollusk_svm::program::loader_keys::LOADER_V3,
);
mollusk.add_program(&test_transfer_hook::id(), "test_transfer_hook");
mollusk.add_program(&test_metadata_owner::ID, "test_metadata_owner");
mollusk.add_program(&mpl_token_metadata::ID, "mpl_token_metadata");
mollusk.add_program(&spl_token_2022::ID, "spl_token_2022");
mollusk
}

Expand Down
3 changes: 1 addition & 2 deletions program/tests/helpers/sync_to_spl_token_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use {
common::{init_mollusk, KeyedAccount, TokenProgram},
mint_builder::MintBuilder,
},
borsh::BorshSerialize,
mollusk_svm::{result::Check, Mollusk},
mpl_token_metadata::{accounts::Metadata as MetaplexMetadata, types::Key},
solana_account::Account,
Expand Down Expand Up @@ -114,7 +113,7 @@ impl<'a> SyncToSplTokenBuilder<'a> {
programmable_config: None,
};
let source_account = Account {
data: source_metadata_obj.try_to_vec().unwrap(),
data: borsh::to_vec(&source_metadata_obj).unwrap(),
owner: mpl_token_metadata::ID,
lamports: 1_000_000_000,
..Default::default()
Expand Down
Loading
Loading