From 12c57c917469e1d5ea8dbc906d7cd8a6f8b64ae0 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Mon, 27 May 2024 12:30:55 +0200 Subject: [PATCH 01/24] rpc: upgrade jsonrpsee v0.23 --- Cargo.lock | 367 ++++++++++++++---- Cargo.toml | 1 + bridges/relays/client-substrate/Cargo.toml | 2 +- .../client/relay-chain-interface/Cargo.toml | 2 +- .../relay-chain-rpc-interface/Cargo.toml | 2 +- .../src/light_client_worker.rs | 4 +- cumulus/polkadot-parachain/Cargo.toml | 2 +- cumulus/test/service/Cargo.toml | 2 +- polkadot/rpc/Cargo.toml | 2 +- substrate/bin/node/cli/Cargo.toml | 2 +- substrate/bin/node/rpc/Cargo.toml | 2 +- .../client/consensus/babe/rpc/Cargo.toml | 2 +- .../client/consensus/beefy/rpc/Cargo.toml | 2 +- .../client/consensus/grandpa/rpc/Cargo.toml | 2 +- .../client/consensus/manual-seal/Cargo.toml | 2 +- .../merkle-mountain-range/rpc/Cargo.toml | 2 +- substrate/client/rpc-api/Cargo.toml | 2 +- substrate/client/rpc-servers/Cargo.toml | 10 +- substrate/client/rpc-servers/src/lib.rs | 81 ++-- substrate/client/rpc-servers/src/utils.rs | 14 +- substrate/client/rpc-spec-v2/Cargo.toml | 4 +- .../client/rpc-spec-v2/src/chain_head/api.rs | 14 +- .../rpc-spec-v2/src/chain_head/chain_head.rs | 68 ++-- .../client/rpc-spec-v2/src/transaction/api.rs | 4 +- .../src/transaction/transaction_broadcast.rs | 18 +- substrate/client/rpc/Cargo.toml | 2 +- substrate/client/rpc/src/utils.rs | 2 +- substrate/client/service/Cargo.toml | 2 +- substrate/client/sync-state-rpc/Cargo.toml | 2 +- .../frame/transaction-payment/rpc/Cargo.toml | 2 +- .../frame/remote-externalities/Cargo.toml | 2 +- .../frame/remote-externalities/src/lib.rs | 4 +- substrate/utils/frame/rpc/client/Cargo.toml | 2 +- .../rpc/state-trie-migration-rpc/Cargo.toml | 2 +- substrate/utils/frame/rpc/support/Cargo.toml | 4 +- substrate/utils/frame/rpc/system/Cargo.toml | 2 +- templates/minimal/node/Cargo.toml | 2 +- templates/parachain/node/Cargo.toml | 2 +- templates/solochain/node/Cargo.toml | 2 +- 39 files changed, 428 insertions(+), 217 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1767245c6abf..4365b93e9c3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1368,6 +1368,12 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -2366,9 +2372,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "bzip2-sys" @@ -2445,6 +2451,12 @@ dependencies = [ "libc", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cexpr" version = "0.6.0" @@ -6416,7 +6428,26 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.9", + "indexmap 2.2.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", "indexmap 2.2.3", "slab", "tokio", @@ -6624,6 +6655,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.5" @@ -6631,15 +6673,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", - "http", + "http 0.2.9", "pin-project-lite 0.2.12", ] [[package]] -name = "http-range-header" -version = "0.3.1" +name = "http-body" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", + "pin-project-lite 0.2.12", +] [[package]] name = "httparse" @@ -6669,9 +6728,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.9", + "http-body 0.4.5", "httparse", "httpdate", "itoa", @@ -6683,6 +6742,27 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite 0.2.12", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.1" @@ -6690,8 +6770,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.9", + "hyper 0.14.27", "log", "rustls 0.21.6", "rustls-native-certs 0.6.3", @@ -6699,6 +6779,44 @@ dependencies = [ "tokio-rustls 0.24.1", ] +[[package]] +name = "hyper-rustls" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "908bb38696d7a037a01ebcc68a00634112ac2bbf8ca74e30a2c3d2f4f021302b" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.3.1", + "hyper-util", + "log", + "rustls 0.23.8", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.3.1", + "pin-project-lite 0.2.12", + "socket2 0.5.6", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.57" @@ -6988,7 +7106,7 @@ dependencies = [ "encoding_rs", "event-listener", "futures-lite", - "http", + "http 0.2.9", "log", "mime", "once_cell", @@ -7025,6 +7143,26 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + [[package]] name = "jobserver" version = "0.1.26" @@ -7062,9 +7200,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdb12a2381ea5b2e68c3469ec604a007b367778cdb14d09612c8069ebd616ad" +checksum = "67210bd846b2dca59dc73f34717d6e1589305d506cdd6f14c849115d08e40876" dependencies = [ "jsonrpsee-core", "jsonrpsee-http-client", @@ -7078,20 +7216,22 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4978087a58c3ab02efc5b07c5e5e2803024536106fd5506f558db172c889b3aa" +checksum = "e4c171d64176ae8f57eec75bca9f9dda2b2f746314adef9160a5bbbb2a7c82cb" dependencies = [ + "base64 0.22.1", "futures-util", - "http", + "http 1.1.0", "jsonrpsee-core", "pin-project", - "rustls-native-certs 0.7.0", + "rustls 0.23.8", "rustls-pki-types", - "soketto", + "rustls-platform-verifier", + "soketto 0.8.0", "thiserror", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tokio-util", "tracing", "url", @@ -7099,16 +7239,19 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b257e1ec385e07b0255dde0b933f948b5c8b8c28d42afda9587c3a967b896d" +checksum = "5e966c12c8b6c1790ce67683c792cea9dd250860df49f6b64f1b1ff6c6946850" dependencies = [ "anyhow", "async-trait", "beef", + "bytes", "futures-timer", "futures-util", - "hyper", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "jsonrpsee-types", "parking_lot 0.12.1", "pin-project", @@ -7124,15 +7267,20 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ccf93fc4a0bfe05d851d37d7c32b7f370fe94336b52a2f0efc5f1981895c2e5" +checksum = "bb0187f1969287e5890d84460fe9f6556d98231e70b06179d4416e5c8c47167d" dependencies = [ "async-trait", - "hyper", - "hyper-rustls", + "base64 0.22.1", + "http-body 1.0.0", + "hyper 1.3.1", + "hyper-rustls 0.27.1", + "hyper-util", "jsonrpsee-core", "jsonrpsee-types", + "rustls 0.23.8", + "rustls-platform-verifier", "serde", "serde_json", "thiserror", @@ -7144,11 +7292,11 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d0bb047e79a143b32ea03974a6bf59b62c2a4c5f5d42a381c907a8bbb3f75c0" +checksum = "9f7af1b5071dc1c61b06900f8f3e17f886b1b08e926166e575018643879f63b6" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "proc-macro-crate 3.1.0", "proc-macro2 1.0.82", "quote 1.0.35", @@ -7157,20 +7305,24 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12d8b6a9674422a8572e0b0abb12feeb3f2aeda86528c80d0350c2bd0923ab41" +checksum = "ba63ec742f5f9c4016ca4c443d04dc3ca56e240a26ebe6e56609a5109bd9d13f" dependencies = [ + "anyhow", "futures-util", - "http", - "hyper", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.3.1", + "hyper-util", "jsonrpsee-core", "jsonrpsee-types", "pin-project", "route-recognizer", "serde", "serde_json", - "soketto", + "soketto 0.8.0", "thiserror", "tokio", "tokio-stream", @@ -7181,12 +7333,13 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "150d6168405890a7a3231a3c74843f58b8959471f6df76078db2619ddee1d07d" +checksum = "328c33717b7bdc4f47cdf31c21d5449c5b713a800cb05cb767841ccf2944f9d9" dependencies = [ "anyhow", "beef", + "http 1.1.0", "serde", "serde_json", "thiserror", @@ -7194,11 +7347,11 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58b9db2dfd5bb1194b0ce921504df9ceae210a345bc2f6c5a61432089bbab070" +checksum = "aeb22661e1c018eb503d5a47be2d39a176de832b047d2757fa86b3d2b34fc84e" dependencies = [ - "http", + "http 1.1.0", "jsonrpsee-client-transport", "jsonrpsee-core", "jsonrpsee-types", @@ -7780,7 +7933,7 @@ dependencies = [ "parking_lot 0.12.1", "quicksink", "rw-stream-sink", - "soketto", + "soketto 0.7.1", "url", "webpki-roots 0.22.6", ] @@ -13304,7 +13457,7 @@ dependencies = [ "bs58 0.5.0", "futures", "futures-timer", - "hyper", + "hyper 0.14.27", "log", "parity-scale-codec", "polkadot-primitives", @@ -15858,11 +16011,11 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", + "h2 0.3.26", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.27", + "hyper-rustls 0.24.1", "ipnet", "js-sys", "log", @@ -16424,14 +16577,15 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.2" +version = "0.23.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +checksum = "79adb16721f56eb2d843e67676896a61ce7a0fa622dc18d3e372477a029d2740" dependencies = [ "log", + "once_cell", "ring 0.17.7", "rustls-pki-types", - "rustls-webpki 0.102.2", + "rustls-webpki 0.102.4", "subtle 2.5.0", "zeroize", ] @@ -16482,9 +16636,36 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.2.0" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + +[[package]] +name = "rustls-platform-verifier" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5f0d26fa1ce3c790f9590868f0109289a044acb954525f933e2aa3b871c157d" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls 0.23.8", + "rustls-native-certs 0.7.0", + "rustls-platform-verifier-android", + "rustls-webpki 0.102.4", + "security-framework", + "security-framework-sys", + "webpki-roots 0.26.1", + "winapi", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a716eb65e3158e90e17cd93d855216e27bde02745ab842f2cab4a39dba1bacf" +checksum = "84e217e7fdc8466b5b35d30f8c0a30febd29173df4a3a0c2115d306b9c4117ad" [[package]] name = "rustls-webpki" @@ -16498,9 +16679,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.2" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ "ring 0.17.7", "rustls-pki-types", @@ -17585,8 +17766,8 @@ dependencies = [ "fnv", "futures", "futures-timer", - "hyper", - "hyper-rustls", + "hyper 0.14.27", + "hyper-rustls 0.24.1", "lazy_static", "libp2p", "log", @@ -17691,11 +17872,13 @@ dependencies = [ name = "sc-rpc-server" version = "11.0.0" dependencies = [ + "anyhow", "forwarded-header-value", "futures", "governor", - "http", - "hyper", + "http 1.1.0", + "hyper 1.3.1", + "hyper-util", "ip_network", "jsonrpsee", "log", @@ -18297,22 +18480,23 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", + "num-bigint", "security-framework-sys", ] [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", @@ -18802,9 +18986,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smol" @@ -18879,7 +19063,7 @@ dependencies = [ "siphasher", "slab", "smallvec", - "soketto", + "soketto 0.7.1", "twox-hash", "wasmi", "x25519-dalek 2.0.0", @@ -19296,13 +19480,28 @@ dependencies = [ "bytes", "flate2", "futures", - "http", "httparse", "log", "rand 0.8.5", "sha-1 0.9.8", ] +[[package]] +name = "soketto" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37468c595637c10857701c990f93a40ce0e357cedb0953d1c26c8d8027f9bb53" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures", + "http 1.1.0", + "httparse", + "log", + "rand 0.8.5", + "sha1", +] + [[package]] name = "solochain-template-node" version = "0.0.0" @@ -20528,7 +20727,7 @@ dependencies = [ "scale-info", "serde", "serde_json", - "soketto", + "soketto 0.7.1", "staging-node-inspect", "substrate-cli-test-utils", "tempfile", @@ -20901,7 +21100,7 @@ dependencies = [ name = "substrate-prometheus-endpoint" version = "0.17.0" dependencies = [ - "hyper", + "hyper 0.14.27", "log", "prometheus", "thiserror", @@ -21777,11 +21976,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.22.2", + "rustls 0.23.8", "rustls-pki-types", "tokio", ] @@ -21905,6 +22104,7 @@ dependencies = [ "futures-util", "pin-project", "pin-project-lite 0.2.12", + "tokio", "tower-layer", "tower-service", "tracing", @@ -21912,17 +22112,15 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.4.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ae70283aba8d2a8b411c695c437fe25b8b5e44e23e780662002fc72fb47a82" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ "bitflags 2.4.0", "bytes", - "futures-core", - "futures-util", - "http", - "http-body", - "http-range-header", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "pin-project-lite 0.2.12", "tower-layer", "tower-service", @@ -22255,7 +22453,7 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 0.2.9", "httparse", "log", "rand 0.8.5", @@ -23031,6 +23229,15 @@ version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +[[package]] +name = "webpki-roots" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "westend-emulated-chain" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index d6099e420f91..5d9b525e7435 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -652,3 +652,4 @@ wasmi = { opt-level = 3 } x25519-dalek = { opt-level = 3 } yamux = { opt-level = 3 } zeroize = { opt-level = 3 } + diff --git a/bridges/relays/client-substrate/Cargo.toml b/bridges/relays/client-substrate/Cargo.toml index cb7eae4f340c..ea7e28c557bf 100644 --- a/bridges/relays/client-substrate/Cargo.toml +++ b/bridges/relays/client-substrate/Cargo.toml @@ -15,7 +15,7 @@ async-std = { version = "1.9.0", features = ["attributes"] } async-trait = "0.1.79" codec = { package = "parity-scale-codec", version = "3.6.12" } futures = "0.3.30" -jsonrpsee = { version = "0.22", features = ["macros", "ws-client"] } +jsonrpsee = { version = "0.23", features = ["macros", "ws-client"] } log = { workspace = true } num-traits = "0.2" rand = "0.8.5" diff --git a/cumulus/client/relay-chain-interface/Cargo.toml b/cumulus/client/relay-chain-interface/Cargo.toml index 5962c68bba7a..96b06a74b8d2 100644 --- a/cumulus/client/relay-chain-interface/Cargo.toml +++ b/cumulus/client/relay-chain-interface/Cargo.toml @@ -22,5 +22,5 @@ sc-client-api = { path = "../../../substrate/client/api" } futures = "0.3.28" async-trait = "0.1.79" thiserror = { workspace = true } -jsonrpsee-core = "0.22" +jsonrpsee-core = "0.23" parity-scale-codec = "3.6.12" diff --git a/cumulus/client/relay-chain-rpc-interface/Cargo.toml b/cumulus/client/relay-chain-rpc-interface/Cargo.toml index 2ec42ebca851..4b26f408c8a2 100644 --- a/cumulus/client/relay-chain-rpc-interface/Cargo.toml +++ b/cumulus/client/relay-chain-rpc-interface/Cargo.toml @@ -33,7 +33,7 @@ tokio-util = { version = "0.7.8", features = ["compat"] } futures = "0.3.28" futures-timer = "3.0.2" parity-scale-codec = "3.6.12" -jsonrpsee = { version = "0.22", features = ["ws-client"] } +jsonrpsee = { version = "0.23", features = ["ws-client"] } tracing = "0.1.37" async-trait = "0.1.79" url = "2.4.0" diff --git a/cumulus/client/relay-chain-rpc-interface/src/light_client_worker.rs b/cumulus/client/relay-chain-rpc-interface/src/light_client_worker.rs index 9a49b60281b3..2347dbb85f78 100644 --- a/cumulus/client/relay-chain-rpc-interface/src/light_client_worker.rs +++ b/cumulus/client/relay-chain-rpc-interface/src/light_client_worker.rs @@ -20,7 +20,7 @@ use futures::{channel::mpsc::Sender, prelude::*, stream::FuturesUnordered}; use jsonrpsee::core::client::{ - Client as JsonRpseeClient, ClientBuilder, ClientT, Error, ReceivedMessage, TransportReceiverT, + Client as JsonRpseeClient, ClientBuilder, ClientT, ReceivedMessage, TransportReceiverT, TransportSenderT, }; use smoldot_light::{ChainId, Client as SmoldotClient, JsonRpcResponses}; @@ -124,7 +124,7 @@ pub struct LightClientRpcWorker { } fn handle_notification( - maybe_header: Option>, + maybe_header: Option>, senders: &mut Vec>, ) -> Result<(), ()> { match maybe_header { diff --git a/cumulus/polkadot-parachain/Cargo.toml b/cumulus/polkadot-parachain/Cargo.toml index a22606edb6c5..4ad8623b5ef9 100644 --- a/cumulus/polkadot-parachain/Cargo.toml +++ b/cumulus/polkadot-parachain/Cargo.toml @@ -38,7 +38,7 @@ coretime-rococo-runtime = { path = "../parachains/runtimes/coretime/coretime-roc coretime-westend-runtime = { path = "../parachains/runtimes/coretime/coretime-westend" } bridge-hub-westend-runtime = { path = "../parachains/runtimes/bridge-hubs/bridge-hub-westend" } penpal-runtime = { path = "../parachains/runtimes/testing/penpal" } -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } people-rococo-runtime = { path = "../parachains/runtimes/people/people-rococo" } people-westend-runtime = { path = "../parachains/runtimes/people/people-westend" } parachains-common = { path = "../parachains/common" } diff --git a/cumulus/test/service/Cargo.toml b/cumulus/test/service/Cargo.toml index 732d884528f8..c2e198c02d54 100644 --- a/cumulus/test/service/Cargo.toml +++ b/cumulus/test/service/Cargo.toml @@ -17,7 +17,7 @@ async-trait = "0.1.79" clap = { version = "4.5.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.6.12" } criterion = { version = "0.5.1", features = ["async_tokio"] } -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } rand = "0.8.5" serde = { features = ["derive"], workspace = true, default-features = true } serde_json = { workspace = true, default-features = true } diff --git a/polkadot/rpc/Cargo.toml b/polkadot/rpc/Cargo.toml index 5af5e63b1753..405f391d93f4 100644 --- a/polkadot/rpc/Cargo.toml +++ b/polkadot/rpc/Cargo.toml @@ -10,7 +10,7 @@ description = "Polkadot specific RPC functionality." workspace = true [dependencies] -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } polkadot-primitives = { path = "../primitives" } sc-client-api = { path = "../../substrate/client/api" } sp-blockchain = { path = "../../substrate/primitives/blockchain" } diff --git a/substrate/bin/node/cli/Cargo.toml b/substrate/bin/node/cli/Cargo.toml index 929cd6a29e38..e54ead255b15 100644 --- a/substrate/bin/node/cli/Cargo.toml +++ b/substrate/bin/node/cli/Cargo.toml @@ -41,7 +41,7 @@ array-bytes = "6.1" clap = { version = "4.5.3", features = ["derive"], optional = true } codec = { package = "parity-scale-codec", version = "3.6.12" } serde = { features = ["derive"], workspace = true, default-features = true } -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } futures = "0.3.30" log = { workspace = true, default-features = true } rand = "0.8" diff --git a/substrate/bin/node/rpc/Cargo.toml b/substrate/bin/node/rpc/Cargo.toml index 894dbf0da85c..79020fe792ba 100644 --- a/substrate/bin/node/rpc/Cargo.toml +++ b/substrate/bin/node/rpc/Cargo.toml @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } node-primitives = { path = "../primitives" } pallet-transaction-payment-rpc = { path = "../../../frame/transaction-payment/rpc" } mmr-rpc = { path = "../../../client/merkle-mountain-range/rpc" } diff --git a/substrate/client/consensus/babe/rpc/Cargo.toml b/substrate/client/consensus/babe/rpc/Cargo.toml index 4c755df541d7..aefdb782d7f0 100644 --- a/substrate/client/consensus/babe/rpc/Cargo.toml +++ b/substrate/client/consensus/babe/rpc/Cargo.toml @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } futures = "0.3.30" serde = { features = ["derive"], workspace = true, default-features = true } thiserror = { workspace = true } diff --git a/substrate/client/consensus/beefy/rpc/Cargo.toml b/substrate/client/consensus/beefy/rpc/Cargo.toml index 07e46dbda156..3b7855213de7 100644 --- a/substrate/client/consensus/beefy/rpc/Cargo.toml +++ b/substrate/client/consensus/beefy/rpc/Cargo.toml @@ -14,7 +14,7 @@ workspace = true [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12", features = ["derive"] } futures = "0.3.30" -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } log = { workspace = true, default-features = true } parking_lot = "0.12.1" serde = { features = ["derive"], workspace = true, default-features = true } diff --git a/substrate/client/consensus/grandpa/rpc/Cargo.toml b/substrate/client/consensus/grandpa/rpc/Cargo.toml index d4e72baef3e7..9c2162593f85 100644 --- a/substrate/client/consensus/grandpa/rpc/Cargo.toml +++ b/substrate/client/consensus/grandpa/rpc/Cargo.toml @@ -15,7 +15,7 @@ workspace = true [dependencies] finality-grandpa = { version = "0.16.2", features = ["derive-codec"] } futures = "0.3.30" -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } log = { workspace = true, default-features = true } parity-scale-codec = { version = "3.6.12", features = ["derive"] } serde = { features = ["derive"], workspace = true, default-features = true } diff --git a/substrate/client/consensus/manual-seal/Cargo.toml b/substrate/client/consensus/manual-seal/Cargo.toml index 33f5bf1f8c15..39fe100dcc10 100644 --- a/substrate/client/consensus/manual-seal/Cargo.toml +++ b/substrate/client/consensus/manual-seal/Cargo.toml @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } assert_matches = "1.3.0" async-trait = "0.1.79" codec = { package = "parity-scale-codec", version = "3.6.12" } diff --git a/substrate/client/merkle-mountain-range/rpc/Cargo.toml b/substrate/client/merkle-mountain-range/rpc/Cargo.toml index 25e6e316a8be..c03787eb7463 100644 --- a/substrate/client/merkle-mountain-range/rpc/Cargo.toml +++ b/substrate/client/merkle-mountain-range/rpc/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } serde = { features = ["derive"], workspace = true, default-features = true } sp-api = { path = "../../../primitives/api" } sp-blockchain = { path = "../../../primitives/blockchain" } diff --git a/substrate/client/rpc-api/Cargo.toml b/substrate/client/rpc-api/Cargo.toml index d8f833e2b8d4..f7b8173de003 100644 --- a/substrate/client/rpc-api/Cargo.toml +++ b/substrate/client/rpc-api/Cargo.toml @@ -28,4 +28,4 @@ sp-core = { path = "../../primitives/core" } sp-rpc = { path = "../../primitives/rpc" } sp-runtime = { path = "../../primitives/runtime" } sp-version = { path = "../../primitives/version" } -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } diff --git a/substrate/client/rpc-servers/Cargo.toml b/substrate/client/rpc-servers/Cargo.toml index 7837c852a1c9..e0d977afd442 100644 --- a/substrate/client/rpc-servers/Cargo.toml +++ b/substrate/client/rpc-servers/Cargo.toml @@ -16,16 +16,18 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] +anyhow = "1" forwarded-header-value = "0.1.1" futures = "0.3.30" governor = "0.6.0" -http = "0.2.8" -hyper = "0.14.27" +http = "1.1" +hyper = "1.3" +hyper-util = { version = "0.1", features = ["tokio", "service", "tokio", "server-auto"] } ip_network = "0.4.1" -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } log = { workspace = true, default-features = true } prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" } serde_json = { workspace = true, default-features = true } tokio = { version = "1.22.0", features = ["parking_lot"] } tower = { version = "0.4.13", features = ["util"] } -tower-http = { version = "0.4.0", features = ["cors"] } +tower-http = { version = "0.5.2", features = ["cors"] } diff --git a/substrate/client/rpc-servers/src/lib.rs b/substrate/client/rpc-servers/src/lib.rs index ba1fcf5e3677..47f9e85e4422 100644 --- a/substrate/client/rpc-servers/src/lib.rs +++ b/substrate/client/rpc-servers/src/lib.rs @@ -23,18 +23,12 @@ pub mod middleware; pub mod utils; -use std::{ - convert::Infallible, error::Error as StdError, net::SocketAddr, num::NonZeroU32, time::Duration, -}; +use std::{error::Error as StdError, net::SocketAddr, num::NonZeroU32, sync::Arc, time::Duration}; -use hyper::{ - server::conn::AddrStream, - service::{make_service_fn, service_fn}, -}; use jsonrpsee::{ server::{ - middleware::http::ProxyGetRequestLayer, stop_channel, ws, PingConfig, StopHandle, - TowerServiceBuilder, + middleware::http::ProxyGetRequestLayer, serve_with_graceful_shutdown, stop_channel, ws, + PingConfig, StopHandle, TowerServiceBuilder, }, Methods, RpcModule, }; @@ -99,6 +93,7 @@ struct PerConnection { metrics: Option, tokio_handle: tokio::runtime::Handle, service_builder: TowerServiceBuilder, + rate_limit_whitelisted_ips: Arc>, } /// Start RPC server listening on given address. @@ -126,8 +121,8 @@ where rate_limit_trust_proxy_headers, } = config; - let std_listener = TcpListener::bind(addrs.as_slice()).await?.into_std()?; - let local_addr = std_listener.local_addr().ok(); + let listener = TcpListener::bind(addrs.as_slice()).await?; + let local_addr = listener.local_addr().ok(); let host_filter = host_filtering(cors.is_some(), local_addr); let http_middleware = tower::ServiceBuilder::new() @@ -163,20 +158,38 @@ where methods: build_rpc_api(rpc_api).into(), service_builder: builder.to_service_builder(), metrics, - tokio_handle, - stop_handle: stop_handle.clone(), + tokio_handle: tokio_handle.clone(), + stop_handle, + rate_limit_whitelisted_ips: Arc::new(rate_limit_whitelisted_ips), }; - let make_service = make_service_fn(move |addr: &AddrStream| { - let cfg = cfg.clone(); - let rate_limit_whitelisted_ips = rate_limit_whitelisted_ips.clone(); - let ip = addr.remote_addr().ip(); - - async move { - let cfg = cfg.clone(); - let rate_limit_whitelisted_ips = rate_limit_whitelisted_ips.clone(); + tokio_handle.spawn(async move { + loop { + let (sock, remote_addr) = tokio::select! { + res = listener.accept() => { + match res { + Ok(s) => s, + Err(e) => { + log::debug!("Failed to accept ipv4 connection: {:?}", e); + continue; + } + } + } + _ = cfg.stop_handle.clone().shutdown() => break, + }; + + let ip = remote_addr.ip(); + let cfg2 = cfg.clone(); + let svc = tower::service_fn(move |req: http::Request| { + let PerConnection { + methods, + service_builder, + metrics, + tokio_handle, + stop_handle, + rate_limit_whitelisted_ips, + } = cfg2.clone(); - Ok::<_, Infallible>(service_fn(move |req| { let proxy_ip = if rate_limit_trust_proxy_headers { get_proxy_ip(&req) } else { None }; @@ -193,9 +206,6 @@ where rate_limit }; - let PerConnection { service_builder, metrics, tokio_handle, stop_handle, methods } = - cfg.clone(); - let is_websocket = ws::is_upgrade_request(&req); let transport_label = if is_websocket { "ws" } else { "http" }; @@ -215,7 +225,6 @@ where let rpc_middleware = RpcServiceBuilder::new().option_layer(middleware_layer.clone()); - let mut svc = service_builder.set_rpc_middleware(rpc_middleware).build(methods, stop_handle); @@ -232,17 +241,19 @@ where }); } - svc.call(req).await + // https://github.com/rust-lang/rust/issues/102211 the error type can't be inferred + // to be `Box` so we need to convert it to + // a concrete type as workaround. + svc.call(req).await.map_err(|e| anyhow::anyhow!("{:?}", e)) } - })) - } - }); - - let server = hyper::Server::from_tcp(std_listener)?.serve(make_service); + }); - tokio::spawn(async move { - let graceful = server.with_graceful_shutdown(async move { stop_handle.shutdown().await }); - let _ = graceful.await; + cfg.tokio_handle.spawn(serve_with_graceful_shutdown( + sock, + svc, + cfg.stop_handle.clone().shutdown(), + )); + } }); log::info!( diff --git a/substrate/client/rpc-servers/src/utils.rs b/substrate/client/rpc-servers/src/utils.rs index d99b8e637d9d..d9d943c7c1fb 100644 --- a/substrate/client/rpc-servers/src/utils.rs +++ b/substrate/client/rpc-servers/src/utils.rs @@ -25,10 +25,7 @@ use std::{ }; use forwarded_header_value::ForwardedHeaderValue; -use hyper::{ - header::{HeaderName, HeaderValue}, - Request, -}; +use http::header::{HeaderName, HeaderValue}; use jsonrpsee::{server::middleware::http::HostFilterLayer, RpcModule}; use tower_http::cors::{AllowOrigin, CorsLayer}; @@ -57,7 +54,7 @@ pub(crate) fn build_rpc_api(mut rpc_api: RpcModule) available_methods.sort(); rpc_api - .register_method("rpc_methods", move |_, _| { + .register_method("rpc_methods", move |_, _, _| { serde_json::json!({ "methods": available_methods, }) @@ -96,7 +93,7 @@ pub(crate) fn format_cors(maybe_cors: Option<&Vec>) -> String { /// 1. `Forwarded` header. /// 2. `X-Forwarded-For` header. /// 3. `X-Real-Ip`. -pub(crate) fn get_proxy_ip(req: &Request) -> Option { +pub(crate) fn get_proxy_ip(req: &http::Request) -> Option { if let Some(ip) = req .headers() .get(&FORWARDED) @@ -133,9 +130,10 @@ pub(crate) fn get_proxy_ip(req: &Request) -> Option { mod tests { use super::*; use hyper::header::HeaderValue; + use jsonrpsee::server::{HttpBody, HttpRequest}; - fn request() -> hyper::Request { - hyper::Request::builder().body(hyper::Body::empty()).unwrap() + fn request() -> http::Request { + HttpRequest::builder().body(HttpBody::empty()).unwrap() } #[test] diff --git a/substrate/client/rpc-spec-v2/Cargo.toml b/substrate/client/rpc-spec-v2/Cargo.toml index 8977c842d038..5fd03eb8c95d 100644 --- a/substrate/client/rpc-spec-v2/Cargo.toml +++ b/substrate/client/rpc-spec-v2/Cargo.toml @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } # Internal chain structures for "chain_spec". sc-chain-spec = { path = "../chain-spec" } # Pool for submitting extrinsics required by "transaction" @@ -45,7 +45,7 @@ rand = "0.8.5" schnellru = "0.2.1" [dev-dependencies] -jsonrpsee = { version = "0.22", features = ["server", "ws-client"] } +jsonrpsee = { version = "0.23", features = ["server", "ws-client"] } serde_json = { workspace = true, default-features = true } tokio = { version = "1.22.0", features = ["macros"] } substrate-test-runtime-client = { path = "../../test-utils/runtime/client" } diff --git a/substrate/client/rpc-spec-v2/src/chain_head/api.rs b/substrate/client/rpc-spec-v2/src/chain_head/api.rs index 23cb0bbf5458..128d803521f6 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/api.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/api.rs @@ -54,7 +54,7 @@ pub trait ChainHeadApi { /// # Unstable /// /// This method is unstable and subject to change in the future. - #[method(name = "chainHead_v1_body", raw_method)] + #[method(name = "chainHead_v1_body", with_extensions)] async fn chain_head_unstable_body( &self, follow_subscription: String, @@ -73,7 +73,7 @@ pub trait ChainHeadApi { /// # Unstable /// /// This method is unstable and subject to change in the future. - #[method(name = "chainHead_v1_header", raw_method)] + #[method(name = "chainHead_v1_header", with_extensions)] async fn chain_head_unstable_header( &self, follow_subscription: String, @@ -85,7 +85,7 @@ pub trait ChainHeadApi { /// # Unstable /// /// This method is unstable and subject to change in the future. - #[method(name = "chainHead_v1_storage", raw_method)] + #[method(name = "chainHead_v1_storage", with_extensions)] async fn chain_head_unstable_storage( &self, follow_subscription: String, @@ -99,7 +99,7 @@ pub trait ChainHeadApi { /// # Unstable /// /// This method is unstable and subject to change in the future. - #[method(name = "chainHead_v1_call", raw_method)] + #[method(name = "chainHead_v1_call", with_extensions)] async fn chain_head_unstable_call( &self, follow_subscription: String, @@ -118,7 +118,7 @@ pub trait ChainHeadApi { /// # Unstable /// /// This method is unstable and subject to change in the future. - #[method(name = "chainHead_v1_unpin", raw_method)] + #[method(name = "chainHead_v1_unpin", with_extensions)] async fn chain_head_unstable_unpin( &self, follow_subscription: String, @@ -131,7 +131,7 @@ pub trait ChainHeadApi { /// # Unstable /// /// This method is unstable and subject to change in the future. - #[method(name = "chainHead_v1_continue", raw_method)] + #[method(name = "chainHead_v1_continue", with_extensions)] async fn chain_head_unstable_continue( &self, follow_subscription: String, @@ -145,7 +145,7 @@ pub trait ChainHeadApi { /// # Unstable /// /// This method is unstable and subject to change in the future. - #[method(name = "chainHead_v1_stopOperation", raw_method)] + #[method(name = "chainHead_v1_stopOperation", with_extensions)] async fn chain_head_unstable_stop_operation( &self, follow_subscription: String, diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index 6779180a4146..f0637c29a747 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -36,7 +36,7 @@ use crate::{ use codec::Encode; use futures::{channel::oneshot, future::FutureExt}; use jsonrpsee::{ - core::async_trait, server::ResponsePayload, types::SubscriptionId, ConnectionDetails, + core::async_trait, server::ResponsePayload, types::SubscriptionId, ConnectionId, Extensions, MethodResponseFuture, PendingSubscriptionSink, SubscriptionSink, }; use log::debug; @@ -207,7 +207,8 @@ where // The RAII `reserved_subscription` will clean up resources on drop: // - free the reserved subscription for the connection ID. // - remove the subscription ID from the subscription management. - let Some(mut reserved_subscription) = subscriptions.reserve_subscription(connection_id) + let Some(mut reserved_subscription) = + subscriptions.reserve_subscription(connection_id) else { pending.reject(ChainHeadRpcError::ReachedLimits).await; return @@ -251,14 +252,13 @@ where async fn chain_head_unstable_body( &self, - connection_details: ConnectionDetails, + ext: &Extensions, follow_subscription: String, hash: Block::Hash, ) -> ResponsePayload<'static, MethodResponse> { - if !self - .subscriptions - .contains_subscription(connection_details.id(), &follow_subscription) - { + let conn_id = *ext.get::().unwrap(); + + if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or // stale. return ResponsePayload::success(MethodResponse::LimitReached); @@ -335,14 +335,13 @@ where async fn chain_head_unstable_header( &self, - connection_details: ConnectionDetails, + ext: &Extensions, follow_subscription: String, hash: Block::Hash, ) -> Result, ChainHeadRpcError> { - if !self - .subscriptions - .contains_subscription(connection_details.id(), &follow_subscription) - { + let conn_id = *ext.get::().unwrap(); + + if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(None); } @@ -371,16 +370,15 @@ where async fn chain_head_unstable_storage( &self, - connection_details: ConnectionDetails, + ext: &Extensions, follow_subscription: String, hash: Block::Hash, items: Vec>, child_trie: Option, ) -> ResponsePayload<'static, MethodResponse> { - if !self - .subscriptions - .contains_subscription(connection_details.id(), &follow_subscription) - { + let conn_id = *ext.get::().unwrap(); + + if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or // stale. return ResponsePayload::success(MethodResponse::LimitReached); @@ -452,7 +450,7 @@ where async fn chain_head_unstable_call( &self, - connection_details: ConnectionDetails, + ext: &Extensions, follow_subscription: String, hash: Block::Hash, function: String, @@ -463,10 +461,9 @@ where Err(err) => return ResponsePayload::error(err), }; - if !self - .subscriptions - .contains_subscription(connection_details.id(), &follow_subscription) - { + let conn_id = *ext.get::().unwrap(); + + if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or // stale. return ResponsePayload::success(MethodResponse::LimitReached); @@ -530,14 +527,13 @@ where async fn chain_head_unstable_unpin( &self, - connection_details: ConnectionDetails, + ext: &Extensions, follow_subscription: String, hash_or_hashes: ListOrValue, ) -> Result<(), ChainHeadRpcError> { - if !self - .subscriptions - .contains_subscription(connection_details.id(), &follow_subscription) - { + let conn_id = *ext.get::().unwrap(); + + if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()); } @@ -566,14 +562,13 @@ where async fn chain_head_unstable_continue( &self, - connection_details: ConnectionDetails, + ext: &Extensions, follow_subscription: String, operation_id: String, ) -> Result<(), ChainHeadRpcError> { - if !self - .subscriptions - .contains_subscription(connection_details.id(), &follow_subscription) - { + let conn_id = *ext.get::().unwrap(); + + if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) } @@ -592,14 +587,13 @@ where async fn chain_head_unstable_stop_operation( &self, - connection_details: ConnectionDetails, + ext: &Extensions, follow_subscription: String, operation_id: String, ) -> Result<(), ChainHeadRpcError> { - if !self - .subscriptions - .contains_subscription(connection_details.id(), &follow_subscription) - { + let conn_id = *ext.get::().unwrap(); + + if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) } diff --git a/substrate/client/rpc-spec-v2/src/transaction/api.rs b/substrate/client/rpc-spec-v2/src/transaction/api.rs index ed358922d53e..6af6f1678440 100644 --- a/substrate/client/rpc-spec-v2/src/transaction/api.rs +++ b/substrate/client/rpc-spec-v2/src/transaction/api.rs @@ -48,7 +48,7 @@ pub trait TransactionBroadcastApi { /// /// This method is unstable and subject to change in the future. - #[method(name = "transaction_v1_broadcast", raw_method)] + #[method(name = "transaction_v1_broadcast", with_extensions)] async fn broadcast(&self, bytes: Bytes) -> RpcResult>; /// Broadcast an extrinsic to the chain. @@ -56,6 +56,6 @@ pub trait TransactionBroadcastApi { /// # Unstable /// /// This method is unstable and subject to change in the future. - #[method(name = "transaction_v1_stop", raw_method)] + #[method(name = "transaction_v1_stop", with_extensions)] async fn stop_broadcast(&self, operation_id: String) -> Result<(), ErrorBroadcast>; } diff --git a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs index 68c19010e31c..cb22107366c7 100644 --- a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs +++ b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs @@ -27,7 +27,7 @@ use futures::{FutureExt, Stream, StreamExt}; use futures_util::stream::AbortHandle; use jsonrpsee::{ core::{async_trait, RpcResult}, - ConnectionDetails, + ConnectionId, Extensions, }; use parking_lot::RwLock; use rand::{distributions::Alphanumeric, Rng}; @@ -121,19 +121,15 @@ where ::Hash: Unpin, Client: HeaderBackend + BlockchainEvents + Send + Sync + 'static, { - async fn broadcast( - &self, - connection_details: ConnectionDetails, - bytes: Bytes, - ) -> RpcResult> { + async fn broadcast(&self, ext: &Extensions, bytes: Bytes) -> RpcResult> { let pool = self.pool.clone(); + let conn_id = *ext.get::().unwrap(); // The unique ID of this operation. let id = self.generate_unique_id(); // Ensure that the connection has not reached the maximum number of active operations. - let Some(reserved_connection) = self.rpc_connections.reserve_space(connection_details.id()) - else { + let Some(reserved_connection) = self.rpc_connections.reserve_space(conn_id) else { return Ok(None) }; let Some(reserved_identifier) = reserved_connection.register(id.clone()) else { @@ -245,11 +241,13 @@ where async fn stop_broadcast( &self, - connection_details: ConnectionDetails, + ext: &Extensions, operation_id: String, ) -> Result<(), ErrorBroadcast> { + let conn_id = *ext.get::().unwrap(); + // The operation ID must correlate to the same connection ID. - if !self.rpc_connections.contains_identifier(connection_details.id(), &operation_id) { + if !self.rpc_connections.contains_identifier(conn_id, &operation_id) { return Err(ErrorBroadcast::InvalidOperationID) } diff --git a/substrate/client/rpc/Cargo.toml b/substrate/client/rpc/Cargo.toml index 7dd46b2ab4c3..e0f8775c43df 100644 --- a/substrate/client/rpc/Cargo.toml +++ b/substrate/client/rpc/Cargo.toml @@ -18,7 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } futures = "0.3.30" -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } log = { workspace = true, default-features = true } parking_lot = "0.12.1" serde_json = { workspace = true, default-features = true } diff --git a/substrate/client/rpc/src/utils.rs b/substrate/client/rpc/src/utils.rs index 3b5372615e73..e05260e18fd6 100644 --- a/substrate/client/rpc/src/utils.rs +++ b/substrate/client/rpc/src/utils.rs @@ -130,7 +130,7 @@ async fn inner_pipe_from_stream( "Subscription buffer limit={} exceeded for subscription={} conn_id={}; dropping subscription", buf.max_cap, sink.method_name(), - sink.connection_id() + sink.connection_id().0 ); return } diff --git a/substrate/client/service/Cargo.toml b/substrate/client/service/Cargo.toml index dfdd485f15c0..cf8c6b43597f 100644 --- a/substrate/client/service/Cargo.toml +++ b/substrate/client/service/Cargo.toml @@ -28,7 +28,7 @@ runtime-benchmarks = [ ] [dependencies] -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } thiserror = { workspace = true } futures = "0.3.30" rand = "0.8.5" diff --git a/substrate/client/sync-state-rpc/Cargo.toml b/substrate/client/sync-state-rpc/Cargo.toml index d5bdc920f7c9..7bfbbec790ae 100644 --- a/substrate/client/sync-state-rpc/Cargo.toml +++ b/substrate/client/sync-state-rpc/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } serde = { features = ["derive"], workspace = true, default-features = true } serde_json = { workspace = true, default-features = true } thiserror = { workspace = true } diff --git a/substrate/frame/transaction-payment/rpc/Cargo.toml b/substrate/frame/transaction-payment/rpc/Cargo.toml index 2c9f814460f7..31f062837e74 100644 --- a/substrate/frame/transaction-payment/rpc/Cargo.toml +++ b/substrate/frame/transaction-payment/rpc/Cargo.toml @@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } pallet-transaction-payment-rpc-runtime-api = { path = "runtime-api" } sp-api = { path = "../../../primitives/api" } sp-blockchain = { path = "../../../primitives/blockchain" } diff --git a/substrate/utils/frame/remote-externalities/Cargo.toml b/substrate/utils/frame/remote-externalities/Cargo.toml index 2911d5eef659..c7e7b97e2e37 100644 --- a/substrate/utils/frame/remote-externalities/Cargo.toml +++ b/substrate/utils/frame/remote-externalities/Cargo.toml @@ -15,7 +15,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.22", features = ["http-client"] } +jsonrpsee = { version = "0.23", features = ["http-client"] } codec = { package = "parity-scale-codec", version = "3.6.12" } log = { workspace = true, default-features = true } serde = { workspace = true, default-features = true } diff --git a/substrate/utils/frame/remote-externalities/src/lib.rs b/substrate/utils/frame/remote-externalities/src/lib.rs index 0ecb98f31343..f5e522535fa1 100644 --- a/substrate/utils/frame/remote-externalities/src/lib.rs +++ b/substrate/utils/frame/remote-externalities/src/lib.rs @@ -24,7 +24,7 @@ use codec::{Compact, Decode, Encode}; use indicatif::{ProgressBar, ProgressStyle}; use jsonrpsee::{ core::params::ArrayParams, - http_client::{HttpClient, HttpClientBuilder}, + http_client::HttpClient, }; use log::*; use serde::de::DeserializeOwned; @@ -190,7 +190,7 @@ impl Transport { } else { uri.clone() }; - let http_client = HttpClientBuilder::default() + let http_client = HttpClient::builder() .max_request_size(u32::MAX) .max_response_size(u32::MAX) .request_timeout(std::time::Duration::from_secs(60 * 5)) diff --git a/substrate/utils/frame/rpc/client/Cargo.toml b/substrate/utils/frame/rpc/client/Cargo.toml index 501bb95b2579..ff5e4a176573 100644 --- a/substrate/utils/frame/rpc/client/Cargo.toml +++ b/substrate/utils/frame/rpc/client/Cargo.toml @@ -15,7 +15,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.22", features = ["ws-client"] } +jsonrpsee = { version = "0.23", features = ["ws-client"] } sc-rpc-api = { path = "../../../../client/rpc-api" } async-trait = "0.1.79" serde = { workspace = true, default-features = true } diff --git a/substrate/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml b/substrate/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml index ee3bf5eb68d7..6664788edd67 100644 --- a/substrate/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml +++ b/substrate/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml @@ -24,7 +24,7 @@ sp-state-machine = { path = "../../../../primitives/state-machine" } sp-trie = { path = "../../../../primitives/trie" } trie-db = "0.29.0" -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } # Substrate Dependencies sc-client-api = { path = "../../../../client/api" } diff --git a/substrate/utils/frame/rpc/support/Cargo.toml b/substrate/utils/frame/rpc/support/Cargo.toml index bf566f909ecb..41bc3068ba2c 100644 --- a/substrate/utils/frame/rpc/support/Cargo.toml +++ b/substrate/utils/frame/rpc/support/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.22", features = ["jsonrpsee-types"] } +jsonrpsee = { version = "0.23", features = ["jsonrpsee-types"] } serde = { workspace = true, default-features = true } frame-support = { path = "../../../../frame/support" } sc-rpc-api = { path = "../../../../client/rpc-api" } @@ -24,7 +24,7 @@ sp-storage = { path = "../../../../primitives/storage" } [dev-dependencies] scale-info = "2.11.1" -jsonrpsee = { version = "0.22", features = ["jsonrpsee-types", "ws-client"] } +jsonrpsee = { version = "0.23", features = ["jsonrpsee-types", "ws-client"] } tokio = "1.37" sp-core = { path = "../../../../primitives/core" } sp-runtime = { path = "../../../../primitives/runtime" } diff --git a/substrate/utils/frame/rpc/system/Cargo.toml b/substrate/utils/frame/rpc/system/Cargo.toml index 6829d753ed71..2f698b5e71c5 100644 --- a/substrate/utils/frame/rpc/system/Cargo.toml +++ b/substrate/utils/frame/rpc/system/Cargo.toml @@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.22.5", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } futures = "0.3.30" log = { workspace = true, default-features = true } frame-system-rpc-runtime-api = { path = "../../../../frame/system/rpc/runtime-api" } diff --git a/templates/minimal/node/Cargo.toml b/templates/minimal/node/Cargo.toml index 606fd0580356..f62d58e9fc1b 100644 --- a/templates/minimal/node/Cargo.toml +++ b/templates/minimal/node/Cargo.toml @@ -20,7 +20,7 @@ targets = ["x86_64-unknown-linux-gnu"] clap = { version = "4.5.3", features = ["derive"] } futures = { version = "0.3.30", features = ["thread-pool"] } futures-timer = "3.0.1" -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } serde_json = { workspace = true, default-features = true } sc-cli = { path = "../../../substrate/client/cli" } diff --git a/templates/parachain/node/Cargo.toml b/templates/parachain/node/Cargo.toml index 6f7150829829..75e56b74fb57 100644 --- a/templates/parachain/node/Cargo.toml +++ b/templates/parachain/node/Cargo.toml @@ -21,7 +21,7 @@ clap = { version = "4.5.3", features = ["derive"] } log = { workspace = true, default-features = true } codec = { package = "parity-scale-codec", version = "3.6.12" } serde = { features = ["derive"], workspace = true, default-features = true } -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } futures = "0.3.28" serde_json = { workspace = true, default-features = true } docify = "0.2.8" diff --git a/templates/solochain/node/Cargo.toml b/templates/solochain/node/Cargo.toml index 9332da3a6549..c8f12ff0dc12 100644 --- a/templates/solochain/node/Cargo.toml +++ b/templates/solochain/node/Cargo.toml @@ -21,7 +21,7 @@ targets = ["x86_64-unknown-linux-gnu"] clap = { version = "4.5.3", features = ["derive"] } futures = { version = "0.3.30", features = ["thread-pool"] } serde_json = { workspace = true, default-features = true } -jsonrpsee = { version = "0.22", features = ["server"] } +jsonrpsee = { version = "0.23", features = ["server"] } # substrate client sc-cli = { path = "../../../substrate/client/cli" } From 15691d6272a3de936037da6d36c1b9e7b837cc3e Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 7 Jun 2024 12:34:45 +0200 Subject: [PATCH 02/24] cleanup --- Cargo.toml | 1 - substrate/client/rpc-servers/src/lib.rs | 2 +- .../rpc-spec-v2/src/chain_head/chain_head.rs | 17 ++++++++--------- .../src/transaction/transaction_broadcast.rs | 4 ++-- .../utils/frame/remote-externalities/src/lib.rs | 5 +---- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c017b2bb4e03..2b2a1cdc17d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -653,4 +653,3 @@ wasmi = { opt-level = 3 } x25519-dalek = { opt-level = 3 } yamux = { opt-level = 3 } zeroize = { opt-level = 3 } - diff --git a/substrate/client/rpc-servers/src/lib.rs b/substrate/client/rpc-servers/src/lib.rs index 47f9e85e4422..c5e5c2657e16 100644 --- a/substrate/client/rpc-servers/src/lib.rs +++ b/substrate/client/rpc-servers/src/lib.rs @@ -170,7 +170,7 @@ where match res { Ok(s) => s, Err(e) => { - log::debug!("Failed to accept ipv4 connection: {:?}", e); + log::debug!(target: "rpc", "Failed to accept ipv4 connection: {:?}", e); continue; } } diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index f0637c29a747..0e2fdbdaf05d 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -207,8 +207,7 @@ where // The RAII `reserved_subscription` will clean up resources on drop: // - free the reserved subscription for the connection ID. // - remove the subscription ID from the subscription management. - let Some(mut reserved_subscription) = - subscriptions.reserve_subscription(connection_id) + let Some(mut reserved_subscription) = subscriptions.reserve_subscription(connection_id) else { pending.reject(ChainHeadRpcError::ReachedLimits).await; return @@ -256,7 +255,7 @@ where follow_subscription: String, hash: Block::Hash, ) -> ResponsePayload<'static, MethodResponse> { - let conn_id = *ext.get::().unwrap(); + let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or @@ -339,7 +338,7 @@ where follow_subscription: String, hash: Block::Hash, ) -> Result, ChainHeadRpcError> { - let conn_id = *ext.get::().unwrap(); + let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(None); @@ -376,7 +375,7 @@ where items: Vec>, child_trie: Option, ) -> ResponsePayload<'static, MethodResponse> { - let conn_id = *ext.get::().unwrap(); + let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or @@ -461,7 +460,7 @@ where Err(err) => return ResponsePayload::error(err), }; - let conn_id = *ext.get::().unwrap(); + let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or @@ -531,7 +530,7 @@ where follow_subscription: String, hash_or_hashes: ListOrValue, ) -> Result<(), ChainHeadRpcError> { - let conn_id = *ext.get::().unwrap(); + let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()); @@ -566,7 +565,7 @@ where follow_subscription: String, operation_id: String, ) -> Result<(), ChainHeadRpcError> { - let conn_id = *ext.get::().unwrap(); + let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) @@ -591,7 +590,7 @@ where follow_subscription: String, operation_id: String, ) -> Result<(), ChainHeadRpcError> { - let conn_id = *ext.get::().unwrap(); + let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) diff --git a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs index cb22107366c7..d38faf0f4a18 100644 --- a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs +++ b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs @@ -123,7 +123,7 @@ where { async fn broadcast(&self, ext: &Extensions, bytes: Bytes) -> RpcResult> { let pool = self.pool.clone(); - let conn_id = *ext.get::().unwrap(); + let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); // The unique ID of this operation. let id = self.generate_unique_id(); @@ -244,7 +244,7 @@ where ext: &Extensions, operation_id: String, ) -> Result<(), ErrorBroadcast> { - let conn_id = *ext.get::().unwrap(); + let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); // The operation ID must correlate to the same connection ID. if !self.rpc_connections.contains_identifier(conn_id, &operation_id) { diff --git a/substrate/utils/frame/remote-externalities/src/lib.rs b/substrate/utils/frame/remote-externalities/src/lib.rs index f5e522535fa1..aff2b95c9da6 100644 --- a/substrate/utils/frame/remote-externalities/src/lib.rs +++ b/substrate/utils/frame/remote-externalities/src/lib.rs @@ -22,10 +22,7 @@ use codec::{Compact, Decode, Encode}; use indicatif::{ProgressBar, ProgressStyle}; -use jsonrpsee::{ - core::params::ArrayParams, - http_client::HttpClient, -}; +use jsonrpsee::{core::params::ArrayParams, http_client::HttpClient}; use log::*; use serde::de::DeserializeOwned; use sp_core::{ From f681f0e3e2dc4f47cbe988a5c3d495c3602381e6 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 7 Jun 2024 12:46:57 +0200 Subject: [PATCH 03/24] make it compile --- .../rpc-spec-v2/src/chain_head/chain_head.rs | 14 +++++++------- .../src/transaction/transaction_broadcast.rs | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index 0e2fdbdaf05d..86ead9bd2d76 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -255,7 +255,7 @@ where follow_subscription: String, hash: Block::Hash, ) -> ResponsePayload<'static, MethodResponse> { - let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or @@ -338,7 +338,7 @@ where follow_subscription: String, hash: Block::Hash, ) -> Result, ChainHeadRpcError> { - let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(None); @@ -375,7 +375,7 @@ where items: Vec>, child_trie: Option, ) -> ResponsePayload<'static, MethodResponse> { - let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or @@ -460,7 +460,7 @@ where Err(err) => return ResponsePayload::error(err), }; - let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or @@ -530,7 +530,7 @@ where follow_subscription: String, hash_or_hashes: ListOrValue, ) -> Result<(), ChainHeadRpcError> { - let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()); @@ -565,7 +565,7 @@ where follow_subscription: String, operation_id: String, ) -> Result<(), ChainHeadRpcError> { - let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) @@ -590,7 +590,7 @@ where follow_subscription: String, operation_id: String, ) -> Result<(), ChainHeadRpcError> { - let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) diff --git a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs index d38faf0f4a18..c44ea0926dca 100644 --- a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs +++ b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs @@ -123,7 +123,7 @@ where { async fn broadcast(&self, ext: &Extensions, bytes: Bytes) -> RpcResult> { let pool = self.pool.clone(); - let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); // The unique ID of this operation. let id = self.generate_unique_id(); @@ -244,7 +244,7 @@ where ext: &Extensions, operation_id: String, ) -> Result<(), ErrorBroadcast> { - let conn_id = ext.get::().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); // The operation ID must correlate to the same connection ID. if !self.rpc_connections.contains_identifier(conn_id, &operation_id) { From bd74645a96dad2d1e78796c9306b37511d1edeff Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 7 Jun 2024 17:08:50 +0200 Subject: [PATCH 04/24] fix test build --- .../rpc-spec-v2/src/chain_head/chain_head.rs | 35 ++++++++++++--- .../src/chain_head/subscription/inner.rs | 15 ++++--- .../rpc-spec-v2/src/common/connections.rs | 45 ++++++++++--------- .../src/transaction/transaction_broadcast.rs | 10 ++++- substrate/client/rpc/src/utils.rs | 29 +++++++----- 5 files changed, 87 insertions(+), 47 deletions(-) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index 86ead9bd2d76..0a3d2a4a9ee1 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -255,7 +255,10 @@ where follow_subscription: String, hash: Block::Hash, ) -> ResponsePayload<'static, MethodResponse> { - let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext + .get::() + .copied() + .expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or @@ -338,7 +341,10 @@ where follow_subscription: String, hash: Block::Hash, ) -> Result, ChainHeadRpcError> { - let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext + .get::() + .copied() + .expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(None); @@ -375,7 +381,10 @@ where items: Vec>, child_trie: Option, ) -> ResponsePayload<'static, MethodResponse> { - let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext + .get::() + .copied() + .expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or @@ -460,7 +469,10 @@ where Err(err) => return ResponsePayload::error(err), }; - let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext + .get::() + .copied() + .expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or @@ -530,7 +542,10 @@ where follow_subscription: String, hash_or_hashes: ListOrValue, ) -> Result<(), ChainHeadRpcError> { - let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext + .get::() + .copied() + .expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()); @@ -565,7 +580,10 @@ where follow_subscription: String, operation_id: String, ) -> Result<(), ChainHeadRpcError> { - let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext + .get::() + .copied() + .expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) @@ -590,7 +608,10 @@ where follow_subscription: String, operation_id: String, ) -> Result<(), ChainHeadRpcError> { - let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext + .get::() + .copied() + .expect("ConnectionId is always set by jsonrpsee"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/subscription/inner.rs b/substrate/client/rpc-spec-v2/src/chain_head/subscription/inner.rs index a6edc344bc63..d4d616f54dc8 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/subscription/inner.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/subscription/inner.rs @@ -846,6 +846,7 @@ impl> SubscriptionsInner { #[cfg(test)] mod tests { use super::*; + use jsonrpsee::ConnectionId; use sc_block_builder::BlockBuilderBuilder; use sc_service::client::new_in_mem; use sp_consensus::BlockOrigin; @@ -1420,17 +1421,20 @@ mod tests { rpc_connections.clone(), ); - let reserved_sub_first = subscription_management.reserve_subscription(1).unwrap(); - let mut reserved_sub_second = subscription_management.reserve_subscription(1).unwrap(); + let reserved_sub_first = + subscription_management.reserve_subscription(ConnectionId(1)).unwrap(); + let mut reserved_sub_second = + subscription_management.reserve_subscription(ConnectionId(1)).unwrap(); // Subscriptions reserved but not yet populated. assert_eq!(subs.read().subs.len(), 0); // Cannot reserve anymore. - assert!(subscription_management.reserve_subscription(1).is_none()); + assert!(subscription_management.reserve_subscription(ConnectionId(1)).is_none()); // Drop the first subscription. drop(reserved_sub_first); // Space is freed-up for the rpc connections. - let mut reserved_sub_first = subscription_management.reserve_subscription(1).unwrap(); + let mut reserved_sub_first = + subscription_management.reserve_subscription(ConnectionId(1)).unwrap(); // Insert subscriptions. let _sub_data_first = @@ -1445,7 +1449,8 @@ mod tests { // Check that the subscription is removed. assert_eq!(subs.read().subs.len(), 1); // Space is freed-up for the rpc connections. - let reserved_sub_first = subscription_management.reserve_subscription(1).unwrap(); + let reserved_sub_first = + subscription_management.reserve_subscription(ConnectionId(1)).unwrap(); // Drop all subscriptions. drop(reserved_sub_first); diff --git a/substrate/client/rpc-spec-v2/src/common/connections.rs b/substrate/client/rpc-spec-v2/src/common/connections.rs index c16a80bf49db..f0c31d612ebd 100644 --- a/substrate/client/rpc-spec-v2/src/common/connections.rs +++ b/substrate/client/rpc-spec-v2/src/common/connections.rs @@ -195,68 +195,71 @@ mod tests { #[test] fn reserve_space() { let rpc_connections = RpcConnections::new(2); - let reserved = rpc_connections.reserve_space(1); + let conn_id = ConnectionId(1); + let reserved = rpc_connections.reserve_space(conn_id); + assert!(reserved.is_some()); - assert_eq!(1, rpc_connections.data.lock().get(&1).unwrap().num_identifiers); + assert_eq!(1, rpc_connections.data.lock().get(&conn_id).unwrap().num_identifiers); assert_eq!(rpc_connections.data.lock().len(), 1); let reserved = reserved.unwrap(); let registered = reserved.register("identifier1".to_string()).unwrap(); - assert!(rpc_connections.contains_identifier(1, "identifier1")); - assert_eq!(1, rpc_connections.data.lock().get(&1).unwrap().num_identifiers); + assert!(rpc_connections.contains_identifier(conn_id, "identifier1")); + assert_eq!(1, rpc_connections.data.lock().get(&conn_id).unwrap().num_identifiers); drop(registered); // Data is dropped. - assert!(rpc_connections.data.lock().get(&1).is_none()); + assert!(rpc_connections.data.lock().get(&conn_id).is_none()); assert!(rpc_connections.data.lock().is_empty()); // Checks can still happen. - assert!(!rpc_connections.contains_identifier(1, "identifier1")); + assert!(!rpc_connections.contains_identifier(conn_id, "identifier1")); } #[test] fn reserve_space_capacity_reached() { let rpc_connections = RpcConnections::new(2); + let conn_id = ConnectionId(1); // Reserve identifier for connection 1. - let reserved = rpc_connections.reserve_space(1); + let reserved = rpc_connections.reserve_space(conn_id); assert!(reserved.is_some()); - assert_eq!(1, rpc_connections.data.lock().get(&1).unwrap().num_identifiers); + assert_eq!(1, rpc_connections.data.lock().get(&conn_id).unwrap().num_identifiers); // Add identifier for connection 1. let reserved = reserved.unwrap(); let registered = reserved.register("identifier1".to_string()).unwrap(); - assert!(rpc_connections.contains_identifier(1, "identifier1")); - assert_eq!(1, rpc_connections.data.lock().get(&1).unwrap().num_identifiers); + assert!(rpc_connections.contains_identifier(conn_id, "identifier1")); + assert_eq!(1, rpc_connections.data.lock().get(&conn_id).unwrap().num_identifiers); // Reserve identifier for connection 1 again. - let reserved = rpc_connections.reserve_space(1); + let reserved = rpc_connections.reserve_space(conn_id); assert!(reserved.is_some()); - assert_eq!(2, rpc_connections.data.lock().get(&1).unwrap().num_identifiers); + assert_eq!(2, rpc_connections.data.lock().get(&conn_id).unwrap().num_identifiers); // Add identifier for connection 1 again. let reserved = reserved.unwrap(); let registered_second = reserved.register("identifier2".to_string()).unwrap(); - assert!(rpc_connections.contains_identifier(1, "identifier2")); - assert_eq!(2, rpc_connections.data.lock().get(&1).unwrap().num_identifiers); + assert!(rpc_connections.contains_identifier(conn_id, "identifier2")); + assert_eq!(2, rpc_connections.data.lock().get(&conn_id).unwrap().num_identifiers); // Cannot reserve more identifiers. - let reserved = rpc_connections.reserve_space(1); + let reserved = rpc_connections.reserve_space(conn_id); assert!(reserved.is_none()); // Drop the first identifier. drop(registered); - assert_eq!(1, rpc_connections.data.lock().get(&1).unwrap().num_identifiers); - assert!(rpc_connections.contains_identifier(1, "identifier2")); - assert!(!rpc_connections.contains_identifier(1, "identifier1")); + assert_eq!(1, rpc_connections.data.lock().get(&conn_id).unwrap().num_identifiers); + assert!(rpc_connections.contains_identifier(conn_id, "identifier2")); + assert!(!rpc_connections.contains_identifier(conn_id, "identifier1")); // Can reserve again after clearing the space. - let reserved = rpc_connections.reserve_space(1); + let reserved = rpc_connections.reserve_space(conn_id); assert!(reserved.is_some()); - assert_eq!(2, rpc_connections.data.lock().get(&1).unwrap().num_identifiers); + assert_eq!(2, rpc_connections.data.lock().get(&conn_id).unwrap().num_identifiers); // Ensure data is cleared. drop(reserved); drop(registered_second); - assert!(rpc_connections.data.lock().get(&1).is_none()); + assert!(rpc_connections.data.lock().get(&conn_id).is_none()); } } diff --git a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs index c44ea0926dca..ea6592221bf4 100644 --- a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs +++ b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs @@ -123,7 +123,10 @@ where { async fn broadcast(&self, ext: &Extensions, bytes: Bytes) -> RpcResult> { let pool = self.pool.clone(); - let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext + .get::() + .copied() + .expect("ConnectionId is always set by jsonrpsee"); // The unique ID of this operation. let id = self.generate_unique_id(); @@ -244,7 +247,10 @@ where ext: &Extensions, operation_id: String, ) -> Result<(), ErrorBroadcast> { - let conn_id = ext.get::().copied().expect("ConnectionId is always set by jsonrpsee"); + let conn_id = ext + .get::() + .copied() + .expect("ConnectionId is always set by jsonrpsee"); // The operation ID must correlate to the same connection ID. if !self.rpc_connections.contains_identifier(conn_id, &operation_id) { diff --git a/substrate/client/rpc/src/utils.rs b/substrate/client/rpc/src/utils.rs index e05260e18fd6..bc566ed37f23 100644 --- a/substrate/client/rpc/src/utils.rs +++ b/substrate/client/rpc/src/utils.rs @@ -189,7 +189,7 @@ mod tests { async fn subscribe() -> Subscription { let mut module = RpcModule::new(()); module - .register_subscription("sub", "my_sub", "unsub", |_, pending, _| async move { + .register_subscription("sub", "my_sub", "unsub", |_, pending, _, _| async move { let stream = futures::stream::iter([0; 16]); pipe_from_stream(pending, stream).await; Ok(()) @@ -217,7 +217,7 @@ mod tests { let mut module = RpcModule::new(tx); module - .register_subscription("sub", "my_sub", "unsub", |_, pending, ctx| async move { + .register_subscription("sub", "my_sub", "unsub", |_, pending, ctx, _| async move { let stream = futures::stream::iter([0; 32]); pipe_from_stream(pending, stream).await; _ = ctx.unbounded_send(()); @@ -239,16 +239,21 @@ mod tests { let mut module = RpcModule::new(notify_tx); module - .register_subscription("sub", "my_sub", "unsub", |_, pending, notify_tx| async move { - // emulate empty stream for simplicity: otherwise we need some mechanism - // to sync buffer and channel send operations - let stream = futures::stream::empty::<()>(); - // this should exit immediately - pipe_from_stream(pending, stream).await; - // notify that the `pipe_from_stream` has returned - notify_tx.notify_one(); - Ok(()) - }) + .register_subscription( + "sub", + "my_sub", + "unsub", + |_, pending, notify_tx, _| async move { + // emulate empty stream for simplicity: otherwise we need some mechanism + // to sync buffer and channel send operations + let stream = futures::stream::empty::<()>(); + // this should exit immediately + pipe_from_stream(pending, stream).await; + // notify that the `pipe_from_stream` has returned + notify_tx.notify_one(); + Ok(()) + }, + ) .unwrap(); module.subscribe("sub", EmptyServerParams::new(), 1).await.unwrap(); From 369db7e42d44475d4580e16b912c246e399252f5 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Mon, 10 Jun 2024 17:41:49 +0200 Subject: [PATCH 05/24] jsonrpsee v0.23.1 --- Cargo.lock | 33 +++++++++---------- bridges/relays/client-substrate/Cargo.toml | 2 +- .../client/relay-chain-interface/Cargo.toml | 2 +- .../relay-chain-rpc-interface/Cargo.toml | 2 +- cumulus/polkadot-parachain/Cargo.toml | 2 +- cumulus/test/service/Cargo.toml | 2 +- polkadot/rpc/Cargo.toml | 2 +- substrate/bin/node/cli/Cargo.toml | 2 +- substrate/bin/node/rpc/Cargo.toml | 2 +- .../client/consensus/babe/rpc/Cargo.toml | 2 +- .../client/consensus/beefy/rpc/Cargo.toml | 2 +- .../client/consensus/grandpa/rpc/Cargo.toml | 2 +- .../client/consensus/manual-seal/Cargo.toml | 2 +- .../merkle-mountain-range/rpc/Cargo.toml | 2 +- substrate/client/rpc-api/Cargo.toml | 2 +- substrate/client/rpc-servers/Cargo.toml | 2 +- substrate/client/rpc-spec-v2/Cargo.toml | 4 +-- substrate/client/rpc/Cargo.toml | 2 +- substrate/client/service/Cargo.toml | 2 +- substrate/client/sync-state-rpc/Cargo.toml | 2 +- .../frame/transaction-payment/rpc/Cargo.toml | 2 +- .../frame/remote-externalities/Cargo.toml | 2 +- substrate/utils/frame/rpc/client/Cargo.toml | 2 +- .../rpc/state-trie-migration-rpc/Cargo.toml | 2 +- substrate/utils/frame/rpc/support/Cargo.toml | 4 +-- substrate/utils/frame/rpc/system/Cargo.toml | 2 +- templates/minimal/node/Cargo.toml | 2 +- templates/parachain/node/Cargo.toml | 2 +- templates/solochain/node/Cargo.toml | 2 +- 29 files changed, 46 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7498e3607be0..2d7866990450 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7234,9 +7234,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67210bd846b2dca59dc73f34717d6e1589305d506cdd6f14c849115d08e40876" +checksum = "95a130d27083a4001b7b2d72a19f08786299550f76c9bd5307498dce2c2b20fa" dependencies = [ "jsonrpsee-core", "jsonrpsee-http-client", @@ -7250,9 +7250,9 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c171d64176ae8f57eec75bca9f9dda2b2f746314adef9160a5bbbb2a7c82cb" +checksum = "039db9fe25cd63b7221c3f8788c1ef4ea07987d40ec25a1e7d7a3c3e3e3fd130" dependencies = [ "base64 0.22.1", "futures-util", @@ -7273,9 +7273,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e966c12c8b6c1790ce67683c792cea9dd250860df49f6b64f1b1ff6c6946850" +checksum = "21545a9445fbd582840ff5160a9a3e12b8e6da582151cdb07bde9a1970ba3a24" dependencies = [ "anyhow", "async-trait", @@ -7301,9 +7301,9 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0187f1969287e5890d84460fe9f6556d98231e70b06179d4416e5c8c47167d" +checksum = "fb25cab482c8512c4f3323a5c90b95a3b8f7c90681a87bf7a68b942d52f08933" dependencies = [ "async-trait", "base64 0.22.1", @@ -7326,9 +7326,9 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7af1b5071dc1c61b06900f8f3e17f886b1b08e926166e575018643879f63b6" +checksum = "c18184cd09b386feb18085609e8bf77bdc942482bdd82777b433b8d015edf561" dependencies = [ "heck 0.5.0", "proc-macro-crate 3.1.0", @@ -7339,9 +7339,9 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba63ec742f5f9c4016ca4c443d04dc3ca56e240a26ebe6e56609a5109bd9d13f" +checksum = "810f63eff0f78fa8d413d678c0e55b702e2ea61d4587774c0db4ea2fc554ef92" dependencies = [ "anyhow", "futures-util", @@ -7367,11 +7367,10 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "328c33717b7bdc4f47cdf31c21d5449c5b713a800cb05cb767841ccf2944f9d9" +checksum = "f511b714bca46f9a3e97c0e0eb21d2c112e83e444d2db535b5ec7093f5836d73" dependencies = [ - "anyhow", "beef", "http 1.1.0", "serde", @@ -7381,9 +7380,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb22661e1c018eb503d5a47be2d39a176de832b047d2757fa86b3d2b34fc84e" +checksum = "786c100eb67df2f2d863d231c2c6978bcf80ff4bf606ffc40e7e68ef562da7bf" dependencies = [ "http 1.1.0", "jsonrpsee-client-transport", diff --git a/bridges/relays/client-substrate/Cargo.toml b/bridges/relays/client-substrate/Cargo.toml index ea7e28c557bf..212059662268 100644 --- a/bridges/relays/client-substrate/Cargo.toml +++ b/bridges/relays/client-substrate/Cargo.toml @@ -15,7 +15,7 @@ async-std = { version = "1.9.0", features = ["attributes"] } async-trait = "0.1.79" codec = { package = "parity-scale-codec", version = "3.6.12" } futures = "0.3.30" -jsonrpsee = { version = "0.23", features = ["macros", "ws-client"] } +jsonrpsee = { version = "0.23.1", features = ["macros", "ws-client"] } log = { workspace = true } num-traits = "0.2" rand = "0.8.5" diff --git a/cumulus/client/relay-chain-interface/Cargo.toml b/cumulus/client/relay-chain-interface/Cargo.toml index 0866163d2e9b..f06216c010bc 100644 --- a/cumulus/client/relay-chain-interface/Cargo.toml +++ b/cumulus/client/relay-chain-interface/Cargo.toml @@ -22,5 +22,5 @@ sc-client-api = { path = "../../../substrate/client/api" } futures = "0.3.28" async-trait = "0.1.79" thiserror = { workspace = true } -jsonrpsee-core = "0.23" +jsonrpsee-core = "0.23.1" codec = { package = "parity-scale-codec", version = "3.6.12" } diff --git a/cumulus/client/relay-chain-rpc-interface/Cargo.toml b/cumulus/client/relay-chain-rpc-interface/Cargo.toml index 9975be433d9c..65d6b9e780cc 100644 --- a/cumulus/client/relay-chain-rpc-interface/Cargo.toml +++ b/cumulus/client/relay-chain-rpc-interface/Cargo.toml @@ -33,7 +33,7 @@ tokio-util = { version = "0.7.8", features = ["compat"] } futures = "0.3.28" futures-timer = "3.0.2" codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.23", features = ["ws-client"] } +jsonrpsee = { version = "0.23.1", features = ["ws-client"] } tracing = "0.1.37" async-trait = "0.1.79" url = "2.4.0" diff --git a/cumulus/polkadot-parachain/Cargo.toml b/cumulus/polkadot-parachain/Cargo.toml index 0cc641293747..ca12a5182a25 100644 --- a/cumulus/polkadot-parachain/Cargo.toml +++ b/cumulus/polkadot-parachain/Cargo.toml @@ -38,7 +38,7 @@ coretime-rococo-runtime = { path = "../parachains/runtimes/coretime/coretime-roc coretime-westend-runtime = { path = "../parachains/runtimes/coretime/coretime-westend" } bridge-hub-westend-runtime = { path = "../parachains/runtimes/bridge-hubs/bridge-hub-westend" } penpal-runtime = { path = "../parachains/runtimes/testing/penpal" } -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } people-rococo-runtime = { path = "../parachains/runtimes/people/people-rococo" } people-westend-runtime = { path = "../parachains/runtimes/people/people-westend" } parachains-common = { path = "../parachains/common" } diff --git a/cumulus/test/service/Cargo.toml b/cumulus/test/service/Cargo.toml index c2e198c02d54..cb333f835587 100644 --- a/cumulus/test/service/Cargo.toml +++ b/cumulus/test/service/Cargo.toml @@ -17,7 +17,7 @@ async-trait = "0.1.79" clap = { version = "4.5.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.6.12" } criterion = { version = "0.5.1", features = ["async_tokio"] } -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } rand = "0.8.5" serde = { features = ["derive"], workspace = true, default-features = true } serde_json = { workspace = true, default-features = true } diff --git a/polkadot/rpc/Cargo.toml b/polkadot/rpc/Cargo.toml index 0f67fa782f66..87d59205bbf7 100644 --- a/polkadot/rpc/Cargo.toml +++ b/polkadot/rpc/Cargo.toml @@ -10,7 +10,7 @@ description = "Polkadot specific RPC functionality." workspace = true [dependencies] -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } polkadot-primitives = { path = "../primitives" } sc-client-api = { path = "../../substrate/client/api" } sp-blockchain = { path = "../../substrate/primitives/blockchain" } diff --git a/substrate/bin/node/cli/Cargo.toml b/substrate/bin/node/cli/Cargo.toml index e54ead255b15..eebd01e28676 100644 --- a/substrate/bin/node/cli/Cargo.toml +++ b/substrate/bin/node/cli/Cargo.toml @@ -41,7 +41,7 @@ array-bytes = "6.1" clap = { version = "4.5.3", features = ["derive"], optional = true } codec = { package = "parity-scale-codec", version = "3.6.12" } serde = { features = ["derive"], workspace = true, default-features = true } -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } futures = "0.3.30" log = { workspace = true, default-features = true } rand = "0.8" diff --git a/substrate/bin/node/rpc/Cargo.toml b/substrate/bin/node/rpc/Cargo.toml index 431647d26a07..13678670f88a 100644 --- a/substrate/bin/node/rpc/Cargo.toml +++ b/substrate/bin/node/rpc/Cargo.toml @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } node-primitives = { path = "../primitives" } pallet-transaction-payment-rpc = { path = "../../../frame/transaction-payment/rpc" } mmr-rpc = { path = "../../../client/merkle-mountain-range/rpc" } diff --git a/substrate/client/consensus/babe/rpc/Cargo.toml b/substrate/client/consensus/babe/rpc/Cargo.toml index aefdb782d7f0..8ee6ed8421c0 100644 --- a/substrate/client/consensus/babe/rpc/Cargo.toml +++ b/substrate/client/consensus/babe/rpc/Cargo.toml @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } futures = "0.3.30" serde = { features = ["derive"], workspace = true, default-features = true } thiserror = { workspace = true } diff --git a/substrate/client/consensus/beefy/rpc/Cargo.toml b/substrate/client/consensus/beefy/rpc/Cargo.toml index 81cf6fb1d1d2..8f0fb5649ce1 100644 --- a/substrate/client/consensus/beefy/rpc/Cargo.toml +++ b/substrate/client/consensus/beefy/rpc/Cargo.toml @@ -14,7 +14,7 @@ workspace = true [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12", features = ["derive"] } futures = "0.3.30" -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } log = { workspace = true, default-features = true } parking_lot = "0.12.1" serde = { features = ["derive"], workspace = true, default-features = true } diff --git a/substrate/client/consensus/grandpa/rpc/Cargo.toml b/substrate/client/consensus/grandpa/rpc/Cargo.toml index 58a26ffab7a4..afea05ff70dd 100644 --- a/substrate/client/consensus/grandpa/rpc/Cargo.toml +++ b/substrate/client/consensus/grandpa/rpc/Cargo.toml @@ -15,7 +15,7 @@ workspace = true [dependencies] finality-grandpa = { version = "0.16.2", features = ["derive-codec"] } futures = "0.3.30" -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } log = { workspace = true, default-features = true } codec = { package = "parity-scale-codec", version = "3.6.12", features = ["derive"] } serde = { features = ["derive"], workspace = true, default-features = true } diff --git a/substrate/client/consensus/manual-seal/Cargo.toml b/substrate/client/consensus/manual-seal/Cargo.toml index 39fe100dcc10..b1d156ee34ff 100644 --- a/substrate/client/consensus/manual-seal/Cargo.toml +++ b/substrate/client/consensus/manual-seal/Cargo.toml @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } assert_matches = "1.3.0" async-trait = "0.1.79" codec = { package = "parity-scale-codec", version = "3.6.12" } diff --git a/substrate/client/merkle-mountain-range/rpc/Cargo.toml b/substrate/client/merkle-mountain-range/rpc/Cargo.toml index c03787eb7463..180696a51423 100644 --- a/substrate/client/merkle-mountain-range/rpc/Cargo.toml +++ b/substrate/client/merkle-mountain-range/rpc/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } serde = { features = ["derive"], workspace = true, default-features = true } sp-api = { path = "../../../primitives/api" } sp-blockchain = { path = "../../../primitives/blockchain" } diff --git a/substrate/client/rpc-api/Cargo.toml b/substrate/client/rpc-api/Cargo.toml index f7b8173de003..55d83c882f79 100644 --- a/substrate/client/rpc-api/Cargo.toml +++ b/substrate/client/rpc-api/Cargo.toml @@ -28,4 +28,4 @@ sp-core = { path = "../../primitives/core" } sp-rpc = { path = "../../primitives/rpc" } sp-runtime = { path = "../../primitives/runtime" } sp-version = { path = "../../primitives/version" } -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } diff --git a/substrate/client/rpc-servers/Cargo.toml b/substrate/client/rpc-servers/Cargo.toml index e0d977afd442..b93a84e8bb17 100644 --- a/substrate/client/rpc-servers/Cargo.toml +++ b/substrate/client/rpc-servers/Cargo.toml @@ -24,7 +24,7 @@ http = "1.1" hyper = "1.3" hyper-util = { version = "0.1", features = ["tokio", "service", "tokio", "server-auto"] } ip_network = "0.4.1" -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } log = { workspace = true, default-features = true } prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" } serde_json = { workspace = true, default-features = true } diff --git a/substrate/client/rpc-spec-v2/Cargo.toml b/substrate/client/rpc-spec-v2/Cargo.toml index 5fd03eb8c95d..d6efce5ad5b6 100644 --- a/substrate/client/rpc-spec-v2/Cargo.toml +++ b/substrate/client/rpc-spec-v2/Cargo.toml @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } # Internal chain structures for "chain_spec". sc-chain-spec = { path = "../chain-spec" } # Pool for submitting extrinsics required by "transaction" @@ -45,7 +45,7 @@ rand = "0.8.5" schnellru = "0.2.1" [dev-dependencies] -jsonrpsee = { version = "0.23", features = ["server", "ws-client"] } +jsonrpsee = { version = "0.23.1", features = ["server", "ws-client"] } serde_json = { workspace = true, default-features = true } tokio = { version = "1.22.0", features = ["macros"] } substrate-test-runtime-client = { path = "../../test-utils/runtime/client" } diff --git a/substrate/client/rpc/Cargo.toml b/substrate/client/rpc/Cargo.toml index e0f8775c43df..8edb95b22f14 100644 --- a/substrate/client/rpc/Cargo.toml +++ b/substrate/client/rpc/Cargo.toml @@ -18,7 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } futures = "0.3.30" -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } log = { workspace = true, default-features = true } parking_lot = "0.12.1" serde_json = { workspace = true, default-features = true } diff --git a/substrate/client/service/Cargo.toml b/substrate/client/service/Cargo.toml index cf8c6b43597f..c101454d813a 100644 --- a/substrate/client/service/Cargo.toml +++ b/substrate/client/service/Cargo.toml @@ -28,7 +28,7 @@ runtime-benchmarks = [ ] [dependencies] -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } thiserror = { workspace = true } futures = "0.3.30" rand = "0.8.5" diff --git a/substrate/client/sync-state-rpc/Cargo.toml b/substrate/client/sync-state-rpc/Cargo.toml index 7bfbbec790ae..be630af8aa63 100644 --- a/substrate/client/sync-state-rpc/Cargo.toml +++ b/substrate/client/sync-state-rpc/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } serde = { features = ["derive"], workspace = true, default-features = true } serde_json = { workspace = true, default-features = true } thiserror = { workspace = true } diff --git a/substrate/frame/transaction-payment/rpc/Cargo.toml b/substrate/frame/transaction-payment/rpc/Cargo.toml index 31f062837e74..3a8f2e7f7851 100644 --- a/substrate/frame/transaction-payment/rpc/Cargo.toml +++ b/substrate/frame/transaction-payment/rpc/Cargo.toml @@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } pallet-transaction-payment-rpc-runtime-api = { path = "runtime-api" } sp-api = { path = "../../../primitives/api" } sp-blockchain = { path = "../../../primitives/blockchain" } diff --git a/substrate/utils/frame/remote-externalities/Cargo.toml b/substrate/utils/frame/remote-externalities/Cargo.toml index c7e7b97e2e37..c6e4127d9276 100644 --- a/substrate/utils/frame/remote-externalities/Cargo.toml +++ b/substrate/utils/frame/remote-externalities/Cargo.toml @@ -15,7 +15,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.23", features = ["http-client"] } +jsonrpsee = { version = "0.23.1", features = ["http-client"] } codec = { package = "parity-scale-codec", version = "3.6.12" } log = { workspace = true, default-features = true } serde = { workspace = true, default-features = true } diff --git a/substrate/utils/frame/rpc/client/Cargo.toml b/substrate/utils/frame/rpc/client/Cargo.toml index ff5e4a176573..c75e8d85045d 100644 --- a/substrate/utils/frame/rpc/client/Cargo.toml +++ b/substrate/utils/frame/rpc/client/Cargo.toml @@ -15,7 +15,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.23", features = ["ws-client"] } +jsonrpsee = { version = "0.23.1", features = ["ws-client"] } sc-rpc-api = { path = "../../../../client/rpc-api" } async-trait = "0.1.79" serde = { workspace = true, default-features = true } diff --git a/substrate/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml b/substrate/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml index 6664788edd67..2ad6aef38eb3 100644 --- a/substrate/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml +++ b/substrate/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml @@ -24,7 +24,7 @@ sp-state-machine = { path = "../../../../primitives/state-machine" } sp-trie = { path = "../../../../primitives/trie" } trie-db = "0.29.0" -jsonrpsee = { version = "0.23", features = ["client-core", "macros", "server-core"] } +jsonrpsee = { version = "0.23.1", features = ["client-core", "macros", "server-core"] } # Substrate Dependencies sc-client-api = { path = "../../../../client/api" } diff --git a/substrate/utils/frame/rpc/support/Cargo.toml b/substrate/utils/frame/rpc/support/Cargo.toml index 41bc3068ba2c..6db1d8915cd0 100644 --- a/substrate/utils/frame/rpc/support/Cargo.toml +++ b/substrate/utils/frame/rpc/support/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.12" } -jsonrpsee = { version = "0.23", features = ["jsonrpsee-types"] } +jsonrpsee = { version = "0.23.1", features = ["jsonrpsee-types"] } serde = { workspace = true, default-features = true } frame-support = { path = "../../../../frame/support" } sc-rpc-api = { path = "../../../../client/rpc-api" } @@ -24,7 +24,7 @@ sp-storage = { path = "../../../../primitives/storage" } [dev-dependencies] scale-info = "2.11.1" -jsonrpsee = { version = "0.23", features = ["jsonrpsee-types", "ws-client"] } +jsonrpsee = { version = "0.23.1", features = ["jsonrpsee-types", "ws-client"] } tokio = "1.37" sp-core = { path = "../../../../primitives/core" } sp-runtime = { path = "../../../../primitives/runtime" } diff --git a/substrate/utils/frame/rpc/system/Cargo.toml b/substrate/utils/frame/rpc/system/Cargo.toml index 001d26aa5924..43adc6efcd94 100644 --- a/substrate/utils/frame/rpc/system/Cargo.toml +++ b/substrate/utils/frame/rpc/system/Cargo.toml @@ -19,7 +19,7 @@ targets = ["x86_64-unknown-linux-gnu"] futures = "0.3.30" codec = { package = "parity-scale-codec", version = "3.6.12" } docify = "0.2.0" -jsonrpsee = { version = "0.23.0", features = [ +jsonrpsee = { version = "0.23.1", features = [ "client-core", "macros", "server-core", diff --git a/templates/minimal/node/Cargo.toml b/templates/minimal/node/Cargo.toml index a1510d6fb811..57cb44ec29b9 100644 --- a/templates/minimal/node/Cargo.toml +++ b/templates/minimal/node/Cargo.toml @@ -18,7 +18,7 @@ docify = "0.2.0" clap = { version = "4.5.3", features = ["derive"] } futures = { version = "0.3.30", features = ["thread-pool"] } futures-timer = "3.0.1" -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } serde_json = { workspace = true, default-features = true } sc-cli = { path = "../../../substrate/client/cli" } diff --git a/templates/parachain/node/Cargo.toml b/templates/parachain/node/Cargo.toml index acff0bde0c40..bf4e3f8e5367 100644 --- a/templates/parachain/node/Cargo.toml +++ b/templates/parachain/node/Cargo.toml @@ -18,7 +18,7 @@ clap = { version = "4.5.3", features = ["derive"] } log = { workspace = true, default-features = true } codec = { package = "parity-scale-codec", version = "3.6.12" } serde = { features = ["derive"], workspace = true, default-features = true } -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } futures = "0.3.28" serde_json = { workspace = true, default-features = true } docify = "0.2.8" diff --git a/templates/solochain/node/Cargo.toml b/templates/solochain/node/Cargo.toml index 2a0b8902c35e..b6815a2696b7 100644 --- a/templates/solochain/node/Cargo.toml +++ b/templates/solochain/node/Cargo.toml @@ -18,7 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"] clap = { version = "4.5.3", features = ["derive"] } futures = { version = "0.3.30", features = ["thread-pool"] } serde_json = { workspace = true, default-features = true } -jsonrpsee = { version = "0.23", features = ["server"] } +jsonrpsee = { version = "0.23.1", features = ["server"] } # substrate client sc-cli = { path = "../../../substrate/client/cli" } From a2418a2da7a3c73e7deb11d18297903952c0bd0e Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 12 Jun 2024 14:18:23 +0200 Subject: [PATCH 06/24] remove needless deps --- Cargo.lock | 2 -- substrate/client/rpc-servers/Cargo.toml | 2 -- substrate/client/rpc-servers/src/lib.rs | 3 ++- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7dc680498dc2..14109c0a2325 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17986,13 +17986,11 @@ dependencies = [ name = "sc-rpc-server" version = "11.0.0" dependencies = [ - "anyhow", "forwarded-header-value", "futures", "governor", "http 1.1.0", "hyper 1.3.1", - "hyper-util", "ip_network", "jsonrpsee", "log", diff --git a/substrate/client/rpc-servers/Cargo.toml b/substrate/client/rpc-servers/Cargo.toml index b93a84e8bb17..167d3a117a74 100644 --- a/substrate/client/rpc-servers/Cargo.toml +++ b/substrate/client/rpc-servers/Cargo.toml @@ -16,13 +16,11 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -anyhow = "1" forwarded-header-value = "0.1.1" futures = "0.3.30" governor = "0.6.0" http = "1.1" hyper = "1.3" -hyper-util = { version = "0.1", features = ["tokio", "service", "tokio", "server-auto"] } ip_network = "0.4.1" jsonrpsee = { version = "0.23.1", features = ["server"] } log = { workspace = true, default-features = true } diff --git a/substrate/client/rpc-servers/src/lib.rs b/substrate/client/rpc-servers/src/lib.rs index c5e5c2657e16..70bc82f3cda1 100644 --- a/substrate/client/rpc-servers/src/lib.rs +++ b/substrate/client/rpc-servers/src/lib.rs @@ -26,6 +26,7 @@ pub mod utils; use std::{error::Error as StdError, net::SocketAddr, num::NonZeroU32, sync::Arc, time::Duration}; use jsonrpsee::{ + core::BoxError, server::{ middleware::http::ProxyGetRequestLayer, serve_with_graceful_shutdown, stop_channel, ws, PingConfig, StopHandle, TowerServiceBuilder, @@ -244,7 +245,7 @@ where // https://github.com/rust-lang/rust/issues/102211 the error type can't be inferred // to be `Box` so we need to convert it to // a concrete type as workaround. - svc.call(req).await.map_err(|e| anyhow::anyhow!("{:?}", e)) + svc.call(req).await.map_err(|e| BoxError::from(e)) } }); From f3df0da5fbe070659100eda68936638797725808 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 19 Jun 2024 10:27:17 +0200 Subject: [PATCH 07/24] fix bad merge --- bridges/relays/client-substrate/src/client/subscription.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bridges/relays/client-substrate/src/client/subscription.rs b/bridges/relays/client-substrate/src/client/subscription.rs index 43a46573f987..9f08097cb583 100644 --- a/bridges/relays/client-substrate/src/client/subscription.rs +++ b/bridges/relays/client-substrate/src/client/subscription.rs @@ -21,7 +21,6 @@ use async_std::{ stream::StreamExt, }; use futures::{FutureExt, Stream}; -use jsonrpsee::core::ClientError; use sp_runtime::DeserializeOwned; use std::{ fmt::Debug, @@ -143,7 +142,7 @@ impl Subscription { /// Create new forwarded subscription. pub fn new_forwarded( desc: StreamDescription, - subscription: impl Stream> + Unpin + Send + 'static, + subscription: impl Stream> + Unpin + Send + 'static, ) -> Self { Self { desc: desc.clone(), From 0b0cabe36e0fef74610cd6041bb1f028e314c15e Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 19 Jun 2024 10:36:52 +0200 Subject: [PATCH 08/24] add prdoc --- prdoc/pr_4730.prdoc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 prdoc/pr_4730.prdoc diff --git a/prdoc/pr_4730.prdoc b/prdoc/pr_4730.prdoc new file mode 100644 index 000000000000..1fa639ad27b2 --- /dev/null +++ b/prdoc/pr_4730.prdoc @@ -0,0 +1,19 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: rpc upgrade jsonrpsee to v0.23.1 + +doc: + - audience: Node Dev + description: | + Upgrade the rpc library jsonrpsee to v0.23.1 to utilize: + + - Add Extensions which we now is using to get the connection id (used by the rpc spec v2) + - Update hyper to v1.0, http v1.0, soketto and related crates (hyper::service::make_service_fn is removed) + - The subscription API for the client is modified to know why a subscription was closed. + +crates: + - name: sc-rpc-spec-v2 + bump: major + - name: sc-rpc-server + bump: patch From 0237951160fb88faf0593542735b0c4bb0e530bd Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 19 Jun 2024 10:45:34 +0200 Subject: [PATCH 09/24] bridges: add `serde_json` dependency --- Cargo.lock | 1 + bridges/relays/client-substrate/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 5833f7c14e7c..d2dc1b2b23b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16089,6 +16089,7 @@ dependencies = [ "sc-rpc-api", "sc-transaction-pool-api", "scale-info", + "serde_json", "sp-consensus-grandpa", "sp-core", "sp-rpc", diff --git a/bridges/relays/client-substrate/Cargo.toml b/bridges/relays/client-substrate/Cargo.toml index cc40d8e74c3c..be5a71f8ced8 100644 --- a/bridges/relays/client-substrate/Cargo.toml +++ b/bridges/relays/client-substrate/Cargo.toml @@ -19,6 +19,7 @@ jsonrpsee = { version = "0.23.1", features = ["macros", "ws-client"] } log = { workspace = true } num-traits = "0.2" rand = "0.8.5" +serde_json = { workspace = true } scale-info = { version = "2.11.1", features = ["derive"] } tokio = { version = "1.37", features = ["rt-multi-thread"] } thiserror = { workspace = true } From 0f90c4ed2593e3ad2defa0258f8893ebfd92d715 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 19 Jun 2024 11:19:32 +0200 Subject: [PATCH 10/24] fix prdoc --- prdoc/pr_4730.prdoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/prdoc/pr_4730.prdoc b/prdoc/pr_4730.prdoc index 1fa639ad27b2..bdac7d0e9abd 100644 --- a/prdoc/pr_4730.prdoc +++ b/prdoc/pr_4730.prdoc @@ -14,6 +14,10 @@ doc: crates: - name: sc-rpc-spec-v2 - bump: major + bump: patch + - name: sc-rpc + bump: patch - name: sc-rpc-server bump: patch + - name: cumulus-relay-chain-rpc-interface + bump: patch \ No newline at end of file From 3115029a9f2e00a9eb53c61ac96af6f7e36d0dc0 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 19 Jun 2024 11:46:24 +0200 Subject: [PATCH 11/24] fix prdoc again --- prdoc/pr_4730.prdoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/prdoc/pr_4730.prdoc b/prdoc/pr_4730.prdoc index bdac7d0e9abd..9af14534bcbd 100644 --- a/prdoc/pr_4730.prdoc +++ b/prdoc/pr_4730.prdoc @@ -20,4 +20,6 @@ crates: - name: sc-rpc-server bump: patch - name: cumulus-relay-chain-rpc-interface - bump: patch \ No newline at end of file + bump: patch + - name: frame-remote-externalities + bump: patch From f61b3ce84be4064e85d98ffb9edc1b0af530f2db Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 21 Jun 2024 14:47:22 +0200 Subject: [PATCH 12/24] Update substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- .../client/rpc-spec-v2/src/transaction/transaction_broadcast.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs index ea6592221bf4..a463f546cf03 100644 --- a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs +++ b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs @@ -126,7 +126,7 @@ where let conn_id = ext .get::() .copied() - .expect("ConnectionId is always set by jsonrpsee"); + .expect("ConnectionId is always set by jsonrpsee; qed"); // The unique ID of this operation. let id = self.generate_unique_id(); From e3f02ce46e0f732af84f59de214e4cbcea4af057 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 21 Jun 2024 14:47:28 +0200 Subject: [PATCH 13/24] Update substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index 0a3d2a4a9ee1..4c8f7ecabb15 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -583,7 +583,7 @@ where let conn_id = ext .get::() .copied() - .expect("ConnectionId is always set by jsonrpsee"); + .expect("ConnectionId is always set by jsonrpsee; qed"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) From 45667bc5f29bd906f447f991504ba10e99141639 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 21 Jun 2024 14:47:35 +0200 Subject: [PATCH 14/24] Update substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index 4c8f7ecabb15..6ffb14d321c7 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -384,7 +384,7 @@ where let conn_id = ext .get::() .copied() - .expect("ConnectionId is always set by jsonrpsee"); + .expect("ConnectionId is always set by jsonrpsee; qed"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or From 919065c1f851123d533106d1ff65eb645ce42386 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 21 Jun 2024 14:47:41 +0200 Subject: [PATCH 15/24] Update substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index 6ffb14d321c7..5b83ca5390da 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -545,7 +545,7 @@ where let conn_id = ext .get::() .copied() - .expect("ConnectionId is always set by jsonrpsee"); + .expect("ConnectionId is always set by jsonrpsee; qed"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()); From 30dc44a0825555414eb18938d429c020e795e40e Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 21 Jun 2024 14:47:47 +0200 Subject: [PATCH 16/24] Update substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index 5b83ca5390da..818705ac7a9d 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -611,7 +611,7 @@ where let conn_id = ext .get::() .copied() - .expect("ConnectionId is always set by jsonrpsee"); + .expect("ConnectionId is always set by jsonrpsee; qed"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(()) From b83f1f952d6f2a6272b2e10df202d3ba96c02f3c Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 21 Jun 2024 14:47:53 +0200 Subject: [PATCH 17/24] Update substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index 818705ac7a9d..27db10223ed2 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -472,7 +472,7 @@ where let conn_id = ext .get::() .copied() - .expect("ConnectionId is always set by jsonrpsee"); + .expect("ConnectionId is always set by jsonrpsee; qed"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or From fc80004cda45aeb91258f819285c4c96d49ad149 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 21 Jun 2024 14:47:59 +0200 Subject: [PATCH 18/24] Update substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- .../client/rpc-spec-v2/src/transaction/transaction_broadcast.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs index a463f546cf03..2fd4ce245456 100644 --- a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs +++ b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs @@ -250,7 +250,7 @@ where let conn_id = ext .get::() .copied() - .expect("ConnectionId is always set by jsonrpsee"); + .expect("ConnectionId is always set by jsonrpsee; qed"); // The operation ID must correlate to the same connection ID. if !self.rpc_connections.contains_identifier(conn_id, &operation_id) { From 526ff76d43a1a8cba7bd344ee8bdf8901cacf68b Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 21 Jun 2024 14:48:05 +0200 Subject: [PATCH 19/24] Update substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index 27db10223ed2..d2878770ac04 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -258,7 +258,7 @@ where let conn_id = ext .get::() .copied() - .expect("ConnectionId is always set by jsonrpsee"); + .expect("ConnectionId is always set by jsonrpsee; qed"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { // The spec says to return `LimitReached` if the follow subscription is invalid or From cc99e4079b173be900f04bab162feca14d69aa1d Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 21 Jun 2024 14:48:12 +0200 Subject: [PATCH 20/24] Update substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs index d2878770ac04..a056b4d437c8 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/chain_head.rs @@ -344,7 +344,7 @@ where let conn_id = ext .get::() .copied() - .expect("ConnectionId is always set by jsonrpsee"); + .expect("ConnectionId is always set by jsonrpsee; qed"); if !self.subscriptions.contains_subscription(conn_id, &follow_subscription) { return Ok(None); From 1ec6466099500232fb4a89bf69c72b0f1f3f8965 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Tue, 25 Jun 2024 21:24:52 +0200 Subject: [PATCH 21/24] fix bad merge --- Cargo.lock | 1 + bridges/relays/client-substrate/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 00ecc1ce7524..8c8b2708aeb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16290,6 +16290,7 @@ dependencies = [ "sc-rpc-api", "sc-transaction-pool-api", "scale-info", + "serde_json", "sp-consensus-grandpa", "sp-core", "sp-rpc", diff --git a/bridges/relays/client-substrate/Cargo.toml b/bridges/relays/client-substrate/Cargo.toml index 6db4f3e9ef6d..66501d03691a 100644 --- a/bridges/relays/client-substrate/Cargo.toml +++ b/bridges/relays/client-substrate/Cargo.toml @@ -19,6 +19,7 @@ jsonrpsee = { features = ["macros", "ws-client"], workspace = true } log = { workspace = true } num-traits = { workspace = true, default-features = true } rand = { workspace = true, default-features = true } +serde_json = { workspace = true } scale-info = { features = ["derive"], workspace = true, default-features = true } tokio = { features = ["rt-multi-thread"], workspace = true, default-features = true } thiserror = { workspace = true } From 2d310ff1478f0ed0f4f0cb921b3b821e8c84dd20 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 26 Jun 2024 09:40:37 +0200 Subject: [PATCH 22/24] fix taplo fmt --- substrate/client/rpc-servers/Cargo.toml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/substrate/client/rpc-servers/Cargo.toml b/substrate/client/rpc-servers/Cargo.toml index d40e64d367f1..ce73bc80188a 100644 --- a/substrate/client/rpc-servers/Cargo.toml +++ b/substrate/client/rpc-servers/Cargo.toml @@ -19,9 +19,6 @@ targets = ["x86_64-unknown-linux-gnu"] forwarded-header-value = { workspace = true } futures = { workspace = true } governor = { workspace = true } -http = "1.1" -http-body-util = "0.1.2" -hyper = "1.3" ip_network = { workspace = true } jsonrpsee = { features = ["server"], workspace = true } log = { workspace = true, default-features = true } @@ -29,5 +26,11 @@ prometheus-endpoint = { workspace = true, default-features = true } serde = { workspace = true } serde_json = { workspace = true, default-features = true } tokio = { features = ["parking_lot"], workspace = true, default-features = true } -tower = { version = "0.4.13", features = ["util"]} + +# Dependencies outside of the polkadot-sdk workspace +# which requires hyper v1.0 and http v1.0 +http = "1.1" +http-body-util = "0.1.2" +hyper = "1.3" +tower = { version = "0.4.13", features = ["util"] } tower-http = { version = "0.5.2", features = ["cors"] } From b63698c6d0c69a0931a7f323b0b00b9919d0c7c6 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 26 Jun 2024 09:51:32 +0200 Subject: [PATCH 23/24] move more deps to workspace --- Cargo.toml | 3 ++- substrate/client/rpc-servers/Cargo.toml | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d1f3bd69547c..c874db4aaf2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -780,6 +780,7 @@ hkdf = { version = "0.12.0" } hmac = { version = "0.12.1" } honggfuzz = { version = "0.5.55" } http = { version = "0.2.8" } +http-body-util = { version = "0.1.2" } hyper = { version = "0.14.27", default-features = false } hyper-rustls = { version = "0.24.0" } impl-serde = { version = "0.4.0", default-features = false } @@ -1298,7 +1299,7 @@ tokio-util = { version = "0.7.8" } toml = { version = "0.8.8" } toml_edit = { version = "0.19" } tower = { version = "0.4.13" } -tower-http = { version = "0.4.0" } +tower-http = { version = "0.5.2" } tracing = { version = "0.1.37", default-features = false } tracing-core = { version = "0.1.32", default-features = false } tracing-futures = { version = "0.2.4" } diff --git a/substrate/client/rpc-servers/Cargo.toml b/substrate/client/rpc-servers/Cargo.toml index ce73bc80188a..7986408d2b2f 100644 --- a/substrate/client/rpc-servers/Cargo.toml +++ b/substrate/client/rpc-servers/Cargo.toml @@ -19,6 +19,7 @@ targets = ["x86_64-unknown-linux-gnu"] forwarded-header-value = { workspace = true } futures = { workspace = true } governor = { workspace = true } +http-body-util = { workspace = true } ip_network = { workspace = true } jsonrpsee = { features = ["server"], workspace = true } log = { workspace = true, default-features = true } @@ -26,11 +27,10 @@ prometheus-endpoint = { workspace = true, default-features = true } serde = { workspace = true } serde_json = { workspace = true, default-features = true } tokio = { features = ["parking_lot"], workspace = true, default-features = true } +tower = { workspace = true, features = ["util"] } +tower-http = { workspace = true, features = ["cors"] } # Dependencies outside of the polkadot-sdk workspace -# which requires hyper v1.0 and http v1.0 +# which requires hyper v1 and http v1 http = "1.1" -http-body-util = "0.1.2" hyper = "1.3" -tower = { version = "0.4.13", features = ["util"] } -tower-http = { version = "0.5.2", features = ["cors"] } From f9081de08104f21df6a5168f6deb7e10cfc0a70f Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 26 Jun 2024 11:51:22 +0200 Subject: [PATCH 24/24] jsonrpsee v0.23.2 --- Cargo.lock | 32 ++++++++++++++++---------------- Cargo.toml | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f935b562ea0b..537adb68792c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7351,9 +7351,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a130d27083a4001b7b2d72a19f08786299550f76c9bd5307498dce2c2b20fa" +checksum = "62b089779ad7f80768693755a031cc14a7766aba707cbe886674e3f79e9b7e47" dependencies = [ "jsonrpsee-core", "jsonrpsee-http-client", @@ -7367,9 +7367,9 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039db9fe25cd63b7221c3f8788c1ef4ea07987d40ec25a1e7d7a3c3e3e3fd130" +checksum = "08163edd8bcc466c33d79e10f695cdc98c00d1e6ddfb95cec41b6b0279dd5432" dependencies = [ "base64 0.22.1", "futures-util", @@ -7390,9 +7390,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21545a9445fbd582840ff5160a9a3e12b8e6da582151cdb07bde9a1970ba3a24" +checksum = "79712302e737d23ca0daa178e752c9334846b08321d439fd89af9a384f8c830b" dependencies = [ "anyhow", "async-trait", @@ -7418,9 +7418,9 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb25cab482c8512c4f3323a5c90b95a3b8f7c90681a87bf7a68b942d52f08933" +checksum = "2d90064e04fb9d7282b1c71044ea94d0bbc6eff5621c66f1a0bce9e9de7cf3ac" dependencies = [ "async-trait", "base64 0.22.1", @@ -7443,9 +7443,9 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c18184cd09b386feb18085609e8bf77bdc942482bdd82777b433b8d015edf561" +checksum = "7895f186d5921065d96e16bd795e5ca89ac8356ec423fafc6e3d7cf8ec11aee4" dependencies = [ "heck 0.5.0", "proc-macro-crate 3.1.0", @@ -7456,9 +7456,9 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "810f63eff0f78fa8d413d678c0e55b702e2ea61d4587774c0db4ea2fc554ef92" +checksum = "654afab2e92e5d88ebd8a39d6074483f3f2bfdf91c5ac57fe285e7127cdd4f51" dependencies = [ "anyhow", "futures-util", @@ -7484,9 +7484,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f511b714bca46f9a3e97c0e0eb21d2c112e83e444d2db535b5ec7093f5836d73" +checksum = "d9c465fbe385238e861fdc4d1c85e04ada6c1fd246161d26385c1b311724d2af" dependencies = [ "beef", "http 1.1.0", @@ -7497,9 +7497,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786c100eb67df2f2d863d231c2c6978bcf80ff4bf606ffc40e7e68ef562da7bf" +checksum = "1c28759775f5cb2f1ea9667672d3fe2b0e701d1f4b7b67954e60afe7fd058b5e" dependencies = [ "http 1.1.0", "jsonrpsee-client-transport", diff --git a/Cargo.toml b/Cargo.toml index c874db4aaf2e..9ddfedd5155a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -794,8 +794,8 @@ is_executable = { version = "1.0.1" } isahc = { version = "1.2" } itertools = { version = "0.11" } jsonpath_lib = { version = "0.3" } -jsonrpsee = { version = "0.23.1" } -jsonrpsee-core = { version = "0.23.1" } +jsonrpsee = { version = "0.23.2" } +jsonrpsee-core = { version = "0.23.2" } k256 = { version = "0.13.3", default-features = false } kitchensink-runtime = { path = "substrate/bin/node/runtime" } kvdb = { version = "0.13.0" }