mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-01 20:04:41 +00:00
Builder deposit requests
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, SignedExecutionPayloadEnvelope,
|
||||
SignedVoluntaryExit, SyncAggregate, WithdrawalRequest,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize)]
|
||||
@@ -720,11 +720,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 +750,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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user