Skip to content

Commit

Permalink
replace solana_sdk::pubkey with solana_pubkey in solana-runtime (#4181)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey authored Jan 2, 2025
1 parent 85b647f commit 892dee8
Show file tree
Hide file tree
Showing 25 changed files with 242 additions and 259 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 programs/sbf/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 runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ solana-metrics = { workspace = true }
solana-perf = { workspace = true }
solana-program = { workspace = true }
solana-program-runtime = { workspace = true }
solana-pubkey = { workspace = true }
solana-rayon-threadlimit = { workspace = true }
solana-runtime-transaction = { workspace = true }
solana-sdk = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion runtime/benches/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use {

fn deposit_many(bank: &Bank, pubkeys: &mut Vec<Pubkey>, num: usize) -> Result<(), LamportsError> {
for t in 0..num {
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();
let account =
AccountSharedData::new((t + 1) as u64, 0, AccountSharedData::default().owner());
pubkeys.push(pubkey);
Expand Down
2 changes: 1 addition & 1 deletion runtime/benches/prioritization_fee_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn bench_process_transactions_multiple_slots(bencher: &mut Bencher) {
let bank0 = Bank::new_for_benches(&genesis_config);
let bank_forks = BankForks::new_rw_arc(bank0);
let bank = bank_forks.read().unwrap().working_bank();
let collector = solana_sdk::pubkey::new_rand();
let collector = solana_pubkey::new_rand();
let banks = (1..=NUM_SLOTS)
.map(|n| Arc::new(Bank::new_from_parent(bank.clone(), &collector, n as u64)))
.collect::<Vec<_>>();
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/account_saver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ mod tests {
fn test_collect_accounts_to_store() {
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();
let account0 = AccountSharedData::new(1, 0, &Pubkey::default());
let account1 = AccountSharedData::new(2, 0, &Pubkey::default());
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
Expand Down
311 changes: 151 additions & 160 deletions runtime/src/bank/tests.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion runtime/src/bank_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ mod tests {
let amount = genesis_config.rent.minimum_balance(0);

// Create 2-2 Multisig Transfer instruction.
let bob_pubkey = solana_sdk::pubkey::new_rand();
let bob_pubkey = solana_pubkey::new_rand();
let mut transfer_instruction =
system_instruction::transfer(&john_pubkey, &bob_pubkey, amount);
transfer_instruction
Expand Down
6 changes: 3 additions & 3 deletions runtime/src/epoch_stakes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ pub(crate) mod tests {
// Create some vote accounts for each pubkey
(0..num_nodes)
.map(|_| {
let node_id = solana_sdk::pubkey::new_rand();
let node_id = solana_pubkey::new_rand();
(
node_id,
iter::repeat_with(|| {
let authorized_voter = solana_sdk::pubkey::new_rand();
let authorized_voter = solana_pubkey::new_rand();
VoteAccountInfo {
vote_account: solana_sdk::pubkey::new_rand(),
vote_account: solana_pubkey::new_rand(),
account: create_account_with_authorized(
&node_id,
&authorized_voter,
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/genesis_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ pub fn create_genesis_config(mint_lamports: u64) -> GenesisConfigInfo {
// accounts-db which in particular will break snapshots test.
create_genesis_config_with_leader(
mint_lamports,
&solana_sdk::pubkey::new_rand(), // validator_pubkey
0, // validator_stake_lamports
&solana_pubkey::new_rand(), // validator_pubkey
0, // validator_stake_lamports
)
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/installed_scheduler_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ mod tests {
} = create_genesis_config(10_000);
let tx0 = RuntimeTransaction::from_transaction_for_tests(system_transaction::transfer(
&mint_keypair,
&solana_sdk::pubkey::new_rand(),
&solana_pubkey::new_rand(),
2,
genesis_config.hash(),
));
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/non_circulating_supply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ mod tests {
let num_genesis_accounts = 10;
for _ in 0..num_genesis_accounts {
accounts.insert(
solana_sdk::pubkey::new_rand(),
solana_pubkey::new_rand(),
Account::new(balance, 0, &Pubkey::default()),
);
}
Expand All @@ -253,7 +253,7 @@ mod tests {

let num_stake_accounts = 3;
for _ in 0..num_stake_accounts {
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();
let meta = Meta {
authorized: Authorized::auto(&pubkey),
lockup: Lockup {
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/prioritization_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl PrioritizationFee {

#[cfg(test)]
mod tests {
use {super::*, solana_sdk::pubkey::Pubkey};
use {super::*, solana_pubkey::Pubkey};

#[test]
fn test_update_prioritization_fee() {
Expand Down
6 changes: 3 additions & 3 deletions runtime/src/prioritization_fee_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ mod tests {
let bank0 = Bank::new_for_benches(&genesis_config);
let bank_forks = BankForks::new_rw_arc(bank0);
let bank = bank_forks.read().unwrap().working_bank();
let collector = solana_sdk::pubkey::new_rand();
let collector = solana_pubkey::new_rand();

let bank1 = Arc::new(Bank::new_from_parent(bank.clone(), &collector, 1));
sync_update(
Expand Down Expand Up @@ -620,7 +620,7 @@ mod tests {
let bank0 = Bank::new_for_benches(&genesis_config);
let bank_forks = BankForks::new_rw_arc(bank0);
let bank = bank_forks.read().unwrap().working_bank();
let collector = solana_sdk::pubkey::new_rand();
let collector = solana_pubkey::new_rand();
let bank1 = Arc::new(Bank::new_from_parent(bank.clone(), &collector, 1));
let bank2 = Arc::new(Bank::new_from_parent(bank.clone(), &collector, 2));
let bank3 = Arc::new(Bank::new_from_parent(bank, &collector, 3));
Expand Down Expand Up @@ -872,7 +872,7 @@ mod tests {
let bank0 = Bank::new_for_benches(&genesis_config);
let bank_forks = BankForks::new_rw_arc(bank0);
let bank = bank_forks.read().unwrap().working_bank();
let collector = solana_sdk::pubkey::new_rand();
let collector = solana_pubkey::new_rand();
let slot: Slot = 999;
let bank1 = Arc::new(Bank::new_from_parent(bank.clone(), &collector, slot));
let bank2 = Arc::new(Bank::new_from_parent(bank, &collector, slot + 1));
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/root_bank_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ mod tests {
bank_forks::BankForks,
genesis_utils::{create_genesis_config, GenesisConfigInfo},
},
solana_sdk::pubkey::Pubkey,
solana_pubkey::Pubkey,
};

#[test]
Expand Down
30 changes: 15 additions & 15 deletions runtime/src/serde_snapshot/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ mod serde_snapshot_tests {
let unrooted_slot = 9;
let unrooted_bank_id = 9;
let db = AccountsDb::new_single_for_tests();
let key = solana_sdk::pubkey::new_rand();
let key = solana_pubkey::new_rand();
let account0 = AccountSharedData::new(1, 0, &key);
db.store_for_tests(unrooted_slot, &[(&key, &account0)]);

// Purge the slot
db.remove_unrooted_slots(&[(unrooted_slot, unrooted_bank_id)]);

// Add a new root
let key2 = solana_sdk::pubkey::new_rand();
let key2 = solana_pubkey::new_rand();
let new_root = unrooted_slot + 1;
db.store_for_tests(new_root, &[(&key2, &account0)]);
db.add_root_and_flush_write_cache(new_root);
Expand Down Expand Up @@ -437,11 +437,11 @@ mod serde_snapshot_tests {
let owner = *AccountSharedData::default().owner();

let account = AccountSharedData::new(some_lamport, no_data, &owner);
let pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();
let zero_lamport_account = AccountSharedData::new(zero_lamport, no_data, &owner);

let account2 = AccountSharedData::new(some_lamport + 1, no_data, &owner);
let pubkey2 = solana_sdk::pubkey::new_rand();
let pubkey2 = solana_pubkey::new_rand();

let accounts = AccountsDb::new_single_for_tests();

Expand Down Expand Up @@ -493,9 +493,9 @@ mod serde_snapshot_tests {
let account3 = AccountSharedData::new(some_lamport + 100_002, no_data, &owner);
let zero_lamport_account = AccountSharedData::new(zero_lamport, no_data, &owner);

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

let dummy_account = AccountSharedData::new(dummy_lamport, no_data, &owner);
let dummy_pubkey = Pubkey::default();
Expand Down Expand Up @@ -585,10 +585,10 @@ mod serde_snapshot_tests {
let dummy_account = AccountSharedData::new(99_999_999, no_data, &owner);
let zero_lamport_account = AccountSharedData::new(zero_lamport, no_data, &owner);

let pubkey = solana_sdk::pubkey::new_rand();
let dummy_pubkey = solana_sdk::pubkey::new_rand();
let purged_pubkey1 = solana_sdk::pubkey::new_rand();
let purged_pubkey2 = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();
let dummy_pubkey = solana_pubkey::new_rand();
let purged_pubkey1 = solana_pubkey::new_rand();
let purged_pubkey2 = solana_pubkey::new_rand();

let mut current_slot = 0;
let accounts = AccountsDb::new_single_for_tests();
Expand Down Expand Up @@ -656,9 +656,9 @@ mod serde_snapshot_tests {
let dummy_account = AccountSharedData::new(dummy_lamport, no_data, &owner);
let zero_lamport_account = AccountSharedData::new(zero_lamport, no_data, &owner);

let pubkey1 = solana_sdk::pubkey::new_rand();
let pubkey2 = solana_sdk::pubkey::new_rand();
let dummy_pubkey = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_pubkey::new_rand();
let pubkey2 = solana_pubkey::new_rand();
let dummy_pubkey = solana_pubkey::new_rand();

let mut current_slot = 0;
let accounts = AccountsDb::new_single_for_tests();
Expand Down Expand Up @@ -786,7 +786,7 @@ mod serde_snapshot_tests {

let pubkey_count = 100;
let pubkeys: Vec<_> = (0..pubkey_count)
.map(|_| solana_sdk::pubkey::new_rand())
.map(|_| solana_pubkey::new_rand())
.collect();

let some_lamport = 223;
Expand Down
16 changes: 8 additions & 8 deletions runtime/src/snapshot_minimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ mod tests {
fn test_minimization_get_vote_accounts() {
solana_logger::setup();

let bootstrap_validator_pubkey = solana_sdk::pubkey::new_rand();
let bootstrap_validator_pubkey = solana_pubkey::new_rand();
let bootstrap_validator_stake_lamports = 30;
let genesis_config_info = create_genesis_config_with_leader(
10,
Expand Down Expand Up @@ -500,7 +500,7 @@ mod tests {
fn test_minimization_get_stake_accounts() {
solana_logger::setup();

let bootstrap_validator_pubkey = solana_sdk::pubkey::new_rand();
let bootstrap_validator_pubkey = solana_pubkey::new_rand();
let bootstrap_validator_stake_lamports = 30;
let genesis_config_info = create_genesis_config_with_leader(
10,
Expand Down Expand Up @@ -543,8 +543,8 @@ mod tests {
let (genesis_config, _) = create_genesis_config(1_000_000);
let bank = Arc::new(Bank::new_for_tests(&genesis_config));

let pubkey = solana_sdk::pubkey::new_rand();
let owner_pubkey = solana_sdk::pubkey::new_rand();
let pubkey = solana_pubkey::new_rand();
let owner_pubkey = solana_pubkey::new_rand();
bank.store_account(&pubkey, &AccountSharedData::new(1, 0, &owner_pubkey));

let owner_accounts = DashSet::new();
Expand All @@ -568,9 +568,9 @@ mod tests {
let (genesis_config, _) = create_genesis_config(1_000_000);
let bank = Arc::new(Bank::new_for_tests(&genesis_config));

let non_program_id = solana_sdk::pubkey::new_rand();
let program_id = solana_sdk::pubkey::new_rand();
let programdata_address = solana_sdk::pubkey::new_rand();
let non_program_id = solana_pubkey::new_rand();
let program_id = solana_pubkey::new_rand();
let programdata_address = solana_pubkey::new_rand();

let program = UpgradeableLoaderState::Program {
programdata_address,
Expand Down Expand Up @@ -623,7 +623,7 @@ mod tests {
let minimized_account_set = DashSet::new();
for _ in 0..num_slots {
let pubkeys: Vec<_> = (0..num_accounts_per_slot)
.map(|_| solana_sdk::pubkey::new_rand())
.map(|_| solana_pubkey::new_rand())
.collect();

let some_lamport = 223;
Expand Down
34 changes: 17 additions & 17 deletions runtime/src/stake_weighted_timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ pub mod tests {
let recent_timestamp: UnixTimestamp = 1_578_909_061;
let slot = 5;
let slot_duration = Duration::from_millis(400);
let pubkey0 = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_sdk::pubkey::new_rand();
let pubkey2 = solana_sdk::pubkey::new_rand();
let pubkey3 = solana_sdk::pubkey::new_rand();
let pubkey4 = solana_sdk::pubkey::new_rand();
let pubkey0 = solana_pubkey::new_rand();
let pubkey1 = solana_pubkey::new_rand();
let pubkey2 = solana_pubkey::new_rand();
let pubkey3 = solana_pubkey::new_rand();
let pubkey4 = solana_pubkey::new_rand();
let max_allowable_drift = MaxAllowableDrift { fast: 25, slow: 25 };

// Test low-staked outlier(s)
Expand Down Expand Up @@ -327,9 +327,9 @@ pub mod tests {
};
let acceptable_delta = (max_allowable_drift_percentage * poh_offset as u32 / 100) as i64;
let poh_estimate = epoch_start_timestamp + poh_offset as i64;
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 stakes: HashMap<Pubkey, (u64, Account)> = [
(
Expand Down Expand Up @@ -468,9 +468,9 @@ pub mod tests {
(max_allowable_drift_percentage_50 * poh_offset as u32 / 100) as i64;
assert!(acceptable_delta_50 > acceptable_delta_25 + 1);
let poh_estimate = epoch_start_timestamp + poh_offset as i64;
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 stakes: HashMap<Pubkey, (u64, Account)> = [
(
Expand Down Expand Up @@ -604,9 +604,9 @@ pub mod tests {
(max_allowable_drift_percentage_50 * poh_offset as u32 / 100) as i64;
assert!(acceptable_delta_slow > acceptable_delta_fast + 1);
let poh_estimate = epoch_start_timestamp + poh_offset as i64;
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 stakes: HashMap<Pubkey, (u64, Account)> = [
(
Expand Down Expand Up @@ -742,9 +742,9 @@ pub mod tests {
};
let acceptable_delta = (max_allowable_drift_percentage * poh_offset as u32 / 100) as i64;
let poh_estimate = epoch_start_timestamp + poh_offset as i64;
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 stakes: HashMap<Pubkey, (u64, Account)> = [
(
Expand Down
Loading

0 comments on commit 892dee8

Please sign in to comment.