mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
update config
This commit is contained in:
@@ -2141,7 +2141,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
// NOTE: not sure how to handle scenario where head hash is `None` i.e. pre-bellatrix, which
|
||||
// is pre-electra.
|
||||
let Some(parent_hash) = parent_hash else {
|
||||
debug!("Failed to fetch parent_hash");
|
||||
info!("Failed to fetch parent_hash");
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
@@ -2152,7 +2152,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
//
|
||||
// This prevents the routine from running during sync.
|
||||
if head_slot != current_slot {
|
||||
debug!(?head_slot, ?current_slot, "Head too old for inclusion list");
|
||||
info!(?head_slot, ?current_slot, "Head too old for inclusion list");
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -2161,16 +2161,16 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
//
|
||||
// NOTE: does this represent a critical error? should we return an error here or log crit?
|
||||
// is this check redundant?
|
||||
if request_slot != next_slot {
|
||||
debug!(
|
||||
?request_slot,
|
||||
?next_slot,
|
||||
"Inclusion list request slot not equal to next slot"
|
||||
);
|
||||
return Ok(None);
|
||||
}
|
||||
// if request_slot != next_slot {
|
||||
// info!(
|
||||
// ?request_slot,
|
||||
// ?next_slot,
|
||||
// "Inclusion list request slot not equal to next slot"
|
||||
// );
|
||||
// return Ok(None);
|
||||
// }
|
||||
|
||||
debug!(
|
||||
info!(
|
||||
%parent_hash,
|
||||
?current_slot,
|
||||
"Attempt to fetch IL from EL"
|
||||
@@ -2181,7 +2181,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.await
|
||||
.map_err(|e| Error::ExecutionLayerGetInclusionListFailed(Box::new(e)))?;
|
||||
|
||||
debug!(
|
||||
info!(
|
||||
tx_count = inclusion_list.len(),
|
||||
"Inclusion list fetched from EL"
|
||||
);
|
||||
@@ -7357,6 +7357,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.on_inclusion_list(signed_il);
|
||||
}
|
||||
|
||||
pub fn inclusion_list_seen(&self, signed_il: &SignedInclusionList<T::EthSpec>) -> bool {
|
||||
self.inclusion_list_cache
|
||||
.read()
|
||||
.inclusion_list_seen(signed_il)
|
||||
}
|
||||
|
||||
pub fn metrics(&self) -> BeaconChainMetrics {
|
||||
BeaconChainMetrics {
|
||||
reqresp_pre_import_cache_len: self.reqresp_pre_import_cache.read().len(),
|
||||
|
||||
@@ -112,7 +112,7 @@ impl<T: BeaconChainTypes> PayloadNotifier<T> {
|
||||
.get_inclusion_list_transactions(block.slot())
|
||||
.unwrap_or(vec![].into());
|
||||
|
||||
debug!(
|
||||
info!(
|
||||
tx_count = inclusion_list_transactions.len(),
|
||||
slot = ?block.slot(),
|
||||
"Adding inclusion list transactions in the Payload Notifier"
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
use crate::{BeaconChain, BeaconChainError, BeaconChainTypes};
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::{
|
||||
validator_monitor::{get_slot_delay_ms, timestamp_now},
|
||||
BeaconChain, BeaconChainError, BeaconChainTypes,
|
||||
};
|
||||
|
||||
use slot_clock::SlotClock;
|
||||
use strum::AsRefStr;
|
||||
use types::{Domain, EthSpec, SignedInclusionList, SignedRoot, Slot};
|
||||
use tree_hash::TreeHash;
|
||||
use types::{Domain, SignedInclusionList, SignedRoot, Slot};
|
||||
|
||||
#[derive(Debug, AsRefStr)]
|
||||
pub enum GossipInclusionListError {
|
||||
@@ -16,6 +22,7 @@ pub enum GossipInclusionListError {
|
||||
InvalidSignature,
|
||||
BeaconChainError(Box<BeaconChainError>),
|
||||
PriorInclusionListKnown,
|
||||
InclusionListSeen,
|
||||
// TODO: equivocation e.g. PriorInclusionListKnown
|
||||
}
|
||||
|
||||
@@ -42,6 +49,18 @@ impl<T: BeaconChainTypes> GossipVerifiedInclusionList<T> {
|
||||
.now()
|
||||
.ok_or(BeaconChainError::UnableToReadSlot)?;
|
||||
|
||||
// TODO(focil) move 8192 to config
|
||||
if signed_il
|
||||
.message
|
||||
.transactions
|
||||
.iter()
|
||||
.map(|v| v.len())
|
||||
.sum::<usize>()
|
||||
> 8192
|
||||
{
|
||||
return Err(GossipInclusionListError::TooManyTransactions);
|
||||
}
|
||||
|
||||
if message_slot != current_slot && message_slot != current_slot - 1 {
|
||||
return Err(GossipInclusionListError::InvalidSlot {
|
||||
message_slot,
|
||||
@@ -49,23 +68,35 @@ impl<T: BeaconChainTypes> GossipVerifiedInclusionList<T> {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO(focil): the slot is equal to the current slot or the previous slot and the current time is
|
||||
// not past the attestation deadline
|
||||
let attestation_deadline = Duration::from_secs(chain.spec.seconds_per_slot / 3);
|
||||
|
||||
// TODO(focil): the IL committee root is equal to the hash tree root of the expected committee
|
||||
let inclusion_list_delay_total =
|
||||
get_slot_delay_ms(timestamp_now(), message_slot, &chain.slot_clock);
|
||||
|
||||
// TODO(focil): the validator index is contained in the committee corresponding to the committee
|
||||
// root
|
||||
let exceeds_attestation_deadline = attestation_deadline >= inclusion_list_delay_total;
|
||||
|
||||
// the transaction length is less than or equal to the specified maximum
|
||||
// TODO(focil) review this
|
||||
// if signed_il.message.transactions.len() > T::EthSpec::max_bytes_per_inclusion_list()
|
||||
// {
|
||||
// return Err(GossipInclusionListError::TooManyTransactions);
|
||||
// }
|
||||
if exceeds_attestation_deadline {
|
||||
return Err(GossipInclusionListError::InvalidSlot {
|
||||
message_slot,
|
||||
current_slot,
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: the message is the first or second valid message received from the validator
|
||||
// corresponding to the validator index
|
||||
let head_snapshot = chain.head_snapshot();
|
||||
|
||||
let il_committee = head_snapshot
|
||||
.beacon_state
|
||||
.get_inclusion_list_committee(message_slot, &chain.spec)
|
||||
.map_err(|_| GossipInclusionListError::InvalidCommitteeRoot)?;
|
||||
|
||||
if signed_il.message.inclusion_list_committee_root != il_committee.tree_hash_root() {
|
||||
tracing::error!("INVALID COMMITTEE ROOT");
|
||||
return Err(GossipInclusionListError::InvalidCommitteeRoot);
|
||||
}
|
||||
|
||||
if !il_committee.contains(&signed_il.message.validator_index) {
|
||||
return Err(GossipInclusionListError::ValidatorNotInCommittee);
|
||||
}
|
||||
|
||||
// the signature is valid w.r.t. the validator index
|
||||
let epoch = chain.epoch()?;
|
||||
@@ -85,11 +116,15 @@ impl<T: BeaconChainTypes> GossipVerifiedInclusionList<T> {
|
||||
BeaconChainError::ValidatorIndexUnknown(validator_index),
|
||||
)));
|
||||
};
|
||||
// TODO(focil) fix inclusion list verify
|
||||
|
||||
if !signed_il.signature.verify(&pubkey, message) {
|
||||
return Err(GossipInclusionListError::InvalidSignature);
|
||||
}
|
||||
|
||||
if chain.inclusion_list_seen(&signed_il) {
|
||||
return Err(GossipInclusionListError::InclusionListSeen);
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
signed_il: signed_il.clone(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user