Cargo.toml: Remove duplicate solana dependencies (#31607)

See comment in Cargo.toml for an explanation of the issue.

This change removes duplicate dependencies for older version of solana-*
crates, and any of the dependencies that are no longer needed.
This commit is contained in:
Illia Bobyr 2023-05-15 19:02:11 -07:00 committed by GitHub
parent 69dfd842c8
commit 00405bbc42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 476 additions and 1142 deletions

706
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -404,3 +404,27 @@ zstd = "0.11.2"
# for details, see https://github.com/solana-labs/crossbeam/commit/fd279d707025f0e60951e429bf778b4813d1b6bf
[patch.crates-io]
crossbeam-epoch = { git = "https://github.com/solana-labs/crossbeam", rev = "fd279d707025f0e60951e429bf778b4813d1b6bf" }
# We include the following crates as our dependencies above from crates.io:
#
# * spl-associated-token-account
# * spl-instruction-padding
# * spl-memo
# * spl-token
# * spl-token-2022
#
# They, in turn, depend on a number of crates that we also include directly using `path`
# specifications. For example, `spl-token` depends on `solana-program`. And we explicitly specify
# `solana-program` above as a local path dependency:
#
# solana-program = { path = "../../sdk/program", version = "=1.16.0" }
#
# Unfortunately, Cargo will try to resolve the `spl-token` `solana-program` dependency only using
# what is available on crates.io. Crates.io normally contains a previous version of these crates,
# and we end up with two versions of `solana-program` and `solana-zk-token-sdk` and all of their
# dependencies in our build tree.
#
# There is a similar override in `programs/sbf/Cargo.toml`. Please keep both comments and the
# overrides in sync.
solana-program = { path = "sdk/program" }
solana-zk-token-sdk = { path = "zk-token-sdk" }

View File

@ -4,7 +4,6 @@ use {
cli::{Config, InstructionPaddingConfig},
perf_utils::{sample_txs, SampleStats},
send_batch::*,
spl_convert::FromOtherSolana,
},
log::*,
rand::distributions::{Distribution, Uniform},
@ -577,15 +576,13 @@ fn transfer_with_compute_unit_price_and_padding(
let from_pubkey = from_keypair.pubkey();
let transfer_instruction = system_instruction::transfer(&from_pubkey, to, lamports);
let instruction = if let Some(instruction_padding_config) = instruction_padding_config {
FromOtherSolana::from(
wrap_instruction(
FromOtherSolana::from(instruction_padding_config.program_id),
FromOtherSolana::from(transfer_instruction),
vec![],
instruction_padding_config.data_size,
)
.expect("Could not create padded instruction"),
wrap_instruction(
instruction_padding_config.program_id,
transfer_instruction,
vec![],
instruction_padding_config.data_size,
)
.expect("Could not create padded instruction")
} else {
transfer_instruction
};
@ -672,15 +669,13 @@ fn nonced_transfer_with_padding(
let from_pubkey = from_keypair.pubkey();
let transfer_instruction = system_instruction::transfer(&from_pubkey, to, lamports);
let instruction = if let Some(instruction_padding_config) = instruction_padding_config {
FromOtherSolana::from(
wrap_instruction(
FromOtherSolana::from(instruction_padding_config.program_id),
FromOtherSolana::from(transfer_instruction),
vec![],
instruction_padding_config.data_size,
)
.expect("Could not create padded instruction"),
wrap_instruction(
instruction_padding_config.program_id,
transfer_instruction,
vec![],
instruction_padding_config.data_size,
)
.expect("Could not create padded instruction")
} else {
transfer_instruction
};

View File

@ -1,5 +1,4 @@
use {
crate::spl_convert::FromOtherSolana,
clap::{crate_description, crate_name, App, Arg, ArgMatches},
solana_clap_utils::{
hidden_unless_forced,
@ -530,7 +529,7 @@ pub fn parse_args(matches: &ArgMatches) -> Result<Config, &'static str> {
let program_id = matches
.value_of("instruction_padding_program_id")
.map(|target_str| target_str.parse().unwrap())
.unwrap_or_else(|| FromOtherSolana::from(spl_instruction_padding::ID));
.unwrap_or_else(|| spl_instruction_padding::ID);
let data_size = data_size
.parse()
.map_err(|_| "Can't parse padded instruction data size")?;

View File

@ -5,4 +5,3 @@ pub mod cli;
pub mod keypairs;
mod perf_utils;
pub mod send_batch;
pub mod spl_convert;

View File

@ -1,62 +0,0 @@
use {
solana_sdk::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
},
spl_instruction_padding::solana_program::{
instruction::{AccountMeta as SplAccountMeta, Instruction as SplInstruction},
pubkey::Pubkey as SplPubkey,
},
};
pub trait FromOtherSolana<T> {
fn from(_: T) -> Self;
}
macro_rules! impl_pubkey_conversion {
($S:ty, $L:ty) => {
impl FromOtherSolana<$S> for $L {
fn from(pubkey: $S) -> Self {
Self::new_from_array(pubkey.to_bytes())
}
}
};
}
impl_pubkey_conversion!(SplPubkey, Pubkey);
impl_pubkey_conversion!(Pubkey, SplPubkey);
macro_rules! impl_account_meta_conversion {
($S:ty, $L:ty) => {
impl FromOtherSolana<$S> for $L {
fn from(meta: $S) -> Self {
Self {
pubkey: FromOtherSolana::from(meta.pubkey),
is_signer: meta.is_signer,
is_writable: meta.is_writable,
}
}
}
};
}
impl_account_meta_conversion!(SplAccountMeta, AccountMeta);
impl_account_meta_conversion!(AccountMeta, SplAccountMeta);
macro_rules! impl_instruction_conversion {
($S: ty, $L:ty) => {
impl FromOtherSolana<$S> for $L {
fn from(instruction: $S) -> Self {
Self {
program_id: FromOtherSolana::from(instruction.program_id),
accounts: instruction
.accounts
.into_iter()
.map(|meta| FromOtherSolana::from(meta))
.collect(),
data: instruction.data,
}
}
}
};
}
impl_instruction_conversion!(SplInstruction, Instruction);
impl_instruction_conversion!(Instruction, SplInstruction);

View File

@ -6,7 +6,6 @@ use {
bench::{do_bench_tps, generate_and_fund_keypairs},
cli::{Config, InstructionPaddingConfig},
send_batch::generate_durable_nonce_accounts,
spl_convert::FromOtherSolana,
},
solana_client::{
thin_client::ThinClient,
@ -45,7 +44,7 @@ fn program_account(program_data: &[u8]) -> AccountSharedData {
fn test_bench_tps_local_cluster(config: Config) {
let native_instruction_processors = vec![];
let additional_accounts = vec![(
FromOtherSolana::from(spl_instruction_padding::ID),
spl_instruction_padding::ID,
program_account(include_bytes!("fixtures/spl_instruction_padding.so")),
)];
@ -121,10 +120,7 @@ fn test_bench_tps_test_validator(config: Config) {
..Rent::default()
})
.faucet_addr(Some(faucet_addr))
.add_program(
"spl_instruction_padding",
FromOtherSolana::from(spl_instruction_padding::ID),
)
.add_program("spl_instruction_padding", spl_instruction_padding::ID)
.start_with_mint_address(mint_pubkey, SocketAddrSpace::Unspecified)
.expect("validator start failed");
@ -196,7 +192,7 @@ fn test_bench_tps_local_cluster_with_padding() {
tx_count: 100,
duration: Duration::from_secs(10),
instruction_padding_config: Some(InstructionPaddingConfig {
program_id: FromOtherSolana::from(spl_instruction_padding::ID),
program_id: spl_instruction_padding::ID,
data_size: 0,
}),
..Config::default()
@ -210,7 +206,7 @@ fn test_bench_tps_tpu_client_with_padding() {
tx_count: 100,
duration: Duration::from_secs(10),
instruction_padding_config: Some(InstructionPaddingConfig {
program_id: FromOtherSolana::from(spl_instruction_padding::ID),
program_id: spl_instruction_padding::ID,
data_size: 0,
}),
..Config::default()

747
programs/sbf/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -158,3 +158,37 @@ members = [
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[patch.crates-io]
# We include the following crates as our dependencies from crates.io:
#
# * spl-associated-token-account
# * spl-instruction-padding
# * spl-memo
# * spl-token
# * spl-token-2022
#
# They are included indirectly, for example, `account-decoder` depends on
#
# solana-sdk = { workspace = true }
#
# and that is specified as
#
# spl-token = "=3.5.0"
#
# in `../../Cargo.toml`.
#
# `spl-token`, in turn, depends on `solana-program`, which we explicitly specify above as a local
# path dependency:
#
# solana-program = { path = "../../sdk/program", version = "=1.16.0" }
#
# Unfortunately, Cargo will try to resolve the `spl-token` `solana-program` dependency only using
# what is available on crates.io. Crates.io normally contains a previous version of these crates,
# and we end up with two versions of `solana-program` and `solana-zk-token-sdk` and all of their
# dependencies in our build tree.
#
# There is a similar override in `../../Cargo.toml`. Please keep both comments and the
# overrides in sync.
solana-program = { path = "../../sdk/program" }
solana-zk-token-sdk = { path = "../../zk-token-sdk" }