Merge remote-tracking branch 'upstream/unstable' into gloas-containers

This commit is contained in:
Mark Mackey
2025-10-22 16:05:06 -05:00
78 changed files with 5569 additions and 615 deletions

View File

@@ -483,15 +483,23 @@ impl ChainSpec {
/// Returns a full `Fork` struct for a given epoch.
pub fn fork_at_epoch(&self, epoch: Epoch) -> Fork {
let current_fork_name = self.fork_name_at_epoch(epoch);
let previous_fork_name = current_fork_name.previous_fork().unwrap_or(ForkName::Base);
let epoch = self
let fork_epoch = self
.fork_epoch(current_fork_name)
.unwrap_or_else(|| Epoch::new(0));
// At genesis the Fork is initialised with two copies of the same value for both
// `previous_version` and `current_version` (see `initialize_beacon_state_from_eth1`).
let previous_fork_name = if fork_epoch == 0 {
current_fork_name
} else {
current_fork_name.previous_fork().unwrap_or(ForkName::Base)
};
Fork {
previous_version: self.fork_version_for_name(previous_fork_name),
current_version: self.fork_version_for_name(current_fork_name),
epoch,
epoch: fork_epoch,
}
}
@@ -3031,9 +3039,11 @@ mod yaml_tests {
fn proposer_shuffling_decision_root_around_epoch_boundary() {
type E = MainnetEthSpec;
let fulu_fork_epoch = 5;
let gloas_fork_epoch = 10;
let spec = {
let mut spec = ForkName::Electra.make_genesis_spec(E::default_spec());
spec.fulu_fork_epoch = Some(Epoch::new(fulu_fork_epoch));
spec.gloas_fork_epoch = Some(Epoch::new(gloas_fork_epoch));
Arc::new(spec)
};
@@ -3047,7 +3057,7 @@ mod yaml_tests {
}
// For epochs after Fulu, the decision slot is the end of the epoch two epochs prior.
for epoch in ((fulu_fork_epoch + 1)..(fulu_fork_epoch + 10)).map(Epoch::new) {
for epoch in ((fulu_fork_epoch + 1)..=(gloas_fork_epoch + 1)).map(Epoch::new) {
assert_eq!(
spec.proposer_shuffling_decision_slot::<E>(epoch),
(epoch - 1).start_slot(E::slots_per_epoch()) - 1

View File

@@ -10,7 +10,6 @@ use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
/// A Validators aggregate sync committee contribution and selection proof.
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),

View File

@@ -33,6 +33,13 @@ pub struct Slot(#[serde(with = "serde_utils::quoted_u64")] u64);
#[serde(transparent)]
pub struct Epoch(#[serde(with = "serde_utils::quoted_u64")] u64);
impl Epoch {
/// Returns an iterator `(end..=start)`
pub fn range_inclusive_rev(start: Self, end: Self) -> impl Iterator<Item = Self> {
(end.0..=start.0).rev().map(Epoch)
}
}
impl_common!(Slot);
impl_common!(Epoch);