mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 21:34:46 +00:00
Merge branch 'capella' of https://github.com/sigp/lighthouse into eip4844
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user