Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
chore(deps): update sn_messaging
Browse files Browse the repository at this point in the history
BREAKING CHANGE: new version of sn_messaging
- Also removes handling of the unused `AtSource` aggregation scheme.
  • Loading branch information
oetyng committed Apr 8, 2021
1 parent 2c6b891 commit 8d61421
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 66 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ qp2p = "~0.11.3"
rand = "~0.7.3"
rand_chacha = "~0.2.2"
resource_proof = "0.8.0"
sn_messaging = "~12.0.0"
sn_messaging = "~13.0.0"
sn_data_types = "~0.18.0"
thiserror = "1.0.23"
tokio = "1.3.0"
Expand Down
23 changes: 0 additions & 23 deletions src/delivery_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,29 +154,6 @@ fn get_peer<'a>(name: &XorName, section: &'a Section, network: &'a Network) -> O
.or_else(|| network.get_elder(name))
}

// Returns the set of peers that are responsible for collecting signatures to verify a message;
// this may contain us or only other nodes.
pub fn signature_targets<I>(dst: &DstLocation, our_elders: I) -> Vec<Peer>
where
I: IntoIterator<Item = Peer>,
{
let dst_name = match dst {
DstLocation::Node(name) => *name,
DstLocation::Section(name) => *name,
DstLocation::EndUser(_) | DstLocation::Direct => {
error!("Invalid destination for signature targets: {:?}", dst);
return vec![];
}
};

let mut list: Vec<_> = our_elders
.into_iter()
.sorted_by(|lhs, rhs| dst_name.cmp_distance(lhs.name(), rhs.name()))
.collect();
list.truncate(cmp::min(list.len(), ELDER_SIZE));
list
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
42 changes: 0 additions & 42 deletions src/routing/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2091,16 +2091,6 @@ impl Core {
proof_chain,
None,
)?
} else if itinerary.aggregate_at_src() {
let proof_chain =
self.create_proof_chain(&itinerary.dst, additional_proof_chain_key)?;
let proposal =
self.create_accumulate_at_src_proposal(itinerary.dst, variant, proof_chain);
let recipients = delivery_group::signature_targets(
&itinerary.dst,
self.section.elders_info().peers().copied(),
);
return self.send_proposal(&recipients, proposal);
} else {
Message::single_src(&self.node, itinerary.dst, variant, None, None)?
};
Expand Down Expand Up @@ -2201,38 +2191,6 @@ impl Core {
commands
}

fn create_accumulate_at_src_proposal(
&self,
dst: DstLocation,
variant: Variant,
proof_chain: SectionChain,
) -> Proposal {
let dst_key = if let Some(name) = dst.name() {
*self.section_key_by_name(&name)
} else {
// NOTE: `dst` is `Direct`. We use this when we want the message to accumulate at the
// destination and also be handled only there. We only do this if the recipient is in
// our section, so it's OK to use our latest key as the `dst_key`.
*self.section.chain().last_key()
};

let message = PlainMessage {
src: self.section.prefix().name(),
dst,
dst_key,
variant,
};

let proposal = Proposal::AccumulateAtSrc {
message: Box::new(message),
proof_chain,
};

trace!("Create {:?}", proposal);

proposal
}

fn create_proof_chain(
&self,
dst: &DstLocation,
Expand Down

0 comments on commit 8d61421

Please sign in to comment.