Use clearer types in test_harness::Config

This commit is contained in:
Paul Hauner 2019-03-04 09:30:09 +11:00
parent 9d77f2b1a8
commit 3aaa3ea024
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6

View File

@ -3,9 +3,12 @@ use bls::create_proof_of_possession;
use types::*;
use yaml_rust::Yaml;
pub type DepositTuple = (u64, Deposit, Keypair);
pub type ProposerSlashingTuple = (u64, u64);
pub type AttesterSlashingTuple = (u64, Vec<u64>);
pub type ValidatorIndex = u64;
pub type ValidatorIndices = Vec<u64>;
pub type DepositTuple = (SlotHeight, Deposit, Keypair);
pub type ProposerSlashingTuple = (SlotHeight, ValidatorIndex);
pub type AttesterSlashingTuple = (SlotHeight, ValidatorIndices);
/// Defines the execution of a `BeaconStateHarness` across a series of slots.
#[derive(Debug)]
@ -53,7 +56,7 @@ fn parse_attester_slashings(yaml: &Yaml) -> Option<Vec<AttesterSlashingTuple>> {
let validator_indices = as_vec_u64(slashing, "validator_indices")
.expect("Incomplete attester_slashing (validator_indices)");
slashings.push((slot, validator_indices));
slashings.push((SlotHeight::from(slot), validator_indices));
}
Some(slashings)
@ -68,7 +71,7 @@ fn parse_proposer_slashings(yaml: &Yaml) -> Option<Vec<ProposerSlashingTuple>> {
let validator_index = as_u64(slashing, "validator_index")
.expect("Incomplete proposer slashing (validator_index)");
slashings.push((slot, validator_index));
slashings.push((SlotHeight::from(slot), validator_index));
}
Some(slashings)
@ -102,7 +105,7 @@ fn parse_deposits(yaml: &Yaml) -> Option<Vec<DepositTuple>> {
},
};
deposits.push((slot, deposit, keypair));
deposits.push((SlotHeight::from(slot), deposit, keypair));
}
Some(deposits)