mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-30 03:14:25 +00:00
Merge remote-tracking branch 'origin/unstable' into tree-states
This commit is contained in:
@@ -4023,7 +4023,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.task_executor
|
||||
.spawn_blocking_handle(
|
||||
move || chain.load_state_for_block_production(slot),
|
||||
"produce_partial_beacon_block",
|
||||
"load_state_for_block_production",
|
||||
)
|
||||
.ok_or(BlockProductionError::ShuttingDown)?
|
||||
.await
|
||||
|
||||
@@ -545,6 +545,18 @@ pub struct AvailableBlock<E: EthSpec> {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> AvailableBlock<E> {
|
||||
pub fn __new_for_testing(
|
||||
block_root: Hash256,
|
||||
block: Arc<SignedBeaconBlock<E>>,
|
||||
blobs: Option<BlobSidecarList<E>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
block_root,
|
||||
block,
|
||||
blobs,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn block(&self) -> &SignedBeaconBlock<E> {
|
||||
&self.block
|
||||
}
|
||||
|
||||
@@ -141,13 +141,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
|
||||
prev_block_slot = block.slot();
|
||||
expected_block_root = block.message().parent_root();
|
||||
signed_blocks.push(block);
|
||||
|
||||
// If we've reached genesis, add the genesis block root to the batch for all slots
|
||||
// between 0 and the first block slot, and set the anchor slot to 0 to indicate
|
||||
// completion.
|
||||
if expected_block_root == self.genesis_block_root {
|
||||
let genesis_slot = self.spec.genesis_slot;
|
||||
for slot in genesis_slot.as_u64()..block.slot().as_u64() {
|
||||
for slot in genesis_slot.as_u64()..prev_block_slot.as_u64() {
|
||||
cold_batch.push(KeyValueStoreOp::PutKeyValue(
|
||||
get_key_for_col(DBColumn::BeaconBlockRoots.into(), &slot.to_be_bytes()),
|
||||
self.genesis_block_root.as_bytes().to_vec(),
|
||||
@@ -157,7 +158,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
expected_block_root = Hash256::zero();
|
||||
break;
|
||||
}
|
||||
signed_blocks.push(block);
|
||||
}
|
||||
// these were pushed in reverse order so we reverse again
|
||||
signed_blocks.reverse();
|
||||
|
||||
@@ -43,7 +43,7 @@ impl<T: EthSpec> Consts for Attestation<T> {
|
||||
|
||||
/// We need to keep attestations for each slot of the current epoch.
|
||||
fn max_slot_capacity() -> usize {
|
||||
T::slots_per_epoch() as usize
|
||||
2 * T::slots_per_epoch() as usize
|
||||
}
|
||||
|
||||
/// As a DoS protection measure, the maximum number of distinct `Attestations` or
|
||||
|
||||
@@ -24,18 +24,16 @@ use types::{Epoch, EthSpec, Hash256, Slot, Unsigned};
|
||||
|
||||
/// The maximum capacity of the `AutoPruningEpochContainer`.
|
||||
///
|
||||
/// Fits the next, current and previous epochs. We require the next epoch due to the
|
||||
/// `MAXIMUM_GOSSIP_CLOCK_DISPARITY`. We require the previous epoch since the specification
|
||||
/// declares:
|
||||
/// If the current epoch is N, this fits epoch N + 1, N, N - 1, and N - 2. We require the next epoch due
|
||||
/// to the `MAXIMUM_GOSSIP_CLOCK_DISPARITY`. We require the N - 2 epoch since the specification declares:
|
||||
///
|
||||
/// ```ignore
|
||||
/// aggregate.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE
|
||||
/// >= current_slot >= aggregate.data.slot
|
||||
/// the epoch of `aggregate.data.slot` is either the current or previous epoch
|
||||
/// ```
|
||||
///
|
||||
/// This means that during the current epoch we will always accept an attestation
|
||||
/// from at least one slot in the previous epoch.
|
||||
pub const MAX_CACHED_EPOCHS: u64 = 3;
|
||||
/// This means that during the current epoch we will always accept an attestation from
|
||||
/// at least one slot in the epoch prior to the previous epoch.
|
||||
pub const MAX_CACHED_EPOCHS: u64 = 4;
|
||||
|
||||
pub type ObservedAttesters<E> = AutoPruningEpochContainer<EpochBitfield, E>;
|
||||
pub type ObservedSyncContributors<E> =
|
||||
|
||||
Reference in New Issue
Block a user