Update replicator sampling and proof generation (#4522)

* Update replicator sampling and proof generation

* Clippy
This commit is contained in:
Sagar Dhawan
2019-06-03 17:27:28 -07:00
committed by GitHub
parent dea663d509
commit 167e15a5ae
4 changed files with 58 additions and 54 deletions

View File

@ -23,7 +23,6 @@ pub enum StorageInstruction {
sha_state: Hash,
slot: u64,
signature: Signature,
proof_index: u64,
},
AdvertiseStorageRecentBlockhash {
hash: Hash,
@ -111,13 +110,11 @@ pub fn mining_proof(
sha_state: Hash,
slot: u64,
signature: Signature,
proof_index: u64,
) -> Instruction {
let storage_instruction = StorageInstruction::SubmitMiningProof {
sha_state,
slot,
signature,
proof_index,
};
let account_metas = vec![
AccountMeta::new(*storage_pubkey, true),

View File

@ -43,7 +43,6 @@ pub fn process_instruction(
sha_state,
slot,
signature,
..
} => {
if me_unsigned || rest.len() != 1 {
// This instruction must be signed by `me`
@ -158,7 +157,6 @@ mod tests {
Hash::default(),
SLOTS_PER_SEGMENT,
Signature::default(),
0,
);
// the proof is for slot 16, which is in segment 0, need to move the tick height into segment 2
let ticks_till_next_segment = TICKS_IN_SEGMENT * 2;
@ -204,7 +202,7 @@ mod tests {
let mut accounts = [Account::default()];
let ix =
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default(), 0);
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default());
// move tick height into segment 1
let ticks_till_next_segment = TICKS_IN_SEGMENT + 1;
let mut tick_account = tick_height::create_account(1);
@ -226,7 +224,7 @@ mod tests {
accounts[1].data.resize(STORAGE_ACCOUNT_SPACE as usize, 0);
let ix =
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default(), 0);
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default());
// submitting a proof for a slot in the past, so this should fail
assert!(test_instruction(&ix, &mut accounts).is_err());
@ -244,7 +242,7 @@ mod tests {
}
let ix =
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default(), 0);
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default());
// move tick height into segment 1
let ticks_till_next_segment = TICKS_IN_SEGMENT + 1;
let mut tick_account = tick_height::create_account(1);
@ -501,7 +499,6 @@ mod tests {
sha_state,
slot,
Signature::default(),
0,
)],
Some(&mint_keypair.pubkey()),
);
@ -595,7 +592,6 @@ mod tests {
Hash::default(),
slot,
Signature::default(),
0,
)],
Some(&mint_pubkey),
);