removed ValidatorRecord::zero_with_rand_keypair()
This commit is contained in:
parent
a3ef9231a6
commit
d2a62fa211
@ -43,23 +43,6 @@ pub struct ValidatorRecord {
|
|||||||
pub second_last_poc_slot: u64
|
pub second_last_poc_slot: u64
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ValidatorRecord {
|
|
||||||
pub fn zero_with_rand_keypair() -> Self {
|
|
||||||
Self {
|
|
||||||
pubkey: Keypair::random().pk,
|
|
||||||
withdrawal_credentials: Hash256::zero(),
|
|
||||||
randao_commitment: Hash256::zero(),
|
|
||||||
randao_layers: 0,
|
|
||||||
status: ValidatorStatus::from(0),
|
|
||||||
latest_status_change_slot: 0,
|
|
||||||
exit_count: 0,
|
|
||||||
poc_commitment: Hash256::zero(),
|
|
||||||
last_poc_change_slot: 0,
|
|
||||||
second_last_poc_slot: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ValidatorRecord {
|
impl ValidatorRecord {
|
||||||
pub fn status_is(&self, status: ValidatorStatus) -> bool {
|
pub fn status_is(&self, status: ValidatorStatus) -> bool {
|
||||||
self.status == status
|
self.status == status
|
||||||
|
@ -98,6 +98,11 @@ mod tests {
|
|||||||
deposit
|
deposit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_validator() -> ValidatorRecord {
|
||||||
|
let mut rng = XorShiftRng::from_seed([42; 16]);
|
||||||
|
ValidatorRecord::random_for_test(&mut rng)
|
||||||
|
}
|
||||||
|
|
||||||
fn deposit_equals_record(dep: &Deposit, val: &ValidatorRecord) -> bool {
|
fn deposit_equals_record(dep: &Deposit, val: &ValidatorRecord) -> bool {
|
||||||
(dep.deposit_data.deposit_input.pubkey == val.pubkey)
|
(dep.deposit_data.deposit_input.pubkey == val.pubkey)
|
||||||
& (dep.deposit_data.deposit_input.withdrawal_credentials == val.withdrawal_credentials)
|
& (dep.deposit_data.deposit_input.withdrawal_credentials == val.withdrawal_credentials)
|
||||||
@ -142,7 +147,8 @@ mod tests {
|
|||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
let mut deposit = get_deposit();
|
let mut deposit = get_deposit();
|
||||||
let mut validator = ValidatorRecord::zero_with_rand_keypair();
|
let mut validator = get_validator();
|
||||||
|
|
||||||
deposit.deposit_data.value = DEPOSIT_GWEI;
|
deposit.deposit_data.value = DEPOSIT_GWEI;
|
||||||
validator.pubkey = deposit.deposit_data.deposit_input.pubkey.clone();
|
validator.pubkey = deposit.deposit_data.deposit_input.pubkey.clone();
|
||||||
validator.withdrawal_credentials = deposit.deposit_data.deposit_input.withdrawal_credentials;
|
validator.withdrawal_credentials = deposit.deposit_data.deposit_input.withdrawal_credentials;
|
||||||
@ -165,7 +171,8 @@ mod tests {
|
|||||||
let mut state = BeaconState::default();
|
let mut state = BeaconState::default();
|
||||||
let spec = ChainSpec::foundation();
|
let spec = ChainSpec::foundation();
|
||||||
|
|
||||||
let validator = ValidatorRecord::zero_with_rand_keypair();
|
let mut validator = get_validator();
|
||||||
|
validator.latest_status_change_slot = 0;
|
||||||
state.validator_registry.push(validator);
|
state.validator_registry.push(validator);
|
||||||
state.validator_balances.push(0);
|
state.validator_balances.push(0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user