Merge branch 'capella' of https://github.com/sigp/lighthouse into eip4844
This commit is contained in:
commit
2a7a1b31dc
@ -2205,7 +2205,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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(
|
pub fn verify_bls_to_execution_change_for_gossip(
|
||||||
&self,
|
&self,
|
||||||
bls_to_execution_change: SignedBlsToExecutionChange,
|
bls_to_execution_change: SignedBlsToExecutionChange,
|
||||||
|
@ -305,7 +305,7 @@ pub enum AttesterSlashingInvalid {
|
|||||||
/// Describes why an object is invalid.
|
/// Describes why an object is invalid.
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub enum AttestationInvalid {
|
pub enum AttestationInvalid {
|
||||||
/// Commmittee index exceeds number of committees in that slot.
|
/// Committee index exceeds number of committees in that slot.
|
||||||
BadCommitteeIndex,
|
BadCommitteeIndex,
|
||||||
/// Attestation included before the inclusion delay.
|
/// Attestation included before the inclusion delay.
|
||||||
IncludedTooEarly {
|
IncludedTooEarly {
|
||||||
@ -420,11 +420,11 @@ pub enum ExitInvalid {
|
|||||||
pub enum BlsExecutionChangeInvalid {
|
pub enum BlsExecutionChangeInvalid {
|
||||||
/// The specified validator is not in the state's validator registry.
|
/// The specified validator is not in the state's validator registry.
|
||||||
ValidatorUnknown(u64),
|
ValidatorUnknown(u64),
|
||||||
/// Validator does not have BLS Withdrawal credentials before this change
|
/// Validator does not have BLS Withdrawal credentials before this change.
|
||||||
NonBlsWithdrawalCredentials,
|
NonBlsWithdrawalCredentials,
|
||||||
/// Provided BLS pubkey does not match withdrawal credentials
|
/// Provided BLS pubkey does not match withdrawal credentials.
|
||||||
WithdrawalCredentialsMismatch,
|
WithdrawalCredentialsMismatch,
|
||||||
/// The signature is invalid
|
/// The signature is invalid.
|
||||||
BadSignature,
|
BadSignature,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ pub fn process_exits<T: EthSpec>(
|
|||||||
|
|
||||||
/// Validates each `bls_to_execution_change` and updates the state
|
/// 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.
|
/// an `Err` describing the invalid object or cause of failure.
|
||||||
pub fn process_bls_to_execution_changes<T: EthSpec>(
|
pub fn process_bls_to_execution_changes<T: EthSpec>(
|
||||||
state: &mut BeaconState<T>,
|
state: &mut BeaconState<T>,
|
||||||
|
@ -67,7 +67,7 @@ pub fn upgrade_to_eip4844<E: EthSpec>(
|
|||||||
#[cfg(feature = "withdrawals")]
|
#[cfg(feature = "withdrawals")]
|
||||||
next_withdrawal_index: pre.next_withdrawal_index,
|
next_withdrawal_index: pre.next_withdrawal_index,
|
||||||
#[cfg(feature = "withdrawals")]
|
#[cfg(feature = "withdrawals")]
|
||||||
next_withdrawal_validator_index: 0,
|
next_withdrawal_validator_index: pre.next_withdrawal_validator_index,
|
||||||
// Caches
|
// Caches
|
||||||
total_active_balance: pre.total_active_balance,
|
total_active_balance: pre.total_active_balance,
|
||||||
committee_caches: mem::take(&mut pre.committee_caches),
|
committee_caches: mem::take(&mut pre.committee_caches),
|
||||||
|
@ -6,7 +6,6 @@ use ssz_derive::{Decode, Encode};
|
|||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
use tree_hash_derive::TreeHash;
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
/// A deposit to potentially become a beacon chain validator.
|
|
||||||
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
|
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
|
||||||
|
@ -6,7 +6,6 @@ use ssz_derive::{Decode, Encode};
|
|||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
use tree_hash_derive::TreeHash;
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
/// A deposit to potentially become a beacon chain validator.
|
|
||||||
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
|
Debug, PartialEq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
|
||||||
|
@ -67,7 +67,7 @@ impl Validator {
|
|||||||
&& self.activation_epoch == spec.far_future_epoch
|
&& 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 {
|
pub fn has_eth1_withdrawal_credential(&self, spec: &ChainSpec) -> bool {
|
||||||
self.withdrawal_credentials
|
self.withdrawal_credentials
|
||||||
.as_bytes()
|
.as_bytes()
|
||||||
@ -88,7 +88,7 @@ impl Validator {
|
|||||||
.flatten()
|
.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!
|
/// WARNING: this function does NO VALIDATION - it just does it!
|
||||||
pub fn change_withdrawal_credentials(&mut self, execution_address: &Address, spec: &ChainSpec) {
|
pub fn change_withdrawal_credentials(&mut self, execution_address: &Address, spec: &ChainSpec) {
|
||||||
@ -98,12 +98,12 @@ impl Validator {
|
|||||||
self.withdrawal_credentials = Hash256::from(bytes);
|
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 {
|
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
|
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 {
|
pub fn is_partially_withdrawable_validator(&self, balance: u64, spec: &ChainSpec) -> bool {
|
||||||
self.has_eth1_withdrawal_credential(spec)
|
self.has_eth1_withdrawal_credential(spec)
|
||||||
&& self.effective_balance == spec.max_effective_balance
|
&& self.effective_balance == spec.max_effective_balance
|
||||||
|
@ -5,9 +5,6 @@ use ssz_derive::{Decode, Encode};
|
|||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
use tree_hash_derive::TreeHash;
|
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))]
|
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
|
Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
|
||||||
|
Loading…
Reference in New Issue
Block a user