More updates base upon the specs, again

This commit is contained in:
Kirk Baird
2019-01-24 10:17:12 +11:00
parent e047fbe914
commit c860191f14
17 changed files with 118 additions and 140 deletions

View File

@@ -1,7 +1,7 @@
use super::ChainSpec;
use bls::{Keypair, PublicKey, SecretKey, Signature};
use types::{Address, Eth1Data, Hash256, ValidatorRecord};
use types::{Address, Eth1Data, Hash256, Validator};
/// The size of a validators deposit in GWei.
pub const DEPOSIT_GWEI: u64 = 32_000_000_000;
@@ -37,7 +37,7 @@ impl ChainSpec {
* Initial Values
*/
genesis_fork_version: 0,
genesis_slot_number: 0,
genesis_slot: 0,
genesis_start_shard: 0,
far_future_slot: u64::max_value(),
zero_hash: Hash256::zero(),
@@ -83,7 +83,7 @@ impl ChainSpec {
}
/// Generate a set of validator records to use with testing until the real chain starts.
fn initial_validators_for_testing() -> Vec<ValidatorRecord> {
fn initial_validators_for_testing() -> Vec<Validator> {
// Some dummy private keys to start with.
let key_strings = vec![
"jzjxxgjajfjrmgodszzsgqccmhnyvetcuxobhtynojtpdtbj",
@@ -106,7 +106,7 @@ fn initial_validators_for_testing() -> Vec<ValidatorRecord> {
pk: public_key,
}
};
let validator_record = ValidatorRecord {
let validator = Validator {
pubkey: keypair.pk.clone(),
withdrawal_credentials: Hash256::zero(),
proposer_slots: 0,
@@ -116,11 +116,10 @@ fn initial_validators_for_testing() -> Vec<ValidatorRecord> {
penalized_slot: u64::max_value(),
exit_count: 0,
status_flags: None,
custody_commitment: Hash256::zero(),
latest_custody_reseed_slot: 0,
penultimate_custody_reseed_slot: 0,
};
initial_validators.push(validator_record);
initial_validators.push(validator);
}
initial_validators

View File

@@ -4,7 +4,7 @@ extern crate types;
mod foundation;
use bls::Signature;
use types::{Address, Eth1Data, Hash256, ValidatorRecord};
use types::{Address, Eth1Data, Hash256, Validator};
#[derive(PartialEq, Debug)]
pub struct ChainSpec {
@@ -32,7 +32,7 @@ pub struct ChainSpec {
* Initial Values
*/
pub genesis_fork_version: u64,
pub genesis_slot_number: u64,
pub genesis_slot: u64,
pub genesis_start_shard: u64,
pub far_future_slot: u64,
pub zero_hash: Hash256,
@@ -66,7 +66,7 @@ pub struct ChainSpec {
/*
* Intialization parameters
*/
pub initial_validators: Vec<ValidatorRecord>,
pub initial_validators: Vec<Validator>,
pub initial_balances: Vec<u64>,
pub genesis_time: u64,
pub intial_eth1_data: Eth1Data,