Skip to content

Commit 1dcaa2f

Browse files
Apply suggestions from code review
Co-authored-by: Alin Sinpalean <58422065+alin-at-dfinity@users.noreply.github.com>
1 parent 6f2f945 commit 1dcaa2f

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

rs/messaging/src/routing/stream_builder.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -472,20 +472,18 @@ impl StreamBuilderImpl {
472472
Some(dst_subnet_id) => {
473473
let is_loopback_stream = self.subnet_id == dst_subnet_id;
474474
let is_engine_dst = !is_loopback_stream
475-
&& network_topology
476-
.subnets()
477-
.get(&dst_subnet_id)
478-
.is_some_and(|t| t.subnet_type == SubnetType::CloudEngine);
479-
let is_engine_src =
480-
!is_loopback_stream && own_subnet_type == SubnetType::CloudEngine;
481475
// A message that must never cross an engine boundary: a
482476
// guaranteed-response message, or one carrying cycles. Such a message
483477
// is always handled by the engine boundary arms below, whether or not
484478
// the destination subnet is cooling down: it is illegal there
485-
// permanently, so retaining it until the subnet stops cooling down
486-
// would only defer the same outcome.
487-
let is_illegal_engine_msg = (is_engine_dst || is_engine_src)
488-
&& (msg.deadline() == NO_DEADLINE || msg.cycles() > Cycles::zero());
479+
// permanently, so a transient rejection would be misleading.
480+
let is_illegal_engine_msg = (msg.deadline() == NO_DEADLINE || msg.cycles() > Cycles::zero())
481+
&& !is_loopback_stream
482+
&& (own_subnet_type == SubnetType::CloudEngine
483+
|| network_topology
484+
.subnets()
485+
.get(&dst_subnet_id)
486+
.is_some_and(|s| s.subnet_type == SubnetType::CloudEngine));
489487

490488
// A cooling down destination subnet must not be sent any messages.
491489
// Retain them in the output queue (along with everything behind

rs/replicated_state/src/metadata_state.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ pub struct SubnetTopology {
418418
pub chain_keys_held: BTreeSet<MasterPublicKeyId>,
419419
pub cost_schedule: CanisterCyclesCostSchedule,
420420
pub subnet_admins: BTreeSet<PrincipalId>,
421+
421422
/// Whether the subnet is "cooling down", i.e. quiescing: it stops accepting new
422423
/// messages and lets the messages already in flight drain. While a subnet is
423424
/// cooling down:

0 commit comments

Comments
 (0)