From 5fa251943bdb011074ce523b15ebda0580e9d226 Mon Sep 17 00:00:00 2001 From: Grant Wuerker Date: Fri, 14 Dec 2018 17:32:01 -0600 Subject: [PATCH] updated deposit structs and validator record accrding to spec --- beacon_chain/types/src/deposit.rs | 9 +-------- beacon_chain/types/src/deposit_data.rs | 7 +++++++ .../src/{deposit_parameters.rs => deposit_input.rs} | 4 ++-- beacon_chain/types/src/validator_record.rs | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 beacon_chain/types/src/deposit_data.rs rename beacon_chain/types/src/{deposit_parameters.rs => deposit_input.rs} (68%) diff --git a/beacon_chain/types/src/deposit.rs b/beacon_chain/types/src/deposit.rs index b10352a45..58e61c9cf 100644 --- a/beacon_chain/types/src/deposit.rs +++ b/beacon_chain/types/src/deposit.rs @@ -1,14 +1,7 @@ -use super::deposit_parameters::DepositParameters; use super::{Hash256}; pub struct Deposit { - pub merkle_branch: Hash256, + pub merkle_branch: Vec, pub merkle_tree_index: u64, pub deposit_data: DepositData } - -pub struct DepositData { - pub deposit_parameters: DepositParameters, - pub value: u64, - pub timestamp: u64 -} diff --git a/beacon_chain/types/src/deposit_data.rs b/beacon_chain/types/src/deposit_data.rs new file mode 100644 index 000000000..32a705d27 --- /dev/null +++ b/beacon_chain/types/src/deposit_data.rs @@ -0,0 +1,7 @@ +use super::deposit_parameters::DepositParameters; + +pub struct DepositData { + pub deposit_parameter: DepositInput, + pub value: u64, + pub timestamp: u64 +} diff --git a/beacon_chain/types/src/deposit_parameters.rs b/beacon_chain/types/src/deposit_input.rs similarity index 68% rename from beacon_chain/types/src/deposit_parameters.rs rename to beacon_chain/types/src/deposit_input.rs index 9ff121fb9..d2db350ef 100644 --- a/beacon_chain/types/src/deposit_parameters.rs +++ b/beacon_chain/types/src/deposit_input.rs @@ -3,7 +3,7 @@ use super::{Hash256}; pub struct DepositParameters { pub pubkey: PublicKey, - pub proof_of_possession: AggregateSignature, pub withdrawal_credentials: Hash256, - pub randao_commitment: Hash256 + pub randao_commitment: Hash256, + pub proof_of_possession: AggregateSignature } diff --git a/beacon_chain/types/src/validator_record.rs b/beacon_chain/types/src/validator_record.rs index c4e57d335..c68830f60 100644 --- a/beacon_chain/types/src/validator_record.rs +++ b/beacon_chain/types/src/validator_record.rs @@ -31,7 +31,7 @@ pub struct ValidatorRecord { pub pubkey: PublicKey, pub withdrawal_credentials: Hash256, pub randao_commitment: Hash256, - pub randao_skips: u64, + pub randao_layers: u64, pub balance: u64, pub status: u64, pub latest_status_change_slot: u64, @@ -49,7 +49,7 @@ impl ValidatorRecord { pubkey: keypair.pk.clone(), withdrawal_credentials: Hash256::zero(), randao_commitment: Hash256::zero(), - randao_skips: 0, + randao_layers: 0, balance: 0, status: 0, latest_status_change_slot: 0, @@ -72,7 +72,7 @@ mod tests { let (v, _kp) = ValidatorRecord::zero_with_thread_rand_keypair(); assert!(v.withdrawal_credentials.is_zero()); assert!(v.randao_commitment.is_zero()); - assert_eq!(v.randao_skips, 0); + assert_eq!(v.randao_layers, 0); assert_eq!(v.balance, 0); assert_eq!(v.status, 0); assert_eq!(v.latest_status_change_slot, 0);