Skip to content

Commit

Permalink
A0-0000: Workaround for updating from version 13 (#1894)
Browse files Browse the repository at this point in the history
# Description

Strongly suggests older nodes to actually download our blocks.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

# Checklist:
  • Loading branch information
timorleph authored Dec 19, 2024
1 parent ea1e23b commit 0788bc5
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions finality-aleph/src/sync/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use crate::{
session::SessionBoundaryInfo,
sync::{
data::{
NetworkData, PreRequest, Request, ResponseItem, ResponseItems, State, VersionWrapper,
VersionedNetworkData,
BranchKnowledge, NetworkData, PreRequest, Request, ResponseItem, ResponseItems, State,
VersionWrapper, VersionedNetworkData,
},
forest::ExtensionRequest,
handler::{Action, DatabaseIO, Error as HandlerError, HandleStateAction, Handler},
Expand Down Expand Up @@ -713,7 +713,25 @@ where
}
}

fn hacky_workaround_for_cooperation_with_version_13_during_update(
&mut self,
own_new_header: UnverifiedHeaderFor<J>,
) {
let branch_knowledge = BranchKnowledge::LowestId(own_new_header.id());
// send the request for our newest block to 10 random peers, as long as at least one of
// them is running v13, all the v13s will eventually get the block
for _ in 0..10 {
let pre_request = PreRequest::new(
own_new_header.clone(),
branch_knowledge.clone(),
HashSet::new(),
);
self.send_request(pre_request);
}
}

fn handle_own_block(&mut self, block: B) {
self.hacky_workaround_for_cooperation_with_version_13_during_update(block.header().clone());
match self.handler.handle_own_block(block) {
Ok(maybe_proof) => {
self.process_equivocation_proofs(maybe_proof);
Expand Down

0 comments on commit 0788bc5

Please sign in to comment.