Forráskód Böngészése

Boot VoteTransaction

Greg Fitzgerald 6 éve
szülő
commit
4bc3f70150

+ 9 - 4
core/src/entry.rs

@@ -440,7 +440,7 @@ mod tests {
     use solana_sdk::hash::hash;
     use solana_sdk::hash::hash;
     use solana_sdk::signature::{Keypair, KeypairUtil};
     use solana_sdk::signature::{Keypair, KeypairUtil};
     use solana_sdk::system_transaction::SystemTransaction;
     use solana_sdk::system_transaction::SystemTransaction;
-    use solana_vote_api::vote_transaction::VoteTransaction;
+    use solana_vote_api::vote_instruction::{Vote, VoteInstruction};
     use std::net::{IpAddr, Ipv4Addr, SocketAddr};
     use std::net::{IpAddr, Ipv4Addr, SocketAddr};
 
 
     fn create_sample_payment(keypair: &Keypair, hash: Hash) -> Transaction {
     fn create_sample_payment(keypair: &Keypair, hash: Hash) -> Transaction {
@@ -461,6 +461,12 @@ mod tests {
         Transaction::new_signed_instructions(&[keypair], vec![ix], hash, 0)
         Transaction::new_signed_instructions(&[keypair], vec![ix], hash, 0)
     }
     }
 
 
+    fn create_sample_vote(keypair: &Keypair, hash: Hash) -> Transaction {
+        let pubkey = keypair.pubkey();
+        let ix = VoteInstruction::new_vote(&pubkey, Vote::new(1));
+        Transaction::new_signed_instructions(&[keypair], vec![ix], hash, 0)
+    }
+
     #[test]
     #[test]
     fn test_entry_verify() {
     fn test_entry_verify() {
         let zero = Hash::default();
         let zero = Hash::default();
@@ -564,7 +570,7 @@ mod tests {
         let one = hash(&zero.as_ref());
         let one = hash(&zero.as_ref());
         let keypair = Keypair::new();
         let keypair = Keypair::new();
         let vote_account = Keypair::new();
         let vote_account = Keypair::new();
-        let tx0 = VoteTransaction::new_vote(&vote_account.pubkey(), &vote_account, 1, one, 1);
+        let tx0 = create_sample_vote(&vote_account, one);
         let tx1 = create_sample_timestamp(&keypair, one);
         let tx1 = create_sample_timestamp(&keypair, one);
         //
         //
         // TODO: this magic number and the mix of transaction types
         // TODO: this magic number and the mix of transaction types
@@ -623,8 +629,7 @@ mod tests {
         let next_hash = solana_sdk::hash::hash(&hash.as_ref());
         let next_hash = solana_sdk::hash::hash(&hash.as_ref());
         let keypair = Keypair::new();
         let keypair = Keypair::new();
         let vote_account = Keypair::new();
         let vote_account = Keypair::new();
-        let tx_small =
-            VoteTransaction::new_vote(&vote_account.pubkey(), &vote_account, 1, next_hash, 2);
+        let tx_small = create_sample_vote(&vote_account, next_hash);
         let tx_large = create_sample_payment(&keypair, next_hash);
         let tx_large = create_sample_payment(&keypair, next_hash);
 
 
         let tx_small_size = tx_small.serialized_size().unwrap() as usize;
         let tx_small_size = tx_small.serialized_size().unwrap() as usize;

+ 12 - 11
core/src/fullnode.rs

@@ -27,7 +27,8 @@ use solana_sdk::pubkey::Pubkey;
 use solana_sdk::signature::{Keypair, KeypairUtil};
 use solana_sdk::signature::{Keypair, KeypairUtil};
 use solana_sdk::system_transaction::SystemTransaction;
 use solana_sdk::system_transaction::SystemTransaction;
 use solana_sdk::timing::timestamp;
 use solana_sdk::timing::timestamp;
-use solana_vote_api::vote_transaction::VoteTransaction;
+use solana_sdk::transaction::Transaction;
+use solana_vote_api::vote_instruction::{Vote, VoteInstruction};
 use std::net::{IpAddr, Ipv4Addr, SocketAddr};
 use std::net::{IpAddr, Ipv4Addr, SocketAddr};
 use std::sync::atomic::{AtomicBool, Ordering};
 use std::sync::atomic::{AtomicBool, Ordering};
 use std::sync::mpsc::Receiver;
 use std::sync::mpsc::Receiver;
@@ -325,23 +326,23 @@ pub fn make_active_set_entries(
     let voting_keypair = Keypair::new();
     let voting_keypair = Keypair::new();
     let vote_account_id = voting_keypair.pubkey();
     let vote_account_id = voting_keypair.pubkey();
 
 
-    let new_vote_account_tx = VoteTransaction::new_account(
-        active_keypair,
+    let new_vote_account_ixs = VoteInstruction::new_account(
+        &active_keypair.pubkey(),
         &vote_account_id,
         &vote_account_id,
-        *blockhash,
         stake.saturating_sub(2),
         stake.saturating_sub(2),
+    );
+    let new_vote_account_tx = Transaction::new_signed_instructions(
+        &[active_keypair.as_ref()],
+        new_vote_account_ixs,
+        *blockhash,
         1,
         1,
     );
     );
     let new_vote_account_entry = next_entry_mut(&mut last_entry_hash, 1, vec![new_vote_account_tx]);
     let new_vote_account_entry = next_entry_mut(&mut last_entry_hash, 1, vec![new_vote_account_tx]);
 
 
     // 3) Create vote entry
     // 3) Create vote entry
-    let vote_tx = VoteTransaction::new_vote(
-        &voting_keypair.pubkey(),
-        &voting_keypair,
-        slot_to_vote_on,
-        *blockhash,
-        0,
-    );
+    let vote_ix = VoteInstruction::new_vote(&voting_keypair.pubkey(), Vote::new(slot_to_vote_on));
+    let vote_tx =
+        Transaction::new_signed_instructions(&[&voting_keypair], vec![vote_ix], *blockhash, 0);
     let vote_entry = next_entry_mut(&mut last_entry_hash, 1, vec![vote_tx]);
     let vote_entry = next_entry_mut(&mut last_entry_hash, 1, vec![vote_tx]);
 
 
     // 4) Create `num_ending_ticks` empty ticks
     // 4) Create `num_ending_ticks` empty ticks

+ 6 - 8
core/src/leader_confirmation_service.rs

@@ -119,7 +119,8 @@ mod tests {
     use solana_sdk::pubkey::Pubkey;
     use solana_sdk::pubkey::Pubkey;
     use solana_sdk::signature::{Keypair, KeypairUtil};
     use solana_sdk::signature::{Keypair, KeypairUtil};
     use solana_sdk::timing::MAX_RECENT_BLOCKHASHES;
     use solana_sdk::timing::MAX_RECENT_BLOCKHASHES;
-    use solana_vote_api::vote_transaction::VoteTransaction;
+    use solana_sdk::transaction::Transaction;
+    use solana_vote_api::vote_instruction::{Vote, VoteInstruction};
     use std::sync::Arc;
     use std::sync::Arc;
 
 
     #[test]
     #[test]
@@ -177,13 +178,10 @@ mod tests {
 
 
         // Get another validator to vote, so we now have 2/3 consensus
         // Get another validator to vote, so we now have 2/3 consensus
         let voting_keypair = &vote_accounts[7].0;
         let voting_keypair = &vote_accounts[7].0;
-        let vote_tx = VoteTransaction::new_vote(
-            &voting_keypair.pubkey(),
-            voting_keypair,
-            MAX_RECENT_BLOCKHASHES as u64,
-            blockhash,
-            0,
-        );
+        let vote = Vote::new(MAX_RECENT_BLOCKHASHES as u64);
+        let vote_ix = VoteInstruction::new_vote(&voting_keypair.pubkey(), vote);
+        let vote_tx =
+            Transaction::new_signed_instructions(&[voting_keypair], vec![vote_ix], blockhash, 0);
         bank.process_transaction(&vote_tx).unwrap();
         bank.process_transaction(&vote_tx).unwrap();
 
 
         LeaderConfirmationService::compute_confirmation(&bank, &mut last_confirmation_time);
         LeaderConfirmationService::compute_confirmation(&bank, &mut last_confirmation_time);

+ 14 - 9
core/src/local_cluster.rs

@@ -14,8 +14,9 @@ use solana_sdk::signature::{Keypair, KeypairUtil};
 use solana_sdk::system_transaction::SystemTransaction;
 use solana_sdk::system_transaction::SystemTransaction;
 use solana_sdk::timing::DEFAULT_SLOTS_PER_EPOCH;
 use solana_sdk::timing::DEFAULT_SLOTS_PER_EPOCH;
 use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
 use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
+use solana_sdk::transaction::Transaction;
+use solana_vote_api::vote_instruction::VoteInstruction;
 use solana_vote_api::vote_state::VoteState;
 use solana_vote_api::vote_state::VoteState;
-use solana_vote_api::vote_transaction::VoteTransaction;
 use std::collections::HashMap;
 use std::collections::HashMap;
 use std::fs::remove_dir_all;
 use std::fs::remove_dir_all;
 use std::io::{Error, ErrorKind, Result};
 use std::io::{Error, ErrorKind, Result};
@@ -295,11 +296,12 @@ impl LocalCluster {
         // Create the vote account if necessary
         // Create the vote account if necessary
         if client.poll_get_balance(&vote_account_pubkey).unwrap_or(0) == 0 {
         if client.poll_get_balance(&vote_account_pubkey).unwrap_or(0) == 0 {
             // 1) Create vote account
             // 1) Create vote account
-            let mut transaction = VoteTransaction::new_account(
-                from_account,
-                &vote_account_pubkey,
+            let instructions =
+                VoteInstruction::new_account(&from_account.pubkey(), &vote_account_pubkey, amount);
+            let mut transaction = Transaction::new_signed_instructions(
+                &[from_account.as_ref()],
+                instructions,
                 client.get_recent_blockhash().unwrap(),
                 client.get_recent_blockhash().unwrap(),
-                amount,
                 1,
                 1,
             );
             );
 
 
@@ -311,11 +313,14 @@ impl LocalCluster {
                 .expect("get balance");
                 .expect("get balance");
 
 
             // 2) Set delegate for new vote account
             // 2) Set delegate for new vote account
-            let mut transaction = VoteTransaction::delegate_vote_account(
-                vote_account,
+            let vote_instruction =
+                VoteInstruction::new_delegate_stake(&vote_account_pubkey, &delegate_id);
+
+            let mut transaction = Transaction::new_signed_instructions(
+                &[vote_account],
+                vec![vote_instruction],
                 client.get_recent_blockhash().unwrap(),
                 client.get_recent_blockhash().unwrap(),
-                &delegate_id,
-                0,
+                1,
             );
             );
 
 
             client
             client

+ 15 - 11
core/src/replay_stage.rs

@@ -19,7 +19,8 @@ use solana_sdk::hash::Hash;
 use solana_sdk::pubkey::Pubkey;
 use solana_sdk::pubkey::Pubkey;
 use solana_sdk::signature::KeypairUtil;
 use solana_sdk::signature::KeypairUtil;
 use solana_sdk::timing::{self, duration_as_ms};
 use solana_sdk::timing::{self, duration_as_ms};
-use solana_vote_api::vote_transaction::VoteTransaction;
+use solana_sdk::transaction::Transaction;
+use solana_vote_api::vote_instruction::{Vote, VoteInstruction};
 use std::collections::HashMap;
 use std::collections::HashMap;
 use std::sync::atomic::{AtomicBool, Ordering};
 use std::sync::atomic::{AtomicBool, Ordering};
 use std::sync::mpsc::{channel, Receiver, RecvTimeoutError, Sender};
 use std::sync::mpsc::{channel, Receiver, RecvTimeoutError, Sender};
@@ -297,11 +298,10 @@ impl ReplayStage {
         T: 'static + KeypairUtil + Send + Sync,
         T: 'static + KeypairUtil + Send + Sync,
     {
     {
         if let Some(ref voting_keypair) = voting_keypair {
         if let Some(ref voting_keypair) = voting_keypair {
-            let keypair = voting_keypair.as_ref();
-            let vote = VoteTransaction::new_vote(
-                &vote_account,
-                keypair,
-                bank.slot(),
+            let vote_ix = VoteInstruction::new_vote(&vote_account, Vote::new(bank.slot()));
+            let vote_tx = Transaction::new_signed_instructions(
+                &[voting_keypair.as_ref()],
+                vec![vote_ix],
                 bank.last_blockhash(),
                 bank.last_blockhash(),
                 0,
                 0,
             );
             );
@@ -310,7 +310,7 @@ impl ReplayStage {
                 Self::handle_new_root(&bank_forks, progress);
                 Self::handle_new_root(&bank_forks, progress);
             }
             }
             locktower.update_epoch(&bank);
             locktower.update_epoch(&bank);
-            cluster_info.write().unwrap().push_vote(vote);
+            cluster_info.write().unwrap().push_vote(vote_tx);
         }
         }
     }
     }
 
 
@@ -606,10 +606,14 @@ mod test {
                 &poh_recorder,
                 &poh_recorder,
             );
             );
 
 
-            let keypair = voting_keypair.as_ref();
-            let vote =
-                VoteTransaction::new_vote(&keypair.pubkey(), keypair, 0, bank.last_blockhash(), 0);
-            cluster_info_me.write().unwrap().push_vote(vote);
+            let vote_ix = VoteInstruction::new_vote(&voting_keypair.pubkey(), Vote::new(0));
+            let vote_tx = Transaction::new_signed_instructions(
+                &[voting_keypair.as_ref()],
+                vec![vote_ix],
+                bank.last_blockhash(),
+                0,
+            );
+            cluster_info_me.write().unwrap().push_vote(vote_tx);
 
 
             info!("Send ReplayStage an entry, should see it on the ledger writer receiver");
             info!("Send ReplayStage an entry, should see it on the ledger writer receiver");
             let next_tick = create_ticks(1, bank.last_blockhash());
             let next_tick = create_ticks(1, bank.last_blockhash());

+ 26 - 20
core/src/voting_keypair.rs

@@ -106,9 +106,17 @@ impl VotingKeypair {
 #[cfg(test)]
 #[cfg(test)]
 pub mod tests {
 pub mod tests {
     use solana_runtime::bank::Bank;
     use solana_runtime::bank::Bank;
+    use solana_sdk::instruction::Instruction;
     use solana_sdk::pubkey::Pubkey;
     use solana_sdk::pubkey::Pubkey;
     use solana_sdk::signature::{Keypair, KeypairUtil};
     use solana_sdk::signature::{Keypair, KeypairUtil};
-    use solana_vote_api::vote_transaction::VoteTransaction;
+    use solana_sdk::transaction::Transaction;
+    use solana_vote_api::vote_instruction::{Vote, VoteInstruction};
+
+    fn process_instructions<T: KeypairUtil>(bank: &Bank, keypairs: &[&T], ixs: Vec<Instruction>) {
+        let blockhash = bank.last_blockhash();
+        let tx = Transaction::new_signed_instructions(keypairs, ixs, blockhash, 0);
+        bank.process_transaction(&tx).unwrap();
+    }
 
 
     pub fn new_vote_account(
     pub fn new_vote_account(
         from_keypair: &Keypair,
         from_keypair: &Keypair,
@@ -116,9 +124,8 @@ pub mod tests {
         bank: &Bank,
         bank: &Bank,
         lamports: u64,
         lamports: u64,
     ) {
     ) {
-        let blockhash = bank.last_blockhash();
-        let tx = VoteTransaction::new_account(from_keypair, voting_pubkey, blockhash, lamports, 0);
-        bank.process_transaction(&tx).unwrap();
+        let ixs = VoteInstruction::new_account(&from_keypair.pubkey(), voting_pubkey, lamports);
+        process_instructions(bank, &[from_keypair], ixs);
     }
     }
 
 
     pub fn new_vote_account_with_delegate(
     pub fn new_vote_account_with_delegate(
@@ -128,33 +135,32 @@ pub mod tests {
         bank: &Bank,
         bank: &Bank,
         lamports: u64,
         lamports: u64,
     ) {
     ) {
-        let blockhash = bank.last_blockhash();
-        let tx = VoteTransaction::new_account_with_delegate(
-            from_keypair,
-            voting_keypair,
+        let voting_pubkey = voting_keypair.pubkey();
+        let mut ixs =
+            VoteInstruction::new_account(&from_keypair.pubkey(), &voting_pubkey, lamports);
+        ixs.push(VoteInstruction::new_delegate_stake(
+            &voting_pubkey,
             delegate,
             delegate,
-            blockhash,
-            lamports,
-            0,
-        );
-        bank.process_transaction(&tx).unwrap();
+        ));
+        process_instructions(bank, &[from_keypair, voting_keypair], ixs);
     }
     }
 
 
     pub fn push_vote<T: KeypairUtil>(voting_keypair: &T, bank: &Bank, slot: u64) {
     pub fn push_vote<T: KeypairUtil>(voting_keypair: &T, bank: &Bank, slot: u64) {
-        let blockhash = bank.last_blockhash();
-        let tx =
-            VoteTransaction::new_vote(&voting_keypair.pubkey(), voting_keypair, slot, blockhash, 0);
-        bank.process_transaction(&tx).unwrap();
+        let ix = VoteInstruction::new_vote(&voting_keypair.pubkey(), Vote::new(slot));
+        process_instructions(bank, &[voting_keypair], vec![ix]);
     }
     }
 
 
     pub fn new_vote_account_with_vote<T: KeypairUtil>(
     pub fn new_vote_account_with_vote<T: KeypairUtil>(
-        from_keypair: &Keypair,
+        from_keypair: &T,
         voting_keypair: &T,
         voting_keypair: &T,
         bank: &Bank,
         bank: &Bank,
         lamports: u64,
         lamports: u64,
         slot: u64,
         slot: u64,
     ) {
     ) {
-        new_vote_account(from_keypair, &voting_keypair.pubkey(), bank, lamports);
-        push_vote(voting_keypair, bank, slot);
+        let voting_pubkey = voting_keypair.pubkey();
+        let mut ixs =
+            VoteInstruction::new_account(&from_keypair.pubkey(), &voting_pubkey, lamports);
+        ixs.push(VoteInstruction::new_vote(&voting_pubkey, Vote::new(slot)));
+        process_instructions(bank, &[from_keypair, voting_keypair], ixs);
     }
     }
 }
 }

+ 0 - 1
programs/vote_api/src/lib.rs

@@ -1,7 +1,6 @@
 pub mod vote_instruction;
 pub mod vote_instruction;
 pub mod vote_processor;
 pub mod vote_processor;
 pub mod vote_state;
 pub mod vote_state;
-pub mod vote_transaction;
 
 
 use solana_sdk::pubkey::Pubkey;
 use solana_sdk::pubkey::Pubkey;
 
 

+ 0 - 86
programs/vote_api/src/vote_transaction.rs

@@ -1,86 +0,0 @@
-//! The `vote_transaction` module provides functionality for creating vote transactions.
-
-use crate::vote_instruction::{Vote, VoteInstruction};
-use solana_sdk::hash::Hash;
-use solana_sdk::pubkey::Pubkey;
-use solana_sdk::signature::{Keypair, KeypairUtil};
-use solana_sdk::transaction::Transaction;
-
-pub struct VoteTransaction {}
-
-impl VoteTransaction {
-    pub fn new_vote<T: KeypairUtil>(
-        staking_account: &Pubkey,
-        authorized_voter_keypair: &T,
-        slot: u64,
-        recent_blockhash: Hash,
-        fee: u64,
-    ) -> Transaction {
-        let ix = VoteInstruction::new_vote(staking_account, Vote { slot });
-        Transaction::new_signed_instructions(
-            &[authorized_voter_keypair],
-            vec![ix],
-            recent_blockhash,
-            fee,
-        )
-    }
-
-    /// Fund or create the staking account with lamports
-    pub fn new_account(
-        from_keypair: &Keypair,
-        staker_id: &Pubkey,
-        recent_blockhash: Hash,
-        lamports: u64,
-        fee: u64,
-    ) -> Transaction {
-        let from_id = from_keypair.pubkey();
-        let ixs = VoteInstruction::new_account(&from_id, staker_id, lamports);
-        Transaction::new_signed_instructions(&[from_keypair], ixs, recent_blockhash, fee)
-    }
-
-    /// Fund or create the staking account with lamports
-    pub fn new_account_with_delegate(
-        from_keypair: &Keypair,
-        voter_keypair: &Keypair,
-        delegate_id: &Pubkey,
-        recent_blockhash: Hash,
-        lamports: u64,
-        fee: u64,
-    ) -> Transaction {
-        let from_id = from_keypair.pubkey();
-        let voter_id = voter_keypair.pubkey();
-
-        let mut ixs = VoteInstruction::new_account(&from_id, &voter_id, lamports);
-        let delegate_ix = VoteInstruction::new_delegate_stake(&voter_id, &delegate_id);
-        ixs.push(delegate_ix);
-
-        Transaction::new_signed_instructions(
-            &[from_keypair, voter_keypair],
-            ixs,
-            recent_blockhash,
-            fee,
-        )
-    }
-
-    /// Choose a voter id to accept signed votes from
-    pub fn new_authorize_voter(
-        vote_keypair: &Keypair,
-        recent_blockhash: Hash,
-        authorized_voter_id: &Pubkey,
-        fee: u64,
-    ) -> Transaction {
-        let ix = VoteInstruction::new_authorize_voter(&vote_keypair.pubkey(), authorized_voter_id);
-        Transaction::new_signed_instructions(&[vote_keypair], vec![ix], recent_blockhash, fee)
-    }
-
-    /// Choose a node id to `delegate` or `assign` this vote account to
-    pub fn delegate_vote_account<T: KeypairUtil>(
-        vote_keypair: &T,
-        recent_blockhash: Hash,
-        node_id: &Pubkey,
-        fee: u64,
-    ) -> Transaction {
-        let ix = VoteInstruction::new_delegate_stake(&vote_keypair.pubkey(), node_id);
-        Transaction::new_signed_instructions(&[vote_keypair], vec![ix], recent_blockhash, fee)
-    }
-}

+ 4 - 2
tests/thin_client.rs

@@ -11,8 +11,8 @@ use solana_sdk::pubkey::Pubkey;
 use solana_sdk::signature::{Keypair, KeypairUtil, Signature};
 use solana_sdk::signature::{Keypair, KeypairUtil, Signature};
 use solana_sdk::system_instruction::SystemInstruction;
 use solana_sdk::system_instruction::SystemInstruction;
 use solana_sdk::system_transaction::SystemTransaction;
 use solana_sdk::system_transaction::SystemTransaction;
+use solana_vote_api::vote_instruction::VoteInstruction;
 use solana_vote_api::vote_state::VoteState;
 use solana_vote_api::vote_state::VoteState;
-use solana_vote_api::vote_transaction::VoteTransaction;
 use std::fs::remove_dir_all;
 use std::fs::remove_dir_all;
 use std::net::UdpSocket;
 use std::net::UdpSocket;
 use std::thread::sleep;
 use std::thread::sleep;
@@ -124,8 +124,10 @@ fn test_register_vote_account() {
     let vote_account_id = validator_vote_account_keypair.pubkey();
     let vote_account_id = validator_vote_account_keypair.pubkey();
     let blockhash = client.get_recent_blockhash().unwrap();
     let blockhash = client.get_recent_blockhash().unwrap();
 
 
+    let instructions =
+        VoteInstruction::new_account(&validator_keypair.pubkey(), &vote_account_id, 1);
     let transaction =
     let transaction =
-        VoteTransaction::new_account(&validator_keypair, &vote_account_id, blockhash, 1, 1);
+        Transaction::new_signed_instructions(&[&validator_keypair], instructions, blockhash, 1);
     let signature = client.transfer_signed(&transaction).unwrap();
     let signature = client.transfer_signed(&transaction).unwrap();
     client.poll_for_signature(&signature).unwrap();
     client.poll_for_signature(&signature).unwrap();
 
 

+ 3 - 5
wallet/src/wallet.rs

@@ -21,7 +21,6 @@ use solana_sdk::signature::{Keypair, KeypairUtil, Signature};
 use solana_sdk::system_transaction::SystemTransaction;
 use solana_sdk::system_transaction::SystemTransaction;
 use solana_sdk::transaction::Transaction;
 use solana_sdk::transaction::Transaction;
 use solana_vote_api::vote_instruction::VoteInstruction;
 use solana_vote_api::vote_instruction::VoteInstruction;
-use solana_vote_api::vote_transaction::VoteTransaction;
 use std::fs::File;
 use std::fs::File;
 use std::io::Read;
 use std::io::Read;
 use std::net::{IpAddr, Ipv4Addr, SocketAddr};
 use std::net::{IpAddr, Ipv4Addr, SocketAddr};
@@ -345,8 +344,7 @@ fn process_configure_staking(
             &authorized_voter_id,
             &authorized_voter_id,
         ));
         ));
     }
     }
-    let mut tx = Transaction::new(ixs);
-    tx.sign(&[&config.id], recent_blockhash);
+    let mut tx = Transaction::new_signed_instructions(&[&config.id], ixs, recent_blockhash, 0);
     let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
     let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
     Ok(signature_str.to_string())
     Ok(signature_str.to_string())
 }
 }
@@ -358,8 +356,8 @@ fn process_create_staking(
     lamports: u64,
     lamports: u64,
 ) -> ProcessResult {
 ) -> ProcessResult {
     let recent_blockhash = rpc_client.get_recent_blockhash()?;
     let recent_blockhash = rpc_client.get_recent_blockhash()?;
-    let mut tx =
-        VoteTransaction::new_account(&config.id, voting_account_id, recent_blockhash, lamports, 0);
+    let ixs = VoteInstruction::new_account(&config.id.pubkey(), voting_account_id, lamports);
+    let mut tx = Transaction::new_signed_instructions(&[&config.id], ixs, recent_blockhash, 0);
     let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
     let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
     Ok(signature_str.to_string())
     Ok(signature_str.to_string())
 }
 }