custody names refactored

This commit is contained in:
Grant Wuerker 2019-01-07 21:57:35 -06:00
parent d2a62fa211
commit 0a1c299206
5 changed files with 28 additions and 29 deletions

View File

@ -106,9 +106,9 @@ fn initial_validators_for_testing() -> Vec<ValidatorRecord> {
status: From::from(0),
latest_status_change_slot: 0,
exit_count: 0,
poc_commitment: Hash256::zero(),
last_poc_change_slot: 0,
second_last_poc_slot: 0
custody_commitment: Hash256::zero(),
latest_custody_reseed_slot: 0,
penultimate_custody_reseed_slot: 0
};
initial_validators.push(validator_record);
}

View File

@ -1,8 +1,7 @@
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
use super::{DepositData, DepositInput, Hash256};
use super::{DepositData, Hash256};
use crate::test_utils::TestRandom;
use rand::RngCore;
use bls::{Keypair, create_proof_of_possession};
#[derive(Debug, PartialEq, Clone)]
pub struct Deposit {

View File

@ -9,7 +9,7 @@ pub struct DepositInput {
pub pubkey: PublicKey,
pub withdrawal_credentials: Hash256,
pub randao_commitment: Hash256,
pub poc_commitment: Hash256,
pub custody_commitment: Hash256,
pub proof_of_possession: Signature,
}
@ -18,7 +18,7 @@ impl Encodable for DepositInput {
s.append(&self.pubkey);
s.append(&self.withdrawal_credentials);
s.append(&self.randao_commitment);
s.append(&self.poc_commitment);
s.append(&self.custody_commitment);
s.append(&self.proof_of_possession);
}
}
@ -28,7 +28,7 @@ impl Decodable for DepositInput {
let (pubkey, i) = <_>::ssz_decode(bytes, i)?;
let (withdrawal_credentials, i) = <_>::ssz_decode(bytes, i)?;
let (randao_commitment, i) = <_>::ssz_decode(bytes, i)?;
let (poc_commitment, i) = <_>::ssz_decode(bytes, i)?;
let (custody_commitment, i) = <_>::ssz_decode(bytes, i)?;
let (proof_of_possession, i) = <_>::ssz_decode(bytes, i)?;
Ok((
@ -36,7 +36,7 @@ impl Decodable for DepositInput {
pubkey,
withdrawal_credentials,
randao_commitment,
poc_commitment,
custody_commitment,
proof_of_possession,
},
i,
@ -50,7 +50,7 @@ impl<T: RngCore> TestRandom<T> for DepositInput {
pubkey: <_>::random_for_test(rng),
withdrawal_credentials: <_>::random_for_test(rng),
randao_commitment: <_>::random_for_test(rng),
poc_commitment: <_>::random_for_test(rng),
custody_commitment: <_>::random_for_test(rng),
proof_of_possession: <_>::random_for_test(rng),
}
}

View File

@ -1,4 +1,4 @@
use super::bls::{Keypair, PublicKey};
use super::bls::PublicKey;
use super::{Hash256};
use crate::test_utils::TestRandom;
use rand::RngCore;
@ -38,9 +38,9 @@ pub struct ValidatorRecord {
pub status: ValidatorStatus,
pub latest_status_change_slot: u64,
pub exit_count: u64,
pub poc_commitment: Hash256,
pub last_poc_change_slot: u64,
pub second_last_poc_slot: u64
pub custody_commitment: Hash256,
pub latest_custody_reseed_slot: u64,
pub penultimate_custody_reseed_slot: u64
}
impl ValidatorRecord {
@ -102,9 +102,9 @@ impl Encodable for ValidatorRecord {
s.append(&self.status);
s.append(&self.latest_status_change_slot);
s.append(&self.exit_count);
s.append(&self.poc_commitment);
s.append(&self.last_poc_change_slot);
s.append(&self.second_last_poc_slot);
s.append(&self.custody_commitment);
s.append(&self.latest_custody_reseed_slot);
s.append(&self.penultimate_custody_reseed_slot);
}
}
@ -117,9 +117,9 @@ impl Decodable for ValidatorRecord {
let (status, i) = <_>::ssz_decode(bytes, i)?;
let (latest_status_change_slot, i) = <_>::ssz_decode(bytes, i)?;
let (exit_count, i) = <_>::ssz_decode(bytes, i)?;
let (poc_commitment, i) = <_>::ssz_decode(bytes, i)?;
let (last_poc_change_slot, i) = <_>::ssz_decode(bytes, i)?;
let (second_last_poc_slot, i) = <_>::ssz_decode(bytes, i)?;
let (custody_commitment, i) = <_>::ssz_decode(bytes, i)?;
let (latest_custody_reseed_slot, i) = <_>::ssz_decode(bytes, i)?;
let (penultimate_custody_reseed_slot, i) = <_>::ssz_decode(bytes, i)?;
Ok((
Self {
@ -130,9 +130,9 @@ impl Decodable for ValidatorRecord {
status,
latest_status_change_slot,
exit_count,
poc_commitment,
last_poc_change_slot,
second_last_poc_slot
custody_commitment,
latest_custody_reseed_slot,
penultimate_custody_reseed_slot
},
i,
))
@ -149,9 +149,9 @@ impl<T: RngCore> TestRandom<T> for ValidatorRecord {
status: <_>::random_for_test(rng),
latest_status_change_slot: <_>::random_for_test(rng),
exit_count: <_>::random_for_test(rng),
poc_commitment: <_>::random_for_test(rng),
last_poc_change_slot: <_>::random_for_test(rng),
second_last_poc_slot: <_>::random_for_test(rng),
custody_commitment: <_>::random_for_test(rng),
latest_custody_reseed_slot: <_>::random_for_test(rng),
penultimate_custody_reseed_slot: <_>::random_for_test(rng),
}
}
}

View File

@ -43,9 +43,9 @@ pub fn process_deposit(
status: ValidatorStatus::PendingActivation,
latest_status_change_slot: state.validator_registry_latest_change_slot,
exit_count: 0,
poc_commitment: deposit_input.poc_commitment,
last_poc_change_slot: 0,
second_last_poc_slot: 0
custody_commitment: deposit_input.custody_commitment,
latest_custody_reseed_slot: 0,
penultimate_custody_reseed_slot: 0
};
match min_empty_validator_index(state, spec) {