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

Chore: remove ic_api_version field in IC status response #3569

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
8 changes: 2 additions & 6 deletions hs/spec_compliance/src/IC/Test/Agent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ makeAgentConfig allow_self_signed_certs ep' subnets httpbin_proto httpbin' to =
`catch` (\(HUnitFailure _ r) -> putStrLn r >> exitFailure)

putStrLn $ "Spec version tested: " ++ T.unpack specVersion
putStrLn $ "Spec version claimed: " ++ T.unpack (status_api_version s)

return
AgentConfig
Expand Down Expand Up @@ -991,20 +990,17 @@ runGet a b = case Get.runGetOrFail (a <* done) b of
-- * Status endpoint parsing

data StatusResponse = StatusResponse
{ status_api_version :: T.Text,
status_root_key :: Blob
}
{ status_root_key :: Blob }

statusResponse :: (HasCallStack) => GenR -> IO StatusResponse
statusResponse =
asExceptT . record do
v <- field text "ic_api_version"
_ <- optionalField text "impl_source"
_ <- optionalField text "impl_version"
_ <- optionalField text "impl_revision"
pk <- field blob "root_key"
swallowAllFields -- More fields are explicitly allowed
return StatusResponse {status_api_version = v, status_root_key = pk}
return StatusResponse { status_root_key = pk}

-- * Interacting with aaaaa-aa (via HTTP)

Expand Down
3 changes: 0 additions & 3 deletions rs/boundary_node/ic_boundary/src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ use crate::{
snapshot::{Node, RegistrySnapshot},
};

// TODO which one to use?
const IC_API_VERSION: &str = "0.18.0";
pub const ANONYMOUS_PRINCIPAL: Principal = Principal::anonymous();
const METHOD_HTTP: &str = "http_request";

Expand Down Expand Up @@ -787,7 +785,6 @@ pub async fn status(
let health = h.health().await;

let status = HttpStatusResponse {
ic_api_version: IC_API_VERSION.to_string(),
root_key: rk.root_key().await.map(|x| x.into()),
impl_version: None,
impl_hash: None,
Expand Down
5 changes: 0 additions & 5 deletions rs/http_endpoints/public/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ use ic_types::{
};
use std::sync::Arc;

// TODO(NET-776)
// The IC API version reported on status requests.
const IC_API_VERSION: &str = "0.18.0";

#[derive(Clone)]
pub(crate) struct StatusService {
log: ReplicaLogger,
Expand Down Expand Up @@ -72,7 +68,6 @@ pub(crate) async fn status(State(state): State<StatusService>) -> Cbor<HttpStatu
});

let response = HttpStatusResponse {
ic_api_version: IC_API_VERSION.to_string(),
// For test networks, and networks that we still reset
// rather often, let them indicate the root public key
// in /api/v2/status, so that agents can fetch them.
Expand Down
5 changes: 2 additions & 3 deletions rs/types/types/src/messages/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,14 +757,13 @@ pub enum ReplicaHealthStatus {
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub struct HttpStatusResponse {
pub ic_api_version: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub impl_hash: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub root_key: Option<Blob>,
#[serde(skip_serializing_if = "Option::is_none")]
pub impl_version: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub impl_hash: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub replica_health_status: Option<ReplicaHealthStatus>,
#[serde(skip_serializing_if = "Option::is_none")]
pub certified_height: Option<Height>,
Expand Down
8 changes: 0 additions & 8 deletions rs/types/types/src/messages/http/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,15 +730,13 @@ mod cbor_serialization {
fn encoding_status_without_root_key() {
assert_cbor_ser_equal(
&HttpStatusResponse {
ic_api_version: "foobar".to_string(),
root_key: None,
impl_version: Some("0.0".to_string()),
impl_hash: None,
replica_health_status: Some(ReplicaHealthStatus::Starting),
certified_height: None,
},
Value::Map(btreemap! {
text("ic_api_version") => text("foobar"),
text("impl_version") => text("0.0"),
text("replica_health_status") => text("starting"),
}),
Expand All @@ -749,15 +747,13 @@ mod cbor_serialization {
fn encoding_status_with_root_key() {
assert_cbor_ser_equal(
&HttpStatusResponse {
ic_api_version: "foobar".to_string(),
root_key: Some(Blob(vec![1, 2, 3])),
impl_version: Some("0.0".to_string()),
impl_hash: None,
replica_health_status: Some(ReplicaHealthStatus::Healthy),
certified_height: None,
},
Value::Map(btreemap! {
text("ic_api_version") => text("foobar"),
text("root_key") => bytes(&[1, 2, 3]),
text("impl_version") => text("0.0"),
text("replica_health_status") => text("healthy"),
Expand All @@ -769,15 +765,13 @@ mod cbor_serialization {
fn encoding_status_without_health_status() {
assert_cbor_ser_equal(
&HttpStatusResponse {
ic_api_version: "foobar".to_string(),
root_key: Some(Blob(vec![1, 2, 3])),
impl_version: Some("0.0".to_string()),
impl_hash: None,
replica_health_status: None,
certified_height: None,
},
Value::Map(btreemap! {
text("ic_api_version") => text("foobar"),
text("root_key") => bytes(&[1, 2, 3]),
text("impl_version") => text("0.0"),
}),
Expand All @@ -788,15 +782,13 @@ mod cbor_serialization {
fn encoding_status_with_certified_height() {
assert_cbor_ser_equal(
&HttpStatusResponse {
ic_api_version: "foobar".to_string(),
root_key: Some(Blob(vec![1, 2, 3])),
impl_version: Some("0.0".to_string()),
impl_hash: None,
replica_health_status: Some(ReplicaHealthStatus::Healthy),
certified_height: Some(AmountOf::new(1)),
},
Value::Map(btreemap! {
text("ic_api_version") => text("foobar"),
text("root_key") => bytes(&[1, 2, 3]),
text("impl_version") => text("0.0"),
text("replica_health_status") => text("healthy"),
Expand Down
Loading