Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 0 deletions rs/execution_environment/src/execution_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ impl ExecutionEnvironment {
request.as_ref(),
args,
&registry_settings.node_ids,
registry_settings.subnet_size,
rng,
) {
Err(err) => ExecuteSubnetMessageResult::Finished {
Expand Down
3 changes: 2 additions & 1 deletion rs/https_outcalls/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ mod tests {
use ic_logger::replica_logger::no_op_logger;
use ic_test_utilities_types::messages::RequestBuilder;
use ic_types::canister_http::{
MAX_CANISTER_HTTP_RESPONSE_BYTES, PricingVersion, Replication, Transform,
MAX_CANISTER_HTTP_RESPONSE_BYTES, PricingVersion, RefundStatus, Replication, Transform,
};
use ic_types::{
Time, canister_http::CanisterHttpMethod, messages::CallbackId, time::UNIX_EPOCH,
Expand Down Expand Up @@ -591,6 +591,7 @@ mod tests {
time: UNIX_EPOCH,
replication: Replication::FullyReplicated,
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
},
socks_proxy_addrs: vec![],
}
Expand Down
9 changes: 9 additions & 0 deletions rs/https_outcalls/consensus/src/payload_builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ fn timeout_priority() {
time: UNIX_EPOCH,
replication: ic_types::canister_http::Replication::FullyReplicated,
pricing_version: ic_types::canister_http::PricingVersion::Legacy,
refund_status: ic_types::canister_http::RefundStatus::default(),
};
init_state
.metadata
Expand Down Expand Up @@ -851,6 +852,7 @@ fn non_replicated_request_response_coming_in_gossip_payload_created() {
time: UNIX_EPOCH,
replication: ic_types::canister_http::Replication::NonReplicated(delegated_node_id),
pricing_version: ic_types::canister_http::PricingVersion::Legacy,
refund_status: ic_types::canister_http::RefundStatus::default(),
};

// Insert the context in the replicated state
Expand Down Expand Up @@ -955,6 +957,7 @@ fn non_replicated_request_with_extra_share_includes_only_delegated_share() {
time: UNIX_EPOCH,
replication: ic_types::canister_http::Replication::NonReplicated(delegated_node_id),
pricing_version: ic_types::canister_http::PricingVersion::Legacy,
refund_status: ic_types::canister_http::RefundStatus::default(),
};

// Insert the context in the replicated state
Expand Down Expand Up @@ -1060,6 +1063,7 @@ fn non_replicated_share_is_ignored_if_content_is_missing() {
time: UNIX_EPOCH,
replication: ic_types::canister_http::Replication::NonReplicated(delegated_node_id),
pricing_version: ic_types::canister_http::PricingVersion::Legacy,
refund_status: ic_types::canister_http::RefundStatus::default(),
};

let mut init_state = ic_test_utilities_state::get_initial_state(0, 0);
Expand Down Expand Up @@ -1139,6 +1143,7 @@ fn validate_payload_succeeds_for_valid_non_replicated_response() {
time: UNIX_EPOCH,
replication: ic_types::canister_http::Replication::NonReplicated(delegated_node_id),
pricing_version: ic_types::canister_http::PricingVersion::Legacy,
refund_status: ic_types::canister_http::RefundStatus::default(),
};

// Inject this context into the state reader used by the validator.
Expand Down Expand Up @@ -1206,6 +1211,7 @@ fn validate_payload_fails_for_non_replicated_response_with_wrong_signer() {
time: UNIX_EPOCH,
replication: ic_types::canister_http::Replication::NonReplicated(delegated_node_id),
pricing_version: ic_types::canister_http::PricingVersion::Legacy,
refund_status: ic_types::canister_http::RefundStatus::default(),
};

// Inject this context into the state reader.
Expand Down Expand Up @@ -1289,6 +1295,7 @@ fn validate_payload_fails_for_response_with_no_signatures() {
time: UNIX_EPOCH,
replication: ic_types::canister_http::Replication::NonReplicated(delegated_node_id),
pricing_version: ic_types::canister_http::PricingVersion::Legacy,
refund_status: ic_types::canister_http::RefundStatus::default(),
};

// Inject this context into the state reader used by the validator.
Expand Down Expand Up @@ -1377,6 +1384,7 @@ fn validate_payload_fails_when_non_replicated_proof_is_for_fully_replicated_requ
// The state says the request is replicated.
replication: ic_types::canister_http::Replication::FullyReplicated,
pricing_version: ic_types::canister_http::PricingVersion::Legacy,
refund_status: ic_types::canister_http::RefundStatus::default(),
};

// Inject this context into the state reader.
Expand Down Expand Up @@ -1470,6 +1478,7 @@ fn validate_payload_fails_for_duplicate_non_replicated_response() {
time: UNIX_EPOCH,
replication: ic_types::canister_http::Replication::NonReplicated(delegated_node_id),
pricing_version: ic_types::canister_http::PricingVersion::Legacy,
refund_status: ic_types::canister_http::RefundStatus::default(),
};

// 2. Inject this context into the state reader
Expand Down
15 changes: 15 additions & 0 deletions rs/https_outcalls/consensus/src/pool_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::FullyReplicated,
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

state_manager
Expand Down Expand Up @@ -854,6 +855,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::FullyReplicated,
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

// NOTE: We need at least some context in the state, otherwise next_callback_id will be 0 and no
Expand Down Expand Up @@ -968,6 +970,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::FullyReplicated,
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

state_manager
Expand Down Expand Up @@ -1101,6 +1104,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::NonReplicated(delegated_node_id),
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

state_manager
Expand Down Expand Up @@ -1240,6 +1244,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::NonReplicated(delegated_node_id),
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};
state_manager
.get_mut()
Expand Down Expand Up @@ -1344,6 +1349,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::FullyReplicated,
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

state_manager
Expand Down Expand Up @@ -1457,6 +1463,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::NonReplicated(delegated_node_id),
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

state_manager
Expand Down Expand Up @@ -1639,6 +1646,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::NonReplicated(delegated_node_id),
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

state_manager
Expand Down Expand Up @@ -1751,6 +1759,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::NonReplicated(delegated_node_id),
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};
state_manager
.get_mut()
Expand Down Expand Up @@ -1875,6 +1884,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::NonReplicated(delegated_node_id),
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};
state_manager
.get_mut()
Expand Down Expand Up @@ -2007,6 +2017,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::NonReplicated(delegated_node_id),
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};
state_manager
.get_mut()
Expand Down Expand Up @@ -2130,6 +2141,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::NonReplicated(delegated_node_id),
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

state_manager
Expand Down Expand Up @@ -2247,6 +2259,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::FullyReplicated,
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

state_manager
Expand Down Expand Up @@ -2396,6 +2409,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::NonReplicated(delegated_node_id),
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};
state_manager
.get_mut()
Expand Down Expand Up @@ -2495,6 +2509,7 @@ pub mod test {
time: ic_types::Time::from_nanos_since_unix_epoch(10),
replication: Replication::FullyReplicated,
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};

// Expect times to be called exactly once to check that already
Expand Down
8 changes: 8 additions & 0 deletions rs/protobuf/def/state/metadata/v1/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,17 @@ message CanisterHttpRequestContext {
google.protobuf.BytesValue transform_context = 10;
optional Replication replication = 11;
optional PricingVersion pricing_version = 12;
optional RefundStatus refund_status = 13;
reserved 5;
}

message RefundStatus {
state.queues.v1.Cycles refundable_cycles = 1;
state.queues.v1.Cycles per_replica_allowance = 2;
state.queues.v1.Cycles refunded_cycles = 3;
repeated types.v1.NodeId refunding_nodes = 4;
}

message PricingVersion {
oneof version {
google.protobuf.Empty legacy = 1;
Expand Down
13 changes: 13 additions & 0 deletions rs/protobuf/src/gen/state/state.metadata.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,19 @@ pub struct CanisterHttpRequestContext {
pub replication: ::core::option::Option<Replication>,
#[prost(message, optional, tag = "12")]
pub pricing_version: ::core::option::Option<PricingVersion>,
#[prost(message, optional, tag = "13")]
pub refund_status: ::core::option::Option<RefundStatus>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RefundStatus {
#[prost(message, optional, tag = "1")]
pub refundable_cycles: ::core::option::Option<super::super::queues::v1::Cycles>,
#[prost(message, optional, tag = "2")]
pub per_replica_allowance: ::core::option::Option<super::super::queues::v1::Cycles>,
#[prost(message, optional, tag = "3")]
pub refunded_cycles: ::core::option::Option<super::super::queues::v1::Cycles>,
#[prost(message, repeated, tag = "4")]
pub refunding_nodes: ::prost::alloc::vec::Vec<super::super::super::types::v1::NodeId>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PricingVersion {
Expand Down
4 changes: 3 additions & 1 deletion rs/replicated_state/src/metadata_state/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ use ic_test_utilities_types::messages::{RequestBuilder, ResponseBuilder};
use ic_test_utilities_types::xnet::{StreamHeaderBuilder, StreamSliceBuilder};
use ic_types::batch::BlockmakerMetrics;
use ic_types::canister_http::{
CanisterHttpMethod, CanisterHttpRequestContext, PricingVersion, Replication, Transform,
CanisterHttpMethod, CanisterHttpRequestContext, PricingVersion, RefundStatus, Replication,
Transform,
};
use ic_types::consensus::idkg::{IDkgMasterPublicKeyId, PreSigId, common::PreSignature};
use ic_types::crypto::AlgorithmId;
Expand Down Expand Up @@ -761,6 +762,7 @@ fn subnet_call_contexts_deserialization() {
time: UNIX_EPOCH,
replication: Replication::FullyReplicated,
pricing_version: PricingVersion::Legacy,
refund_status: RefundStatus::default(),
};
subnet_call_context_manager.push_context(SubnetCallContext::CanisterHttpRequest(
canister_http_request,
Expand Down
1 change: 1 addition & 0 deletions rs/tests/networking/canister_http_correctness_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2493,6 +2493,7 @@ fn expected_cycle_cost(
.build(),
request.into(),
&BTreeSet::new(),
0,
&mut rand::thread_rng(),
)
.unwrap();
Expand Down
Loading
Loading