Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: [MR-603] Typed canister queues and references #1697

Merged
merged 31 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
75461e9
feat: [MR-523] Prevent enqueueing multiple responses for the same cal…
alin-at-dfinity Sep 7, 2024
9534ca4
feat: [MR-603] Keep track of shed inbound responses
alin-at-dfinity Sep 7, 2024
e65c087
Define two separate CanisterInput variants of SysUnknown responses: D…
alin-at-dfinity Sep 8, 2024
c70e701
Merge branch 'master' into alin/MR-523-response-deduplication
alin-at-dfinity Sep 9, 2024
9fe3fa6
Merge branch 'alin/MR-523-response-deduplication' into alin/MR-603-sh…
alin-at-dfinity Sep 9, 2024
fa0e182
Make clippy happy.
alin-at-dfinity Sep 9, 2024
5c90ada
Address review comments.
alin-at-dfinity Sep 10, 2024
e2a5852
Merge branch 'alin/MR-523-response-deduplication' into alin/MR-603-sh…
alin-at-dfinity Sep 10, 2024
9b8bbf5
Update queues_compatibility_test to use mainnet version. Describe cal…
alin-at-dfinity Sep 12, 2024
9d0e758
Merge branch 'alin/MR-523-response-deduplication' into alin/MR-603-sh…
alin-at-dfinity Sep 12, 2024
54f89c3
Merge branch 'master' into alin/MR-603-shed-inbound-responses
alin-at-dfinity Sep 12, 2024
679d618
Produce SysUnknown reject codes for shed responses.
alin-at-dfinity Sep 12, 2024
e0b1bc3
Merge branch 'master' into alin/MR-603-shed-inbound-responses
alin-at-dfinity Sep 13, 2024
e55ba00
Add test for shedding inbound responses.
alin-at-dfinity Sep 16, 2024
d01c587
Have SystemState::pop_input() always succeed, by returning an arbitra…
alin-at-dfinity Sep 20, 2024
dc80ea3
Merge branch 'master' into alin/MR-603-shed-inbound-responses
alin-at-dfinity Sep 20, 2024
195b5e8
Address review comments: use the anonymous principal instead of IC-00…
alin-at-dfinity Sep 23, 2024
2b6fb3a
refactor: [MR-603] Typed canister queues and references
alin-at-dfinity Sep 26, 2024
efa16a2
Make clippy happy.
alin-at-dfinity Sep 26, 2024
4ede3ff
Make clippy even happier.
alin-at-dfinity Sep 26, 2024
0e7b71c
Address review comments: deduplicate `queue_front_not_stale()` out of…
alin-at-dfinity Sep 26, 2024
e0388bb
Merge branch 'master' into alin/MR-603-typed-queues
alin-at-dfinity Sep 26, 2024
523a1ce
Add tests for Reference<T> conversions. Improve documentations. MNino…
alin-at-dfinity Sep 27, 2024
61a3f17
Fix doc comment.
alin-at-dfinity Sep 28, 2024
46b514a
Merge branch 'master' into alin/MR-603-typed-queues
alin-at-dfinity Sep 28, 2024
913a0af
Make clippy happy.
alin-at-dfinity Sep 28, 2024
2da5b3b
Remove the now unnecessary and potentially conflicting Context argume…
alin-at-dfinity Sep 28, 2024
e9f462b
Have MessageStore::get() return &RequestOrResponse for output queues …
alin-at-dfinity Sep 28, 2024
9728778
Clippy.
alin-at-dfinity Sep 28, 2024
94937cc
Rely on free functions instead of implementing from to convert from I…
alin-at-dfinity Sep 30, 2024
0e185a2
Get rid of asserts about reference contexts altogether. Heve the queu…
alin-at-dfinity Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion rs/execution_environment/src/hypervisor/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5414,7 +5414,6 @@ fn call_with_best_effort_response_test_helper(
match test
.canister_state_mut(canister_receiver)
.system_state
.queues_mut()
.pop_input()
.unwrap()
{
Expand Down
6 changes: 1 addition & 5 deletions rs/messaging/src/routing/stream_builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1018,11 +1018,7 @@ fn canister_states_with_outputs<M: Into<RequestOrResponse>>(
NO_DEADLINE,
);
push_input(canister_state, req.into());
canister_state
.system_state
.queues_mut()
.pop_input()
.unwrap();
canister_state.system_state.pop_input().unwrap();

canister_state.push_output_response(rep);
}
Expand Down
9 changes: 9 additions & 0 deletions rs/protobuf/def/state/queues/v1/queues.proto
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ message CanisterQueues {
repeated CanisterQueuePair canister_queues = 9;
MessagePool pool = 10;

// A reference to a callback, used as a compact reject response (e.g. an
// expired best-effort callback; or one whose response was shed while in an
// input queue.
message CallbackReference {
uint64 id = 1;
uint64 callback_id = 2;
}
repeated CallbackReference shed_responses = 12;

enum NextInputQueue {
NEXT_INPUT_QUEUE_UNSPECIFIED = 0;
NEXT_INPUT_QUEUE_LOCAL_SUBNET = 1;
Expand Down
13 changes: 13 additions & 0 deletions rs/protobuf/src/gen/state/state.queues.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ pub struct CanisterQueues {
pub canister_queues: ::prost::alloc::vec::Vec<canister_queues::CanisterQueuePair>,
#[prost(message, optional, tag = "10")]
pub pool: ::core::option::Option<MessagePool>,
#[prost(message, repeated, tag = "12")]
pub shed_responses: ::prost::alloc::vec::Vec<canister_queues::CallbackReference>,
#[prost(enumeration = "canister_queues::NextInputQueue", tag = "6")]
pub next_input_source: i32,
#[prost(message, repeated, tag = "7")]
Expand All @@ -293,6 +295,17 @@ pub mod canister_queues {
#[prost(message, optional, tag = "3")]
pub output_queue: ::core::option::Option<super::CanisterQueue>,
}
/// A reference to a callback, used as a compact reject response (e.g. an
/// expired best-effort callback; or one whose response was shed while in an
/// input queue.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CallbackReference {
#[prost(uint64, tag = "1")]
pub id: u64,
#[prost(uint64, tag = "2")]
pub callback_id: u64,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NextInputQueue {
Expand Down
13 changes: 13 additions & 0 deletions rs/protobuf/src/gen/types/state.queues.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ pub struct CanisterQueues {
pub canister_queues: ::prost::alloc::vec::Vec<canister_queues::CanisterQueuePair>,
#[prost(message, optional, tag = "10")]
pub pool: ::core::option::Option<MessagePool>,
#[prost(message, repeated, tag = "12")]
pub shed_responses: ::prost::alloc::vec::Vec<canister_queues::CallbackReference>,
#[prost(enumeration = "canister_queues::NextInputQueue", tag = "6")]
pub next_input_source: i32,
#[prost(message, repeated, tag = "7")]
Expand All @@ -288,6 +290,17 @@ pub mod canister_queues {
#[prost(message, optional, tag = "3")]
pub output_queue: ::core::option::Option<super::CanisterQueue>,
}
/// A reference to a callback, used as a compact reject response (e.g. an
/// expired best-effort callback; or one whose response was shed while in an
/// input queue.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CallbackReference {
#[prost(uint64, tag = "1")]
pub id: u64,
#[prost(uint64, tag = "2")]
pub callback_id: u64,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NextInputQueue {
Expand Down
Loading
Loading