From f7a54afde5cf91f8fb4ac67a1dd2689b3e481d8a Mon Sep 17 00:00:00 2001 From: Justin Traglia <95511699+jtraglia@users.noreply.github.com> Date: Mon, 12 Dec 2022 00:40:44 +0000 Subject: [PATCH] Fix some capella nits (#3782) --- beacon_node/beacon_chain/src/beacon_chain.rs | 2 +- .../state_processing/src/per_block_processing/errors.rs | 8 ++++---- .../src/per_block_processing/process_operations.rs | 2 +- consensus/state_processing/src/upgrade/eip4844.rs | 2 +- consensus/types/src/bls_to_execution_change.rs | 1 - consensus/types/src/signed_bls_to_execution_change.rs | 1 - consensus/types/src/validator.rs | 8 ++++---- consensus/types/src/withdrawal.rs | 3 --- 8 files changed, 11 insertions(+), 16 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 1968a38a5..7841f53e7 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -2184,7 +2184,7 @@ impl BeaconChain { } } - /// Verify a signed BLS to exection change before allowing it to propagate on the gossip network. + /// Verify a signed BLS to execution change before allowing it to propagate on the gossip network. pub fn verify_bls_to_execution_change_for_gossip( &self, bls_to_execution_change: SignedBlsToExecutionChange, diff --git a/consensus/state_processing/src/per_block_processing/errors.rs b/consensus/state_processing/src/per_block_processing/errors.rs index 7b355b0dd..5c34afd59 100644 --- a/consensus/state_processing/src/per_block_processing/errors.rs +++ b/consensus/state_processing/src/per_block_processing/errors.rs @@ -305,7 +305,7 @@ pub enum AttesterSlashingInvalid { /// Describes why an object is invalid. #[derive(Debug, PartialEq, Clone)] pub enum AttestationInvalid { - /// Commmittee index exceeds number of committees in that slot. + /// Committee index exceeds number of committees in that slot. BadCommitteeIndex, /// Attestation included before the inclusion delay. IncludedTooEarly { @@ -420,11 +420,11 @@ pub enum ExitInvalid { pub enum BlsExecutionChangeInvalid { /// The specified validator is not in the state's validator registry. ValidatorUnknown(u64), - /// Validator does not have BLS Withdrawal credentials before this change + /// Validator does not have BLS Withdrawal credentials before this change. NonBlsWithdrawalCredentials, - /// Provided BLS pubkey does not match withdrawal credentials + /// Provided BLS pubkey does not match withdrawal credentials. WithdrawalCredentialsMismatch, - /// The signature is invalid + /// The signature is invalid. BadSignature, } diff --git a/consensus/state_processing/src/per_block_processing/process_operations.rs b/consensus/state_processing/src/per_block_processing/process_operations.rs index d0e855b7a..105faba83 100644 --- a/consensus/state_processing/src/per_block_processing/process_operations.rs +++ b/consensus/state_processing/src/per_block_processing/process_operations.rs @@ -293,7 +293,7 @@ pub fn process_exits( /// Validates each `bls_to_execution_change` and updates the state /// -/// Returns `Ok(())` if the validation and state updates completed successfully. Otherwise returs +/// Returns `Ok(())` if the validation and state updates completed successfully. Otherwise returns /// an `Err` describing the invalid object or cause of failure. #[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))] pub fn process_bls_to_execution_changes( diff --git a/consensus/state_processing/src/upgrade/eip4844.rs b/consensus/state_processing/src/upgrade/eip4844.rs index 478024f17..6d66fd841 100644 --- a/consensus/state_processing/src/upgrade/eip4844.rs +++ b/consensus/state_processing/src/upgrade/eip4844.rs @@ -67,7 +67,7 @@ pub fn upgrade_to_eip4844( #[cfg(feature = "withdrawals")] next_withdrawal_index: pre.next_withdrawal_index, #[cfg(feature = "withdrawals")] - next_withdrawal_validator_index: 0, + next_withdrawal_validator_index: pre.next_withdrawal_validator_index, // Caches total_active_balance: pre.total_active_balance, committee_caches: mem::take(&mut pre.committee_caches), diff --git a/consensus/types/src/bls_to_execution_change.rs b/consensus/types/src/bls_to_execution_change.rs index fa15a0132..497e9aa14 100644 --- a/consensus/types/src/bls_to_execution_change.rs +++ b/consensus/types/src/bls_to_execution_change.rs @@ -6,7 +6,6 @@ use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; use tree_hash_derive::TreeHash; -/// A deposit to potentially become a beacon chain validator. #[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive( Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, diff --git a/consensus/types/src/signed_bls_to_execution_change.rs b/consensus/types/src/signed_bls_to_execution_change.rs index d7cce693b..8c8131c1e 100644 --- a/consensus/types/src/signed_bls_to_execution_change.rs +++ b/consensus/types/src/signed_bls_to_execution_change.rs @@ -6,7 +6,6 @@ use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; use tree_hash_derive::TreeHash; -/// A deposit to potentially become a beacon chain validator. #[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive( Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, diff --git a/consensus/types/src/validator.rs b/consensus/types/src/validator.rs index e4497c809..ebe3ca046 100644 --- a/consensus/types/src/validator.rs +++ b/consensus/types/src/validator.rs @@ -67,7 +67,7 @@ impl Validator { && self.activation_epoch == spec.far_future_epoch } - /// Returns `true` if the validator has eth1 withdrawal credential + /// Returns `true` if the validator has eth1 withdrawal credential. pub fn has_eth1_withdrawal_credential(&self, spec: &ChainSpec) -> bool { self.withdrawal_credentials .as_bytes() @@ -88,7 +88,7 @@ impl Validator { .flatten() } - /// Changes withdrawal credentials to the provided eth1 execution address + /// Changes withdrawal credentials to the provided eth1 execution address. /// /// WARNING: this function does NO VALIDATION - it just does it! pub fn change_withdrawal_credentials(&mut self, execution_address: &Address, spec: &ChainSpec) { @@ -98,12 +98,12 @@ impl Validator { self.withdrawal_credentials = Hash256::from(bytes); } - /// Returns `true` if the validator is fully withdrawable at some epoch + /// Returns `true` if the validator is fully withdrawable at some epoch. pub fn is_fully_withdrawable_at(&self, balance: u64, epoch: Epoch, spec: &ChainSpec) -> bool { self.has_eth1_withdrawal_credential(spec) && self.withdrawable_epoch <= epoch && balance > 0 } - /// Returns `true` if the validator is partially withdrawable + /// Returns `true` if the validator is partially withdrawable. pub fn is_partially_withdrawable_validator(&self, balance: u64, spec: &ChainSpec) -> bool { self.has_eth1_withdrawal_credential(spec) && self.effective_balance == spec.max_effective_balance diff --git a/consensus/types/src/withdrawal.rs b/consensus/types/src/withdrawal.rs index c2529747c..10530dcb5 100644 --- a/consensus/types/src/withdrawal.rs +++ b/consensus/types/src/withdrawal.rs @@ -5,9 +5,6 @@ use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; use tree_hash_derive::TreeHash; -/// A deposit to potentially become a beacon chain validator. -/// -/// Spec v0.12.1 #[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive( Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,