mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Cleanup consensus/types re-exports (#8643)
Removes some of the temporary re-exports in `consensus/types`. I am doing this in multiple parts to keep each diff small. Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
@@ -28,7 +28,7 @@ pub fn get_base_reward(
|
||||
validator_effective_balance: u64,
|
||||
base_reward_per_increment: BaseRewardPerIncrement,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<u64, Error> {
|
||||
) -> Result<u64, BeaconStateError> {
|
||||
validator_effective_balance
|
||||
.safe_div(spec.effective_balance_increment)?
|
||||
.safe_mul(base_reward_per_increment.as_u64())
|
||||
|
||||
@@ -107,7 +107,7 @@ pub mod attesting_indices_electra {
|
||||
for committee_index in committee_indices {
|
||||
let beacon_committee = committees
|
||||
.get(committee_index as usize)
|
||||
.ok_or(Error::NoCommitteeFound(committee_index))?;
|
||||
.ok_or(BeaconStateError::NoCommitteeFound(committee_index))?;
|
||||
|
||||
// This check is new to the spec's `process_attestation` in Electra.
|
||||
if committee_index >= committee_count_per_slot {
|
||||
|
||||
@@ -195,7 +195,7 @@ pub fn is_valid_genesis_state<E: EthSpec>(state: &BeaconState<E>, spec: &ChainSp
|
||||
pub fn process_activations<E: EthSpec>(
|
||||
state: &mut BeaconState<E>,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
) -> Result<(), BeaconStateError> {
|
||||
let (validators, balances, _) = state.validators_and_balances_and_progressive_balances_mut();
|
||||
let mut validators_iter = validators.iter_cow();
|
||||
while let Some((index, validator)) = validators_iter.next_cow() {
|
||||
@@ -203,7 +203,7 @@ pub fn process_activations<E: EthSpec>(
|
||||
let balance = balances
|
||||
.get(index)
|
||||
.copied()
|
||||
.ok_or(Error::BalancesOutOfBounds(index))?;
|
||||
.ok_or(BeaconStateError::BalancesOutOfBounds(index))?;
|
||||
validator.effective_balance = std::cmp::min(
|
||||
balance.safe_sub(balance.safe_rem(spec.effective_balance_increment)?)?,
|
||||
spec.max_effective_balance,
|
||||
|
||||
@@ -322,7 +322,7 @@ pub fn process_randao<E: EthSpec, Payload: AbstractExecPayload<E>>(
|
||||
pub fn process_eth1_data<E: EthSpec>(
|
||||
state: &mut BeaconState<E>,
|
||||
eth1_data: &Eth1Data,
|
||||
) -> Result<(), Error> {
|
||||
) -> Result<(), BeaconStateError> {
|
||||
if let Some(new_eth1_data) = get_new_eth1_data(state, eth1_data)? {
|
||||
*state.eth1_data_mut() = new_eth1_data;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use ethereum_hashing::hash_fixed;
|
||||
use types::{KzgCommitment, VERSIONED_HASH_VERSION_KZG, VersionedHash};
|
||||
use types::{VersionedHash, kzg_ext::KzgCommitment, kzg_ext::consts::VERSIONED_HASH_VERSION_KZG};
|
||||
|
||||
pub fn kzg_commitment_to_versioned_hash(kzg_commitment: &KzgCommitment) -> VersionedHash {
|
||||
let mut hashed_commitment = hash_fixed(&kzg_commitment.0);
|
||||
|
||||
Reference in New Issue
Block a user