Arc-ify immutable Validator fields

This commit is contained in:
Michael Sproul
2022-03-07 17:33:59 +11:00
parent 73af0b6282
commit f93dfd0c28
9 changed files with 80 additions and 188 deletions

View File

@@ -6,6 +6,7 @@ use crate::common::{
use crate::per_block_processing::errors::{BlockProcessingError, IntoWithIndex};
use crate::VerifySignatures;
use safe_arith::SafeArith;
use std::sync::Arc;
use types::consts::altair::{PARTICIPATION_FLAG_WEIGHTS, PROPOSER_WEIGHT, WEIGHT_DENOMINATOR};
pub fn process_operations<'a, T: EthSpec>(
@@ -340,8 +341,10 @@ pub fn process_deposit<T: EthSpec>(
// Create a new validator.
let validator = Validator {
pubkey: deposit.data.pubkey,
withdrawal_credentials: deposit.data.withdrawal_credentials,
immutable: Arc::new(ValidatorImmutable {
pubkey: deposit.data.pubkey,
withdrawal_credentials: deposit.data.withdrawal_credentials,
}),
activation_eligibility_epoch: spec.far_future_epoch,
activation_epoch: spec.far_future_epoch,
exit_epoch: spec.far_future_epoch,

View File

@@ -63,7 +63,7 @@ where
.validators()
.get(validator_index)
.and_then(|v| {
let pk: Option<PublicKey> = v.pubkey.decompress().ok();
let pk: Option<PublicKey> = v.pubkey().decompress().ok();
pk
})
.map(Cow::Owned)