mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
address changes
This commit is contained in:
@@ -248,7 +248,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
///
|
///
|
||||||
/// ## Errors
|
/// ## Errors
|
||||||
///
|
///
|
||||||
/// Returns an `Err` if the given envelope was invalid, or an error was encountered during
|
/// Returns an `Err` if the given envelope was invalid, or an error was encountered during verification.
|
||||||
pub async fn verify_envelope_for_gossip(
|
pub async fn verify_envelope_for_gossip(
|
||||||
self: &Arc<Self>,
|
self: &Arc<Self>,
|
||||||
envelope: Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>,
|
envelope: Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>,
|
||||||
|
|||||||
@@ -256,6 +256,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
return Err(EnvelopeError::BlockRootUnknown { block_root });
|
return Err(EnvelopeError::BlockRootUnknown { block_root });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(gloas) when the code below is implemented we can delete this drop
|
||||||
|
drop(fork_choice_reader);
|
||||||
|
|
||||||
// TODO(gloas) no fork choice logic yet
|
// TODO(gloas) no fork choice logic yet
|
||||||
// Take an exclusive write-lock on fork choice. It's very important to prevent deadlocks by
|
// Take an exclusive write-lock on fork choice. It's very important to prevent deadlocks by
|
||||||
// avoiding taking other locks whilst holding this lock.
|
// avoiding taking other locks whilst holding this lock.
|
||||||
@@ -323,6 +326,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
error = ?e,
|
error = ?e,
|
||||||
"Database write failed!"
|
"Database write failed!"
|
||||||
);
|
);
|
||||||
|
return Err(e.into());
|
||||||
// TODO(gloas) handle db write failure
|
// TODO(gloas) handle db write failure
|
||||||
// return Err(self
|
// return Err(self
|
||||||
// .handle_import_block_db_write_error(fork_choice)
|
// .handle_import_block_db_write_error(fork_choice)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ pub struct AvailableEnvelope<E: EthSpec> {
|
|||||||
execution_block_hash: ExecutionBlockHash,
|
execution_block_hash: ExecutionBlockHash,
|
||||||
envelope: Arc<SignedExecutionPayloadEnvelope<E>>,
|
envelope: Arc<SignedExecutionPayloadEnvelope<E>>,
|
||||||
columns: DataColumnSidecarList<E>,
|
columns: DataColumnSidecarList<E>,
|
||||||
/// Timestamp at which this block first became available (UNIX timestamp, time since 1970).
|
/// Timestamp at which this envelope first became available (UNIX timestamp, time since 1970).
|
||||||
columns_available_timestamp: Option<std::time::Duration>,
|
columns_available_timestamp: Option<std::time::Duration>,
|
||||||
pub spec: Arc<ChainSpec>,
|
pub spec: Arc<ChainSpec>,
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ pub enum MaybeAvailableEnvelope<E: EthSpec> {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This snapshot is to be used for verifying a envelope of the block.
|
/// This snapshot is to be used for verifying a payload envelope.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct EnvelopeProcessingSnapshot<E: EthSpec> {
|
pub struct EnvelopeProcessingSnapshot<E: EthSpec> {
|
||||||
/// This state is equivalent to the `self.beacon_block.state_root()` before applying the envelope.
|
/// This state is equivalent to the `self.beacon_block.state_root()` before applying the envelope.
|
||||||
@@ -158,54 +158,41 @@ impl<E: EthSpec> AvailableExecutedEnvelope<E> {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum EnvelopeError {
|
pub enum EnvelopeError {
|
||||||
/// The envelope's block root is unknown.
|
/// The envelope's block root is unknown.
|
||||||
BlockRootUnknown {
|
BlockRootUnknown { block_root: Hash256 },
|
||||||
block_root: Hash256,
|
|
||||||
},
|
|
||||||
/// The signature is invalid.
|
/// The signature is invalid.
|
||||||
BadSignature,
|
BadSignature,
|
||||||
/// The builder index doesn't match the committed bid
|
/// The builder index doesn't match the committed bid
|
||||||
BuilderIndexMismatch {
|
BuilderIndexMismatch { committed_bid: u64, envelope: u64 },
|
||||||
committed_bid: u64,
|
/// The envelope slot doesn't match the block
|
||||||
envelope: u64,
|
SlotMismatch { block: Slot, envelope: Slot },
|
||||||
},
|
/// The validator index is unknown
|
||||||
// The envelope slot doesn't match the block
|
UnknownValidator { builder_index: u64 },
|
||||||
SlotMismatch {
|
/// The block hash doesn't match the committed bid
|
||||||
block: Slot,
|
|
||||||
envelope: Slot,
|
|
||||||
},
|
|
||||||
// The validator index is unknown
|
|
||||||
UnknownValidator {
|
|
||||||
builder_index: u64,
|
|
||||||
},
|
|
||||||
// The block hash doesn't match the committed bid
|
|
||||||
BlockHashMismatch {
|
BlockHashMismatch {
|
||||||
committed_bid: ExecutionBlockHash,
|
committed_bid: ExecutionBlockHash,
|
||||||
envelope: ExecutionBlockHash,
|
envelope: ExecutionBlockHash,
|
||||||
},
|
},
|
||||||
// The block's proposer_index does not match the locally computed proposer
|
/// The block's proposer_index does not match the locally computed proposer
|
||||||
IncorrectBlockProposer {
|
IncorrectBlockProposer { block: u64, local_shuffling: u64 },
|
||||||
block: u64,
|
/// The slot belongs to a block that is from a slot prior than
|
||||||
local_shuffling: u64,
|
/// to most recently finalized slot
|
||||||
},
|
|
||||||
// The slot belongs to a block that is from a slot prior than
|
|
||||||
// the most recently finalized slot
|
|
||||||
PriorToFinalization {
|
PriorToFinalization {
|
||||||
payload_slot: Slot,
|
payload_slot: Slot,
|
||||||
latest_finalized_slot: Slot,
|
latest_finalized_slot: Slot,
|
||||||
},
|
},
|
||||||
// Some Beacon Chain Error
|
/// Some Beacon Chain Error
|
||||||
BeaconChainError(Arc<BeaconChainError>),
|
BeaconChainError(Arc<BeaconChainError>),
|
||||||
// Some Beacon State error
|
/// Some Beacon State error
|
||||||
BeaconStateError(BeaconStateError),
|
BeaconStateError(BeaconStateError),
|
||||||
// Some BlockProcessingError (for electra operations)
|
/// Some BlockProcessingError (for electra operations)
|
||||||
BlockProcessingError(BlockProcessingError),
|
BlockProcessingError(BlockProcessingError),
|
||||||
// Some EnvelopeProcessingError
|
/// Some EnvelopeProcessingError
|
||||||
EnvelopeProcessingError(EnvelopeProcessingError),
|
EnvelopeProcessingError(EnvelopeProcessingError),
|
||||||
// Error verifying the execution payload
|
/// Error verifying the execution payload
|
||||||
ExecutionPayloadError(ExecutionPayloadError),
|
ExecutionPayloadError(ExecutionPayloadError),
|
||||||
// An error from block-level checks reused during envelope import
|
/// An error from block-level checks reused during envelope import
|
||||||
BlockError(BlockError),
|
BlockError(BlockError),
|
||||||
// Internal error
|
/// Internal error
|
||||||
InternalError(String),
|
InternalError(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user