Instruction name swap

* Instruction -> GenericInstruction
* Instruction<u8, u8> -> CompiledInstruction
* Instruction<Pubkey, (Pubkey, bool)> -> Instruction
This commit is contained in:
Greg Fitzgerald
2019-03-15 09:47:25 -06:00
parent 66fb1bbb2e
commit 968022a1b0
13 changed files with 97 additions and 94 deletions

View File

@ -1017,7 +1017,7 @@ mod tests {
use solana_sdk::hash::Hash;
use solana_sdk::signature::Keypair;
use solana_sdk::signature::KeypairUtil;
use solana_sdk::transaction::Instruction;
use solana_sdk::transaction::CompiledInstruction;
use solana_sdk::transaction::Transaction;
fn cleanup_paths(paths: &str) {
@ -1046,7 +1046,7 @@ mod tests {
let accounts: Vec<(Pubkey, Account)> = Vec::new();
let mut error_counters = ErrorCounters::default();
let instructions = vec![Instruction::new(1, &(), vec![0])];
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_instructions::<Keypair>(
&[],
&[],
@ -1070,7 +1070,7 @@ mod tests {
let keypair = Keypair::new();
let instructions = vec![Instruction::new(1, &(), vec![0])];
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_instructions(
&[&keypair],
&[],
@ -1102,7 +1102,7 @@ mod tests {
let account = Account::new(2, 1, &Pubkey::default());
accounts.push((key1, account));
let instructions = vec![Instruction::new(1, &(), vec![0])];
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_instructions(
&[&keypair],
&[],
@ -1130,7 +1130,7 @@ mod tests {
let account = Account::new(1, 1, &Pubkey::default());
accounts.push((key0, account));
let instructions = vec![Instruction::new(1, &(), vec![0])];
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_instructions(
&[&keypair],
&[],
@ -1165,7 +1165,7 @@ mod tests {
let account = Account::new(2, 1, &Pubkey::default());
accounts.push((key1, account));
let instructions = vec![Instruction::new(0, &(), vec![0, 1])];
let instructions = vec![CompiledInstruction::new(0, &(), vec![0, 1])];
let tx = Transaction::new_with_instructions(
&[&keypair],
&[key1],
@ -1237,7 +1237,7 @@ mod tests {
account.owner = key5;
accounts.push((key6, account));
let instructions = vec![Instruction::new(0, &(), vec![0])];
let instructions = vec![CompiledInstruction::new(0, &(), vec![0])];
let tx = Transaction::new_with_instructions(
&[&keypair],
&[],
@ -1271,7 +1271,7 @@ mod tests {
account.owner = Pubkey::default();
accounts.push((key1, account));
let instructions = vec![Instruction::new(0, &(), vec![0])];
let instructions = vec![CompiledInstruction::new(0, &(), vec![0])];
let tx = Transaction::new_with_instructions(
&[&keypair],
&[],
@ -1304,7 +1304,7 @@ mod tests {
account.owner = native_loader::id();
accounts.push((key1, account));
let instructions = vec![Instruction::new(0, &(), vec![0])];
let instructions = vec![CompiledInstruction::new(0, &(), vec![0])];
let tx = Transaction::new_with_instructions(
&[&keypair],
&[],
@ -1351,8 +1351,8 @@ mod tests {
accounts.push((key3, account));
let instructions = vec![
Instruction::new(0, &(), vec![0]),
Instruction::new(1, &(), vec![0]),
CompiledInstruction::new(0, &(), vec![0]),
CompiledInstruction::new(1, &(), vec![0]),
];
let tx = Transaction::new_with_instructions(
&[&keypair],
@ -1396,7 +1396,7 @@ mod tests {
let account = Account::new(10, 1, &Pubkey::default());
accounts.push((pubkey, account));
let instructions = vec![Instruction::new(0, &(), vec![0, 1])];
let instructions = vec![CompiledInstruction::new(0, &(), vec![0, 1])];
// Simulate pay-to-self transaction, which loads the same account twice
let tx = Transaction::new_with_instructions(
&[&keypair],

View File

@ -847,7 +847,7 @@ mod tests {
use solana_sdk::system_instruction::SystemInstruction;
use solana_sdk::system_program;
use solana_sdk::system_transaction::SystemTransaction;
use solana_sdk::transaction::{Instruction, InstructionError};
use solana_sdk::transaction::{CompiledInstruction, InstructionError};
#[test]
fn test_bank_new() {
@ -927,12 +927,12 @@ mod tests {
let bank = Bank::new(&genesis_block);
let spend = SystemInstruction::Move { lamports: 1 };
let instructions = vec![
Instruction {
CompiledInstruction {
program_ids_index: 0,
data: serialize(&spend).unwrap(),
accounts: vec![0, 1],
},
Instruction {
CompiledInstruction {
program_ids_index: 0,
data: serialize(&spend).unwrap(),
accounts: vec![0, 2],

View File

@ -5,8 +5,8 @@ use solana_sdk::native_program::ProgramError;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_instruction::SystemInstruction;
use solana_sdk::system_program;
use solana_sdk::transaction::{InstructionError, TransactionError};
use solana_sdk::transaction_builder::{BuilderInstruction, TransactionBuilder};
use solana_sdk::transaction::{Instruction, InstructionError, TransactionError};
use solana_sdk::transaction_builder::TransactionBuilder;
#[test]
fn test_system_unsigned_transaction() {
@ -26,7 +26,7 @@ fn test_system_unsigned_transaction() {
// Erroneously sign transaction with recipient account key
// No signature case is tested by bank `test_zero_signatures()`
let ix = BuilderInstruction::new(
let ix = Instruction::new(
system_program::id(),
&SystemInstruction::Move { lamports: 10 },
vec![(from_pubkey, false), (to_pubkey, true)],