From 0a1c29920611d6f0e57715d24cea6a519d3aeb8b Mon Sep 17 00:00:00 2001 From: Grant Wuerker Date: Mon, 7 Jan 2019 21:57:35 -0600 Subject: [PATCH] custody names refactored --- beacon_chain/spec/src/foundation.rs | 6 ++-- beacon_chain/types/src/deposit.rs | 3 +- beacon_chain/types/src/deposit_input.rs | 10 +++--- beacon_chain/types/src/validator_record.rs | 32 +++++++++---------- .../validator_induction/src/inductor.rs | 6 ++-- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/beacon_chain/spec/src/foundation.rs b/beacon_chain/spec/src/foundation.rs index 930e414e86..c69c57e6db 100644 --- a/beacon_chain/spec/src/foundation.rs +++ b/beacon_chain/spec/src/foundation.rs @@ -106,9 +106,9 @@ fn initial_validators_for_testing() -> Vec { 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); } diff --git a/beacon_chain/types/src/deposit.rs b/beacon_chain/types/src/deposit.rs index 27b8a66cce..9d84bc2780 100644 --- a/beacon_chain/types/src/deposit.rs +++ b/beacon_chain/types/src/deposit.rs @@ -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 { diff --git a/beacon_chain/types/src/deposit_input.rs b/beacon_chain/types/src/deposit_input.rs index 2808e98bc3..636da0d356 100644 --- a/beacon_chain/types/src/deposit_input.rs +++ b/beacon_chain/types/src/deposit_input.rs @@ -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 TestRandom 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), } } diff --git a/beacon_chain/types/src/validator_record.rs b/beacon_chain/types/src/validator_record.rs index c1eb9e6057..fcc93fb079 100644 --- a/beacon_chain/types/src/validator_record.rs +++ b/beacon_chain/types/src/validator_record.rs @@ -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 TestRandom 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), } } } diff --git a/beacon_chain/validator_induction/src/inductor.rs b/beacon_chain/validator_induction/src/inductor.rs index 856bb5e71d..a9b10a0f0f 100644 --- a/beacon_chain/validator_induction/src/inductor.rs +++ b/beacon_chain/validator_induction/src/inductor.rs @@ -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) {