diff --git a/Cargo.lock b/Cargo.lock index 6add8fa..0c1b40b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -475,7 +475,7 @@ dependencies = [ "serde_json", "tokio", "tokio-stream", - "tower 0.5.2", + "tower", "tracing", ] @@ -521,7 +521,7 @@ dependencies = [ "serde_json", "tokio", "tokio-stream", - "tower 0.5.2", + "tower", "tracing", "url", "wasmtimer", @@ -778,7 +778,7 @@ dependencies = [ "serde_json", "thiserror 2.0.12", "tokio", - "tower 0.5.2", + "tower", "tracing", "url", "wasmtimer", @@ -794,7 +794,7 @@ dependencies = [ "alloy-transport", "reqwest", "serde_json", - "tower 0.5.2", + "tower", "tracing", "url", ] @@ -1069,7 +1069,7 @@ dependencies = [ [[package]] name = "assertion-da-client" -version = "0.1.2" +version = "0.1.3" dependencies = [ "alloy 0.11.1", "assertion-da-core", @@ -1077,21 +1077,22 @@ dependencies = [ "bincode", "bollard", "http", - "jsonrpsee", "mockall", "reqwest", + "serde", "serde_json", "sled", "tempfile", "thiserror 2.0.12", "tokio", "tokio-util 0.6.10", + "url", "wiremock", ] [[package]] name = "assertion-da-core" -version = "0.1.2" +version = "0.1.3" dependencies = [ "alloy 0.11.1", "serde", @@ -1099,7 +1100,7 @@ dependencies = [ [[package]] name = "assertion-da-server" -version = "0.1.2" +version = "0.1.3" dependencies = [ "alloy 0.11.1", "alloy-dyn-abi", @@ -1465,12 +1466,6 @@ dependencies = [ "shlex", ] -[[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" @@ -1486,6 +1481,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chrono" version = "0.4.40" @@ -1565,16 +1566,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" -[[package]] -name = "combine" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "concurrent-map" version = "5.0.37" @@ -2256,16 +2247,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" -[[package]] -name = "futures-timer" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" -dependencies = [ - "gloo-timers", - "send_wrapper 0.4.0", -] - [[package]] name = "futures-util" version = "0.3.31" @@ -2321,9 +2302,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi", "wasi 0.14.2+wasi-0.2.4", + "wasm-bindgen", ] [[package]] @@ -2338,52 +2321,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" -[[package]] -name = "gloo-net" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06f627b1a58ca3d42b45d6104bf1e1a03799df472df00988b6ba21accc10580" -dependencies = [ - "futures-channel", - "futures-core", - "futures-sink", - "gloo-utils", - "http", - "js-sys", - "pin-project", - "serde", - "serde_json", - "thiserror 1.0.69", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "gloo-utils" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa" -dependencies = [ - "js-sys", - "serde", - "serde_json", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "group" version = "0.13.0" @@ -2583,13 +2520,13 @@ dependencies = [ "http", "hyper", "hyper-util", - "log", "rustls", "rustls-native-certs", "rustls-pki-types", "tokio", "tokio-rustls", "tower-service", + "webpki-roots", ] [[package]] @@ -2934,28 +2871,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" -[[package]] -name = "jni" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" -dependencies = [ - "cesu8", - "cfg-if", - "combine", - "jni-sys", - "log", - "thiserror 1.0.69", - "walkdir", - "windows-sys 0.45.0", -] - -[[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.32" @@ -2975,162 +2890,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonrpsee" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b26c20e2178756451cfeb0661fb74c47dd5988cb7e3939de7e9241fd604d42" -dependencies = [ - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-http-client", - "jsonrpsee-server", - "jsonrpsee-types", - "jsonrpsee-wasm-client", - "jsonrpsee-ws-client", - "tokio", -] - -[[package]] -name = "jsonrpsee-client-transport" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bacb85abf4117092455e1573625e21b8f8ef4dec8aff13361140b2dc266cdff2" -dependencies = [ - "base64", - "futures-channel", - "futures-util", - "gloo-net", - "http", - "jsonrpsee-core", - "pin-project", - "rustls", - "rustls-pki-types", - "rustls-platform-verifier", - "soketto", - "thiserror 1.0.69", - "tokio", - "tokio-rustls", - "tokio-util 0.7.15", - "tracing", - "url", -] - -[[package]] -name = "jsonrpsee-core" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456196007ca3a14db478346f58c7238028d55ee15c1df15115596e411ff27925" -dependencies = [ - "async-trait", - "bytes", - "futures-timer", - "futures-util", - "http", - "http-body", - "http-body-util", - "jsonrpsee-types", - "parking_lot", - "pin-project", - "rand 0.8.5", - "rustc-hash 2.1.1", - "serde", - "serde_json", - "thiserror 1.0.69", - "tokio", - "tokio-stream", - "tracing", - "wasm-bindgen-futures", -] - -[[package]] -name = "jsonrpsee-http-client" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c872b6c9961a4ccc543e321bb5b89f6b2d2c7fe8b61906918273a3333c95400c" -dependencies = [ - "async-trait", - "base64", - "http-body", - "hyper", - "hyper-rustls", - "hyper-util", - "jsonrpsee-core", - "jsonrpsee-types", - "rustls", - "rustls-platform-verifier", - "serde", - "serde_json", - "thiserror 1.0.69", - "tokio", - "tower 0.4.13", - "tracing", - "url", -] - -[[package]] -name = "jsonrpsee-server" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e363146da18e50ad2b51a0a7925fc423137a0b1371af8235b1c231a0647328" -dependencies = [ - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-util", - "jsonrpsee-core", - "jsonrpsee-types", - "pin-project", - "route-recognizer", - "serde", - "serde_json", - "soketto", - "thiserror 1.0.69", - "tokio", - "tokio-stream", - "tokio-util 0.7.15", - "tower 0.4.13", - "tracing", -] - -[[package]] -name = "jsonrpsee-types" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a8e70baf945b6b5752fc8eb38c918a48f1234daf11355e07106d963f860089" -dependencies = [ - "http", - "serde", - "serde_json", - "thiserror 1.0.69", -] - -[[package]] -name = "jsonrpsee-wasm-client" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6558a9586cad43019dafd0b6311d0938f46efc116b34b28c74778bc11a2edf6" -dependencies = [ - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-types", -] - -[[package]] -name = "jsonrpsee-ws-client" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b3323d890aa384f12148e8d2a1fd18eb66e9e7e825f9de4fa53bcc19b93eef" -dependencies = [ - "http", - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-types", - "url", -] - [[package]] name = "k256" version = "0.13.4" @@ -3315,6 +3074,12 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + [[package]] name = "macro-string" version = "0.1.4" @@ -4045,6 +3810,61 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quinn" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash 2.1.1", + "rustls", + "socket2", + "thiserror 2.0.12", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49df843a9161c85bb8aae55f101bc0bac8bcafd637a620d9122fd7e0b2f7422e" +dependencies = [ + "bytes", + "getrandom 0.3.2", + "lru-slab", + "rand 0.9.0", + "ring", + "rustc-hash 2.1.1", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.12", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee4e529991f949c5e25755532370b8af5d114acae52326361d68d47af64aa842" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.52.0", +] + [[package]] name = "quote" version = "1.0.40" @@ -4338,7 +4158,10 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "quinn", + "rustls", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", @@ -4346,12 +4169,14 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", - "tower 0.5.2", + "tokio-rustls", + "tower", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "windows-registry", ] @@ -4389,12 +4214,6 @@ dependencies = [ "rustc-hex", ] -[[package]] -name = "route-recognizer" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" - [[package]] name = "ruint" version = "1.14.0" @@ -4525,7 +4344,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" dependencies = [ "aws-lc-rs", - "log", "once_cell", "ring", "rustls-pki-types", @@ -4560,34 +4378,10 @@ name = "rustls-pki-types" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" - -[[package]] -name = "rustls-platform-verifier" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5467026f437b4cb2a533865eaa73eb840019a0916f4b9ec563c6e617e086c9" dependencies = [ - "core-foundation 0.10.0", - "core-foundation-sys", - "jni", - "log", - "once_cell", - "rustls", - "rustls-native-certs", - "rustls-platform-verifier-android", - "rustls-webpki", - "security-framework 3.2.0", - "security-framework-sys", - "webpki-root-certs", - "windows-sys 0.59.0", + "web-time", ] -[[package]] -name = "rustls-platform-verifier-android" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" - [[package]] name = "rustls-webpki" version = "0.103.0" @@ -4624,15 +4418,6 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "schannel" version = "0.1.27" @@ -4723,12 +4508,6 @@ dependencies = [ "pest", ] -[[package]] -name = "send_wrapper" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" - [[package]] name = "send_wrapper" version = "0.6.0" @@ -4998,22 +4777,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "soketto" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e859df029d160cb88608f5d7df7fb4753fd20fdfb4de5644f3d8b8440841721" -dependencies = [ - "base64", - "bytes", - "futures", - "http", - "httparse", - "log", - "rand 0.8.5", - "sha1", -] - [[package]] name = "spki" version = "0.7.3" @@ -5320,6 +5083,21 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.44.1" @@ -5419,7 +5197,6 @@ checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", "pin-project-lite", "tokio", @@ -5463,21 +5240,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tower" version = "0.5.2" @@ -5511,7 +5273,6 @@ version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -5760,16 +5521,6 @@ dependencies = [ "libc", ] -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "want" version = "0.3.1" @@ -5899,15 +5650,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki-root-certs" -version = "0.26.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09aed61f5e8d2c18344b3faa33a4c837855fe56642757754775548fee21386c4" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "webpki-roots" version = "0.26.8" @@ -5951,15 +5693,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -6010,15 +5743,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.52.0" @@ -6037,21 +5761,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-targets" version = "0.52.6" @@ -6084,12 +5793,6 @@ dependencies = [ "windows_x86_64_msvc 0.53.0", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -6102,12 +5805,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -6120,12 +5817,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -6150,12 +5841,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -6168,12 +5853,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -6186,12 +5865,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -6204,12 +5877,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -6288,7 +5955,7 @@ dependencies = [ "log", "pharos", "rustc_version 0.4.1", - "send_wrapper 0.6.0", + "send_wrapper", "thiserror 1.0.69", "wasm-bindgen", "wasm-bindgen-futures", diff --git a/Cargo.toml b/Cargo.toml index 0045230..ab40ee7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = [ "crates/client","crates/server", "crates/core"] [workspace.package] -version = "0.1.2" +version = "0.1.3" [workspace.dependencies] alloy = { version = "0.11.1", features = ["full", "node-bindings", "json-rpc", "rpc-client", "signer-local", "k256"] } diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index 5715057..6bfbe1c 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -3,20 +3,21 @@ name = "assertion-da-client" version.workspace = true edition = "2024" +[[example]] +name = "test_http_client" +path = "../../examples/test_http_client.rs" + [dependencies] tokio.workspace = true tokio-util.workspace = true -jsonrpsee = { version = "0.24.7", features = [ - "client", - "http-client", - "server", -] } +reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false } http = "1.1.0" serde_json = "1.0" +serde = { version = "1.0", features = ["derive"] } thiserror = "2" alloy.workspace = true assertion-da-core = { path = "../core" } - +url = "2.5" [dev-dependencies] assertion-da-server = { path = "../server" } @@ -26,5 +27,4 @@ sled.workspace = true tempfile.workspace = true mockall.workspace = true wiremock.workspace = true -reqwest = { version = "0.12", features = ["json"] } bollard.workspace = true diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs index e9133bb..77afee4 100644 --- a/crates/client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -1,20 +1,18 @@ use alloy::primitives::B256; - -use jsonrpsee::{ - core::client::ClientT, - http_client::{ - HttpClient, - HttpClientBuilder, - }, +use http::header; +use reqwest::Client; +use serde::{ + Deserialize, + Serialize, }; +use url::Url; + pub use assertion_da_core::{ DaFetchResponse, DaSubmission, DaSubmissionResponse, }; -use http::header; -pub use jsonrpsee::core::client::Error as ClientError; /// A client for interacting with the DA layer /// This client is responsible for fetching bytecode from the DA layer @@ -32,34 +30,147 @@ pub use jsonrpsee::core::client::Error as ClientError; /// } #[derive(Debug)] pub struct DaClient { - client: HttpClient, + client: Client, + base_url: Url, + request_id: std::sync::atomic::AtomicU64, } #[derive(Debug, thiserror::Error)] pub enum DaClientError { - #[error("Client error: {0}")] - ClientError(#[from] ClientError), + #[error("HTTP client error: {0}")] + ReqwestError(#[from] reqwest::Error), + #[error("URL parse error: {0}")] + UrlParseError(#[from] url::ParseError), + #[error("JSON serialization error: {0}")] + JsonError(#[from] serde_json::Error), + #[error("JSON-RPC error code {code}: {message}")] + JsonRpcError { code: i32, message: String }, #[error("Invalid response: {0}")] InvalidResponse(String), } +/// JSON-RPC request structure +#[derive(Debug, Serialize)] +struct JsonRpcRequest { + jsonrpc: String, + method: String, + params: T, + id: u64, +} + +/// JSON-RPC response structure for successful responses +#[derive(Debug, Deserialize)] +struct JsonRpcResponse { + jsonrpc: String, + result: Option, + error: Option, + id: u64, +} + +/// JSON-RPC error structure +#[derive(Debug, Deserialize)] +struct JsonRpcError { + code: i32, + message: String, +} + impl DaClient { /// Create a new DA client pub fn new(da_url: &str) -> Result { - let client = HttpClientBuilder::default().build(da_url)?; - - Ok(Self { client }) + let base_url = Url::parse(da_url)?; + let client = Client::builder().use_rustls_tls().build()?; + + Ok(Self { + client, + base_url, + request_id: std::sync::atomic::AtomicU64::new(1), + }) } /// Create a new DA client with authentication pub fn new_with_auth(da_url: &str, auth: &str) -> Result { + let base_url = Url::parse(da_url)?; let mut headers = header::HeaderMap::new(); - headers.insert(header::AUTHORIZATION, auth.parse().unwrap()); - let client = HttpClientBuilder::default() - .set_headers(headers) - .build(da_url)?; + headers.insert( + header::AUTHORIZATION, + auth.parse().map_err(|_| { + DaClientError::InvalidResponse("Invalid authorization header".to_string()) + })?, + ); + + let client = Client::builder() + .use_rustls_tls() + .default_headers(headers) + .build()?; + + Ok(Self { + client, + base_url, + request_id: std::sync::atomic::AtomicU64::new(1), + }) + } - Ok(Self { client }) + /// Get next request ID + fn next_request_id(&self) -> u64 { + self.request_id + .fetch_add(1, std::sync::atomic::Ordering::SeqCst) + } + + /// Make a JSON-RPC request + async fn make_request(&self, method: &str, params: P) -> Result + where + P: Serialize, + R: for<'de> Deserialize<'de>, + { + let request_id = self.next_request_id(); + let request = JsonRpcRequest { + jsonrpc: "2.0".to_string(), + method: method.to_string(), + params, + id: request_id, + }; + + let response = self + .client + .post(self.base_url.clone()) + .json(&request) + .send() + .await?; + + if !response.status().is_success() { + return Err(DaClientError::InvalidResponse(format!( + "HTTP error: {}", + response.status() + ))); + } + + let response_body: JsonRpcResponse = response.json().await?; + + // Validate JSON-RPC 2.0 compliance + if response_body.jsonrpc != "2.0" { + return Err(DaClientError::InvalidResponse(format!( + "Invalid JSON-RPC version: expected '2.0', got '{}'", + response_body.jsonrpc + ))); + } + + if response_body.id != request_id { + return Err(DaClientError::InvalidResponse(format!( + "Request/response ID mismatch: expected {}, got {}", + request_id, response_body.id + ))); + } + + if let Some(error) = response_body.error { + return Err(DaClientError::JsonRpcError { + code: error.code, + message: error.message, + }); + } + + response_body.result.ok_or_else(|| { + DaClientError::InvalidResponse("Missing result in successful response".to_string()) + }) } /// Fetch the bytecode and signature for the given assertion id from the DA layer @@ -67,12 +178,8 @@ impl DaClient { &self, assertion_id: B256, ) -> Result { - let response = self - .client - .request::<_, &[String]>("da_get_assertion", &[assertion_id.to_string()]) - .await?; - - Ok(response) + let params = vec![assertion_id.to_string()]; + self.make_request("da_get_assertion", params).await } /// Submit the assertion bytecode to the DA layer @@ -101,18 +208,16 @@ impl DaClient { constructor_abi_signature: String, constructor_args: Vec, ) -> Result { - let params = DaSubmission { + let params = vec![DaSubmission { solidity_source, compiler_version, assertion_contract_name, constructor_abi_signature, constructor_args, - }; + }]; - Ok(self - .client - .request::<_, &[DaSubmission]>("da_submit_solidity_assertion", &[params]) - .await?) + self.make_request("da_submit_solidity_assertion", params) + .await } } @@ -446,4 +551,77 @@ mod tests { assert_eq!(response.constructor_abi_signature, "constructor()"); assert!(response.encoded_constructor_args.is_empty()); } + + #[tokio::test] + async fn test_json_rpc_validation() { + use serde_json::json; + use wiremock::matchers::method; + use wiremock::{ + Mock, + MockServer, + ResponseTemplate, + }; + + // Test invalid JSON-RPC version + { + let mock_server = MockServer::start().await; + let client = DaClient::new(&mock_server.uri()).unwrap(); + + Mock::given(method("POST")) + .respond_with(ResponseTemplate::new(200).set_body_json(json!({ + "jsonrpc": "1.0", // Invalid version + "result": { + "solidity_source": "contract Test {}", + "bytecode": "0x608060405234801561001057600080fd5b50600080fd5b00", + "prover_signature": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef01", + "encoded_constructor_args": "0x", + "constructor_abi_signature": "constructor()" + }, + "id": 1 + }))) + .expect(1) + .mount(&mock_server) + .await; + + let result = client.fetch_assertion(Default::default()).await; + assert!(result.is_err()); + match result.unwrap_err() { + DaClientError::InvalidResponse(msg) => { + assert!(msg.contains("Invalid JSON-RPC version")); + } + other => panic!("Expected InvalidResponse error, got: {other:?}"), + } + } + + // Test mismatched ID + { + let mock_server = MockServer::start().await; + let client = DaClient::new(&mock_server.uri()).unwrap(); + + Mock::given(method("POST")) + .respond_with(ResponseTemplate::new(200).set_body_json(json!({ + "jsonrpc": "2.0", + "result": { + "solidity_source": "contract Test {}", + "bytecode": "0x608060405234801561001057600080fd5b50600080fd5b00", + "prover_signature": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef01", + "encoded_constructor_args": "0x", + "constructor_abi_signature": "constructor()" + }, + "id": 999 // Will not match the sent ID + }))) + .expect(1) + .mount(&mock_server) + .await; + + let result = client.fetch_assertion(Default::default()).await; + assert!(result.is_err()); + match result.unwrap_err() { + DaClientError::InvalidResponse(msg) => { + assert!(msg.contains("Request/response ID mismatch")); + } + other => panic!("Expected InvalidResponse error, got: {other:?}"), + } + } + } } diff --git a/crates/server/src/config.rs b/crates/server/src/config.rs index b305cb6..ac671ee 100644 --- a/crates/server/src/config.rs +++ b/crates/server/src/config.rs @@ -89,10 +89,7 @@ mod tests { use std::str::FromStr; use alloy::signers::local::PrivateKeySigner; - use assertion_da_client::{ - ClientError, - DaClientError, - }; + use assertion_da_client::DaClientError; use tokio_util::sync::CancellationToken; #[tokio::test] @@ -126,10 +123,11 @@ mod tests { let da_client = assertion_da_client::DaClient::new(&format!("http://{listen_addr}")).unwrap(); - if let Err(DaClientError::ClientError(ClientError::Call(err))) = + if let Err(DaClientError::JsonRpcError { code, message }) = da_client.fetch_assertion(Default::default()).await { - assert_eq!(err.message(), "Assertion not found"); + assert_eq!(code, 404); + assert_eq!(message, "Assertion not found"); } cancel_token.cancel(); diff --git a/examples/test_http_client.rs b/examples/test_http_client.rs new file mode 100644 index 0000000..5455b52 --- /dev/null +++ b/examples/test_http_client.rs @@ -0,0 +1,29 @@ +use assertion_da_client::DaClient; + +#[tokio::main] +async fn main() -> Result<(), Box> { + // Test with HTTP endpoint + println!("Testing HTTP endpoint..."); + let _http_client = DaClient::new("http://localhost:5001")?; + println!("✓ HTTP client created successfully"); + + // Test with HTTPS endpoint + println!("Testing HTTPS endpoint..."); + let _https_client = DaClient::new("https://demo-21-assertion-da.phylax.systems")?; + println!("✓ HTTPS client created successfully"); + + // Test with authentication + println!("Testing authenticated client..."); + let _auth_client = DaClient::new_with_auth( + "https://demo-21-assertion-da.phylax.systems", + "Bearer test-token", + )?; + println!("✓ Authenticated client created successfully"); + + println!( + "\nClient creation tests passed! The new reqwest-based client should resolve TLS/SSL issues." + ); + println!("Now you can use the client with both HTTP and HTTPS endpoints without TLS errors."); + + Ok(()) +}