Run codemod --extensions rs Pubkey::new_rand solana_sdk::pubkey::new_rand

This commit is contained in:
Michael Vines
2020-10-21 17:56:32 -07:00
parent 048a2b982c
commit 422bb3c526
116 changed files with 962 additions and 962 deletions

View File

@@ -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");
@@ -644,7 +644,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, &parameter_account));
@@ -662,8 +662,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");
@@ -688,7 +688,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, &parameter_account));
@@ -706,8 +706,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");
@@ -732,7 +732,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, &parameter_account));
@@ -774,8 +774,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");

View File

@@ -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,

View File

@@ -1194,7 +1194,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,
@@ -1206,9 +1206,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 {
@@ -1255,7 +1255,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,
@@ -1265,7 +1265,7 @@ mod tests {
let translated_data =
translate_slice!(Pubkey, 100, data.len(), &regions, &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);
}