Skip to content

Commit

Permalink
Use spec fn for max_effective_balance
Browse files Browse the repository at this point in the history
  • Loading branch information
ethDreamer committed Jun 26, 2024
1 parent ffcc61b commit 7deb40d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
12 changes: 2 additions & 10 deletions consensus/types/src/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,11 +892,7 @@ impl<E: EthSpec> BeaconState<E> {
return Err(Error::InsufficientValidators);
}

let max_effective_balance = if self.fork_name_unchecked() >= ForkName::Electra {
spec.max_effective_balance_electra
} else {
spec.max_effective_balance
};
let max_effective_balance = spec.max_effective_balance_for_fork(self.fork_name_unchecked());

let mut i = 0;
loop {
Expand Down Expand Up @@ -1095,11 +1091,7 @@ impl<E: EthSpec> BeaconState<E> {

let seed = self.get_seed(epoch, Domain::SyncCommittee, spec)?;

let max_effective_balance = if self.fork_name_unchecked() >= ForkName::Electra {
spec.max_effective_balance_electra
} else {
spec.max_effective_balance
};
let max_effective_balance = spec.max_effective_balance_for_fork(self.fork_name_unchecked());

let mut i = 0;
let mut sync_committee_indices = Vec::with_capacity(E::SyncCommitteeSize::to_usize());
Expand Down
1 change: 1 addition & 0 deletions consensus/types/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ impl Validator {
}
}

/// TODO(electra): refactor these functions and make it simpler.. this is a mess
/// Returns `true` if the validator is partially withdrawable.
fn is_partially_withdrawable_validator_capella(&self, balance: u64, spec: &ChainSpec) -> bool {
self.has_eth1_withdrawal_credential(spec)
Expand Down

0 comments on commit 7deb40d

Please sign in to comment.