Run codemod --extensions rs Pubkey::new_rand solana_sdk::pubkey::new_rand
This commit is contained in:
@ -441,8 +441,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_bpf_loader_write() {
|
||||
let program_id = Pubkey::new_rand();
|
||||
let program_key = Pubkey::new_rand();
|
||||
let program_id = solana_sdk::pubkey::new_rand();
|
||||
let program_key = solana_sdk::pubkey::new_rand();
|
||||
let program_account = Account::new_ref(1, 0, &program_id);
|
||||
let keyed_accounts = vec![KeyedAccount::new(&program_key, false, &program_account)];
|
||||
let instruction_data = bincode::serialize(&LoaderInstruction::Write {
|
||||
@ -508,8 +508,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_bpf_loader_finalize() {
|
||||
let program_id = Pubkey::new_rand();
|
||||
let program_key = Pubkey::new_rand();
|
||||
let program_id = solana_sdk::pubkey::new_rand();
|
||||
let program_key = solana_sdk::pubkey::new_rand();
|
||||
let mut file = File::open("test_elfs/noop_aligned.so").expect("file open failed");
|
||||
let mut elf = Vec::new();
|
||||
let rent = Rent::default();
|
||||
@ -572,8 +572,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_bpf_loader_invoke_main() {
|
||||
let program_id = Pubkey::new_rand();
|
||||
let program_key = Pubkey::new_rand();
|
||||
let program_id = solana_sdk::pubkey::new_rand();
|
||||
let program_key = solana_sdk::pubkey::new_rand();
|
||||
|
||||
// Create program account
|
||||
let mut file = File::open("test_elfs/noop_aligned.so").expect("file open failed");
|
||||
@ -646,7 +646,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// Case: With duplicate accounts
|
||||
let duplicate_key = Pubkey::new_rand();
|
||||
let duplicate_key = solana_sdk::pubkey::new_rand();
|
||||
let parameter_account = Account::new_ref(1, 0, &program_id);
|
||||
let mut keyed_accounts = vec![KeyedAccount::new(&program_key, false, &program_account)];
|
||||
keyed_accounts.push(KeyedAccount::new(&duplicate_key, false, ¶meter_account));
|
||||
@ -664,8 +664,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_bpf_loader_serialize_unaligned() {
|
||||
let program_id = Pubkey::new_rand();
|
||||
let program_key = Pubkey::new_rand();
|
||||
let program_id = solana_sdk::pubkey::new_rand();
|
||||
let program_key = solana_sdk::pubkey::new_rand();
|
||||
|
||||
// Create program account
|
||||
let mut file = File::open("test_elfs/noop_unaligned.so").expect("file open failed");
|
||||
@ -690,7 +690,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// Case: With duplicate accounts
|
||||
let duplicate_key = Pubkey::new_rand();
|
||||
let duplicate_key = solana_sdk::pubkey::new_rand();
|
||||
let parameter_account = Account::new_ref(1, 0, &program_id);
|
||||
let mut keyed_accounts = vec![KeyedAccount::new(&program_key, false, &program_account)];
|
||||
keyed_accounts.push(KeyedAccount::new(&duplicate_key, false, ¶meter_account));
|
||||
@ -708,8 +708,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_bpf_loader_serialize_aligned() {
|
||||
let program_id = Pubkey::new_rand();
|
||||
let program_key = Pubkey::new_rand();
|
||||
let program_id = solana_sdk::pubkey::new_rand();
|
||||
let program_key = solana_sdk::pubkey::new_rand();
|
||||
|
||||
// Create program account
|
||||
let mut file = File::open("test_elfs/noop_aligned.so").expect("file open failed");
|
||||
@ -734,7 +734,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// Case: With duplicate accounts
|
||||
let duplicate_key = Pubkey::new_rand();
|
||||
let duplicate_key = solana_sdk::pubkey::new_rand();
|
||||
let parameter_account = Account::new_ref(1, 0, &program_id);
|
||||
let mut keyed_accounts = vec![KeyedAccount::new(&program_key, false, &program_account)];
|
||||
keyed_accounts.push(KeyedAccount::new(&duplicate_key, false, ¶meter_account));
|
||||
@ -776,8 +776,8 @@ mod tests {
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_fuzz() {
|
||||
let program_id = Pubkey::new_rand();
|
||||
let program_key = Pubkey::new_rand();
|
||||
let program_id = solana_sdk::pubkey::new_rand();
|
||||
let program_key = solana_sdk::pubkey::new_rand();
|
||||
|
||||
// Create program account
|
||||
let mut file = File::open("test_elfs/noop_aligned.so").expect("file open failed");
|
||||
|
@ -262,9 +262,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_serialize_parameters() {
|
||||
let program_id = Pubkey::new_rand();
|
||||
let dup_key = Pubkey::new_rand();
|
||||
let keys = vec![dup_key, dup_key, Pubkey::new_rand(), Pubkey::new_rand()];
|
||||
let program_id = solana_sdk::pubkey::new_rand();
|
||||
let dup_key = solana_sdk::pubkey::new_rand();
|
||||
let keys = vec![dup_key, dup_key, solana_sdk::pubkey::new_rand(), solana_sdk::pubkey::new_rand()];
|
||||
let accounts = [
|
||||
RefCell::new(Account {
|
||||
lamports: 1,
|
||||
|
@ -1289,7 +1289,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_translate_type() {
|
||||
// Pubkey
|
||||
let pubkey = Pubkey::new_rand();
|
||||
let pubkey = solana_sdk::pubkey::new_rand();
|
||||
let addr = &pubkey as *const _ as u64;
|
||||
let regions = vec![MemoryRegion {
|
||||
addr_host: addr,
|
||||
@ -1301,9 +1301,9 @@ mod tests {
|
||||
|
||||
// Instruction
|
||||
let instruction = Instruction::new(
|
||||
Pubkey::new_rand(),
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
&"foobar",
|
||||
vec![AccountMeta::new(Pubkey::new_rand(), false)],
|
||||
vec![AccountMeta::new(solana_sdk::pubkey::new_rand(), false)],
|
||||
);
|
||||
let addr = &instruction as *const _ as u64;
|
||||
let mut regions = vec![MemoryRegion {
|
||||
@ -1350,7 +1350,7 @@ mod tests {
|
||||
assert_eq!(data, translated_data);
|
||||
|
||||
// Pubkeys
|
||||
let mut data = vec![Pubkey::new_rand(); 5];
|
||||
let mut data = vec![solana_sdk::pubkey::new_rand(); 5];
|
||||
let addr = data.as_ptr() as *const _ as u64;
|
||||
let regions = vec![MemoryRegion {
|
||||
addr_host: addr,
|
||||
@ -1360,7 +1360,7 @@ mod tests {
|
||||
let translated_data =
|
||||
translate_slice!(Pubkey, 100, data.len(), ®ions, &bpf_loader::id()).unwrap();
|
||||
assert_eq!(data, translated_data);
|
||||
data[0] = Pubkey::new_rand(); // Both should point to same place
|
||||
data[0] = solana_sdk::pubkey::new_rand(); // Both should point to same place
|
||||
assert_eq!(data, translated_data);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user