* Checkout serde_utils from rayonism * Make eth1::http functions pub * Add bones of execution_layer * Modify decoding * Expose Transaction, cargo fmt * Add executePayload * Add all minimal spec endpoints * Start adding json rpc wrapper * Finish custom JSON response handler * Switch to new rpc sending method * Add first test * Fix camelCase * Finish adding tests * Begin threading execution layer into BeaconChain * Fix clippy lints * Fix clippy lints * Thread execution layer into ClientBuilder * Add CLI flags * Add block processing methods to ExecutionLayer * Add block_on to execution_layer * Integrate execute_payload * Add extra_data field * Begin implementing payload handle * Send consensus valid/invalid messages * Fix minor type in task_executor * Call forkchoiceUpdated * Add search for TTD block * Thread TTD into execution layer * Allow producing block with execution payload * Add LRU cache for execution blocks * Remove duplicate 0x on ssz_types serialization * Add tests for block getter methods * Add basic block generator impl * Add is_valid_terminal_block to EL * Verify merge block in block_verification * Partially implement --terminal-block-hash-override * Add terminal_block_hash to ChainSpec * Remove Option from terminal_block_hash in EL * Revert merge changes to consensus/fork_choice * Remove commented-out code * Add bones for handling RPC methods on test server * Add first ExecutionLayer tests * Add testing for finding terminal block * Prevent infinite loops * Add insert_merge_block to block gen * Add block gen test for pos blocks * Start adding payloads to block gen * Fix clippy lints * Add execution payload to block gen * Add execute_payload to block_gen * Refactor block gen * Add all routes to mock server * Use Uint256 for base_fee_per_gas * Add working execution chain build * Remove unused var * Revert "Use Uint256 for base_fee_per_gas" This reverts commit 6c88f19ac45db834dd4dbf7a3c6e7242c1c0f735. * Fix base_fee_for_gas Uint256 * Update execute payload handle * Improve testing, fix bugs * Fix default fee-recipient * Fix fee-recipient address (again) * Add check for terminal block, add comments, tidy * Apply suggestions from code review Co-authored-by: realbigsean <seananderson33@GMAIL.com> * Fix is_none on handle Drop * Remove commented-out tests Co-authored-by: realbigsean <seananderson33@GMAIL.com>
190 lines
6.8 KiB
Rust
190 lines
6.8 KiB
Rust
use crate::attester_cache::Error as AttesterCacheError;
|
|
use crate::beacon_chain::ForkChoiceError;
|
|
use crate::beacon_fork_choice_store::Error as ForkChoiceStoreError;
|
|
use crate::eth1_chain::Error as Eth1ChainError;
|
|
use crate::historical_blocks::HistoricalBlockError;
|
|
use crate::migrate::PruningError;
|
|
use crate::naive_aggregation_pool::Error as NaiveAggregationError;
|
|
use crate::observed_aggregates::Error as ObservedAttestationsError;
|
|
use crate::observed_attesters::Error as ObservedAttestersError;
|
|
use crate::observed_block_producers::Error as ObservedBlockProducersError;
|
|
use futures::channel::mpsc::TrySendError;
|
|
use operation_pool::OpPoolError;
|
|
use safe_arith::ArithError;
|
|
use ssz_types::Error as SszTypesError;
|
|
use state_processing::{
|
|
block_signature_verifier::Error as BlockSignatureVerifierError,
|
|
per_block_processing::errors::{
|
|
AttestationValidationError, AttesterSlashingValidationError, ExitValidationError,
|
|
ProposerSlashingValidationError, SyncCommitteeMessageValidationError,
|
|
},
|
|
signature_sets::Error as SignatureSetError,
|
|
state_advance::Error as StateAdvanceError,
|
|
BlockProcessingError, SlotProcessingError,
|
|
};
|
|
use std::time::Duration;
|
|
use task_executor::ShutdownReason;
|
|
use types::*;
|
|
|
|
macro_rules! easy_from_to {
|
|
($from: ident, $to: ident) => {
|
|
impl From<$from> for $to {
|
|
fn from(e: $from) -> $to {
|
|
$to::$from(e)
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum BeaconChainError {
|
|
InsufficientValidators,
|
|
UnableToReadSlot,
|
|
UnableToComputeTimeAtSlot,
|
|
RevertedFinalizedEpoch {
|
|
previous_epoch: Epoch,
|
|
new_epoch: Epoch,
|
|
},
|
|
SlotClockDidNotStart,
|
|
NoStateForSlot(Slot),
|
|
UnableToFindTargetRoot(Slot),
|
|
BeaconStateError(BeaconStateError),
|
|
DBInconsistent(String),
|
|
DBError(store::Error),
|
|
ForkChoiceError(ForkChoiceError),
|
|
ForkChoiceStoreError(ForkChoiceStoreError),
|
|
MissingBeaconBlock(Hash256),
|
|
MissingBeaconState(Hash256),
|
|
SlotProcessingError(SlotProcessingError),
|
|
StateAdvanceError(StateAdvanceError),
|
|
UnableToAdvanceState(String),
|
|
NoStateForAttestation {
|
|
beacon_block_root: Hash256,
|
|
},
|
|
CannotAttestToFutureState,
|
|
AttestationValidationError(AttestationValidationError),
|
|
SyncCommitteeMessageValidationError(SyncCommitteeMessageValidationError),
|
|
ExitValidationError(ExitValidationError),
|
|
ProposerSlashingValidationError(ProposerSlashingValidationError),
|
|
AttesterSlashingValidationError(AttesterSlashingValidationError),
|
|
StateSkipTooLarge {
|
|
start_slot: Slot,
|
|
requested_slot: Slot,
|
|
max_task_runtime: Duration,
|
|
},
|
|
MissingFinalizedStateRoot(Slot),
|
|
/// Returned when an internal check fails, indicating corrupt data.
|
|
InvariantViolated(String),
|
|
SszTypesError(SszTypesError),
|
|
NoProposerForSlot(Slot),
|
|
CanonicalHeadLockTimeout,
|
|
AttestationCacheLockTimeout,
|
|
ValidatorPubkeyCacheLockTimeout,
|
|
SnapshotCacheLockTimeout,
|
|
IncorrectStateForAttestation(RelativeEpochError),
|
|
InvalidValidatorPubkeyBytes(bls::Error),
|
|
ValidatorPubkeyCacheIncomplete(usize),
|
|
SignatureSetError(SignatureSetError),
|
|
BlockSignatureVerifierError(state_processing::block_signature_verifier::Error),
|
|
DuplicateValidatorPublicKey,
|
|
ValidatorPubkeyCacheFileError(String),
|
|
ValidatorIndexUnknown(usize),
|
|
ValidatorPubkeyUnknown(PublicKeyBytes),
|
|
OpPoolError(OpPoolError),
|
|
NaiveAggregationError(NaiveAggregationError),
|
|
ObservedAttestationsError(ObservedAttestationsError),
|
|
ObservedAttestersError(ObservedAttestersError),
|
|
ObservedBlockProducersError(ObservedBlockProducersError),
|
|
AttesterCacheError(AttesterCacheError),
|
|
PruningError(PruningError),
|
|
ArithError(ArithError),
|
|
InvalidShufflingId {
|
|
shuffling_epoch: Epoch,
|
|
head_block_epoch: Epoch,
|
|
},
|
|
WeakSubjectivtyVerificationFailure,
|
|
WeakSubjectivtyShutdownError(TrySendError<ShutdownReason>),
|
|
AttestingToFinalizedSlot {
|
|
finalized_slot: Slot,
|
|
request_slot: Slot,
|
|
},
|
|
AttestingToAncientSlot {
|
|
lowest_permissible_slot: Slot,
|
|
request_slot: Slot,
|
|
},
|
|
BadPreState {
|
|
parent_root: Hash256,
|
|
parent_slot: Slot,
|
|
block_root: Hash256,
|
|
block_slot: Slot,
|
|
state_slot: Slot,
|
|
},
|
|
HistoricalBlockError(HistoricalBlockError),
|
|
InvalidStateForShuffling {
|
|
state_epoch: Epoch,
|
|
shuffling_epoch: Epoch,
|
|
},
|
|
SyncDutiesError(BeaconStateError),
|
|
InconsistentForwardsIter {
|
|
request_slot: Slot,
|
|
slot: Slot,
|
|
},
|
|
InvalidReorgSlotIter {
|
|
old_slot: Slot,
|
|
new_slot: Slot,
|
|
},
|
|
AltairForkDisabled,
|
|
ExecutionLayerMissing,
|
|
ExecutionForkChoiceUpdateFailed(execution_layer::Error),
|
|
}
|
|
|
|
easy_from_to!(SlotProcessingError, BeaconChainError);
|
|
easy_from_to!(AttestationValidationError, BeaconChainError);
|
|
easy_from_to!(SyncCommitteeMessageValidationError, BeaconChainError);
|
|
easy_from_to!(ExitValidationError, BeaconChainError);
|
|
easy_from_to!(ProposerSlashingValidationError, BeaconChainError);
|
|
easy_from_to!(AttesterSlashingValidationError, BeaconChainError);
|
|
easy_from_to!(SszTypesError, BeaconChainError);
|
|
easy_from_to!(OpPoolError, BeaconChainError);
|
|
easy_from_to!(NaiveAggregationError, BeaconChainError);
|
|
easy_from_to!(ObservedAttestationsError, BeaconChainError);
|
|
easy_from_to!(ObservedAttestersError, BeaconChainError);
|
|
easy_from_to!(ObservedBlockProducersError, BeaconChainError);
|
|
easy_from_to!(AttesterCacheError, BeaconChainError);
|
|
easy_from_to!(BlockSignatureVerifierError, BeaconChainError);
|
|
easy_from_to!(PruningError, BeaconChainError);
|
|
easy_from_to!(ArithError, BeaconChainError);
|
|
easy_from_to!(ForkChoiceStoreError, BeaconChainError);
|
|
easy_from_to!(HistoricalBlockError, BeaconChainError);
|
|
easy_from_to!(StateAdvanceError, BeaconChainError);
|
|
|
|
#[derive(Debug)]
|
|
pub enum BlockProductionError {
|
|
UnableToGetHeadInfo(BeaconChainError),
|
|
UnableToGetBlockRootFromState,
|
|
UnableToReadSlot,
|
|
UnableToProduceAtSlot(Slot),
|
|
SlotProcessingError(SlotProcessingError),
|
|
BlockProcessingError(BlockProcessingError),
|
|
Eth1ChainError(Eth1ChainError),
|
|
BeaconStateError(BeaconStateError),
|
|
StateAdvanceError(StateAdvanceError),
|
|
OpPoolError(OpPoolError),
|
|
/// The `BeaconChain` was explicitly configured _without_ a connection to eth1, therefore it
|
|
/// cannot produce blocks.
|
|
NoEth1ChainConnection,
|
|
StateSlotTooHigh {
|
|
produce_at_slot: Slot,
|
|
state_slot: Slot,
|
|
},
|
|
ExecutionLayerMissing,
|
|
TerminalPoWBlockLookupFailed(execution_layer::Error),
|
|
GetPayloadFailed(execution_layer::Error),
|
|
}
|
|
|
|
easy_from_to!(BlockProcessingError, BlockProductionError);
|
|
easy_from_to!(BeaconStateError, BlockProductionError);
|
|
easy_from_to!(SlotProcessingError, BlockProductionError);
|
|
easy_from_to!(Eth1ChainError, BlockProductionError);
|
|
easy_from_to!(StateAdvanceError, BlockProductionError);
|