Don't use move semantics if not needed (#8793)
This commit is contained in:
@ -53,7 +53,7 @@ fn fill_epoch_with_votes(
|
||||
let parent = bank.parent().unwrap();
|
||||
|
||||
let message = Message::new_with_payer(
|
||||
vec![vote_instruction::vote(
|
||||
&[vote_instruction::vote(
|
||||
&vote_pubkey,
|
||||
&vote_pubkey,
|
||||
Vote::new(vec![parent.slot() as u64], parent.hash()),
|
||||
@ -121,7 +121,7 @@ fn test_stake_create_and_split_single_signature() {
|
||||
let lamports = 1_000_000;
|
||||
|
||||
// Create stake account with seed
|
||||
let message = Message::new(stake_instruction::create_account_with_seed(
|
||||
let message = Message::new(&stake_instruction::create_account_with_seed(
|
||||
&staker_pubkey, // from
|
||||
&stake_address, // to
|
||||
&staker_pubkey, // base
|
||||
@ -141,7 +141,7 @@ fn test_stake_create_and_split_single_signature() {
|
||||
create_address_with_seed(&staker_pubkey, "split_stake", &solana_stake_program::id())
|
||||
.unwrap();
|
||||
// Test split
|
||||
let message = Message::new(stake_instruction::split_with_seed(
|
||||
let message = Message::new(&stake_instruction::split_with_seed(
|
||||
&stake_address, // original
|
||||
&staker_pubkey, // authorized
|
||||
lamports / 2,
|
||||
@ -179,7 +179,7 @@ fn test_stake_account_lifetime() {
|
||||
let bank_client = BankClient::new_shared(&bank);
|
||||
|
||||
// Create Vote Account
|
||||
let message = Message::new(vote_instruction::create_account(
|
||||
let message = Message::new(&vote_instruction::create_account(
|
||||
&mint_pubkey,
|
||||
&vote_pubkey,
|
||||
&VoteInit {
|
||||
@ -196,7 +196,7 @@ fn test_stake_account_lifetime() {
|
||||
|
||||
let authorized = stake_state::Authorized::auto(&stake_pubkey);
|
||||
// Create stake account and delegate to vote account
|
||||
let message = Message::new(stake_instruction::create_account_and_delegate_stake(
|
||||
let message = Message::new(&stake_instruction::create_account_and_delegate_stake(
|
||||
&mint_pubkey,
|
||||
&stake_pubkey,
|
||||
&vote_pubkey,
|
||||
@ -219,7 +219,7 @@ fn test_stake_account_lifetime() {
|
||||
|
||||
// Test that we cannot withdraw anything until deactivation
|
||||
let message = Message::new_with_payer(
|
||||
vec![stake_instruction::withdraw(
|
||||
&[stake_instruction::withdraw(
|
||||
&stake_pubkey,
|
||||
&stake_pubkey,
|
||||
&Pubkey::new_rand(),
|
||||
@ -282,7 +282,7 @@ fn test_stake_account_lifetime() {
|
||||
let bank_client = BankClient::new_shared(&bank);
|
||||
// Test split
|
||||
let message = Message::new_with_payer(
|
||||
stake_instruction::split(
|
||||
&stake_instruction::split(
|
||||
&stake_pubkey,
|
||||
&stake_pubkey,
|
||||
lamports / 2,
|
||||
@ -299,7 +299,7 @@ fn test_stake_account_lifetime() {
|
||||
|
||||
// Deactivate the split
|
||||
let message = Message::new_with_payer(
|
||||
vec![stake_instruction::deactivate_stake(
|
||||
&[stake_instruction::deactivate_stake(
|
||||
&split_stake_pubkey,
|
||||
&stake_pubkey,
|
||||
)],
|
||||
@ -313,7 +313,7 @@ fn test_stake_account_lifetime() {
|
||||
|
||||
// Test that we cannot withdraw above what's staked
|
||||
let message = Message::new_with_payer(
|
||||
vec![stake_instruction::withdraw(
|
||||
&[stake_instruction::withdraw(
|
||||
&split_stake_pubkey,
|
||||
&stake_pubkey,
|
||||
&Pubkey::new_rand(),
|
||||
@ -334,7 +334,7 @@ fn test_stake_account_lifetime() {
|
||||
|
||||
// withdrawal in cooldown
|
||||
let message = Message::new_with_payer(
|
||||
vec![stake_instruction::withdraw(
|
||||
&[stake_instruction::withdraw(
|
||||
&split_stake_pubkey,
|
||||
&stake_pubkey,
|
||||
&Pubkey::new_rand(),
|
||||
@ -349,7 +349,7 @@ fn test_stake_account_lifetime() {
|
||||
|
||||
// but we can withdraw unstaked
|
||||
let message = Message::new_with_payer(
|
||||
vec![stake_instruction::withdraw(
|
||||
&[stake_instruction::withdraw(
|
||||
&split_stake_pubkey,
|
||||
&stake_pubkey,
|
||||
&Pubkey::new_rand(),
|
||||
@ -373,7 +373,7 @@ fn test_stake_account_lifetime() {
|
||||
|
||||
// Test that we can withdraw everything else out of the split
|
||||
let message = Message::new_with_payer(
|
||||
vec![stake_instruction::withdraw(
|
||||
&[stake_instruction::withdraw(
|
||||
&split_stake_pubkey,
|
||||
&stake_pubkey,
|
||||
&Pubkey::new_rand(),
|
||||
@ -414,7 +414,7 @@ fn test_create_stake_account_from_seed() {
|
||||
create_address_with_seed(&mint_pubkey, seed, &solana_stake_program::id()).unwrap();
|
||||
|
||||
// Create Vote Account
|
||||
let message = Message::new(vote_instruction::create_account(
|
||||
let message = Message::new(&vote_instruction::create_account(
|
||||
&mint_pubkey,
|
||||
&vote_pubkey,
|
||||
&VoteInit {
|
||||
@ -432,7 +432,7 @@ fn test_create_stake_account_from_seed() {
|
||||
let authorized = stake_state::Authorized::auto(&mint_pubkey);
|
||||
// Create stake account and delegate to vote account
|
||||
let message = Message::new(
|
||||
stake_instruction::create_account_with_seed_and_delegate_stake(
|
||||
&stake_instruction::create_account_with_seed_and_delegate_stake(
|
||||
&mint_pubkey,
|
||||
&stake_pubkey,
|
||||
&mint_pubkey,
|
||||
|
@ -49,7 +49,7 @@ fn test_account_owner() {
|
||||
let bank = Arc::new(bank);
|
||||
let bank_client = BankClient::new_shared(&bank);
|
||||
|
||||
let message = Message::new(storage_instruction::create_storage_account(
|
||||
let message = Message::new(&storage_instruction::create_storage_account(
|
||||
&mint_pubkey,
|
||||
&account_owner,
|
||||
&validator_storage_pubkey,
|
||||
@ -69,7 +69,7 @@ fn test_account_owner() {
|
||||
assert!(false, "wrong account type found")
|
||||
}
|
||||
|
||||
let message = Message::new(storage_instruction::create_storage_account(
|
||||
let message = Message::new(&storage_instruction::create_storage_account(
|
||||
&mint_pubkey,
|
||||
&account_owner,
|
||||
&archiver_storage_pubkey,
|
||||
@ -137,7 +137,7 @@ fn test_validate_mining() {
|
||||
|
||||
// advertise for storage segment 1
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::advertise_recent_blockhash(
|
||||
&[storage_instruction::advertise_recent_blockhash(
|
||||
&validator_storage_id,
|
||||
Hash::default(),
|
||||
1,
|
||||
@ -172,7 +172,7 @@ fn test_validate_mining() {
|
||||
));
|
||||
}
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::advertise_recent_blockhash(
|
||||
&[storage_instruction::advertise_recent_blockhash(
|
||||
&validator_storage_id,
|
||||
Hash::default(),
|
||||
2,
|
||||
@ -195,7 +195,7 @@ fn test_validate_mining() {
|
||||
);
|
||||
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::proof_validation(
|
||||
&[storage_instruction::proof_validation(
|
||||
&validator_storage_id,
|
||||
proof_segment as u64,
|
||||
checked_proofs.into_iter().map(|entry| entry).collect(),
|
||||
@ -209,7 +209,7 @@ fn test_validate_mining() {
|
||||
);
|
||||
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::advertise_recent_blockhash(
|
||||
&[storage_instruction::advertise_recent_blockhash(
|
||||
&validator_storage_id,
|
||||
Hash::default(),
|
||||
3,
|
||||
@ -244,7 +244,7 @@ fn test_validate_mining() {
|
||||
.map(|account| Rewards::from_account(&account).unwrap())
|
||||
.unwrap();
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::claim_reward(
|
||||
&[storage_instruction::claim_reward(
|
||||
&owner_pubkey,
|
||||
&validator_storage_id,
|
||||
)],
|
||||
@ -264,7 +264,7 @@ fn test_validate_mining() {
|
||||
assert_eq!(bank_client.get_balance(&archiver_1_storage_id).unwrap(), 10);
|
||||
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::claim_reward(
|
||||
&[storage_instruction::claim_reward(
|
||||
&owner_pubkey,
|
||||
&archiver_1_storage_id,
|
||||
)],
|
||||
@ -278,7 +278,7 @@ fn test_validate_mining() {
|
||||
);
|
||||
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::claim_reward(
|
||||
&[storage_instruction::claim_reward(
|
||||
&owner_pubkey,
|
||||
&archiver_2_storage_id,
|
||||
)],
|
||||
@ -328,7 +328,7 @@ fn init_storage_accounts(
|
||||
StorageAccountType::Archiver,
|
||||
))
|
||||
});
|
||||
let message = Message::new(ixs);
|
||||
let message = Message::new(&ixs);
|
||||
client.send_message(&signers, message).unwrap();
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ fn submit_proof(
|
||||
) -> ProofStatus {
|
||||
let sha_state = Hash::new(Pubkey::new_rand().as_ref());
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::mining_proof(
|
||||
&[storage_instruction::mining_proof(
|
||||
&storage_keypair.pubkey(),
|
||||
sha_state,
|
||||
segment_index,
|
||||
@ -422,7 +422,7 @@ fn test_bank_storage() {
|
||||
let x2 = x * 2;
|
||||
let storage_blockhash = hash(&[x2]);
|
||||
|
||||
let message = Message::new(storage_instruction::create_storage_account(
|
||||
let message = Message::new(&storage_instruction::create_storage_account(
|
||||
&mint_pubkey,
|
||||
&Pubkey::default(),
|
||||
&archiver_pubkey,
|
||||
@ -433,7 +433,7 @@ fn test_bank_storage() {
|
||||
.send_message(&[&mint_keypair, &archiver_keypair], message)
|
||||
.unwrap();
|
||||
|
||||
let message = Message::new(storage_instruction::create_storage_account(
|
||||
let message = Message::new(&storage_instruction::create_storage_account(
|
||||
&mint_pubkey,
|
||||
&Pubkey::default(),
|
||||
&validator_pubkey,
|
||||
@ -445,7 +445,7 @@ fn test_bank_storage() {
|
||||
.unwrap();
|
||||
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::advertise_recent_blockhash(
|
||||
&[storage_instruction::advertise_recent_blockhash(
|
||||
&validator_pubkey,
|
||||
storage_blockhash,
|
||||
1,
|
||||
@ -460,7 +460,7 @@ fn test_bank_storage() {
|
||||
|
||||
let slot = 0;
|
||||
let message = Message::new_with_payer(
|
||||
vec![storage_instruction::mining_proof(
|
||||
&[storage_instruction::mining_proof(
|
||||
&archiver_pubkey,
|
||||
Hash::default(),
|
||||
slot,
|
||||
|
Reference in New Issue
Block a user