mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-04 13:24:39 +00:00
Merge remote-tracking branch 'michael/delete-fork-revert' into gloas-replay-blocks
This commit is contained in:
@@ -722,14 +722,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch a block from the store, ignoring which fork variant it *should* be for.
|
|
||||||
pub fn get_block_any_variant<Payload: AbstractExecPayload<E>>(
|
|
||||||
&self,
|
|
||||||
block_root: &Hash256,
|
|
||||||
) -> Result<Option<SignedBeaconBlock<E, Payload>>, Error> {
|
|
||||||
self.get_block_with(block_root, SignedBeaconBlock::any_from_ssz_bytes)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Fetch a block from the store using a custom decode function.
|
/// Fetch a block from the store using a custom decode function.
|
||||||
///
|
///
|
||||||
/// This is useful for e.g. ignoring the slot-indicated fork to forcefully load a block as if it
|
/// This is useful for e.g. ignoring the slot-indicated fork to forcefully load a block as if it
|
||||||
|
|||||||
@@ -249,7 +249,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> Iterator
|
|||||||
pub struct ParentRootBlockIterator<'a, E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> {
|
pub struct ParentRootBlockIterator<'a, E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> {
|
||||||
store: &'a HotColdDB<E, Hot, Cold>,
|
store: &'a HotColdDB<E, Hot, Cold>,
|
||||||
next_block_root: Hash256,
|
next_block_root: Hash256,
|
||||||
decode_any_variant: bool,
|
|
||||||
_phantom: PhantomData<E>,
|
_phantom: PhantomData<E>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,17 +259,6 @@ impl<'a, E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>>
|
|||||||
Self {
|
Self {
|
||||||
store,
|
store,
|
||||||
next_block_root: start_block_root,
|
next_block_root: start_block_root,
|
||||||
decode_any_variant: false,
|
|
||||||
_phantom: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Block iterator that is tolerant of blocks that have the wrong fork for their slot.
|
|
||||||
pub fn fork_tolerant(store: &'a HotColdDB<E, Hot, Cold>, start_block_root: Hash256) -> Self {
|
|
||||||
Self {
|
|
||||||
store,
|
|
||||||
next_block_root: start_block_root,
|
|
||||||
decode_any_variant: true,
|
|
||||||
_phantom: PhantomData,
|
_phantom: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,12 +273,10 @@ impl<'a, E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>>
|
|||||||
Ok(None)
|
Ok(None)
|
||||||
} else {
|
} else {
|
||||||
let block_root = self.next_block_root;
|
let block_root = self.next_block_root;
|
||||||
let block = if self.decode_any_variant {
|
let block = self
|
||||||
self.store.get_block_any_variant(&block_root)
|
.store
|
||||||
} else {
|
.get_blinded_block(&block_root)?
|
||||||
self.store.get_blinded_block(&block_root)
|
.ok_or(Error::BlockNotFound(block_root))?;
|
||||||
}?
|
|
||||||
.ok_or(Error::BlockNotFound(block_root))?;
|
|
||||||
self.next_block_root = block.message().parent_root();
|
self.next_block_root = block.message().parent_root();
|
||||||
Ok(Some((block_root, block)))
|
Ok(Some((block_root, block)))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,9 +56,10 @@ use crate::{
|
|||||||
|
|
||||||
pub const CACHED_EPOCHS: usize = 3;
|
pub const CACHED_EPOCHS: usize = 3;
|
||||||
|
|
||||||
// Pre-electra WS calculations are not supported. On mainnet, pre-electra epochs are outside the weak subjectivity
|
// Pre-electra WS calculations are not supported. On mainnet, pre-electra epochs are outside the
|
||||||
// period. The default pre-electra WS value is set to 256 to allow for `basic-sim``, `fallback-sim`` test case `revert_minority_fork_on_resume`
|
// weak subjectivity period. The default pre-electra WS value is set to 256 to allow for `basic-sim`
|
||||||
// to pass. 256 is a small enough number to trigger the WS safety check pre-electra on mainnet.
|
// and `fallback-sim` tests to pass. 256 is a small enough number to trigger the WS safety check
|
||||||
|
// pre-electra on mainnet.
|
||||||
pub const DEFAULT_PRE_ELECTRA_WS_PERIOD: u64 = 256;
|
pub const DEFAULT_PRE_ELECTRA_WS_PERIOD: u64 = 256;
|
||||||
|
|
||||||
const MAX_RANDOM_BYTE: u64 = (1 << 8) - 1;
|
const MAX_RANDOM_BYTE: u64 = (1 << 8) - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user