Initial merge changes

Added Execution Payload from Rayonism Fork

Updated new Containers to match Merge Spec

Updated BeaconBlockBody for Merge Spec

Completed updating BeaconState and BeaconBlockBody

Modified ExecutionPayload<T> to use Transaction<T>

Mostly Finished Changes for beacon-chain.md

Added some things for fork-choice.md

Update to match new fork-choice.md/fork.md changes

ran cargo fmt

Added Missing Pieces in eth2_libp2p for Merge

fix ef test

Various Changes to Conform Closer to Merge Spec
This commit is contained in:
Mark Mackey
2021-09-08 13:45:22 -05:00
committed by Paul Hauner
parent fe75a0a9a1
commit 5687c56d51
50 changed files with 1241 additions and 133 deletions

View File

@@ -77,5 +77,6 @@ pub fn previous_fork(fork_name: ForkName) -> ForkName {
match fork_name {
ForkName::Base => ForkName::Base,
ForkName::Altair => ForkName::Base,
ForkName::Merge => ForkName::Altair, // TODO: Check this when tests are released..
}
}

View File

@@ -94,10 +94,12 @@ impl<E: EthSpec> EpochTransition<E> for JustificationAndFinalization {
spec,
)
}
BeaconState::Altair(_) => altair::process_justification_and_finalization(
state,
&altair::ParticipationCache::new(state, spec).unwrap(),
),
BeaconState::Altair(_) | BeaconState::Merge(_) => {
altair::process_justification_and_finalization(
state,
&altair::ParticipationCache::new(state, spec).unwrap(),
)
}
}
}
}
@@ -110,11 +112,13 @@ impl<E: EthSpec> EpochTransition<E> for RewardsAndPenalties {
validator_statuses.process_attestations(state)?;
base::process_rewards_and_penalties(state, &mut validator_statuses, spec)
}
BeaconState::Altair(_) => altair::process_rewards_and_penalties(
state,
&altair::ParticipationCache::new(state, spec).unwrap(),
spec,
),
BeaconState::Altair(_) | BeaconState::Merge(_) => {
altair::process_rewards_and_penalties(
state,
&altair::ParticipationCache::new(state, spec).unwrap(),
spec,
)
}
}
}
}
@@ -138,7 +142,7 @@ impl<E: EthSpec> EpochTransition<E> for Slashings {
spec,
)?;
}
BeaconState::Altair(_) => {
BeaconState::Altair(_) | BeaconState::Merge(_) => {
process_slashings(
state,
altair::ParticipationCache::new(state, spec)
@@ -197,7 +201,9 @@ impl<E: EthSpec> EpochTransition<E> for SyncCommitteeUpdates {
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
match state {
BeaconState::Base(_) => Ok(()),
BeaconState::Altair(_) => altair::process_sync_committee_updates(state, spec),
BeaconState::Altair(_) | BeaconState::Merge(_) => {
altair::process_sync_committee_updates(state, spec)
}
}
}
}
@@ -206,7 +212,7 @@ impl<E: EthSpec> EpochTransition<E> for InactivityUpdates {
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
match state {
BeaconState::Base(_) => Ok(()),
BeaconState::Altair(_) => altair::process_inactivity_updates(
BeaconState::Altair(_) | BeaconState::Merge(_) => altair::process_inactivity_updates(
state,
&altair::ParticipationCache::new(state, spec).unwrap(),
spec,
@@ -219,7 +225,9 @@ impl<E: EthSpec> EpochTransition<E> for ParticipationFlagUpdates {
fn run(state: &mut BeaconState<E>, _: &ChainSpec) -> Result<(), EpochProcessingError> {
match state {
BeaconState::Base(_) => Ok(()),
BeaconState::Altair(_) => altair::process_participation_flag_updates(state),
BeaconState::Altair(_) | BeaconState::Merge(_) => {
altair::process_participation_flag_updates(state)
}
}
}
}
@@ -267,7 +275,7 @@ impl<E: EthSpec, T: EpochTransition<E>> Case for EpochProcessing<E, T> {
&& T::name() != "inactivity_updates"
&& T::name() != "participation_flag_updates"
}
ForkName::Altair => true,
ForkName::Altair | ForkName::Merge => true, // TODO: revisit when tests are out
}
}

View File

@@ -72,7 +72,7 @@ impl<E: EthSpec> Operation<E> for Attestation<E> {
BeaconState::Base(_) => {
base::process_attestations(state, &[self.clone()], VerifySignatures::True, spec)
}
BeaconState::Altair(_) => altair::process_attestation(
BeaconState::Altair(_) | BeaconState::Merge(_) => altair::process_attestation(
state,
self,
0,

View File

@@ -37,6 +37,9 @@ impl<E: EthSpec> LoadCase for TransitionTest<E> {
ForkName::Altair => {
spec.altair_fork_epoch = Some(metadata.fork_epoch);
}
ForkName::Merge => {
spec.merge_fork_epoch = Some(metadata.fork_epoch);
}
}
// Load blocks

View File

@@ -34,6 +34,7 @@ pub trait Handler {
let fork_name_str = match fork_name {
ForkName::Base => "phase0",
ForkName::Altair => "altair",
ForkName::Merge => "merge", // TODO: check this
};
let handler_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))