Revert "Reuse milhouse subtrees to shrink inactivity_scores in memory (#7062)"

This reverts commit 6399ad482b.
This commit is contained in:
Michael Sproul
2025-03-04 09:17:32 +11:00
parent 6399ad482b
commit fcf1e3f24f
15 changed files with 63 additions and 202 deletions

View File

@@ -60,7 +60,6 @@ pub enum BlockProcessingError {
SignatureSetError(SignatureSetError),
SszTypesError(ssz_types::Error),
SszDecodeError(DecodeError),
BitfieldError(ssz::BitfieldError),
MerkleTreeError(MerkleTreeError),
ArithError(ArithError),
InconsistentBlockFork(InconsistentFork),
@@ -154,7 +153,6 @@ impl From<BlockOperationError<HeaderInvalid>> for BlockProcessingError {
BlockOperationError::BeaconStateError(e) => BlockProcessingError::BeaconStateError(e),
BlockOperationError::SignatureSetError(e) => BlockProcessingError::SignatureSetError(e),
BlockOperationError::SszTypesError(e) => BlockProcessingError::SszTypesError(e),
BlockOperationError::BitfieldError(e) => BlockProcessingError::BitfieldError(e),
BlockOperationError::ConsensusContext(e) => BlockProcessingError::ConsensusContext(e),
BlockOperationError::ArithError(e) => BlockProcessingError::ArithError(e),
}
@@ -183,7 +181,6 @@ macro_rules! impl_into_block_processing_error_with_index {
BlockOperationError::BeaconStateError(e) => BlockProcessingError::BeaconStateError(e),
BlockOperationError::SignatureSetError(e) => BlockProcessingError::SignatureSetError(e),
BlockOperationError::SszTypesError(e) => BlockProcessingError::SszTypesError(e),
BlockOperationError::BitfieldError(e) => BlockProcessingError::BitfieldError(e),
BlockOperationError::ConsensusContext(e) => BlockProcessingError::ConsensusContext(e),
BlockOperationError::ArithError(e) => BlockProcessingError::ArithError(e),
}
@@ -218,7 +215,6 @@ pub enum BlockOperationError<T> {
BeaconStateError(BeaconStateError),
SignatureSetError(SignatureSetError),
SszTypesError(ssz_types::Error),
BitfieldError(ssz::BitfieldError),
ConsensusContext(ContextError),
ArithError(ArithError),
}
@@ -246,12 +242,6 @@ impl<T> From<ssz_types::Error> for BlockOperationError<T> {
}
}
impl<T> From<ssz::BitfieldError> for BlockOperationError<T> {
fn from(error: ssz::BitfieldError) -> Self {
BlockOperationError::BitfieldError(error)
}
}
impl<T> From<ArithError> for BlockOperationError<T> {
fn from(e: ArithError) -> Self {
BlockOperationError::ArithError(e)
@@ -377,7 +367,6 @@ impl From<BlockOperationError<IndexedAttestationInvalid>>
BlockOperationError::BeaconStateError(e) => BlockOperationError::BeaconStateError(e),
BlockOperationError::SignatureSetError(e) => BlockOperationError::SignatureSetError(e),
BlockOperationError::SszTypesError(e) => BlockOperationError::SszTypesError(e),
BlockOperationError::BitfieldError(e) => BlockOperationError::BitfieldError(e),
BlockOperationError::ConsensusContext(e) => BlockOperationError::ConsensusContext(e),
BlockOperationError::ArithError(e) => BlockOperationError::ArithError(e),
}

View File

@@ -19,10 +19,9 @@ pub enum EpochProcessingError {
BeaconStateError(BeaconStateError),
InclusionError(InclusionError),
SszTypesError(ssz_types::Error),
BitfieldError(ssz::BitfieldError),
ArithError(safe_arith::ArithError),
InconsistentStateFork(InconsistentFork),
InvalidJustificationBit(ssz::BitfieldError),
InvalidJustificationBit(ssz_types::Error),
InvalidFlagIndex(usize),
MilhouseError(milhouse::Error),
EpochCache(EpochCacheError),
@@ -50,12 +49,6 @@ impl From<ssz_types::Error> for EpochProcessingError {
}
}
impl From<ssz::BitfieldError> for EpochProcessingError {
fn from(e: ssz::BitfieldError) -> EpochProcessingError {
EpochProcessingError::BitfieldError(e)
}
}
impl From<safe_arith::ArithError> for EpochProcessingError {
fn from(e: safe_arith::ArithError) -> EpochProcessingError {
EpochProcessingError::ArithError(e)

View File

@@ -449,11 +449,6 @@ pub fn process_epoch_single_pass<E: EthSpec>(
next_epoch_cache.into_epoch_cache(next_epoch_activation_queue, spec)?;
}
// As an optimisation, perform an intra-rebase on `inactivity_scores`. They have a tendency to
// be exactly the same for large swathes of consecutive validator indices, so this helps reduce
// memory usage quite a lot.
state.inactivity_scores_mut()?.intra_rebase()?;
Ok(summary)
}