mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-29 02:33:48 +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);
|
||||
|
||||
@@ -114,10 +114,6 @@ pub mod blob_sidecar {
|
||||
};
|
||||
}
|
||||
|
||||
pub mod payload {
|
||||
pub use crate::execution::BlockProductionVersion;
|
||||
}
|
||||
|
||||
pub mod execution_requests {
|
||||
pub use crate::execution::{
|
||||
ConsolidationRequests, DepositRequests, ExecutionRequests, RequestType, WithdrawalRequests,
|
||||
@@ -135,10 +131,6 @@ pub mod data_column_custody_group {
|
||||
};
|
||||
}
|
||||
|
||||
pub mod sync_aggregate {
|
||||
pub use crate::sync_committee::SyncAggregateError as Error;
|
||||
}
|
||||
|
||||
pub mod light_client_update {
|
||||
pub use crate::light_client::consts::{
|
||||
CURRENT_SYNC_COMMITTEE_INDEX, CURRENT_SYNC_COMMITTEE_INDEX_ELECTRA, FINALIZED_ROOT_INDEX,
|
||||
@@ -153,10 +145,6 @@ pub mod sync_committee_contribution {
|
||||
};
|
||||
}
|
||||
|
||||
pub mod slot_data {
|
||||
pub use crate::core::SlotData;
|
||||
}
|
||||
|
||||
pub mod signed_aggregate_and_proof {
|
||||
pub use crate::attestation::SignedAggregateAndProofRefMut;
|
||||
}
|
||||
@@ -166,12 +154,3 @@ pub mod payload_attestation {
|
||||
PayloadAttestation, PayloadAttestationData, PayloadAttestationMessage,
|
||||
};
|
||||
}
|
||||
|
||||
pub mod application_domain {
|
||||
pub use crate::core::ApplicationDomain;
|
||||
}
|
||||
|
||||
// Temporary re-exports to maintain backwards compatibility for Lighthouse.
|
||||
pub use crate::kzg_ext::consts::VERSIONED_HASH_VERSION_KZG;
|
||||
pub use crate::light_client::LightClientError as LightClientUpdateError;
|
||||
pub use crate::state::BeaconStateError as Error;
|
||||
|
||||
Reference in New Issue
Block a user