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

67
Cargo.lock generated
View File

@@ -2370,18 +2370,6 @@ dependencies = [
"zeroize",
]
[[package]]
name = "educe"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417"
dependencies = [
"enum-ordinalize",
"proc-macro2",
"quote",
"syn 2.0.98",
]
[[package]]
name = "ef_tests"
version = "0.2.0"
@@ -2499,26 +2487,6 @@ dependencies = [
"syn 2.0.98",
]
[[package]]
name = "enum-ordinalize"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5"
dependencies = [
"enum-ordinalize-derive",
]
[[package]]
name = "enum-ordinalize-derive"
version = "4.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
]
[[package]]
name = "env_logger"
version = "0.8.4"
@@ -2879,25 +2847,20 @@ dependencies = [
[[package]]
name = "ethereum_ssz"
version = "0.8.3"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86da3096d1304f5f28476ce383005385459afeaf0eea08592b65ddbc9b258d16"
checksum = "1e999563461faea0ab9bc0024e5e66adcee35881f3d5062f52f31a4070fe1522"
dependencies = [
"alloy-primitives",
"arbitrary",
"ethereum_serde_utils",
"itertools 0.13.0",
"serde",
"serde_derive",
"smallvec",
"typenum",
]
[[package]]
name = "ethereum_ssz_derive"
version = "0.8.3"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d832a5c38eba0e7ad92592f7a22d693954637fbb332b4f669590d66a5c3183e5"
checksum = "f3deae99c8e74829a00ba7a92d49055732b3c1f093f2ccfa3cbc621679b6fa91"
dependencies = [
"darling 0.20.10",
"proc-macro2",
@@ -5797,12 +5760,13 @@ dependencies = [
[[package]]
name = "milhouse"
version = "0.5.0"
source = "git+https://github.com/sigp/milhouse?branch=main#e0389cbb8dce78d872ef2ad525e6702e37da6d71"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f68e33f98199224d1073f7c1468ea6abfea30736306fb79c7181a881e97ea32f"
dependencies = [
"alloy-primitives",
"arbitrary",
"educe",
"derivative",
"ethereum_hashing",
"ethereum_ssz",
"ethereum_ssz_derive",
@@ -8601,11 +8565,12 @@ dependencies = [
[[package]]
name = "ssz_types"
version = "0.10.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22bc24c8a61256950632fb6b68ea09f6b5c988070924c6292eb5933635202e00"
checksum = "35e0719d2b86ac738a55ae71a8429f52aa2741da988f1fd0975b4cc610fd1e08"
dependencies = [
"arbitrary",
"derivative",
"ethereum_serde_utils",
"ethereum_ssz",
"itertools 0.13.0",
@@ -9515,22 +9480,20 @@ dependencies = [
[[package]]
name = "tree_hash"
version = "0.9.1"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c58eb0f518840670270d90d97ffee702d8662d9c5494870c9e1e9e0fa00f668"
checksum = "373495c23db675a5192de8b610395e1bec324d596f9e6111192ce903dc11403a"
dependencies = [
"alloy-primitives",
"ethereum_hashing",
"ethereum_ssz",
"smallvec",
"typenum",
]
[[package]]
name = "tree_hash_derive"
version = "0.9.1"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "699e7fb6b3fdfe0c809916f251cf5132d64966858601695c3736630a87e7166a"
checksum = "b0857056ca4eb5de8c417309be42bcff6017b47e86fbaddde609b4633f66061e"
dependencies = [
"darling 0.20.10",
"proc-macro2",

View File

@@ -139,8 +139,8 @@ discv5 = { version = "0.9", features = ["libp2p"] }
env_logger = "0.9"
ethereum_hashing = "0.7.0"
ethereum_serde_utils = "0.7"
ethereum_ssz = "0.8.2"
ethereum_ssz_derive = "0.8.2"
ethereum_ssz = "0.7"
ethereum_ssz_derive = "0.7"
ethers-core = "1"
ethers-providers = { version = "1", default-features = false }
exit-future = "0.2"
@@ -156,7 +156,7 @@ libsecp256k1 = "0.7"
log = "0.4"
lru = "0.12"
maplit = "1"
milhouse = { git = "https://github.com/sigp/milhouse", branch = "main" }
milhouse = "0.3"
mockito = "1.5.0"
num_cpus = "1"
parking_lot = "0.12"
@@ -194,7 +194,7 @@ slog-term = "2"
sloggers = { version = "2", features = ["json"] }
smallvec = { version = "1.11.2", features = ["arbitrary"] }
snap = "1"
ssz_types = "0.10"
ssz_types = "0.8"
strum = { version = "0.24", features = ["derive"] }
superstruct = "0.8"
syn = "1"
@@ -213,8 +213,8 @@ tracing-appender = "0.2"
tracing-core = "0.1"
tracing-log = "0.2"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tree_hash = "0.9"
tree_hash_derive = "0.9"
tree_hash = "0.8"
tree_hash_derive = "0.8"
url = "2"
uuid = { version = "0.8", features = ["serde", "v4"] }
warp = { version = "0.3.7", default-features = false, features = ["tls"] }

View File

@@ -2713,16 +2713,16 @@ where
let mut block_hash_from_slot: HashMap<Slot, SignedBeaconBlockHash> = HashMap::new();
let mut state_hash_from_slot: HashMap<Slot, BeaconStateHash> = HashMap::new();
for slot in slots {
// Using a `Box::pin` to reduce the stack size. Clippy was raising a lints.
let (block_hash, new_state) = Box::pin(self.add_attested_block_at_slot_with_sync(
*slot,
state,
state_root,
validators,
sync_committee_strategy,
))
.await
.unwrap();
let (block_hash, new_state) = self
.add_attested_block_at_slot_with_sync(
*slot,
state,
state_root,
validators,
sync_committee_strategy,
)
.await
.unwrap();
state = new_state;

View File

@@ -328,7 +328,8 @@ async fn test_rewards_base_multi_inclusion() {
.extend_slots(E::slots_per_epoch() as usize * 2 - 4)
.await;
check_all_base_rewards(&harness, initial_balances).await;
// pin to reduce stack size for clippy
Box::pin(check_all_base_rewards(&harness, initial_balances)).await;
}
#[tokio::test]
@@ -691,8 +692,7 @@ async fn check_all_base_rewards(
harness: &BeaconChainHarness<EphemeralHarnessType<E>>,
balances: Vec<u64>,
) {
// The box reduces the size on the stack for a clippy lint.
Box::pin(check_all_base_rewards_for_subset(harness, balances, vec![])).await;
check_all_base_rewards_for_subset(harness, balances, vec![]).await;
}
async fn check_all_base_rewards_for_subset(

View File

@@ -765,8 +765,8 @@ fn handle_rpc_response<E: EthSpec>(
SupportedProtocol::PingV1 => Ok(Some(RpcSuccessResponse::Pong(Ping {
data: u64::from_ssz_bytes(decoded_buffer)?,
}))),
SupportedProtocol::MetaDataV1 => Ok(Some(RpcSuccessResponse::MetaData(Arc::new(
MetaData::V1(MetaDataV1::from_ssz_bytes(decoded_buffer)?),
SupportedProtocol::MetaDataV1 => Ok(Some(RpcSuccessResponse::MetaData(MetaData::V1(
MetaDataV1::from_ssz_bytes(decoded_buffer)?,
)))),
SupportedProtocol::LightClientBootstrapV1 => match fork_name {
Some(fork_name) => Ok(Some(RpcSuccessResponse::LightClientBootstrap(Arc::new(
@@ -826,11 +826,11 @@ fn handle_rpc_response<E: EthSpec>(
)),
},
// MetaData V2/V3 responses have no context bytes, so behave similarly to V1 responses
SupportedProtocol::MetaDataV3 => Ok(Some(RpcSuccessResponse::MetaData(Arc::new(
MetaData::V3(MetaDataV3::from_ssz_bytes(decoded_buffer)?),
SupportedProtocol::MetaDataV3 => Ok(Some(RpcSuccessResponse::MetaData(MetaData::V3(
MetaDataV3::from_ssz_bytes(decoded_buffer)?,
)))),
SupportedProtocol::MetaDataV2 => Ok(Some(RpcSuccessResponse::MetaData(Arc::new(
MetaData::V2(MetaDataV2::from_ssz_bytes(decoded_buffer)?),
SupportedProtocol::MetaDataV2 => Ok(Some(RpcSuccessResponse::MetaData(MetaData::V2(
MetaDataV2::from_ssz_bytes(decoded_buffer)?,
)))),
SupportedProtocol::BlocksByRangeV2 => match fork_name {
Some(ForkName::Altair) => Ok(Some(RpcSuccessResponse::BlocksByRange(Arc::new(
@@ -1008,7 +1008,6 @@ mod tests {
) -> SignedBeaconBlock<Spec> {
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
BeaconBlockBellatrix::empty(&Spec::default_spec());
let tx = VariableList::from(vec![0; 1024]);
let txs = VariableList::from(std::iter::repeat(tx).take(5000).collect::<Vec<_>>());
@@ -1028,7 +1027,6 @@ mod tests {
) -> SignedBeaconBlock<Spec> {
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
BeaconBlockBellatrix::empty(&Spec::default_spec());
let tx = VariableList::from(vec![0; 1024]);
let txs = VariableList::from(std::iter::repeat(tx).take(100000).collect::<Vec<_>>());
@@ -1107,31 +1105,28 @@ mod tests {
Ping { data: 1 }
}
fn metadata() -> Arc<MetaData<Spec>> {
fn metadata() -> MetaData<Spec> {
MetaData::V1(MetaDataV1 {
seq_number: 1,
attnets: EnrAttestationBitfield::<Spec>::default(),
})
.into()
}
fn metadata_v2() -> Arc<MetaData<Spec>> {
fn metadata_v2() -> MetaData<Spec> {
MetaData::V2(MetaDataV2 {
seq_number: 1,
attnets: EnrAttestationBitfield::<Spec>::default(),
syncnets: EnrSyncCommitteeBitfield::<Spec>::default(),
})
.into()
}
fn metadata_v3() -> Arc<MetaData<Spec>> {
fn metadata_v3() -> MetaData<Spec> {
MetaData::V3(MetaDataV3 {
seq_number: 1,
attnets: EnrAttestationBitfield::<Spec>::default(),
syncnets: EnrSyncCommitteeBitfield::<Spec>::default(),
custody_group_count: 1,
})
.into()
}
/// Encodes the given protocol response as bytes.

View File

@@ -578,7 +578,7 @@ pub enum RpcSuccessResponse<E: EthSpec> {
Pong(Ping),
/// A response to a META_DATA request.
MetaData(Arc<MetaData<E>>),
MetaData(MetaData<E>),
}
/// Indicates which response is being terminated by a stream termination response.

View File

@@ -1186,7 +1186,7 @@ impl<E: EthSpec> Network<E> {
) {
let metadata = self.network_globals.local_metadata.read().clone();
// The encoder is responsible for sending the negotiated version of the metadata
let event = RpcResponse::Success(RpcSuccessResponse::MetaData(Arc::new(metadata)));
let event = RpcResponse::Success(RpcSuccessResponse::MetaData(metadata));
self.eth2_rpc_mut()
.send_response(peer_id, id, request_id, event);
}
@@ -1601,7 +1601,7 @@ impl<E: EthSpec> Network<E> {
}
RpcSuccessResponse::MetaData(meta_data) => {
self.peer_manager_mut()
.meta_data_response(&peer_id, meta_data.as_ref().clone());
.meta_data_response(&peer_id, meta_data);
None
}
/* Network propagated protocols */

View File

@@ -7,11 +7,9 @@
//!
//! A) `JEMALLOC_SYS_WITH_MALLOC_CONF` at compile-time.
//! B) `_RJEM_MALLOC_CONF` at runtime.
use metrics::{
set_gauge, set_gauge_vec, try_create_int_gauge, try_create_int_gauge_vec, IntGauge, IntGaugeVec,
};
use metrics::{set_gauge, try_create_int_gauge, IntGauge};
use std::sync::LazyLock;
use tikv_jemalloc_ctl::{arenas, epoch, raw, stats, Access, AsName, Error};
use tikv_jemalloc_ctl::{arenas, epoch, stats, Access, AsName, Error};
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
@@ -35,38 +33,6 @@ pub static BYTES_RESIDENT: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|
pub static BYTES_RETAINED: LazyLock<metrics::Result<IntGauge>> = LazyLock::new(|| {
try_create_int_gauge("jemalloc_bytes_retained", "Equivalent to stats.retained")
});
pub static JEMALLOC_ARENAS_SMALL_NMALLOC: LazyLock<metrics::Result<IntGaugeVec>> =
LazyLock::new(|| {
try_create_int_gauge_vec(
"jemalloc_arenas_small_nmalloc",
"Equivalent to stats.arenas.<i>.small.nmalloc",
&["arena"],
)
});
pub static JEMALLOC_ARENAS_SMALL_NDALLOC: LazyLock<metrics::Result<IntGaugeVec>> =
LazyLock::new(|| {
try_create_int_gauge_vec(
"jemalloc_arenas_small_ndalloc",
"Equivalent to stats.arenas.<i>.small.ndalloc",
&["arena"],
)
});
pub static JEMALLOC_ARENAS_LARGE_NMALLOC: LazyLock<metrics::Result<IntGaugeVec>> =
LazyLock::new(|| {
try_create_int_gauge_vec(
"jemalloc_arenas_large_nmalloc",
"Equivalent to stats.arenas.<i>.large.nmalloc",
&["arena"],
)
});
pub static JEMALLOC_ARENAS_LARGE_NDALLOC: LazyLock<metrics::Result<IntGaugeVec>> =
LazyLock::new(|| {
try_create_int_gauge_vec(
"jemalloc_arenas_large_ndalloc",
"Equivalent to stats.arenas.<i>.large.ndalloc",
&["arena"],
)
});
pub fn scrape_jemalloc_metrics() {
scrape_jemalloc_metrics_fallible().unwrap()
@@ -76,8 +42,7 @@ pub fn scrape_jemalloc_metrics_fallible() -> Result<(), Error> {
// Advance the epoch so that the underlying statistics are updated.
epoch::advance()?;
let num_arenas = arenas::narenas::read()?;
set_gauge(&NUM_ARENAS, num_arenas as i64);
set_gauge(&NUM_ARENAS, arenas::narenas::read()? as i64);
set_gauge(&BYTES_ALLOCATED, stats::allocated::read()? as i64);
set_gauge(&BYTES_ACTIVE, stats::active::read()? as i64);
set_gauge(&BYTES_MAPPED, stats::mapped::read()? as i64);
@@ -85,40 +50,9 @@ pub fn scrape_jemalloc_metrics_fallible() -> Result<(), Error> {
set_gauge(&BYTES_RESIDENT, stats::resident::read()? as i64);
set_gauge(&BYTES_RETAINED, stats::retained::read()? as i64);
for arena in 0..num_arenas {
unsafe {
set_stats_gauge(
&JEMALLOC_ARENAS_SMALL_NMALLOC,
arena,
&format!("stats.arenas.{arena}.small.nmalloc\0"),
);
set_stats_gauge(
&JEMALLOC_ARENAS_SMALL_NDALLOC,
arena,
&format!("stats.arenas.{arena}.small.ndalloc\0"),
);
set_stats_gauge(
&JEMALLOC_ARENAS_LARGE_NMALLOC,
arena,
&format!("stats.arenas.{arena}.large.nmalloc\0"),
);
set_stats_gauge(
&JEMALLOC_ARENAS_LARGE_NDALLOC,
arena,
&format!("stats.arenas.{arena}.large.ndalloc\0"),
);
}
}
Ok(())
}
unsafe fn set_stats_gauge(metric: &metrics::Result<IntGaugeVec>, arena: u32, stat: &str) {
if let Ok(val) = raw::read::<usize>(stat.as_bytes()) {
set_gauge_vec(metric, &[&format!("arena_{arena}")], val as i64);
}
}
pub fn page_size() -> Result<usize, Error> {
// Full list of keys: https://jemalloc.net/jemalloc.3.html
"arenas.page\0".name().read()

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)
}

View File

@@ -18,7 +18,6 @@ use super::{
#[derive(Debug, PartialEq)]
pub enum Error {
SszTypesError(ssz_types::Error),
BitfieldError(ssz::BitfieldError),
AlreadySigned(usize),
IncorrectStateVariant,
InvalidCommitteeLength,
@@ -224,7 +223,7 @@ impl<E: EthSpec> Attestation<E> {
}
}
pub fn get_aggregation_bit(&self, index: usize) -> Result<bool, ssz::BitfieldError> {
pub fn get_aggregation_bit(&self, index: usize) -> Result<bool, ssz_types::Error> {
match self {
Attestation::Base(att) => att.aggregation_bits.get(index),
Attestation::Electra(att) => att.aggregation_bits.get(index),
@@ -354,13 +353,13 @@ impl<E: EthSpec> AttestationElectra<E> {
if self
.aggregation_bits
.get(committee_position)
.map_err(Error::BitfieldError)?
.map_err(Error::SszTypesError)?
{
Err(Error::AlreadySigned(committee_position))
} else {
self.aggregation_bits
.set(committee_position, true)
.map_err(Error::BitfieldError)?;
.map_err(Error::SszTypesError)?;
self.signature.add_assign(signature);
@@ -428,13 +427,13 @@ impl<E: EthSpec> AttestationBase<E> {
if self
.aggregation_bits
.get(committee_position)
.map_err(Error::BitfieldError)?
.map_err(Error::SszTypesError)?
{
Err(Error::AlreadySigned(committee_position))
} else {
self.aggregation_bits
.set(committee_position, true)
.map_err(Error::BitfieldError)?;
.map_err(Error::SszTypesError)?;
self.signature.add_assign(signature);
@@ -444,7 +443,7 @@ impl<E: EthSpec> AttestationBase<E> {
pub fn extend_aggregation_bits(
&self,
) -> Result<BitList<E::MaxValidatorsPerSlot>, ssz::BitfieldError> {
) -> Result<BitList<E::MaxValidatorsPerSlot>, ssz_types::Error> {
self.aggregation_bits.resize::<E::MaxValidatorsPerSlot>()
}
}
@@ -601,12 +600,12 @@ mod tests {
let attestation_data = size_of::<AttestationData>();
let signature = size_of::<AggregateSignature>();
assert_eq!(aggregation_bits, 152);
assert_eq!(aggregation_bits, 56);
assert_eq!(attestation_data, 128);
assert_eq!(signature, 288 + 16);
let attestation_expected = aggregation_bits + attestation_data + signature;
assert_eq!(attestation_expected, 584);
assert_eq!(attestation_expected, 488);
assert_eq!(
size_of::<AttestationBase<MainnetEthSpec>>(),
attestation_expected
@@ -624,13 +623,13 @@ mod tests {
size_of::<BitList<<MainnetEthSpec as EthSpec>::MaxCommitteesPerSlot>>();
let signature = size_of::<AggregateSignature>();
assert_eq!(aggregation_bits, 152);
assert_eq!(committee_bits, 152);
assert_eq!(aggregation_bits, 56);
assert_eq!(committee_bits, 56);
assert_eq!(attestation_data, 128);
assert_eq!(signature, 288 + 16);
let attestation_expected = aggregation_bits + committee_bits + attestation_data + signature;
assert_eq!(attestation_expected, 736);
assert_eq!(attestation_expected, 544);
assert_eq!(
size_of::<AttestationElectra<MainnetEthSpec>>(),
attestation_expected

View File

@@ -2470,11 +2470,6 @@ impl<E: EthSpec> BeaconState<E> {
// rebuild and likely to be re-usable from the base state.
self.rebase_caches_on(base, spec)?;
// Perform an intra-rebase of the inactivity scores (if any).
if let Ok(inactivity_scores) = self.inactivity_scores_mut() {
inactivity_scores.intra_rebase()?;
}
Ok(())
}

View File

@@ -11,7 +11,6 @@ use tree_hash_derive::TreeHash;
#[derive(Debug, PartialEq)]
pub enum Error {
SszTypesError(ssz_types::Error),
BitfieldError(ssz::BitfieldError),
ArithError(ArithError),
}
@@ -69,7 +68,7 @@ impl<E: EthSpec> SyncAggregate<E> {
sync_aggregate
.sync_committee_bits
.set(participant_index, true)
.map_err(Error::BitfieldError)?;
.map_err(Error::SszTypesError)?;
}
}
sync_aggregate

View File

@@ -9,7 +9,6 @@ use tree_hash_derive::TreeHash;
#[derive(Debug, PartialEq)]
pub enum Error {
SszTypesError(ssz_types::Error),
BitfieldError(ssz::BitfieldError),
AlreadySigned(usize),
}
@@ -52,7 +51,7 @@ impl<E: EthSpec> SyncCommitteeContribution<E> {
) -> Result<Self, Error> {
let mut bits = BitVector::new();
bits.set(validator_sync_committee_index, true)
.map_err(Error::BitfieldError)?;
.map_err(Error::SszTypesError)?;
Ok(Self {
slot: message.slot,
beacon_block_root: message.beacon_block_root,