From 3aaa3ea0243bb355fc9c2ead3cb6a8e939c4eec1 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 4 Mar 2019 09:30:09 +1100 Subject: [PATCH] Use clearer types in test_harness::Config --- .../test_harness/src/test_case/config.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/beacon_node/beacon_chain/test_harness/src/test_case/config.rs b/beacon_node/beacon_chain/test_harness/src/test_case/config.rs index 8c88ee5d1..d08e7fe40 100644 --- a/beacon_node/beacon_chain/test_harness/src/test_case/config.rs +++ b/beacon_node/beacon_chain/test_harness/src/test_case/config.rs @@ -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); +pub type ValidatorIndex = u64; +pub type ValidatorIndices = Vec; + +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> { 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> { 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> { }, }; - deposits.push((slot, deposit, keypair)); + deposits.push((SlotHeight::from(slot), deposit, keypair)); } Some(deposits)