custody names refactored
This commit is contained in:
parent
d2a62fa211
commit
0a1c299206
@ -106,9 +106,9 @@ fn initial_validators_for_testing() -> Vec<ValidatorRecord> {
|
|||||||
status: From::from(0),
|
status: From::from(0),
|
||||||
latest_status_change_slot: 0,
|
latest_status_change_slot: 0,
|
||||||
exit_count: 0,
|
exit_count: 0,
|
||||||
poc_commitment: Hash256::zero(),
|
custody_commitment: Hash256::zero(),
|
||||||
last_poc_change_slot: 0,
|
latest_custody_reseed_slot: 0,
|
||||||
second_last_poc_slot: 0
|
penultimate_custody_reseed_slot: 0
|
||||||
};
|
};
|
||||||
initial_validators.push(validator_record);
|
initial_validators.push(validator_record);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
use super::{DepositData, DepositInput, Hash256};
|
use super::{DepositData, Hash256};
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
use bls::{Keypair, create_proof_of_possession};
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct Deposit {
|
pub struct Deposit {
|
||||||
|
@ -9,7 +9,7 @@ pub struct DepositInput {
|
|||||||
pub pubkey: PublicKey,
|
pub pubkey: PublicKey,
|
||||||
pub withdrawal_credentials: Hash256,
|
pub withdrawal_credentials: Hash256,
|
||||||
pub randao_commitment: Hash256,
|
pub randao_commitment: Hash256,
|
||||||
pub poc_commitment: Hash256,
|
pub custody_commitment: Hash256,
|
||||||
pub proof_of_possession: Signature,
|
pub proof_of_possession: Signature,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ impl Encodable for DepositInput {
|
|||||||
s.append(&self.pubkey);
|
s.append(&self.pubkey);
|
||||||
s.append(&self.withdrawal_credentials);
|
s.append(&self.withdrawal_credentials);
|
||||||
s.append(&self.randao_commitment);
|
s.append(&self.randao_commitment);
|
||||||
s.append(&self.poc_commitment);
|
s.append(&self.custody_commitment);
|
||||||
s.append(&self.proof_of_possession);
|
s.append(&self.proof_of_possession);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ impl Decodable for DepositInput {
|
|||||||
let (pubkey, i) = <_>::ssz_decode(bytes, i)?;
|
let (pubkey, i) = <_>::ssz_decode(bytes, i)?;
|
||||||
let (withdrawal_credentials, i) = <_>::ssz_decode(bytes, i)?;
|
let (withdrawal_credentials, i) = <_>::ssz_decode(bytes, i)?;
|
||||||
let (randao_commitment, 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)?;
|
let (proof_of_possession, i) = <_>::ssz_decode(bytes, i)?;
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
@ -36,7 +36,7 @@ impl Decodable for DepositInput {
|
|||||||
pubkey,
|
pubkey,
|
||||||
withdrawal_credentials,
|
withdrawal_credentials,
|
||||||
randao_commitment,
|
randao_commitment,
|
||||||
poc_commitment,
|
custody_commitment,
|
||||||
proof_of_possession,
|
proof_of_possession,
|
||||||
},
|
},
|
||||||
i,
|
i,
|
||||||
@ -50,7 +50,7 @@ impl<T: RngCore> TestRandom<T> for DepositInput {
|
|||||||
pubkey: <_>::random_for_test(rng),
|
pubkey: <_>::random_for_test(rng),
|
||||||
withdrawal_credentials: <_>::random_for_test(rng),
|
withdrawal_credentials: <_>::random_for_test(rng),
|
||||||
randao_commitment: <_>::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),
|
proof_of_possession: <_>::random_for_test(rng),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use super::bls::{Keypair, PublicKey};
|
use super::bls::PublicKey;
|
||||||
use super::{Hash256};
|
use super::{Hash256};
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
@ -38,9 +38,9 @@ pub struct ValidatorRecord {
|
|||||||
pub status: ValidatorStatus,
|
pub status: ValidatorStatus,
|
||||||
pub latest_status_change_slot: u64,
|
pub latest_status_change_slot: u64,
|
||||||
pub exit_count: u64,
|
pub exit_count: u64,
|
||||||
pub poc_commitment: Hash256,
|
pub custody_commitment: Hash256,
|
||||||
pub last_poc_change_slot: u64,
|
pub latest_custody_reseed_slot: u64,
|
||||||
pub second_last_poc_slot: u64
|
pub penultimate_custody_reseed_slot: u64
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ValidatorRecord {
|
impl ValidatorRecord {
|
||||||
@ -102,9 +102,9 @@ impl Encodable for ValidatorRecord {
|
|||||||
s.append(&self.status);
|
s.append(&self.status);
|
||||||
s.append(&self.latest_status_change_slot);
|
s.append(&self.latest_status_change_slot);
|
||||||
s.append(&self.exit_count);
|
s.append(&self.exit_count);
|
||||||
s.append(&self.poc_commitment);
|
s.append(&self.custody_commitment);
|
||||||
s.append(&self.last_poc_change_slot);
|
s.append(&self.latest_custody_reseed_slot);
|
||||||
s.append(&self.second_last_poc_slot);
|
s.append(&self.penultimate_custody_reseed_slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,9 +117,9 @@ impl Decodable for ValidatorRecord {
|
|||||||
let (status, i) = <_>::ssz_decode(bytes, i)?;
|
let (status, i) = <_>::ssz_decode(bytes, i)?;
|
||||||
let (latest_status_change_slot, i) = <_>::ssz_decode(bytes, i)?;
|
let (latest_status_change_slot, i) = <_>::ssz_decode(bytes, i)?;
|
||||||
let (exit_count, i) = <_>::ssz_decode(bytes, i)?;
|
let (exit_count, i) = <_>::ssz_decode(bytes, i)?;
|
||||||
let (poc_commitment, i) = <_>::ssz_decode(bytes, i)?;
|
let (custody_commitment, i) = <_>::ssz_decode(bytes, i)?;
|
||||||
let (last_poc_change_slot, i) = <_>::ssz_decode(bytes, i)?;
|
let (latest_custody_reseed_slot, i) = <_>::ssz_decode(bytes, i)?;
|
||||||
let (second_last_poc_slot, i) = <_>::ssz_decode(bytes, i)?;
|
let (penultimate_custody_reseed_slot, i) = <_>::ssz_decode(bytes, i)?;
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
Self {
|
Self {
|
||||||
@ -130,9 +130,9 @@ impl Decodable for ValidatorRecord {
|
|||||||
status,
|
status,
|
||||||
latest_status_change_slot,
|
latest_status_change_slot,
|
||||||
exit_count,
|
exit_count,
|
||||||
poc_commitment,
|
custody_commitment,
|
||||||
last_poc_change_slot,
|
latest_custody_reseed_slot,
|
||||||
second_last_poc_slot
|
penultimate_custody_reseed_slot
|
||||||
},
|
},
|
||||||
i,
|
i,
|
||||||
))
|
))
|
||||||
@ -149,9 +149,9 @@ impl<T: RngCore> TestRandom<T> for ValidatorRecord {
|
|||||||
status: <_>::random_for_test(rng),
|
status: <_>::random_for_test(rng),
|
||||||
latest_status_change_slot: <_>::random_for_test(rng),
|
latest_status_change_slot: <_>::random_for_test(rng),
|
||||||
exit_count: <_>::random_for_test(rng),
|
exit_count: <_>::random_for_test(rng),
|
||||||
poc_commitment: <_>::random_for_test(rng),
|
custody_commitment: <_>::random_for_test(rng),
|
||||||
last_poc_change_slot: <_>::random_for_test(rng),
|
latest_custody_reseed_slot: <_>::random_for_test(rng),
|
||||||
second_last_poc_slot: <_>::random_for_test(rng),
|
penultimate_custody_reseed_slot: <_>::random_for_test(rng),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,9 +43,9 @@ pub fn process_deposit(
|
|||||||
status: ValidatorStatus::PendingActivation,
|
status: ValidatorStatus::PendingActivation,
|
||||||
latest_status_change_slot: state.validator_registry_latest_change_slot,
|
latest_status_change_slot: state.validator_registry_latest_change_slot,
|
||||||
exit_count: 0,
|
exit_count: 0,
|
||||||
poc_commitment: deposit_input.poc_commitment,
|
custody_commitment: deposit_input.custody_commitment,
|
||||||
last_poc_change_slot: 0,
|
latest_custody_reseed_slot: 0,
|
||||||
second_last_poc_slot: 0
|
penultimate_custody_reseed_slot: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
match min_empty_validator_index(state, spec) {
|
match min_empty_validator_index(state, spec) {
|
||||||
|
Loading…
Reference in New Issue
Block a user