Skip to content

Commit dc7cbfa

Browse files
authored
feat(BOUN-1360): make ic-gateway a monorepo dependency (#4216)
* Make `ic-gateway` a dependency in the monorepo to avoid code duplication with PocketIC * Add an example test to PocketIC that creates a `Router` (cc @mraszyk ) * Update some crates
1 parent 5fe7d75 commit dc7cbfa

File tree

13 files changed

+6818
-2072
lines changed

13 files changed

+6818
-2072
lines changed

Cargo.Bazel.Fuzzing.json.lock

Lines changed: 2734 additions & 949 deletions
Large diffs are not rendered by default.

Cargo.Bazel.Fuzzing.toml.lock

Lines changed: 429 additions & 54 deletions
Large diffs are not rendered by default.

Cargo.Bazel.json.lock

Lines changed: 2750 additions & 965 deletions
Large diffs are not rendered by default.

Cargo.Bazel.toml.lock

Lines changed: 431 additions & 56 deletions
Large diffs are not rendered by default.

Cargo.lock

Lines changed: 401 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ hyper-rustls = { version = "0.27.3", default-features = false, features = [
564564
hyper-socks2 = { version = "0.9.1", default-features = false }
565565
hyper-util = { version = "0.1.10", features = ["full"] }
566566
ic-agent = { version = "0.39.2", features = ["pem", "ring"] }
567-
ic-bn-lib = { git = "https://github.com/dfinity/ic-bn-lib", rev = "d74a6527fbaf8a2c1a7076983cc84f5c5a727923" }
567+
ic-bn-lib = { git = "https://github.com/dfinity/ic-bn-lib", rev = "530f8e8ea577740213aff4b6dfa7a49cc32bae4a" }
568568
ic-btc-interface = "0.2.2"
569569
ic-canister-sig-creation = { git = "https://github.com/dfinity/ic-canister-sig-creation", rev = "7f9e931954637526295269155881207f6c832d6d" }
570570
ic-cbor = "3"
@@ -573,8 +573,9 @@ ic-cdk-macros = "0.17.0"
573573
ic-cdk-timers = "0.11.0"
574574
ic-certificate-verification = "3"
575575
ic-certification = "3"
576-
ic-http-certification = "3"
577-
ic-http-gateway = "0.1"
576+
ic-gateway = { git = "https://github.com/dfinity/ic-gateway", rev = "8590b8e9f0af4cdc3b95cd09a0c7a89037b3c038" }
577+
ic-http-certification = "3.0.3"
578+
ic-http-gateway = "0.2.0"
578579
ic-management-canister-types = "0.2.1"
579580
ic-response-verification = "3"
580581
ic-sha3 = "1.0.0"
@@ -664,7 +665,7 @@ rand_chacha = "0.3.1"
664665
rayon = "1.10.0"
665666
rcgen = { version = "0.13.1", features = ["zeroize"] }
666667
regex = "1.11.0"
667-
reqwest = { version = "0.12.8", default-features = false, features = [
668+
reqwest = { version = "0.12.12", default-features = false, features = [
668669
"blocking",
669670
"http2",
670671
"json",
@@ -714,6 +715,8 @@ tar = "0.4.39"
714715
tempfile = "3.12.0"
715716
thiserror = "2.0.3"
716717
threadpool = "1.8.1"
718+
tikv-jemalloc-ctl = { version = "0.6", features = ["stats"] }
719+
tikv-jemallocator = "0.6"
717720
time = { version = "0.3.36", features = ["formatting"] }
718721
tracing-flame = "0.2.0"
719722
tokio = { version = "1.42.0", features = ["full"] }

bazel/external_crates.bzl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
580580
),
581581
"ic-bn-lib": crate.spec(
582582
git = "https://github.com/dfinity/ic-bn-lib",
583-
rev = "d74a6527fbaf8a2c1a7076983cc84f5c5a727923",
583+
rev = "530f8e8ea577740213aff4b6dfa7a49cc32bae4a",
584584
),
585585
"ic-btc-interface": crate.spec(
586586
version = "^0.2.2",
@@ -623,6 +623,10 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
623623
"ic-certificate-verification": crate.spec(
624624
version = "3.0.3",
625625
),
626+
"ic-gateway": crate.spec(
627+
git = "https://github.com/dfinity/ic-gateway",
628+
rev = "8590b8e9f0af4cdc3b95cd09a0c7a89037b3c038",
629+
),
626630
"ic-http-certification": crate.spec(
627631
version = "3.0.3",
628632
),
@@ -660,7 +664,7 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
660664
version = "^3.0.0",
661665
),
662666
"ic-transport-types": crate.spec(
663-
version = "^0.39.2",
667+
version = "^0.39.3",
664668
),
665669
"ic-utils": crate.spec(
666670
version = "^0.39.0",
@@ -1060,7 +1064,7 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
10601064
version = "^1.11.0",
10611065
),
10621066
"reqwest": crate.spec(
1063-
version = "^0.12.8",
1067+
version = "^0.12.12",
10641068
default_features = False,
10651069
features = [
10661070
"blocking",
@@ -1316,10 +1320,11 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
13161320
version = "^1.8.1",
13171321
),
13181322
"tikv-jemalloc-ctl": crate.spec(
1319-
version = "^0.5",
1323+
version = "^0.6",
1324+
features = ["stats"],
13201325
),
13211326
"tikv-jemallocator": crate.spec(
1322-
version = "^0.5",
1327+
version = "^0.6",
13231328
),
13241329
"time": crate.spec(
13251330
version = "^0.3.36",

rs/boundary_node/ic_boundary/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ simple_moving_average = "1.0.2"
8787
slog = { workspace = true }
8888
strum = { workspace = true }
8989
thiserror = { workspace = true }
90-
tikv-jemalloc-ctl = "0.5"
91-
tikv-jemallocator = "0.5"
90+
tikv-jemalloc-ctl = { workspace = true }
91+
tikv-jemallocator = { workspace = true }
9292
tokio = { workspace = true }
9393
tokio-util = { workspace = true }
9494
tower = { workspace = true }

rs/pocket_ic_server/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,13 @@ TEST_DEPENDENCIES = [
104104
"@crate_index//:ic-agent",
105105
"@crate_index//:ic-btc-interface",
106106
"@crate_index//:ic-cdk",
107+
"@crate_index//:ic-gateway",
107108
"@crate_index//:ic-utils",
108109
"@crate_index//:nix",
110+
"@crate_index//:prometheus",
109111
"@crate_index//:rcgen",
110112
"@crate_index//:reqwest",
113+
"@crate_index//:rustls",
111114
"@crate_index//:serde",
112115
"@crate_index//:serde_json",
113116
"@crate_index//:slog",

rs/pocket_ic_server/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,15 @@ wat = { workspace = true }
8888
bitcoincore-rpc = { workspace = true }
8989
ic-btc-interface = { workspace = true }
9090
ic-config = { path = "../config" }
91+
ic-gateway = { workspace = true }
9192
ic-registry-transport = { path = "../registry/transport" }
9293
ic-interfaces-registry = { path = "../interfaces/registry" }
9394
ic-nns-constants = { path = "../nns/constants" }
9495
nix = { version = "0.29.0" }
96+
prometheus = { workspace = true }
9597
rcgen = { workspace = true }
9698
registry-canister = { path = "../registry/canister" }
9799
reqwest = { workspace = true }
100+
rustls = { workspace = true }
98101
serde_json = { workspace = true }
99102
spec-compliance = { path = "../tests/research/spec_compliance" }

rs/pocket_ic_server/src/main.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,3 +493,48 @@ impl BlobStore for InMemoryBlobStore {
493493
m.get(&blob_id).cloned()
494494
}
495495
}
496+
497+
#[cfg(test)]
498+
mod test {
499+
use std::sync::Arc;
500+
501+
use clap::Parser;
502+
use ic_agent::agent::route_provider::RoundRobinRouteProvider;
503+
use ic_bn_lib::tls::prepare_client_config;
504+
use ic_gateway::{setup_router, Cli};
505+
506+
#[test]
507+
fn test_setup_router() {
508+
let args = vec!["", "--domain", "ic0.app"];
509+
let cli = Cli::parse_from(args);
510+
511+
rustls::crypto::ring::default_provider()
512+
.install_default()
513+
.unwrap();
514+
515+
let mut http_client_opts: ic_bn_lib::http::client::Options<ic_bn_lib::http::dns::Resolver> =
516+
(&cli.http_client).into();
517+
http_client_opts.tls_config = Some(prepare_client_config(&[
518+
&rustls::version::TLS13,
519+
&rustls::version::TLS12,
520+
]));
521+
let http_client =
522+
Arc::new(ic_bn_lib::http::ReqwestClient::new(http_client_opts.clone()).unwrap());
523+
524+
let route_provider = RoundRobinRouteProvider::new(vec!["https://icp-api.io"]).unwrap();
525+
526+
let mut tasks = ic_bn_lib::tasks::TaskManager::new();
527+
528+
let _ = setup_router(
529+
&cli,
530+
vec![],
531+
&mut tasks,
532+
http_client,
533+
Arc::new(route_provider),
534+
&prometheus::Registry::new(),
535+
None,
536+
None,
537+
)
538+
.unwrap();
539+
}
540+
}

rs/replica/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ rand = { workspace = true }
5555
regex = { workspace = true }
5656
slog = { workspace = true }
5757
tempfile = { workspace = true }
58-
tikv-jemalloc-ctl = "0.5"
59-
tikv-jemallocator = "0.5"
58+
tikv-jemalloc-ctl = { workspace = true }
59+
tikv-jemallocator = { workspace = true }
6060
tokio = { workspace = true }
6161
tracing = { workspace = true }
6262
tracing-subscriber = { workspace = true }

rs/tests/boundary_nodes/integration_test_common/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ pub fn legacy_asset_canister_test(env: TestEnv) {
453453
.to_vec();
454454

455455
if res != hello_world_gzip {
456-
bail!("gzipped hello world response did not match uploaded content")
456+
bail!("gzipped hello world response did not match uploaded content (got {res:?}, expected {hello_world_gzip:?}")
457457
}
458458

459459
Ok(())

0 commit comments

Comments
 (0)