Rename SystemInstruction::Move to SystemInstruction::Transfer

This commit is contained in:
Greg Fitzgerald
2019-04-02 21:52:07 -06:00
parent 43bb813cbe
commit 867f6f107b
24 changed files with 137 additions and 85 deletions

View File

@ -783,8 +783,8 @@ mod tests {
let pubkey = Pubkey::new_rand();
let transactions = vec![
SystemTransaction::new_move(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
SystemTransaction::new_move(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
SystemTransaction::new_transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
SystemTransaction::new_transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
];
let mut results = vec![Ok(()), Ok(())];
@ -820,7 +820,7 @@ mod tests {
let bank = Arc::new(Bank::new(&genesis_block));
let pubkey = Pubkey::new_rand();
let transactions = vec![SystemTransaction::new_move(
let transactions = vec![SystemTransaction::new_transfer(
&mint_keypair,
&pubkey,
1,
@ -873,7 +873,7 @@ mod tests {
assert_eq!(done, true);
let transactions = vec![SystemTransaction::new_move(
let transactions = vec![SystemTransaction::new_transfer(
&mint_keypair,
&pubkey,
2,

View File

@ -183,8 +183,10 @@ mod test {
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let tx0 = SystemTransaction::new_move(&keypair0, &keypair1.pubkey(), 1, Hash::default(), 0);
let tx1 = SystemTransaction::new_move(&keypair1, &keypair0.pubkey(), 2, Hash::default(), 0);
let tx0 =
SystemTransaction::new_transfer(&keypair0, &keypair1.pubkey(), 1, Hash::default(), 0);
let tx1 =
SystemTransaction::new_transfer(&keypair1, &keypair0.pubkey(), 2, Hash::default(), 0);
let serialized_tx0 = serialize(&tx0).unwrap();
let serialized_tx1 = serialize(&tx1).unwrap();
let entry = Entry::new(&Hash::default(), 1, vec![tx0, tx1]);

View File

@ -649,7 +649,7 @@ mod tests {
bank.last_blockhash(),
0,
),
SystemTransaction::new_move(
SystemTransaction::new_transfer(
&keypair4,
&keypair4.pubkey(),
1,

View File

@ -37,7 +37,7 @@ pub fn spend_and_verify_all_nodes(
.poll_get_balance(&funding_keypair.pubkey())
.expect("balance in source");
assert!(bal > 0);
let mut transaction = SystemTransaction::new_move(
let mut transaction = SystemTransaction::new_transfer(
&funding_keypair,
&random_keypair.pubkey(),
1,
@ -63,7 +63,7 @@ pub fn send_many_transactions(node: &ContactInfo, funding_keypair: &Keypair, num
.poll_get_balance(&funding_keypair.pubkey())
.expect("balance in source");
assert!(bal > 0);
let mut transaction = SystemTransaction::new_move(
let mut transaction = SystemTransaction::new_transfer(
&funding_keypair,
&random_keypair.pubkey(),
1,
@ -183,7 +183,7 @@ pub fn kill_entry_and_spend_and_verify_rest(
}
let random_keypair = Keypair::new();
let mut transaction = SystemTransaction::new_move(
let mut transaction = SystemTransaction::new_transfer(
&funding_keypair,
&random_keypair.pubkey(),
1,

View File

@ -463,7 +463,7 @@ mod tests {
let exit = Arc::new(AtomicBool::new(false));
let blockhash = bank.last_blockhash();
let tx = SystemTransaction::new_move(&alice, pubkey, 20, blockhash, 0);
let tx = SystemTransaction::new_transfer(&alice, pubkey, 20, blockhash, 0);
bank.process_transaction(&tx).expect("process transaction");
let request_processor = Arc::new(RwLock::new(JsonRpcRequestProcessor::new(
@ -503,7 +503,7 @@ mod tests {
);
thread::spawn(move || {
let blockhash = bank.last_blockhash();
let tx = SystemTransaction::new_move(&alice, &bob_pubkey, 20, blockhash, 0);
let tx = SystemTransaction::new_transfer(&alice, &bob_pubkey, 20, blockhash, 0);
bank.process_transaction(&tx).expect("process transaction");
})
.join()
@ -575,7 +575,7 @@ mod tests {
fn test_rpc_confirm_tx() {
let bob_pubkey = Pubkey::new_rand();
let (io, meta, blockhash, alice) = start_rpc_handler_with_tx(&bob_pubkey);
let tx = SystemTransaction::new_move(&alice, &bob_pubkey, 20, blockhash, 0);
let tx = SystemTransaction::new_transfer(&alice, &bob_pubkey, 20, blockhash, 0);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"confirmTransaction","params":["{}"]}}"#,
@ -594,7 +594,7 @@ mod tests {
fn test_rpc_get_signature_status() {
let bob_pubkey = Pubkey::new_rand();
let (io, meta, blockhash, alice) = start_rpc_handler_with_tx(&bob_pubkey);
let tx = SystemTransaction::new_move(&alice, &bob_pubkey, 20, blockhash, 0);
let tx = SystemTransaction::new_transfer(&alice, &bob_pubkey, 20, blockhash, 0);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getSignatureStatus","params":["{}"]}}"#,
@ -609,7 +609,7 @@ mod tests {
assert_eq!(expected, result);
// Test getSignatureStatus request on unprocessed tx
let tx = SystemTransaction::new_move(&alice, &bob_pubkey, 10, blockhash, 0);
let tx = SystemTransaction::new_transfer(&alice, &bob_pubkey, 10, blockhash, 0);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getSignatureStatus","params":["{}"]}}"#,
tx.signatures[0]
@ -716,8 +716,13 @@ mod tests {
#[test]
fn test_rpc_verify_signature() {
let tx =
SystemTransaction::new_move(&Keypair::new(), &Pubkey::new_rand(), 20, hash(&[0]), 0);
let tx = SystemTransaction::new_transfer(
&Keypair::new(),
&Pubkey::new_rand(),
20,
hash(&[0]),
0,
);
assert_eq!(
verify_signature(&tx.signatures[0].to_string()).unwrap(),
tx.signatures[0]

View File

@ -270,7 +270,7 @@ mod tests {
let rpc = RpcSolPubSubImpl::default();
// Test signature subscriptions
let tx = SystemTransaction::new_move(&alice, &bob_pubkey, 20, blockhash, 0);
let tx = SystemTransaction::new_transfer(&alice, &bob_pubkey, 20, blockhash, 0);
let session = create_session();
let (subscriber, _id_receiver, mut receiver) =
@ -302,7 +302,7 @@ mod tests {
let rpc = RpcSolPubSubImpl::default();
io.extend_with(rpc.to_delegate());
let tx = SystemTransaction::new_move(&alice, &bob_pubkey, 20, blockhash, 0);
let tx = SystemTransaction::new_transfer(&alice, &bob_pubkey, 20, blockhash, 0);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"signatureSubscribe","params":["{}"]}}"#,
tx.signatures[0].to_string()

View File

@ -302,7 +302,7 @@ mod tests {
let bank = Bank::new(&genesis_block);
let alice = Keypair::new();
let blockhash = bank.last_blockhash();
let tx = SystemTransaction::new_move(&mint_keypair, &alice.pubkey(), 20, blockhash, 0);
let tx = SystemTransaction::new_transfer(&mint_keypair, &alice.pubkey(), 20, blockhash, 0);
let signature = tx.signatures[0];
bank.process_transaction(&tx).unwrap();

View File

@ -20,7 +20,7 @@ pub fn test_multisig_tx() -> Transaction {
let lamports = 5;
let blockhash = Hash::default();
let system_instruction = SystemInstruction::Move { lamports };
let system_instruction = SystemInstruction::Transfer { lamports };
let program_ids = vec![system_program::id(), solana_budget_api::id()];