Save RNG for generating random storage sampling offsets (#4450)

* Save RNG for generating random storage sampling offsets

* fix clippy

* fix stable-perf

* fix chacha
This commit is contained in:
Pankaj Garg
2019-05-28 14:14:46 -07:00
committed by GitHub
parent 9fcd162412
commit c8a03c7b3d
4 changed files with 31 additions and 12 deletions

View File

@@ -43,6 +43,7 @@ pub fn process_instruction(
sha_state,
slot,
signature,
..
} => {
if me_unsigned || !rest.is_empty() {
// This instruction must be signed by `me`
@@ -154,6 +155,7 @@ 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;
@@ -197,7 +199,7 @@ mod tests {
let mut accounts = [Account::default()];
let ix =
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default());
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default(), 0);
// move tick height into segment 1
let ticks_till_next_segment = TICKS_IN_SEGMENT + 1;
@@ -217,7 +219,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());
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default(), 0);
// submitting a proof for a slot in the past, so this should fail
assert!(test_instruction(&ix, &mut accounts, 0).is_err());
@@ -235,7 +237,7 @@ mod tests {
}
let ix =
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default());
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default(), 0);
// move tick height into segment 1
let ticks_till_next_segment = TICKS_IN_SEGMENT + 1;
@@ -493,6 +495,7 @@ mod tests {
sha_state,
slot,
Signature::default(),
0,
)],
Some(&mint_keypair.pubkey()),
);
@@ -586,6 +589,7 @@ mod tests {
Hash::default(),
slot,
Signature::default(),
0,
)],
Some(&mint_pubkey),
);