From ba184851b05fe67ba34c68a414efe2da79442681 Mon Sep 17 00:00:00 2001 From: driftluo Date: Mon, 2 Dec 2024 19:25:36 +0800 Subject: [PATCH 1/4] feat: default listen on ws port --- Cargo.lock | 13 +++++++------ resource/ckb.toml | 4 ++-- util/app-config/src/tests/app_config.rs | 20 ++++++++++++++++---- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf8fb89453..76598211da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5894,14 +5894,15 @@ dependencies = [ [[package]] name = "tentacle" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6218c3269605008b5e88f4e91fa2e98e20491213c464dc6da8370858db89d92b" +checksum = "19a42caa9f5a8bf3f40b75b4e8e4bf1dcacf92998463afce9cfe5e5e4824de9a" dependencies = [ "async-trait", "bytes", "futures", "futures-timer", + "httparse", "igd-next", "js-sys", "libc", @@ -5938,9 +5939,9 @@ dependencies = [ [[package]] name = "tentacle-secio" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99df015b8649588f2958d4853eee221860f95d2721995857e9dde1462ceb3dc4" +checksum = "53d53673d63399e1d557c2e884b045d242811079d3b2f17a569310e5c3f1db33" dependencies = [ "bs58", "bytes", @@ -6234,9 +6235,9 @@ dependencies = [ [[package]] name = "tokio-yamux" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "208cecd45a38868bfc0a45aac52cb1aea4583c6b801bf57f351e9d531b23cb86" +checksum = "966579a01e6900c22634f5915fda56358496e71067f3dd26572f9fbe85f4b62e" dependencies = [ "bytes", "futures", diff --git a/resource/ckb.toml b/resource/ckb.toml index 68cf8e2fd8..3df8e09dde 100644 --- a/resource/ckb.toml +++ b/resource/ckb.toml @@ -63,8 +63,8 @@ cache_size = 268435456 options_file = "default.db-options" [network] -listen_addresses = ["/ip4/0.0.0.0/tcp/8115"] # {{ -# _ => listen_addresses = ["/ip4/0.0.0.0/tcp/{p2p_port}"] +listen_addresses = ["/ip4/0.0.0.0/tcp/8115", "/ip4/0.0.0.0/tcp/8115/ws"] # {{ +# _ => listen_addresses = ["/ip4/0.0.0.0/tcp/{p2p_port}", "/ip4/0.0.0.0/tcp/{p2p_port}/ws"] # }} ### Specify the public and routable network addresses # public_addresses = [] diff --git a/util/app-config/src/tests/app_config.rs b/util/app-config/src/tests/app_config.rs index 52fcd4b163..68d1de7218 100644 --- a/util/app-config/src/tests/app_config.rs +++ b/util/app-config/src/tests/app_config.rs @@ -55,7 +55,10 @@ fn test_export_dev_config_files() { ); assert_eq!( ckb_config.network.listen_addresses, - vec!["/ip4/0.0.0.0/tcp/8000".parse().unwrap()] + vec![ + "/ip4/0.0.0.0/tcp/8000".parse().unwrap(), + "/ip4/0.0.0.0/tcp/8000/ws".parse().unwrap() + ] ); assert_eq!(ckb_config.network.connect_outbound_interval_secs, 15); assert_eq!(ckb_config.rpc.listen_address, "127.0.0.1:7000"); @@ -148,7 +151,10 @@ fn test_export_testnet_config_files() { ); assert_eq!( ckb_config.network.listen_addresses, - vec!["/ip4/0.0.0.0/tcp/8000".parse().unwrap()] + vec![ + "/ip4/0.0.0.0/tcp/8000".parse().unwrap(), + "/ip4/0.0.0.0/tcp/8000/ws".parse().unwrap() + ] ); assert_eq!(ckb_config.network.connect_outbound_interval_secs, 15); assert_eq!(ckb_config.rpc.listen_address, "127.0.0.1:7000"); @@ -200,7 +206,10 @@ fn test_export_integration_config_files() { ); assert_eq!( ckb_config.network.listen_addresses, - vec!["/ip4/0.0.0.0/tcp/8000".parse().unwrap()] + vec![ + "/ip4/0.0.0.0/tcp/8000".parse().unwrap(), + "/ip4/0.0.0.0/tcp/8000/ws".parse().unwrap() + ] ); assert_eq!(ckb_config.rpc.listen_address, "127.0.0.1:7000"); } @@ -252,7 +261,10 @@ fn test_export_dev_config_files_assembly() { ); assert_eq!( ckb_config.network.listen_addresses, - vec!["/ip4/0.0.0.0/tcp/8000".parse().unwrap()] + vec![ + "/ip4/0.0.0.0/tcp/8000".parse().unwrap(), + "/ip4/0.0.0.0/tcp/8000/ws".parse().unwrap() + ] ); assert_eq!(ckb_config.network.connect_outbound_interval_secs, 15); assert_eq!(ckb_config.rpc.listen_address, "127.0.0.1:7000"); From 211f7861849754660240de7904202e9ca179a160 Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 3 Dec 2024 10:37:46 +0800 Subject: [PATCH 2/4] chore: add missing feature macros of tokio --- util/metrics-service/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/metrics-service/Cargo.toml b/util/metrics-service/Cargo.toml index 8a351a49c2..3cc68975bb 100644 --- a/util/metrics-service/Cargo.toml +++ b/util/metrics-service/Cargo.toml @@ -19,4 +19,4 @@ hyper = { version = "1", features = ["http1", "http2", "server"] } http-body-util = "0.1" hyper-util = { version = "0.1", features = ["server-auto", "server-graceful"] } ckb-stop-handler = { path = "../stop-handler", version = "= 0.120.0-pre" } -tokio = { version = "1", features = ["sync"] } +tokio = { version = "1", features = ["sync", "macros"] } From 3a99b509b70d98bbec6d7b48f7984ab08db2fa86 Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 3 Dec 2024 11:44:36 +0800 Subject: [PATCH 3/4] chore: add missing feature tokio-runtime of cacache --- Cargo.lock | 3 +++ spec/Cargo.toml | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 76598211da..81294b3686 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -468,6 +468,7 @@ checksum = "a61ff12b19d89c752c213316b87fdb4a587f073d219b893cc56974b8c9f39bf7" dependencies = [ "digest", "either", + "futures", "hex", "libc", "memmap2", @@ -481,6 +482,8 @@ dependencies = [ "ssri", "tempfile", "thiserror", + "tokio", + "tokio-stream", "walkdir", ] diff --git a/spec/Cargo.toml b/spec/Cargo.toml index f7694c62a5..9ad6c386de 100644 --- a/spec/Cargo.toml +++ b/spec/Cargo.toml @@ -25,7 +25,10 @@ ckb-traits = { path = "../traits", version = "= 0.120.0-pre" } ckb-logger = { path = "../util/logger", version = "= 0.120.0-pre" } [target.'cfg(not(target_family = "wasm"))'.dependencies] -cacache = { version = "13.0.0", default-features = false, features = ["mmap"] } +cacache = { version = "13.0.0", default-features = false, features = [ + "tokio-runtime", + "mmap", +] } [dev-dependencies] tempfile.workspace = true From 40b3840578653c9e0f029aeb151639dc39dd626e Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 3 Dec 2024 16:05:56 +0800 Subject: [PATCH 4/4] chore: add missing tokio::process for notify --- notify/Cargo.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/notify/Cargo.toml b/notify/Cargo.toml index 49a3ff5d81..013ea4c282 100644 --- a/notify/Cargo.toml +++ b/notify/Cargo.toml @@ -10,10 +10,15 @@ repository = "https://github.com/nervosnetwork/ckb" [dependencies] ckb-logger = { path = "../util/logger", version = "= 0.120.0-pre" } -ckb-app-config = { path = "../util/app-config", version = "= 0.120.0-pre" } +ckb-app-config = { path = "../util/app-config", version = "= 0.120.0-pre" } ckb-types = { path = "../util/types", version = "= 0.120.0-pre" } ckb-stop-handler = { path = "../util/stop-handler", version = "= 0.120.0-pre" } ckb-async-runtime = { path = "../util/runtime", version = "= 0.120.0-pre" } + +[target.'cfg(target_family = "wasm")'.dependencies] tokio = { version = "1", features = ["sync"] } +[target.'cfg(not(target_family = "wasm"))'.dependencies] +tokio = { version = "1", features = ["sync", "process"] } + [dev-dependencies]