Skip to content

Commit

Permalink
replace solana_sdk::pubkey with solana_pubkey in solana-core (#4182)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey authored Jan 2, 2025
1 parent 892dee8 commit 2a2a782
Show file tree
Hide file tree
Showing 33 changed files with 95 additions and 106 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ solana-metrics = { workspace = true }
solana-net-utils = { workspace = true }
solana-perf = { workspace = true }
solana-poh = { workspace = true }
solana-pubkey = { workspace = true }
solana-quic-client = { workspace = true }
solana-rayon-threadlimit = { workspace = true }
solana-rpc = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion core/benches/forwarder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn setup(num_packets: usize, contentious_transaction: bool) -> BenchSetup {
let mut transaction =
system_transaction::transfer(&keypair, &Keypair::new().pubkey(), min_balance, hash);
if !contentious_transaction {
transaction.message.account_keys[0] = solana_sdk::pubkey::Pubkey::new_unique();
transaction.message.account_keys[0] = solana_pubkey::Pubkey::new_unique();
}
let mut packet = Packet::from_data(None, transaction).unwrap();
packet.meta_mut().set_from_staked_node(true);
Expand Down
12 changes: 6 additions & 6 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -968,16 +968,16 @@ mod tests {
bank.process_transaction(&fund_tx).unwrap();

// good tx
let to = solana_sdk::pubkey::new_rand();
let to = solana_pubkey::new_rand();
let tx = system_transaction::transfer(&mint_keypair, &to, 1, start_hash);

// good tx, but no verify
let to2 = solana_sdk::pubkey::new_rand();
let to2 = solana_pubkey::new_rand();
let tx_no_ver = system_transaction::transfer(&keypair, &to2, 2, start_hash);

// bad tx, AccountNotFound
let keypair = Keypair::new();
let to3 = solana_sdk::pubkey::new_rand();
let to3 = solana_pubkey::new_rand();
let tx_anf = system_transaction::transfer(&keypair, &to3, 1, start_hash);

// send 'em over
Expand Down Expand Up @@ -1200,9 +1200,9 @@ mod tests {
.write()
.unwrap()
.set_bank_for_test(bank.clone());
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();
let keypair2 = Keypair::new();
let pubkey2 = solana_sdk::pubkey::new_rand();
let pubkey2 = solana_pubkey::new_rand();

let txs = vec![
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_config.hash())
Expand Down Expand Up @@ -1234,7 +1234,7 @@ mod tests {
}

pub(crate) fn create_slow_genesis_config(lamports: u64) -> GenesisConfigInfo {
create_slow_genesis_config_with_leader(lamports, &solana_sdk::pubkey::new_rand())
create_slow_genesis_config_with_leader(lamports, &solana_pubkey::new_rand())
}

pub(crate) fn create_slow_genesis_config_with_leader(
Expand Down
22 changes: 11 additions & 11 deletions core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1038,9 +1038,9 @@ mod tests {
let poh_recorder = Arc::new(RwLock::new(poh_recorder));

// Set up unparallelizable conflicting transactions
let pubkey0 = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_sdk::pubkey::new_rand();
let pubkey2 = solana_sdk::pubkey::new_rand();
let pubkey0 = solana_pubkey::new_rand();
let pubkey1 = solana_pubkey::new_rand();
let pubkey2 = solana_pubkey::new_rand();
let transactions = vec![
system_transaction::transfer(mint_keypair, &pubkey0, 1, genesis_config.hash()),
system_transaction::transfer(mint_keypair, &pubkey1, 1, genesis_config.hash()),
Expand Down Expand Up @@ -1080,7 +1080,7 @@ mod tests {
..
} = create_slow_genesis_config(10_000);
let (bank, _bank_forks) = Bank::new_no_wallclock_throttle_for_tests(&genesis_config);
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();

let transactions = sanitize_transactions(vec![system_transaction::transfer(
&mint_keypair,
Expand Down Expand Up @@ -1373,7 +1373,7 @@ mod tests {
..
} = create_slow_genesis_config(10_000);
let (bank, _bank_forks) = Bank::new_no_wallclock_throttle_for_tests(&genesis_config);
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();

let transactions = {
let mut tx =
Expand Down Expand Up @@ -1460,7 +1460,7 @@ mod tests {
let mut bank = Bank::new_for_tests(&genesis_config);
bank.ns_per_slot = u128::MAX;
let (bank, _bank_forks) = bank.wrap_with_bank_forks_for_tests();
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();

let ledger_path = get_tmp_ledger_path_auto_delete!();
{
Expand Down Expand Up @@ -1616,8 +1616,8 @@ mod tests {
..
} = create_slow_genesis_config(10_000);
let (bank, _bank_forks) = Bank::new_no_wallclock_throttle_for_tests(&genesis_config);
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();
let pubkey1 = solana_pubkey::new_rand();

let transactions = sanitize_transactions(vec![
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_config.hash()),
Expand Down Expand Up @@ -1823,7 +1823,7 @@ mod tests {
} = create_slow_genesis_config(10_000);
let (bank, _bank_forks) = Bank::new_no_wallclock_throttle_for_tests(&genesis_config);

let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();

let transactions = sanitize_transactions(vec![system_transaction::transfer(
&mint_keypair,
Expand Down Expand Up @@ -1905,8 +1905,8 @@ mod tests {
genesis_config.rent.lamports_per_byte_year = 50;
genesis_config.rent.exemption_threshold = 2.0;
let (bank, _bank_forks) = Bank::new_no_wallclock_throttle_for_tests(&genesis_config);
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();
let pubkey1 = solana_pubkey::new_rand();
let keypair1 = Keypair::new();

let rent_exempt_amount = bank.get_minimum_balance_for_rent_exemption(0);
Expand Down
4 changes: 2 additions & 2 deletions core/src/banking_stage/decision_maker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ mod tests {

#[test]
fn test_should_process_or_forward_packets() {
let my_pubkey = solana_sdk::pubkey::new_rand();
let my_pubkey1 = solana_sdk::pubkey::new_rand();
let my_pubkey = solana_pubkey::new_rand();
let my_pubkey1 = solana_pubkey::new_rand();
let bank = Arc::new(Bank::default_for_tests());
let bank_start = Some(BankStart {
working_bank: bank,
Expand Down
10 changes: 5 additions & 5 deletions core/src/banking_stage/forward_packet_batches_by_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ mod tests {
DeserializedPacket,
u32,
) {
let from_account = solana_sdk::pubkey::new_rand();
let from_account = solana_pubkey::new_rand();

let transaction = Transaction::new_unsigned(Message::new(
&[
Expand All @@ -214,8 +214,8 @@ mod tests {
fn test_try_add_packet_to_multiple_batches() {
// setup two transactions, one has high priority that writes to hot account, the
// other write to non-contentious account with no priority
let hot_account = solana_sdk::pubkey::new_rand();
let other_account = solana_sdk::pubkey::new_rand();
let hot_account = solana_pubkey::new_rand();
let other_account = solana_pubkey::new_rand();
let (tx_high_priority, packet_high_priority, limit_ratio) =
build_test_transaction_and_packet(10, &hot_account);
let (tx_low_priority, packet_low_priority, _) =
Expand Down Expand Up @@ -292,7 +292,7 @@ mod tests {
#[test]
fn test_try_add_packet_to_single_batch() {
let (tx, packet, limit_ratio) =
build_test_transaction_and_packet(10, &solana_sdk::pubkey::new_rand());
build_test_transaction_and_packet(10, &solana_pubkey::new_rand());
let number_of_batches = 1;
let mut forward_packet_batches_by_accounts =
ForwardPacketBatchesByAccounts::new(limit_ratio, number_of_batches);
Expand Down Expand Up @@ -332,7 +332,7 @@ mod tests {
{
// build a small packet to a non-contentious account with high priority
let (tx2, packet2, _) =
build_test_transaction_and_packet(100, &solana_sdk::pubkey::new_rand());
build_test_transaction_and_packet(100, &solana_pubkey::new_rand());

assert!(forward_packet_batches_by_accounts.try_add_packet(
&tx2,
Expand Down
4 changes: 2 additions & 2 deletions core/src/banking_stage/forwarder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ mod tests {
// Create `PacketBatch` with 1 unprocessed packet
let tx = system_transaction::transfer(
&Keypair::new(),
&solana_sdk::pubkey::new_rand(),
&solana_pubkey::new_rand(),
rent_min_balance,
blockhash,
);
Expand Down Expand Up @@ -504,7 +504,7 @@ mod tests {
} = setup();

let keypair = Keypair::new();
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();

// forwarded packets will not be forwarded again
let forwarded_packet = {
Expand Down
2 changes: 1 addition & 1 deletion core/src/banking_stage/immutable_deserialized_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ mod tests {
fn simple_deserialized_packet() {
let tx = system_transaction::transfer(
&Keypair::new(),
&solana_sdk::pubkey::new_rand(),
&solana_pubkey::new_rand(),
1,
Hash::new_unique(),
);
Expand Down
2 changes: 1 addition & 1 deletion core/src/banking_stage/leader_slot_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,8 +1090,8 @@ impl LeaderSlotMetricsTracker {
mod tests {
use {
super::*,
solana_pubkey::Pubkey,
solana_runtime::{bank::Bank, genesis_utils::create_genesis_config},
solana_sdk::pubkey::Pubkey,
std::{mem, sync::Arc},
};

Expand Down
4 changes: 2 additions & 2 deletions core/src/banking_stage/qos_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ mod tests {
let transaction = solana_sdk::transaction::Transaction::new_unsigned(solana_sdk::message::Message::new(
&[
solana_sdk::compute_budget::ComputeBudgetInstruction::set_loaded_accounts_data_size_limit(loaded_accounts_data_size),
solana_sdk::system_instruction::transfer(&keypair.pubkey(), &solana_sdk::pubkey::Pubkey::new_unique(), 1),
solana_sdk::system_instruction::transfer(&keypair.pubkey(), &solana_pubkey::Pubkey::new_unique(), 1),
],
Some(&keypair.pubkey()),
));
Expand Down Expand Up @@ -852,7 +852,7 @@ mod tests {
let transaction = solana_sdk::transaction::Transaction::new_unsigned(solana_sdk::message::Message::new(
&[
solana_sdk::compute_budget::ComputeBudgetInstruction::set_loaded_accounts_data_size_limit(loaded_accounts_data_size),
solana_sdk::system_instruction::transfer(&keypair.pubkey(), &solana_sdk::pubkey::Pubkey::new_unique(), 1),
solana_sdk::system_instruction::transfer(&keypair.pubkey(), &solana_pubkey::Pubkey::new_unique(), 1),
],
Some(&keypair.pubkey()),
));
Expand Down
4 changes: 1 addition & 3 deletions core/src/banking_stage/read_write_account_set.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use {
ahash::AHashSet, solana_sdk::pubkey::Pubkey, solana_svm_transaction::svm_message::SVMMessage,
};
use {ahash::AHashSet, solana_pubkey::Pubkey, solana_svm_transaction::svm_message::SVMMessage};

/// Wrapper struct to accumulate locks for a batch of transactions.
#[derive(Debug, Default)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
ahash::AHashMap,
solana_sdk::pubkey::Pubkey,
solana_pubkey::Pubkey,
std::{
collections::hash_map::Entry,
fmt::{Debug, Display},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,7 @@ mod tests {
) -> TransactionState<RuntimeTransaction<SanitizedTransaction>> {
let from_keypair = Keypair::new();
let ixs = vec![
system_instruction::transfer(
&from_keypair.pubkey(),
&solana_sdk::pubkey::new_rand(),
1,
),
system_instruction::transfer(&from_keypair.pubkey(), &solana_pubkey::new_rand(), 1),
ComputeBudgetInstruction::set_compute_unit_price(compute_unit_price),
];
let message = Message::new(&ixs, Some(&from_keypair.pubkey()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,7 @@ mod tests {
) {
let from_keypair = Keypair::new();
let ixs = vec![
system_instruction::transfer(
&from_keypair.pubkey(),
&solana_sdk::pubkey::new_rand(),
1,
),
system_instruction::transfer(&from_keypair.pubkey(), &solana_pubkey::new_rand(), 1),
ComputeBudgetInstruction::set_compute_unit_price(priority),
];
let message = Message::new(&ixs, Some(&from_keypair.pubkey()));
Expand Down
6 changes: 3 additions & 3 deletions core/src/banking_stage/unprocessed_packet_batches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ mod tests {
fn simple_deserialized_packet() -> DeserializedPacket {
let tx = system_transaction::transfer(
&Keypair::new(),
&solana_sdk::pubkey::new_rand(),
&solana_pubkey::new_rand(),
1,
Hash::new_unique(),
);
Expand All @@ -323,12 +323,12 @@ mod tests {
compute_unit_price: u64,
compute_unit_limit: u64,
) -> DeserializedPacket {
let from_account = solana_sdk::pubkey::new_rand();
let from_account = solana_pubkey::new_rand();
let tx = Transaction::new_unsigned(Message::new(
&[
ComputeBudgetInstruction::set_compute_unit_limit(compute_unit_limit as u32),
ComputeBudgetInstruction::set_compute_unit_price(compute_unit_price),
system_instruction::transfer(&from_account, &solana_sdk::pubkey::new_rand(), 1),
system_instruction::transfer(&from_account, &solana_pubkey::new_rand(), 1),
],
Some(&from_account),
));
Expand Down
2 changes: 1 addition & 1 deletion core/src/banking_stage/unprocessed_transaction_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ mod tests {
fn test_unprocessed_transaction_storage_insert() -> Result<(), Box<dyn Error>> {
let keypair = Keypair::new();
let vote_keypair = Keypair::new();
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();

let small_transfer = Packet::from_data(
None,
Expand Down
2 changes: 1 addition & 1 deletion core/src/cluster_info_vote_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ mod tests {
} = setup();

// Check outdated slots are purged with new root
let new_voter = solana_sdk::pubkey::new_rand();
let new_voter = solana_pubkey::new_rand();
// Make separate copy so the original doesn't count toward
// the ref count, which would prevent cleanup
let new_voter_ = new_voter;
Expand Down
10 changes: 5 additions & 5 deletions core/src/cluster_slots_service/cluster_slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ mod tests {
fn test_best_peer_2() {
let cs = ClusterSlots::default();
let mut map = HashMap::new();
let k1 = solana_sdk::pubkey::new_rand();
let k2 = solana_sdk::pubkey::new_rand();
let k1 = solana_pubkey::new_rand();
let k2 = solana_pubkey::new_rand();
map.insert(k1, u64::MAX / 2);
map.insert(k2, 0);
cs.cluster_slots
Expand All @@ -296,8 +296,8 @@ mod tests {
fn test_best_peer_3() {
let cs = ClusterSlots::default();
let mut map = HashMap::new();
let k1 = solana_sdk::pubkey::new_rand();
let k2 = solana_sdk::pubkey::new_rand();
let k1 = solana_pubkey::new_rand();
let k2 = solana_pubkey::new_rand();
map.insert(k2, 0);
cs.cluster_slots
.write()
Expand All @@ -324,7 +324,7 @@ mod tests {
let cs = ClusterSlots::default();
let contact_infos: Vec<_> = std::iter::repeat_with(|| {
ContactInfo::new(
solana_sdk::pubkey::new_rand(),
solana_pubkey::new_rand(),
0, // wallclock
0, // shred_version
)
Expand Down
Loading

0 comments on commit 2a2a782

Please sign in to comment.