mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-01 03:44:30 +00:00
Gloas alpha spec 11 (#9511)
Alpha spec 11 changes Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# To download/extract nightly tests, run:
|
||||
# CONSENSUS_SPECS_TEST_VERSION=nightly make
|
||||
CONSENSUS_SPECS_TEST_VERSION ?= v1.7.0-alpha.10
|
||||
CONSENSUS_SPECS_TEST_VERSION ?= v1.7.0-alpha.11
|
||||
REPO_NAME := consensus-spec-tests
|
||||
OUTPUT_DIR := ./$(REPO_NAME)
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ use state_processing::common::update_progressive_balances_cache::initialize_prog
|
||||
use state_processing::envelope_processing::verify_execution_payload_envelope;
|
||||
use state_processing::epoch_cache::initialize_epoch_cache;
|
||||
use state_processing::per_block_processing::process_operations::{
|
||||
process_consolidation_requests, process_deposit_requests_post_gloas,
|
||||
process_deposit_requests_pre_gloas, process_withdrawal_requests,
|
||||
process_builder_deposit_requests, process_builder_exit_requests,
|
||||
process_consolidation_requests, process_deposit_requests, process_withdrawal_requests,
|
||||
};
|
||||
use state_processing::{
|
||||
ConsensusContext,
|
||||
@@ -30,10 +30,10 @@ use std::fmt::Debug;
|
||||
use types::{
|
||||
Attestation, AttesterSlashing, BeaconBlock, BeaconBlockBody, BeaconBlockBodyBellatrix,
|
||||
BeaconBlockBodyCapella, BeaconBlockBodyDeneb, BeaconBlockBodyElectra, BeaconBlockBodyFulu,
|
||||
BeaconState, BlindedPayload, ConsolidationRequest, Deposit, DepositRequest, ExecutionPayload,
|
||||
ForkVersionDecode, FullPayload, PayloadAttestation, ProposerSlashing,
|
||||
SignedBlsToExecutionChange, SignedExecutionPayloadEnvelope, SignedVoluntaryExit, SyncAggregate,
|
||||
WithdrawalRequest,
|
||||
BeaconState, BlindedPayload, BuilderDepositRequest, BuilderExitRequest, ConsolidationRequest,
|
||||
Deposit, DepositRequest, ExecutionPayload, ForkVersionDecode, FullPayload, PayloadAttestation,
|
||||
ProposerSlashing, SignedBlsToExecutionChange, SignedExecutionPayloadBid,
|
||||
SignedExecutionPayloadEnvelope, SignedVoluntaryExit, SyncAggregate, WithdrawalRequest,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize)]
|
||||
@@ -65,7 +65,7 @@ pub struct VoluntaryExitChurn {
|
||||
/// Newtype for testing execution payload bids.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct ExecutionPayloadBidBlock<E: EthSpec> {
|
||||
block: BeaconBlock<E>,
|
||||
signed_bid: SignedExecutionPayloadBid<E>,
|
||||
}
|
||||
|
||||
/// Newtype for testing parent execution payload processing.
|
||||
@@ -538,16 +538,15 @@ impl<E: EthSpec> Operation<E> for ExecutionPayloadBidBlock<E> {
|
||||
}
|
||||
|
||||
fn filename() -> String {
|
||||
"block.ssz_snappy".into()
|
||||
"execution_payload_bid.ssz_snappy".into()
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name.gloas_enabled()
|
||||
}
|
||||
|
||||
fn decode(path: &Path, _fork_name: ForkName, spec: &ChainSpec) -> Result<Self, Error> {
|
||||
ssz_decode_file_with(path, |bytes| BeaconBlock::from_ssz_bytes(bytes, spec))
|
||||
.map(|block| ExecutionPayloadBidBlock { block })
|
||||
fn decode(path: &Path, _fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
ssz_decode_file(path).map(|signed_bid| ExecutionPayloadBidBlock { signed_bid })
|
||||
}
|
||||
|
||||
fn apply_to(
|
||||
@@ -556,7 +555,7 @@ impl<E: EthSpec> Operation<E> for ExecutionPayloadBidBlock<E> {
|
||||
spec: &ChainSpec,
|
||||
_: &Operations<E, Self>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
process_execution_payload_bid(state, self.block.to_ref(), VerifySignatures::True, spec)?;
|
||||
process_execution_payload_bid(state, &self.signed_bid, VerifySignatures::True, spec)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -720,11 +719,7 @@ impl<E: EthSpec> Operation<E> for DepositRequest {
|
||||
spec: &ChainSpec,
|
||||
_extra: &Operations<E, Self>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
if state.fork_name_unchecked().gloas_enabled() {
|
||||
process_deposit_requests_post_gloas(state, std::slice::from_ref(self), spec)
|
||||
} else {
|
||||
process_deposit_requests_pre_gloas(state, std::slice::from_ref(self), spec)
|
||||
}
|
||||
process_deposit_requests(state, std::slice::from_ref(self), spec)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -754,6 +749,56 @@ impl<E: EthSpec> Operation<E> for ConsolidationRequest {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Operation<E> for BuilderDepositRequest {
|
||||
type Error = BlockProcessingError;
|
||||
|
||||
fn handler_name() -> String {
|
||||
"builder_deposit_request".into()
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name.gloas_enabled()
|
||||
}
|
||||
|
||||
fn decode(path: &Path, _fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
ssz_decode_file(path)
|
||||
}
|
||||
|
||||
fn apply_to(
|
||||
&self,
|
||||
state: &mut BeaconState<E>,
|
||||
spec: &ChainSpec,
|
||||
_extra: &Operations<E, Self>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
process_builder_deposit_requests(state, std::slice::from_ref(self), spec)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Operation<E> for BuilderExitRequest {
|
||||
type Error = BlockProcessingError;
|
||||
|
||||
fn handler_name() -> String {
|
||||
"builder_exit_request".into()
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name.gloas_enabled()
|
||||
}
|
||||
|
||||
fn decode(path: &Path, _fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
ssz_decode_file(path)
|
||||
}
|
||||
|
||||
fn apply_to(
|
||||
&self,
|
||||
state: &mut BeaconState<E>,
|
||||
spec: &ChainSpec,
|
||||
_extra: &Operations<E, Self>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
process_builder_exit_requests(state, std::slice::from_ref(self), spec)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Operation<E> for PayloadAttestation<E> {
|
||||
type Error = BlockProcessingError;
|
||||
|
||||
|
||||
@@ -718,12 +718,15 @@ impl<E: EthSpec + TypeName> Handler for ForkChoiceHandler<E> {
|
||||
return false;
|
||||
}
|
||||
|
||||
// on_attestation, on_execution_payload_envelope, get_parent_payload_status, and
|
||||
// on_payload_attestation_message tests exist only for Gloas and later.
|
||||
// on_attestation, on_execution_payload_envelope, get_parent_payload_status,
|
||||
// on_payload_attestation_message, payload_timeliness, and payload_data_availability
|
||||
// tests exist only for Gloas and later.
|
||||
if (self.handler_name == "on_attestation"
|
||||
|| self.handler_name == "on_execution_payload_envelope"
|
||||
|| self.handler_name == "get_parent_payload_status"
|
||||
|| self.handler_name == "on_payload_attestation_message")
|
||||
|| self.handler_name == "on_payload_attestation_message"
|
||||
|| self.handler_name == "payload_timeliness"
|
||||
|| self.handler_name == "payload_data_availability")
|
||||
&& !fork_name.gloas_enabled()
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -73,6 +73,8 @@ type_name!(DepositMessage);
|
||||
type_name!(DepositRequest);
|
||||
type_name!(Eth1Data);
|
||||
type_name!(Builder);
|
||||
type_name!(BuilderDepositRequest);
|
||||
type_name!(BuilderExitRequest);
|
||||
type_name!(BuilderPendingPayment);
|
||||
type_name!(BuilderPendingWithdrawal);
|
||||
type_name!(WithdrawalRequest);
|
||||
@@ -92,7 +94,8 @@ type_name_generic!(ExecutionPayloadHeaderElectra, "ExecutionPayloadHeader");
|
||||
type_name_generic!(ExecutionPayloadHeaderFulu, "ExecutionPayloadHeader");
|
||||
type_name_generic!(ExecutionPayloadBid);
|
||||
type_name_generic!(SignedExecutionPayloadBid);
|
||||
type_name_generic!(ExecutionRequests);
|
||||
type_name_generic!(ExecutionRequestsElectra, "ExecutionRequests");
|
||||
type_name_generic!(ExecutionRequestsGloas, "ExecutionRequests");
|
||||
type_name_generic!(ExecutionPayloadEnvelope);
|
||||
type_name_generic!(SignedExecutionPayloadEnvelope);
|
||||
type_name_generic!(BlindedPayload, "ExecutionPayloadHeader");
|
||||
|
||||
@@ -136,6 +136,19 @@ fn operations_consolidations() {
|
||||
OperationsHandler::<MainnetEthSpec, ConsolidationRequest>::default().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "fake_crypto"))]
|
||||
fn operations_builder_deposit_requests() {
|
||||
OperationsHandler::<MinimalEthSpec, BuilderDepositRequest>::default().run();
|
||||
OperationsHandler::<MainnetEthSpec, BuilderDepositRequest>::default().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn operations_builder_exit_requests() {
|
||||
OperationsHandler::<MinimalEthSpec, BuilderExitRequest>::default().run();
|
||||
OperationsHandler::<MainnetEthSpec, BuilderExitRequest>::default().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn operations_bls_to_execution_change() {
|
||||
OperationsHandler::<MinimalEthSpec, SignedBlsToExecutionChange>::default().run();
|
||||
@@ -792,9 +805,19 @@ mod ssz_static {
|
||||
|
||||
#[test]
|
||||
fn execution_requests() {
|
||||
SszStaticHandler::<ExecutionRequests<MainnetEthSpec>, MainnetEthSpec>::electra_and_later()
|
||||
SszStaticHandler::<ExecutionRequestsElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionRequestsElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionRequestsElectra<MainnetEthSpec>, MainnetEthSpec>::fulu_only()
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionRequests<MinimalEthSpec>, MinimalEthSpec>::electra_and_later()
|
||||
SszStaticHandler::<ExecutionRequestsElectra<MinimalEthSpec>, MinimalEthSpec>::fulu_only()
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionRequestsGloas<MainnetEthSpec>, MainnetEthSpec>::gloas_only()
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionRequestsGloas<MinimalEthSpec>, MinimalEthSpec>::gloas_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
@@ -805,6 +828,18 @@ mod ssz_static {
|
||||
SszStaticHandler::<Builder, MainnetEthSpec>::gloas_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn builder_deposit_request() {
|
||||
SszStaticHandler::<BuilderDepositRequest, MinimalEthSpec>::gloas_and_later().run();
|
||||
SszStaticHandler::<BuilderDepositRequest, MainnetEthSpec>::gloas_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn builder_exit_request() {
|
||||
SszStaticHandler::<BuilderExitRequest, MinimalEthSpec>::gloas_and_later().run();
|
||||
SszStaticHandler::<BuilderExitRequest, MainnetEthSpec>::gloas_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn builder_pending_payment() {
|
||||
SszStaticHandler::<BuilderPendingPayment, MinimalEthSpec>::gloas_and_later().run();
|
||||
@@ -1089,6 +1124,18 @@ fn fork_choice_on_payload_attestation_message() {
|
||||
ForkChoiceHandler::<MainnetEthSpec>::new("on_payload_attestation_message").run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fork_choice_payload_timeliness() {
|
||||
ForkChoiceHandler::<MinimalEthSpec>::new("payload_timeliness").run();
|
||||
ForkChoiceHandler::<MainnetEthSpec>::new("payload_timeliness").run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fork_choice_payload_data_availability() {
|
||||
ForkChoiceHandler::<MinimalEthSpec>::new("payload_data_availability").run();
|
||||
ForkChoiceHandler::<MainnetEthSpec>::new("payload_data_availability").run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optimistic_sync() {
|
||||
OptimisticSyncHandler::<MinimalEthSpec>::default().run();
|
||||
|
||||
Reference in New Issue
Block a user