feat: subnet deletion in DSM#10467
Draft
mraszyk wants to merge 19 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.