Skip to content

feat: subnet deletion in DSM#10467

Draft
mraszyk wants to merge 19 commits into
masterfrom
mraszyk/synthetic-rejects-after-subnet-deletion
Draft

feat: subnet deletion in DSM#10467
mraszyk wants to merge 19 commits into
masterfrom
mraszyk/synthetic-rejects-after-subnet-deletion

Conversation

@mraszyk

@mraszyk mraszyk commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions Bot added the feat label Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds handling for “subnet deletion” scenarios in message routing/state evolution, ensuring streams to deleted subnets are discarded and callbacks to deleted/unroutable destinations receive synthetic reject responses instead of triggering critical errors.

Changes:

  • Discard outgoing streams whose destination subnet is no longer present in the network topology.
  • Generate synthetic reject responses for callbacks targeting destinations that no longer have a route.
  • Update StreamBuilder behavior to stop treating unroutable responses as critical errors, and add regression tests covering deleted-subnet cases.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rs/xnet/payload_builder/tests/certified_slice_pool.rs Adds a property test ensuring pooled slices are garbage-collected when a peer subnet disappears.
rs/replicated_state/src/replicated_state.rs Adds helpers to drop streams for deleted subnets and synthesize rejects for callbacks to deleted/unroutable destinations.
rs/messaging/src/state_machine/tests.rs Adds an integration-style test exercising deleted-subnet behavior across streams, output queues, and callbacks.
rs/messaging/src/state_machine.rs Wires new replicated-state helpers into the round execution flow.
rs/messaging/src/routing/stream_builder.rs Changes unroutable response handling to discard with lower log severity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +924 to +947
let mut available_guaranteed_response_memory = i64::MAX / 2;
for (canister_id, callback_id, respondent, deadline) in rejects {
let response = RequestOrResponse::Response(Arc::new(Response {
originator: canister_id,
respondent,
originator_reply_callback: callback_id,
refund: Cycles::zero(),
response_payload: Payload::Reject(RejectContext::new_with_message_length_limit(
RejectCode::CanisterReject,
"Canister has been uninstalled.",
MR_SYNTHETIC_REJECT_MESSAGE_MAX_LEN,
)),
deadline,
}));

let mut canister = self.canister_states.remove(&canister_id).unwrap();
let _ = Arc::make_mut(&mut canister).push_input(
response,
&mut available_guaranteed_response_memory,
own_subnet_type,
InputQueueType::RemoteSubnet,
);
self.canister_states.insert(canister);
}
Comment on lines 576 to +580
RequestOrResponse::Response(rep) => {
// A Response: discard it.
error!(
self.log,
"{}: Discarding response, destination not found: {:?}",
CRITICAL_ERROR_RESPONSE_DESTINATION_NOT_FOUND,
rep
);
self.metrics
.critical_error_response_destination_not_found
.inc();
// A Response: discard it silently when the destination subnet has been deleted.
if rep.is_best_effort() {
debug!(
self.log,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants