Delete lots of fee parameters

So many zeros!
This commit is contained in:
Greg Fitzgerald 2019-03-29 17:29:20 -06:00
parent 7896e8288d
commit 5646daa820
14 changed files with 34 additions and 64 deletions

View File

@ -381,7 +381,7 @@ pub fn make_tiny_test_entries_from_hash(start: &Hash, num: usize) -> Vec<Entry>
(0..num)
.map(|_| {
let ix = BudgetInstruction::new_apply_timestamp(&pubkey, &pubkey, &pubkey, Utc::now());
let tx = Transaction::new_signed_instructions(&[&keypair], vec![ix], *start, 0);
let tx = Transaction::new_signed_instructions(&[&keypair], vec![ix], *start);
Entry::new_mut(&mut hash, &mut num_hashes, vec![tx])
})
.collect()
@ -400,7 +400,7 @@ pub fn make_large_test_entries(num_entries: usize) -> Vec<Entry> {
let pubkey = keypair.pubkey();
let ix = BudgetInstruction::new_apply_timestamp(&pubkey, &pubkey, &pubkey, Utc::now());
let tx = Transaction::new_signed_instructions(&[&keypair], vec![ix], one, 0);
let tx = Transaction::new_signed_instructions(&[&keypair], vec![ix], one);
let serialized_size = serialized_size(&tx).unwrap();
let num_txs = BLOB_DATA_SIZE / serialized_size as usize;
@ -457,25 +457,25 @@ mod tests {
fn create_sample_payment(keypair: &Keypair, hash: Hash) -> Transaction {
let pubkey = keypair.pubkey();
let ixs = BudgetInstruction::new_payment(&pubkey, &pubkey, 1);
Transaction::new_signed_instructions(&[keypair], ixs, hash, 0)
Transaction::new_signed_instructions(&[keypair], ixs, hash)
}
fn create_sample_timestamp(keypair: &Keypair, hash: Hash) -> Transaction {
let pubkey = keypair.pubkey();
let ix = BudgetInstruction::new_apply_timestamp(&pubkey, &pubkey, &pubkey, Utc::now());
Transaction::new_signed_instructions(&[keypair], vec![ix], hash, 0)
Transaction::new_signed_instructions(&[keypair], vec![ix], hash)
}
fn create_sample_signature(keypair: &Keypair, hash: Hash) -> Transaction {
let pubkey = keypair.pubkey();
let ix = BudgetInstruction::new_apply_signature(&pubkey, &pubkey, &pubkey);
Transaction::new_signed_instructions(&[keypair], vec![ix], hash, 0)
Transaction::new_signed_instructions(&[keypair], vec![ix], hash)
}
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)
Transaction::new_signed_instructions(&[keypair], vec![ix], hash)
}
#[test]

View File

@ -340,14 +340,13 @@ pub fn make_active_set_entries(
&[active_keypair.as_ref()],
new_vote_account_ixs,
*blockhash,
1,
);
let new_vote_account_entry = next_entry_mut(&mut last_entry_hash, 1, vec![new_vote_account_tx]);
// 3) Create vote entry
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);
Transaction::new_signed_instructions(&[&voting_keypair], vec![vote_ix], *blockhash);
let vote_entry = next_entry_mut(&mut last_entry_hash, 1, vec![vote_tx]);
// 4) Create `num_ending_ticks` empty ticks

View File

@ -329,7 +329,6 @@ impl LocalCluster {
&[from_account.as_ref()],
instructions,
client.get_recent_blockhash().unwrap(),
1,
);
client
@ -347,7 +346,6 @@ impl LocalCluster {
&[vote_account],
vec![vote_instruction],
client.get_recent_blockhash().unwrap(),
1,
);
client

View File

@ -320,7 +320,6 @@ impl ReplayStage {
&[voting_keypair.as_ref()],
vec![vote_ix],
bank.last_blockhash(),
0,
);
if let Some(new_root) = locktower.record_vote(bank.slot()) {
bank_forks.write().unwrap().set_root(new_root);
@ -657,7 +656,6 @@ mod test {
&[voting_keypair.as_ref()],
vec![vote_ix],
bank.last_blockhash(),
0,
);
cluster_info_me.write().unwrap().push_vote(vote_tx);

View File

@ -365,7 +365,7 @@ mod tests {
None,
51,
);
let tx = Transaction::new_signed_instructions(&[&contract_funds], ixs, blockhash, 0);
let tx = Transaction::new_signed_instructions(&[&contract_funds], ixs, blockhash);
let arc_bank = process_transaction_and_notify(&arc_bank, &tx, &rpc.subscriptions).unwrap();
sleep(Duration::from_millis(200));
@ -398,7 +398,7 @@ mod tests {
&contract_state.pubkey(),
&bob_pubkey,
);
let tx = Transaction::new_signed_instructions(&[&witness], vec![ix], blockhash, 0);
let tx = Transaction::new_signed_instructions(&[&witness], vec![ix], blockhash);
let arc_bank = process_transaction_and_notify(&arc_bank, &tx, &rpc.subscriptions).unwrap();
sleep(Duration::from_millis(200));

View File

@ -18,7 +18,6 @@ pub fn test_multisig_tx() -> Transaction {
let keypair1 = Keypair::new();
let keypairs = vec![&keypair0, &keypair1];
let lamports = 5;
let fee = 2;
let blockhash = Hash::default();
let system_instruction = SystemInstruction::Move { lamports };
@ -31,7 +30,6 @@ pub fn test_multisig_tx() -> Transaction {
&keypairs,
&[],
blockhash,
fee,
program_ids,
instructions,
)

View File

@ -114,7 +114,7 @@ pub mod tests {
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);
let tx = Transaction::new_signed_instructions(keypairs, ixs, blockhash);
bank.process_transaction(&tx).unwrap();
}

View File

@ -15,7 +15,7 @@ impl ExchangeTransaction {
owner: &Keypair,
new: &Pubkey,
recent_blockhash: Hash,
fee: u64,
_fee: u64,
) -> Transaction {
let owner_id = &owner.pubkey();
let space = mem::size_of::<ExchangeState>() as u64;
@ -25,7 +25,6 @@ impl ExchangeTransaction {
&[owner],
vec![create_ix, request_ix],
recent_blockhash,
fee,
)
}
@ -36,12 +35,12 @@ impl ExchangeTransaction {
token: Token,
tokens: u64,
recent_blockhash: Hash,
fee: u64,
_fee: u64,
) -> Transaction {
let owner_id = &owner.pubkey();
let request_ix =
ExchangeInstruction::new_transfer_request(owner_id, to, from, token, tokens);
Transaction::new_signed_instructions(&[owner], vec![request_ix], recent_blockhash, fee)
Transaction::new_signed_instructions(&[owner], vec![request_ix], recent_blockhash)
}
#[allow(clippy::too_many_arguments)]
@ -55,7 +54,7 @@ impl ExchangeTransaction {
src_account: &Pubkey,
dst_account: &Pubkey,
recent_blockhash: Hash,
fee: u64,
_fee: u64,
) -> Transaction {
let owner_id = &owner.pubkey();
let space = mem::size_of::<ExchangeState>() as u64;
@ -74,7 +73,6 @@ impl ExchangeTransaction {
&[owner],
vec![create_ix, request_ix],
recent_blockhash,
fee,
)
}
@ -83,11 +81,11 @@ impl ExchangeTransaction {
trade: &Pubkey,
account: &Pubkey,
recent_blockhash: Hash,
fee: u64,
_fee: u64,
) -> Transaction {
let owner_id = &owner.pubkey();
let request_ix = ExchangeInstruction::new_trade_cancellation(owner_id, trade, account);
Transaction::new_signed_instructions(&[owner], vec![request_ix], recent_blockhash, fee)
Transaction::new_signed_instructions(&[owner], vec![request_ix], recent_blockhash)
}
pub fn new_swap_request(
@ -99,7 +97,7 @@ impl ExchangeTransaction {
from_trade_account: &Pubkey,
profit_account: &Pubkey,
recent_blockhash: Hash,
fee: u64,
_fee: u64,
) -> Transaction {
let owner_id = &owner.pubkey();
let space = mem::size_of::<ExchangeState>() as u64;
@ -117,7 +115,6 @@ impl ExchangeTransaction {
&[owner],
vec![create_ix, request_ix],
recent_blockhash,
fee,
)
}
}

View File

@ -1045,7 +1045,6 @@ mod tests {
&[],
&[],
Hash::default(),
0,
vec![native_loader::id()],
instructions,
);
@ -1069,7 +1068,6 @@ mod tests {
&[&keypair],
&[],
Hash::default(),
0,
vec![native_loader::id()],
instructions,
);
@ -1101,7 +1099,6 @@ mod tests {
&[&keypair],
&[],
Hash::default(),
0,
vec![Pubkey::default()],
instructions,
);
@ -1129,7 +1126,6 @@ mod tests {
&[&keypair],
&[],
Hash::default(),
10,
vec![native_loader::id()],
instructions,
);
@ -1168,7 +1164,6 @@ mod tests {
&[&keypair],
&[key1],
Hash::default(),
0,
vec![native_loader::id()],
instructions,
);
@ -1240,7 +1235,6 @@ mod tests {
&[&keypair],
&[],
Hash::default(),
0,
vec![key6],
instructions,
);
@ -1274,7 +1268,6 @@ mod tests {
&[&keypair],
&[],
Hash::default(),
0,
vec![key1],
instructions,
);
@ -1307,7 +1300,6 @@ mod tests {
&[&keypair],
&[],
Hash::default(),
0,
vec![key1],
instructions,
);
@ -1356,7 +1348,6 @@ mod tests {
&[&keypair],
&[],
Hash::default(),
0,
vec![key1, key2],
instructions,
);
@ -1400,7 +1391,6 @@ mod tests {
&[&keypair],
&[pubkey],
Hash::default(),
0,
vec![native_loader::id()],
instructions,
);

View File

@ -1031,7 +1031,6 @@ mod tests {
&[&mint_keypair],
instructions,
genesis_block.hash(),
0,
);
assert_eq!(
bank.process_transaction(&tx).unwrap_err(),
@ -1057,7 +1056,6 @@ mod tests {
&[&mint_keypair],
instructions,
genesis_block.hash(),
0,
);
bank.process_transaction(&tx).unwrap();
assert_eq!(bank.get_balance(&mint_keypair.pubkey()), 0);
@ -1614,7 +1612,6 @@ mod tests {
&Vec::<&Keypair>::new(),
vec![move_instruction],
bank.last_blockhash(),
0,
);
assert_eq!(bank.process_transaction(&tx), Ok(()));

View File

@ -18,13 +18,13 @@ impl SystemTransaction {
lamports: u64,
space: u64,
program_id: &Pubkey,
fee: u64,
_fee: u64,
) -> Transaction {
let from_pubkey = from_keypair.pubkey();
let create_instruction =
SystemInstruction::new_program_account(&from_pubkey, to, lamports, space, program_id);
let instructions = vec![create_instruction];
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash, fee)
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash)
}
/// Create and sign a transaction to create a system account
@ -52,12 +52,12 @@ impl SystemTransaction {
from_keypair: &Keypair,
recent_blockhash: Hash,
program_id: &Pubkey,
fee: u64,
_fee: u64,
) -> Transaction {
let from_pubkey = from_keypair.pubkey();
let assign_instruction = SystemInstruction::new_assign(&from_pubkey, program_id);
let instructions = vec![assign_instruction];
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash, fee)
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash)
}
/// Create and sign new SystemInstruction::Move transaction
@ -66,11 +66,11 @@ impl SystemTransaction {
to: &Pubkey,
lamports: u64,
recent_blockhash: Hash,
fee: u64,
_fee: u64,
) -> Transaction {
let from_pubkey = from_keypair.pubkey();
let move_instruction = SystemInstruction::new_move(&from_pubkey, to, lamports);
let instructions = vec![move_instruction];
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash, fee)
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash)
}
}

View File

@ -85,7 +85,6 @@ impl Transaction {
from_keypairs: &[&T],
instructions: Vec<Instruction>,
recent_blockhash: Hash,
_fee: u64,
) -> Transaction {
let message = Message::new(instructions);
Self::new(from_keypairs, message, recent_blockhash)
@ -93,17 +92,15 @@ impl Transaction {
/// Create a signed transaction
/// * `from_keypairs` - The keys used to sign the transaction.
/// * `account_keys` - The keys for the transaction. These are the program state
/// * `keys` - The keys for the transaction. These are the program state
/// instances or lamport recipient keys.
/// * `recent_blockhash` - The PoH hash.
/// * `fee` - The transaction fee.
/// * `program_ids` - The keys that identify programs used in the `instruction` vector.
/// * `instructions` - Instructions that will be executed atomically.
pub fn new_with_compiled_instructions<T: KeypairUtil>(
from_keypairs: &[&T],
keys: &[Pubkey],
recent_blockhash: Hash,
_fee: u64,
program_ids: Vec<Pubkey>,
instructions: Vec<CompiledInstruction>,
) -> Self {
@ -225,7 +222,6 @@ mod tests {
&[&key],
&[key1, key2],
Hash::default(),
0,
vec![prog1, prog2],
instructions,
);
@ -260,7 +256,6 @@ mod tests {
&[&key],
&[],
Hash::default(),
0,
vec![],
instructions,
);
@ -274,7 +269,6 @@ mod tests {
&[&key],
&[],
Hash::default(),
0,
vec![Pubkey::default()],
instructions,
);

View File

@ -127,7 +127,7 @@ fn test_register_vote_account() {
let instructions =
VoteInstruction::new_account(&validator_keypair.pubkey(), &vote_account_id, 1);
let transaction =
Transaction::new_signed_instructions(&[&validator_keypair], instructions, blockhash, 1);
Transaction::new_signed_instructions(&[&validator_keypair], instructions, blockhash);
let signature = client.transfer_signed(&transaction).unwrap();
client.poll_for_signature(&signature).unwrap();

View File

@ -344,7 +344,7 @@ fn process_configure_staking(
&authorized_voter_id,
));
}
let mut tx = Transaction::new_signed_instructions(&[&config.id], ixs, recent_blockhash, 0);
let mut tx = Transaction::new_signed_instructions(&[&config.id], ixs, recent_blockhash);
let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
Ok(signature_str.to_string())
}
@ -357,7 +357,7 @@ fn process_create_staking(
) -> ProcessResult {
let recent_blockhash = rpc_client.get_recent_blockhash()?;
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 mut tx = Transaction::new_signed_instructions(&[&config.id], ixs, recent_blockhash);
let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
Ok(signature_str.to_string())
}
@ -417,15 +417,14 @@ fn process_deploy(
(i * USERDATA_CHUNK_SIZE) as u32,
chunk.to_vec(),
);
Transaction::new_signed_instructions(&[&program_id], vec![instruction], blockhash, 0)
Transaction::new_signed_instructions(&[&program_id], vec![instruction], blockhash)
})
.collect();
rpc_client.send_and_confirm_transactions(write_transactions, &program_id)?;
trace!("Finalizing program account");
let instruction = LoaderInstruction::new_finalize(&program_id.pubkey(), &bpf_loader::id());
let mut tx =
Transaction::new_signed_instructions(&[&program_id], vec![instruction], blockhash, 0);
let mut tx = Transaction::new_signed_instructions(&[&program_id], vec![instruction], blockhash);
rpc_client
.send_and_confirm_transaction(&mut tx, &program_id)
.map_err(|_| {
@ -473,7 +472,7 @@ fn process_pay(
cancelable,
lamports,
);
let mut tx = Transaction::new_signed_instructions(&[&config.id], ixs, blockhash, 0);
let mut tx = Transaction::new_signed_instructions(&[&config.id], ixs, blockhash);
let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
Ok(json!({
@ -503,7 +502,7 @@ fn process_pay(
cancelable,
lamports,
);
let mut tx = Transaction::new_signed_instructions(&[&config.id], ixs, blockhash, 0);
let mut tx = Transaction::new_signed_instructions(&[&config.id], ixs, blockhash);
let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
Ok(json!({
@ -520,7 +519,7 @@ fn process_cancel(rpc_client: &RpcClient, config: &WalletConfig, pubkey: &Pubkey
let blockhash = rpc_client.get_recent_blockhash()?;
let ix =
BudgetInstruction::new_apply_signature(&config.id.pubkey(), pubkey, &config.id.pubkey());
let mut tx = Transaction::new_signed_instructions(&[&config.id], vec![ix], blockhash, 0);
let mut tx = Transaction::new_signed_instructions(&[&config.id], vec![ix], blockhash);
let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
Ok(signature_str.to_string())
}
@ -547,7 +546,7 @@ fn process_time_elapsed(
let blockhash = rpc_client.get_recent_blockhash()?;
let ix = BudgetInstruction::new_apply_timestamp(&config.id.pubkey(), pubkey, to, dt);
let mut tx = Transaction::new_signed_instructions(&[&config.id], vec![ix], blockhash, 0);
let mut tx = Transaction::new_signed_instructions(&[&config.id], vec![ix], blockhash);
let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
Ok(signature_str.to_string())
@ -568,7 +567,7 @@ fn process_witness(
let blockhash = rpc_client.get_recent_blockhash()?;
let ix = BudgetInstruction::new_apply_signature(&config.id.pubkey(), pubkey, to);
let mut tx = Transaction::new_signed_instructions(&[&config.id], vec![ix], blockhash, 0);
let mut tx = Transaction::new_signed_instructions(&[&config.id], vec![ix], blockhash);
let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &config.id)?;
Ok(signature_str.to_string())