updated deposit structs and validator record accrding to spec

This commit is contained in:
Grant Wuerker 2018-12-14 17:32:01 -06:00
parent 8974d8e1df
commit 5fa251943b
4 changed files with 13 additions and 13 deletions

View File

@ -1,14 +1,7 @@
use super::deposit_parameters::DepositParameters;
use super::{Hash256}; use super::{Hash256};
pub struct Deposit { pub struct Deposit {
pub merkle_branch: Hash256, pub merkle_branch: Vec<Hash256>,
pub merkle_tree_index: u64, pub merkle_tree_index: u64,
pub deposit_data: DepositData pub deposit_data: DepositData
} }
pub struct DepositData {
pub deposit_parameters: DepositParameters,
pub value: u64,
pub timestamp: u64
}

View File

@ -0,0 +1,7 @@
use super::deposit_parameters::DepositParameters;
pub struct DepositData {
pub deposit_parameter: DepositInput,
pub value: u64,
pub timestamp: u64
}

View File

@ -3,7 +3,7 @@ use super::{Hash256};
pub struct DepositParameters { pub struct DepositParameters {
pub pubkey: PublicKey, pub pubkey: PublicKey,
pub proof_of_possession: AggregateSignature,
pub withdrawal_credentials: Hash256, pub withdrawal_credentials: Hash256,
pub randao_commitment: Hash256 pub randao_commitment: Hash256,
pub proof_of_possession: AggregateSignature
} }

View File

@ -31,7 +31,7 @@ pub struct ValidatorRecord {
pub pubkey: PublicKey, pub pubkey: PublicKey,
pub withdrawal_credentials: Hash256, pub withdrawal_credentials: Hash256,
pub randao_commitment: Hash256, pub randao_commitment: Hash256,
pub randao_skips: u64, pub randao_layers: u64,
pub balance: u64, pub balance: u64,
pub status: u64, pub status: u64,
pub latest_status_change_slot: u64, pub latest_status_change_slot: u64,
@ -49,7 +49,7 @@ impl ValidatorRecord {
pubkey: keypair.pk.clone(), pubkey: keypair.pk.clone(),
withdrawal_credentials: Hash256::zero(), withdrawal_credentials: Hash256::zero(),
randao_commitment: Hash256::zero(), randao_commitment: Hash256::zero(),
randao_skips: 0, randao_layers: 0,
balance: 0, balance: 0,
status: 0, status: 0,
latest_status_change_slot: 0, latest_status_change_slot: 0,
@ -72,7 +72,7 @@ mod tests {
let (v, _kp) = ValidatorRecord::zero_with_thread_rand_keypair(); let (v, _kp) = ValidatorRecord::zero_with_thread_rand_keypair();
assert!(v.withdrawal_credentials.is_zero()); assert!(v.withdrawal_credentials.is_zero());
assert!(v.randao_commitment.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.balance, 0);
assert_eq!(v.status, 0); assert_eq!(v.status, 0);
assert_eq!(v.latest_status_change_slot, 0); assert_eq!(v.latest_status_change_slot, 0);