mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 12:11:59 +00:00
Merge branch 'unstable' into deneb-free-blobs
# Conflicts: # .github/workflows/docker.yml # .github/workflows/local-testnet.yml # .github/workflows/test-suite.yml # Cargo.lock # Cargo.toml # beacon_node/beacon_chain/src/beacon_chain.rs # beacon_node/beacon_chain/src/builder.rs # beacon_node/beacon_chain/src/test_utils.rs # beacon_node/execution_layer/src/engine_api/json_structures.rs # beacon_node/network/src/beacon_processor/mod.rs # beacon_node/network/src/beacon_processor/worker/gossip_methods.rs # beacon_node/network/src/sync/backfill_sync/mod.rs # beacon_node/store/src/config.rs # beacon_node/store/src/hot_cold_store.rs # common/eth2_network_config/Cargo.toml # consensus/ssz/src/decode/impls.rs # consensus/ssz_derive/src/lib.rs # consensus/ssz_derive/tests/tests.rs # consensus/ssz_types/src/serde_utils/mod.rs # consensus/tree_hash/src/impls.rs # consensus/tree_hash/src/lib.rs # consensus/types/Cargo.toml # consensus/types/src/beacon_state.rs # consensus/types/src/chain_spec.rs # consensus/types/src/eth_spec.rs # consensus/types/src/fork_name.rs # lcli/Cargo.toml # lcli/src/main.rs # lcli/src/new_testnet.rs # scripts/local_testnet/el_bootnode.sh # scripts/local_testnet/genesis.json # scripts/local_testnet/geth.sh # scripts/local_testnet/setup.sh # scripts/local_testnet/start_local_testnet.sh # scripts/local_testnet/vars.env # scripts/tests/doppelganger_protection.sh # scripts/tests/genesis.json # scripts/tests/vars.env # testing/ef_tests/Cargo.toml # validator_client/src/block_service.rs
This commit is contained in:
@@ -160,20 +160,20 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
// If, for some reason a backfill has already been completed (or we've used a trusted
|
||||
// genesis root) then backfill has been completed.
|
||||
|
||||
let (state, current_start) = if let Some(anchor_info) = beacon_chain.store.get_anchor_info()
|
||||
{
|
||||
if anchor_info.block_backfill_complete() {
|
||||
(BackFillState::Completed, Epoch::new(0))
|
||||
} else {
|
||||
(
|
||||
BackFillState::Paused,
|
||||
anchor_info
|
||||
.oldest_block_slot
|
||||
.epoch(T::EthSpec::slots_per_epoch()),
|
||||
)
|
||||
let (state, current_start) = match beacon_chain.store.get_anchor_info() {
|
||||
Some(anchor_info) => {
|
||||
if anchor_info.block_backfill_complete(beacon_chain.genesis_backfill_slot) {
|
||||
(BackFillState::Completed, Epoch::new(0))
|
||||
} else {
|
||||
(
|
||||
BackFillState::Paused,
|
||||
anchor_info
|
||||
.oldest_block_slot
|
||||
.epoch(T::EthSpec::slots_per_epoch()),
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
(BackFillState::NotRequired, Epoch::new(0))
|
||||
None => (BackFillState::NotRequired, Epoch::new(0)),
|
||||
};
|
||||
|
||||
let bfs = BackFillSync {
|
||||
@@ -288,6 +288,7 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
remaining: self
|
||||
.current_start
|
||||
.start_slot(T::EthSpec::slots_per_epoch())
|
||||
.saturating_sub(self.beacon_chain.genesis_backfill_slot)
|
||||
.as_usize(),
|
||||
})
|
||||
}
|
||||
@@ -1096,7 +1097,12 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
match self.batches.entry(batch_id) {
|
||||
Entry::Occupied(_) => {
|
||||
// this batch doesn't need downloading, let this same function decide the next batch
|
||||
if batch_id == 0 {
|
||||
if batch_id
|
||||
== self
|
||||
.beacon_chain
|
||||
.genesis_backfill_slot
|
||||
.epoch(T::EthSpec::slots_per_epoch())
|
||||
{
|
||||
self.last_batch_downloaded = true;
|
||||
}
|
||||
|
||||
@@ -1112,7 +1118,12 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
BACKFILL_EPOCHS_PER_BATCH,
|
||||
batch_type,
|
||||
));
|
||||
if batch_id == 0 {
|
||||
if batch_id
|
||||
== self
|
||||
.beacon_chain
|
||||
.genesis_backfill_slot
|
||||
.epoch(T::EthSpec::slots_per_epoch())
|
||||
{
|
||||
self.last_batch_downloaded = true;
|
||||
}
|
||||
self.to_be_downloaded = self
|
||||
@@ -1129,7 +1140,7 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
/// not required.
|
||||
fn reset_start_epoch(&mut self) -> Result<(), ResetEpochError> {
|
||||
if let Some(anchor_info) = self.beacon_chain.store.get_anchor_info() {
|
||||
if anchor_info.block_backfill_complete() {
|
||||
if anchor_info.block_backfill_complete(self.beacon_chain.genesis_backfill_slot) {
|
||||
Err(ResetEpochError::SyncCompleted)
|
||||
} else {
|
||||
self.current_start = anchor_info
|
||||
@@ -1144,12 +1155,17 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
|
||||
/// Checks with the beacon chain if backfill sync has completed.
|
||||
fn check_completed(&mut self) -> bool {
|
||||
if self.current_start == 0 {
|
||||
if self.current_start
|
||||
== self
|
||||
.beacon_chain
|
||||
.genesis_backfill_slot
|
||||
.epoch(T::EthSpec::slots_per_epoch())
|
||||
{
|
||||
// Check that the beacon chain agrees
|
||||
|
||||
if let Some(anchor_info) = self.beacon_chain.store.get_anchor_info() {
|
||||
// Conditions that we have completed a backfill sync
|
||||
if anchor_info.block_backfill_complete() {
|
||||
if anchor_info.block_backfill_complete(self.beacon_chain.genesis_backfill_slot) {
|
||||
return true;
|
||||
} else {
|
||||
error!(self.log, "Backfill out of sync with beacon chain");
|
||||
|
||||
Reference in New Issue
Block a user