diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47e2704..fce6807 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,12 +20,13 @@ jobs: - run: rustup update stable && rustup default stable # hashgraph-like-consensus's build.rs shells out to protoc via prost-build. - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - # chat-cli and the embedded-logos-delivery crate link liblogosdelivery - # (built via Nix or LOGOS_DELIVERY_LIB_DIR). The smoketest job builds and - # exercises them under Nix; here we keep the toolchain-only job fast by - # skipping them. - - run: cargo build --verbose --workspace --exclude chat-cli --exclude embedded-logos-delivery - - run: cargo test --verbose --workspace --exclude chat-cli --exclude embedded-logos-delivery + # chat-cli, embedded-logos-delivery and logos-delivery-bindings all reach + # waku-bindings, whose build script compiles the Nim library and rln from + # source. The smoketest job pays that cost; this one stays fast by + # skipping them. Note the exclusions only hold while nothing else + # selected here depends on that chain. + - run: cargo build --verbose --workspace --exclude chat-cli --exclude embedded-logos-delivery --exclude logos-delivery-bindings + - run: cargo test --verbose --workspace --exclude chat-cli --exclude embedded-logos-delivery --exclude logos-delivery-bindings clippy: name: Clippy @@ -36,7 +37,9 @@ jobs: - run: rustup component add clippy # hashgraph-like-consensus's build.rs shells out to protoc via prost-build. - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - - run: cargo clippy --all-targets --all-features --workspace --exclude chat-cli -- -D warnings + # logos-delivery-bindings excluded: clippy compiles build scripts, so it + # would drive the from-source Nim build described in the test job. + - run: cargo clippy --all-targets --all-features --workspace --exclude chat-cli --exclude logos-delivery-bindings -- -D warnings fmt: name: Format @@ -49,30 +52,41 @@ jobs: smoketest: name: Smoketest - environment: ${{ github.ref == 'refs/heads/main' && 'public-cache' || '' }} strategy: matrix: os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} + # waku-bindings' build script builds the Nim library and rln from source on + # a cold cache, which dominates this job. + timeout-minutes: 60 steps: - uses: actions/checkout@v4 - - uses: logos-co/setup-nix-cache-action@v1 - with: - attic-token-ci: ${{ secrets.ATTIC_TOKEN_CI }} - attic-token-public: ${{ secrets.ATTIC_TOKEN_PUBLIC }} - - name: Build logos-delivery - run: nix build .#logos-delivery --print-build-logs - # Build and run chat-cli through the dev shell so it links against the - # same Nix glibc as the prebuilt liblogosdelivery.so. A plain `cargo - # build` uses the runner's system glibc, which is older than Nix's and - # mismatches it at runtime (libc.so.6: version `GLIBC_ABI_DT_X86_64_PLT' - # not found, required by Nix glibc's libm.so.6). - - name: Build chat-cli (logos-delivery) - run: nix develop -c bash -c 'LOGOS_DELIVERY_LIB_DIR=./result/lib cargo build --release -p chat-cli' + - run: rustup update stable && rustup default stable + # hashgraph-like-consensus's build.rs shells out to protoc via prost-build. + - name: Install protoc + run: | + if [ "$RUNNER_OS" = "Linux" ]; then + sudo apt-get update && sudo apt-get install -y protobuf-compiler + else + brew install protobuf + fi + # waku-bindings' build script bootstraps its own Nim toolchain, and + # install_nim.sh / install_nimble.sh symlink the binaries into + # ~/.nimble/bin without putting it on PATH. The same make run then calls + # `nimble` and fails with "No such file or directory", so add it here. + # The directory does not exist yet at this point; that is fine. + - name: Put the bootstrapped Nim toolchain on PATH + run: echo "$HOME/.nimble/bin" >> "$GITHUB_PATH" + # No Nix here: waku-bindings compiles and statically links its own + # liblogosdelivery, so there is no prebuilt Nix .so to match glibc + # against — which is what the dev shell used to be for. Building outside + # Nix also keeps the system OpenSSL visible, which the Nim toolchain + # bootstrap dlopens while installing nimble/nph. + - name: Build chat-cli + run: cargo build --release -p chat-cli - name: Run chat-cli smoketest # The client registers against the keypackage/account registry on - # startup, so stand up a mock that accepts those calls. It runs on the - # system Python (no Nix needed); only chat-cli needs the dev shell. + # startup, so stand up a mock that accepts those calls. run: | python3 .github/scripts/mock-registry.py & mock_pid=$! @@ -81,4 +95,4 @@ jobs: curl -s -o /dev/null http://127.0.0.1:18080/ && break sleep 0.2 done - nix develop -c ./target/release/chat-cli --name ci-test --smoketest --registry-url http://127.0.0.1:18080 + ./target/release/chat-cli --name ci-test --smoketest --registry-url http://127.0.0.1:18080 diff --git a/Cargo.lock b/Cargo.lock index 7e7467b..2f57315 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,6 +43,18 @@ dependencies = [ "subtle", ] +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.4" @@ -109,7 +121,7 @@ dependencies = [ "c-kzg", "derive_more 2.1.1", "either", - "k256", + "k256 0.13.4", "once_cell", "rand 0.8.6", "secp256k1 0.30.0", @@ -219,7 +231,7 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "borsh", - "k256", + "k256 0.13.4", "serde", "thiserror", ] @@ -357,7 +369,7 @@ dependencies = [ "hashbrown 0.17.0", "indexmap 2.14.0", "itoa", - "k256", + "k256 0.13.4", "keccak-asm", "paste", "proptest", @@ -367,7 +379,7 @@ dependencies = [ "rustc-hash", "secp256k1 0.31.1", "serde", - "sha3", + "sha3 0.11.0", ] [[package]] @@ -397,7 +409,7 @@ dependencies = [ "futures", "futures-utils-wasm", "lru 0.16.4", - "parking_lot", + "parking_lot 0.12.5", "pin-project", "reqwest 0.13.4", "serde", @@ -523,8 +535,8 @@ dependencies = [ "async-trait", "auto_impl", "either", - "elliptic-curve", - "k256", + "elliptic-curve 0.13.8", + "k256 0.13.4", "thiserror", ] @@ -539,7 +551,7 @@ dependencies = [ "alloy-primitives", "alloy-signer", "async-trait", - "k256", + "k256 0.13.4", "rand 0.8.6", "thiserror", ] @@ -572,7 +584,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "sha3", + "sha3 0.11.0", "syn 2.0.117", "syn-solidity", ] @@ -625,11 +637,11 @@ checksum = "86052fdcec72d37ca4aa4b66254601e7453c45a6e1c70aa4561033d002fb80cc" dependencies = [ "alloy-json-rpc", "auto_impl", - "base64", + "base64 0.22.1", "derive_more 2.1.1", "futures", "futures-utils-wasm", - "parking_lot", + "parking_lot 0.12.5", "serde", "serde_json", "thiserror", @@ -772,12 +784,80 @@ dependencies = [ "objc2-core-foundation", "objc2-core-graphics", "objc2-foundation", - "parking_lot", + "parking_lot 0.12.5", "percent-encoding", "windows-sys 0.59.0", "x11rb", ] +[[package]] +name = "ark-bn254" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" +dependencies = [ + "ark-ec", + "ark-ff 0.5.0", + "ark-r1cs-std", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0c292754729c8a190e50414fd1a37093c786c709899f29c9f7daccecfa855e" +dependencies = [ + "ahash", + "ark-crypto-primitives-macros", + "ark-ec", + "ark-ff 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-snark", + "ark-std 0.5.0", + "blake2", + "derivative", + "digest 0.10.7", + "fnv", + "merlin", + "rayon", + "sha2 0.10.9", +] + +[[package]] +name = "ark-crypto-primitives-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "ark-ec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" +dependencies = [ + "ahash", + "ark-ff 0.5.0", + "ark-poly", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe", + "fnv", + "hashbrown 0.15.5", + "itertools 0.13.0", + "num-bigint", + "num-integer", + "num-traits", + "rayon", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.3.0" @@ -833,6 +913,7 @@ dependencies = [ "num-bigint", "num-traits", "paste", + "rayon", "zeroize", ] @@ -904,6 +985,67 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "ark-groth16" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff 0.5.0", + "ark-poly", + "ark-relations", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "rayon", +] + +[[package]] +name = "ark-poly" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" +dependencies = [ + "ahash", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe", + "fnv", + "hashbrown 0.15.5", + "rayon", +] + +[[package]] +name = "ark-r1cs-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941551ef1df4c7a401de7068758db6503598e6f01850bdb2cfdb614a1f9dbea1" +dependencies = [ + "ark-ec", + "ark-ff 0.5.0", + "ark-relations", + "ark-std 0.5.0", + "educe", + "num-bigint", + "num-integer", + "num-traits", + "tracing", +] + +[[package]] +name = "ark-relations" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" +dependencies = [ + "ark-ff 0.5.0", + "ark-std 0.5.0", + "tracing", + "tracing-subscriber 0.2.25", +] + [[package]] name = "ark-serialize" version = "0.3.0" @@ -931,10 +1073,35 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" dependencies = [ + "ark-serialize-derive", "ark-std 0.5.0", "arrayvec", "digest 0.10.7", "num-bigint", + "rayon", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "ark-snark" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88" +dependencies = [ + "ark-ff 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-std 0.5.0", ] [[package]] @@ -965,8 +1132,15 @@ checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" dependencies = [ "num-traits", "rand 0.8.6", + "rayon", ] +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + [[package]] name = "arrayvec" version = "0.7.6" @@ -1051,12 +1225,52 @@ dependencies = [ "fs_extra", ] +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + [[package]] name = "base16ct" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base256emoji" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e9430d9a245a77c92176e649af6e275f20839a48389859d1661e9a128d077c" +dependencies = [ + "const-str", + "match-lookup", +] + +[[package]] +name = "base45" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240e56f4d3c453c36faacb695c535a4d5f8c7d23dac175014f32eb0a71012a03" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -1100,6 +1314,12 @@ dependencies = [ "hex-conservative", ] +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.11.1" @@ -1181,6 +1401,12 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "bs58" version = "0.5.1" @@ -1313,7 +1539,7 @@ version = "0.1.0" dependencies = [ "anyhow", "arboard", - "base64", + "base64 0.22.1", "clap", "crossbeam-channel", "crossterm 0.29.0", @@ -1324,7 +1550,7 @@ dependencies = [ "serde_json", "thiserror", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.23", ] [[package]] @@ -1354,11 +1580,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ "iana-time-zone", + "js-sys", "num-traits", "serde", + "wasm-bindgen", "windows-link", ] +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "cipher" version = "0.4.4" @@ -1462,7 +1717,7 @@ dependencies = [ name = "components" version = "0.1.0" dependencies = [ - "base64", + "base64 0.22.1", "chat-proto", "crossbeam-channel", "crypto", @@ -1501,6 +1756,12 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" +[[package]] +name = "const-str" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f421161cb492475f1661ddc9815a745a1c894592070661180fdec3d4872e9c3" + [[package]] name = "const_format" version = "0.2.36" @@ -1522,6 +1783,15 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "convert_case" version = "0.10.0" @@ -1640,10 +1910,10 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags", + "bitflags 2.11.1", "crossterm_winapi", "mio", - "parking_lot", + "parking_lot 0.12.5", "rustix 0.38.44", "signal-hook", "signal-hook-mio", @@ -1656,12 +1926,12 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" dependencies = [ - "bitflags", + "bitflags 2.11.1", "crossterm_winapi", "derive_more 2.1.1", "document-features", "mio", - "parking_lot", + "parking_lot 0.12.5", "rustix 1.1.4", "signal-hook", "signal-hook-mio", @@ -1698,6 +1968,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "crypto-bigint" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -1812,7 +2094,33 @@ dependencies = [ "hashbrown 0.14.5", "lock_api", "once_cell", - "parking_lot_core", + "parking_lot_core 0.9.12", +] + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + +[[package]] +name = "data-encoding-macro" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6a127ecbb3c4632e1525380e04c0c3fcf8dcb44d32a79ea290d8a36906edcd8" +dependencies = [ + "data-encoding", + "data-encoding-macro-internal", +] + +[[package]] +name = "data-encoding-macro-internal" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c54e03a951783e8b327515db3f2a2fd0e3bed362a96b066f341ce66ed49b4ead" +dependencies = [ + "data-encoding", + "syn 1.0.109", ] [[package]] @@ -1832,6 +2140,16 @@ dependencies = [ "uuid", ] +[[package]] +name = "der" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +dependencies = [ + "const-oid 0.9.6", + "zeroize", +] + [[package]] name = "der" version = "0.7.10" @@ -1890,7 +2208,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ - "convert_case", + "convert_case 0.10.0", "proc-macro2", "quote", "rustc_version 0.4.1", @@ -1936,7 +2254,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" dependencies = [ - "bitflags", + "bitflags 2.11.1", "objc2", ] @@ -1990,19 +2308,31 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +[[package]] +name = "ecdsa" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +dependencies = [ + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + [[package]] name = "ecdsa" version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ - "der", + "der 0.7.10", "digest 0.10.7", - "elliptic-curve", - "rfc6979", + "elliptic-curve 0.13.8", + "rfc6979 0.4.0", "serdect", - "signature", - "spki", + "signature 2.2.0", + "spki 0.7.3", ] [[package]] @@ -2011,8 +2341,8 @@ version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ - "pkcs8", - "signature", + "pkcs8 0.10.2", + "signature 2.2.0", ] [[package]] @@ -2051,23 +2381,43 @@ dependencies = [ "serde", ] +[[package]] +name = "elliptic-curve" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +dependencies = [ + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", + "digest 0.10.7", + "ff 0.12.1", + "generic-array 0.14.7", + "group 0.12.1", + "pkcs8 0.9.0", + "rand_core 0.6.4", + "sec1 0.3.0", + "subtle", + "zeroize", +] + [[package]] name = "elliptic-curve" version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ - "base16ct", - "crypto-bigint", + "base16ct 0.2.0", + "crypto-bigint 0.5.5", "digest 0.10.7", - "ff", + "ff 0.13.1", "generic-array 0.14.7", - "group", + "group 0.13.0", "hkdf", "pem-rfc7468", - "pkcs8", + "pkcs8 0.10.2", "rand_core 0.6.4", - "sec1", + "sec1 0.7.3", "serdect", "subtle", "zeroize", @@ -2077,10 +2427,10 @@ dependencies = [ name = "embedded-logos-delivery" version = "0.1.0" dependencies = [ - "base64", + "base64 0.22.1", "crossbeam-channel", "libchat", - "logos-delivery", + "logos-delivery-bindings", "logos-generic-chat", "serde", "serde_json", @@ -2089,15 +2439,35 @@ dependencies = [ ] [[package]] -name = "enum-ordinalize" -version = "4.3.2" +name = "enr" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" +checksum = "492a7e5fc2504d5fdce8e124d3e263b244a68b283cac67a69eda0cd43e0aebad" dependencies = [ - "enum-ordinalize-derive", -] - -[[package]] + "base64 0.13.1", + "bs58 0.4.0", + "bytes", + "hex", + "k256 0.11.6", + "log", + "rand 0.8.6", + "rlp", + "secp256k1 0.24.3", + "serde", + "sha3 0.10.9", + "zeroize", +] + +[[package]] +name = "enum-ordinalize" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] name = "enum-ordinalize-derive" version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2130,6 +2500,41 @@ version = "3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" +[[package]] +name = "ext-trait" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d772df1c1a777963712fb68e014235e80863d6a91a85c4e06ba2d16243a310e5" +dependencies = [ + "ext-trait-proc_macros", +] + +[[package]] +name = "ext-trait-proc_macros" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ab7934152eaf26aa5aa9f7371408ad5af4c31357073c9e84c3b9d7f11ad639a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "extension-traits" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a296e5a895621edf9fa8329c83aa1cb69a964643e36cf54d8d7a69b789089537" +dependencies = [ + "ext-trait", +] + +[[package]] +name = "extern-c" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320bea982e85d42441eb25c49b41218e7eaa2657e8f90bc4eca7437376751e23" + [[package]] name = "fallible-iterator" version = "0.3.0" @@ -2199,6 +2604,16 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "ff" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "ff" version = "0.13.1" @@ -2249,6 +2664,17 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "spin", +] + [[package]] name = "fnv" version = "1.0.7" @@ -2276,6 +2702,16 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "fs_extra" version = "1.3.0" @@ -2388,6 +2824,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -2476,13 +2921,24 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +[[package]] +name = "group" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +dependencies = [ + "ff 0.12.1", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "group" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "ff", + "ff 0.13.1", "rand_core 0.6.4", "subtle", ] @@ -2551,7 +3007,7 @@ checksum = "cba53b85cc33f28262bbd9c258bbbf3f3b66501ef7cc2b7137712215fdf7cbf5" dependencies = [ "alloy", "alloy-signer", - "parking_lot", + "parking_lot 0.12.5", "prost", "prost-build", "sha2 0.10.9", @@ -2707,7 +3163,7 @@ dependencies = [ "chacha20poly1305", "hkdf", "hpke-rs-crypto", - "k256", + "k256 0.13.4", "p256", "p384", "rand 0.8.6", @@ -2810,7 +3266,7 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures-channel", "futures-util", @@ -3054,6 +3510,15 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + [[package]] name = "integration_tests_core" version = "0.1.0" @@ -3066,7 +3531,7 @@ dependencies = [ "storage", "tempfile", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.23", ] [[package]] @@ -3185,6 +3650,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" +dependencies = [ + "cfg-if", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", + "sha2 0.10.9", +] + [[package]] name = "k256" version = "0.13.4" @@ -3192,13 +3669,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", "once_cell", "serdect", "sha2 0.10.9", ] +[[package]] +name = "keccak" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" +dependencies = [ + "cpufeatures 0.2.17", +] + [[package]] name = "keccak" version = "0.2.0" @@ -3257,7 +3743,7 @@ name = "libchat" version = "0.1.0" dependencies = [ "alloy", - "base64", + "base64 0.22.1", "blake2", "chat-proto", "chat-sqlite", @@ -3551,6 +4037,20 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" +[[package]] +name = "libp2p-identity" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9525f3831544f7ae497bde79adf114ef127b0fbbb97edbbf692a80408636421c" +dependencies = [ + "bs58 0.5.1", + "hkdf", + "multihash", + "sha2 0.10.9", + "thiserror", + "tracing", +] + [[package]] name = "libsqlite3-sys" version = "0.33.0" @@ -3628,7 +4128,7 @@ dependencies = [ name = "logos-delivery" version = "0.1.0" dependencies = [ - "base64", + "base64 0.22.1", "crossbeam-channel", "serde", "serde_json", @@ -3636,6 +4136,18 @@ dependencies = [ "tracing", ] +[[package]] +name = "logos-delivery-bindings" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "crossbeam-channel", + "serde_json", + "thiserror", + "tracing", + "waku-bindings", +] + [[package]] name = "logos-generic-chat" version = "0.1.0" @@ -3647,7 +4159,7 @@ dependencies = [ "hex", "libchat", "logos-account", - "parking_lot", + "parking_lot 0.12.5", "shared-traits", "storage", "tempfile", @@ -3690,6 +4202,33 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "macro_rules_attribute" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf0c9b980bf4f3a37fd7b1c066941dd1b1d0152ce6ee6e8fe8c49b9f6810d862" +dependencies = [ + "macro_rules_attribute-proc_macro", + "paste", +] + +[[package]] +name = "macro_rules_attribute-proc_macro" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58093314a45e00c77d5c508f76e77c3396afbbc0d01506e7fae47b018bac2b1d" + +[[package]] +name = "match-lookup" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "757aee279b8bdbb9f9e676796fd459e4207a1f986e87886700abf589f5abf771" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "matchers" version = "0.2.0" @@ -3705,6 +4244,18 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak 0.1.6", + "rand_core 0.6.4", + "zeroize", +] + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -3737,6 +4288,47 @@ dependencies = [ "pxfm", ] +[[package]] +name = "multiaddr" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe6351f60b488e04c1d21bc69e56b89cb3f5e8f5d22557d6e8031bdfd79b6961" +dependencies = [ + "arrayref", + "byteorder", + "data-encoding", + "libp2p-identity", + "multibase", + "multihash", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint", + "url", +] + +[[package]] +name = "multibase" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e0e4a371cbf1dfd666b658ba137763edb23c45beb43cfe369b5593cd6b437b6" +dependencies = [ + "base-x", + "base256emoji", + "base45", + "data-encoding", + "data-encoding-macro", +] + +[[package]] +name = "multihash" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "577c63b00ad74d57e8c9aa870b5fccebf2fd64a308a5aee9f1bb88e4aea19447" +dependencies = [ + "unsigned-varint", +] + [[package]] name = "multimap" version = "0.10.1" @@ -3847,7 +4439,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ - "bitflags", + "bitflags 2.11.1", "objc2", "objc2-core-graphics", "objc2-foundation", @@ -3859,7 +4451,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ - "bitflags", + "bitflags 2.11.1", "dispatch2", "objc2", ] @@ -3870,7 +4462,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ - "bitflags", + "bitflags 2.11.1", "dispatch2", "objc2", "objc2-core-foundation", @@ -3889,7 +4481,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ - "bitflags", + "bitflags 2.11.1", "objc2", "objc2-core-foundation", ] @@ -3900,7 +4492,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" dependencies = [ - "bitflags", + "bitflags 2.11.1", "objc2", "objc2-core-foundation", ] @@ -4101,14 +4693,23 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + [[package]] name = "p256" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "ecdsa", - "elliptic-curve", + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", "primeorder", "sha2 0.10.9", ] @@ -4119,7 +4720,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" dependencies = [ - "elliptic-curve", + "elliptic-curve 0.13.8", "primeorder", ] @@ -4151,6 +4752,17 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -4158,7 +4770,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.12", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", ] [[package]] @@ -4169,7 +4795,7 @@ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.18", "smallvec", "windows-link", ] @@ -4254,14 +4880,24 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der 0.6.1", + "spki 0.6.0", +] + [[package]] name = "pkcs8" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der", - "spki", + "der 0.7.10", + "spki 0.7.3", ] [[package]] @@ -4276,7 +4912,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" dependencies = [ - "bitflags", + "bitflags 2.11.1", "crc32fast", "fdeflate", "flate2", @@ -4330,6 +4966,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "prettyplease" version = "0.2.37" @@ -4346,7 +4992,7 @@ version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" dependencies = [ - "elliptic-curve", + "elliptic-curve 0.13.8", ] [[package]] @@ -4408,12 +5054,12 @@ checksum = "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744" dependencies = [ "bit-set", "bit-vec", - "bitflags", + "bitflags 2.11.1", "num-traits", "rand 0.9.4", "rand_chacha 0.9.0", "rand_xorshift", - "regex-syntax", + "regex-syntax 0.8.10", "rusty-fork", "tempfile", "unarray", @@ -4440,7 +5086,7 @@ dependencies = [ "log", "multimap", "petgraph", - "prettyplease", + "prettyplease 0.2.37", "prost", "prost-types", "regex", @@ -4683,7 +5329,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" dependencies = [ - "bitflags", + "bitflags 2.11.1", "cassowary", "compact_str", "crossterm 0.28.1", @@ -4718,13 +5364,22 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags", + "bitflags 2.11.1", ] [[package]] @@ -4756,7 +5411,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax", + "regex-syntax 0.8.10", ] [[package]] @@ -4767,9 +5422,15 @@ checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.10", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.8.10" @@ -4788,7 +5449,7 @@ version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures-channel", "futures-core", @@ -4828,7 +5489,7 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures-core", "http", @@ -4859,6 +5520,17 @@ dependencies = [ "web-sys", ] +[[package]] +name = "rfc6979" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +dependencies = [ + "crypto-bigint 0.4.9", + "hmac", + "zeroize", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -4883,6 +5555,39 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rln" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba799769e5c1230b6fcf357de13d32a59ea0071894eaf2832d9ee822b6ee6db0" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff 0.5.0", + "ark-groth16", + "ark-poly", + "ark-relations", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "byteorder", + "cfg-if", + "num-bigint", + "num-traits", + "prost", + "rand 0.8.6", + "rand_chacha 0.3.1", + "rayon", + "ruint", + "safer-ffi", + "serde", + "serde_json", + "tempfile", + "thiserror", + "tiny-keccak", + "zeroize", + "zerokit_utils", +] + [[package]] name = "rlp" version = "0.5.2" @@ -4974,7 +5679,7 @@ version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a22715a5d6deef63c637207afbe68d0c72c3f8d0022d7cf9714c442d6157606b" dependencies = [ - "bitflags", + "bitflags 2.11.1", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -5018,7 +5723,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags", + "bitflags 2.11.1", "errno", "libc", "linux-raw-sys 0.4.15", @@ -5031,7 +5736,7 @@ version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ - "bitflags", + "bitflags 2.11.1", "errno", "libc", "linux-raw-sys 0.12.1", @@ -5139,8 +5844,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] -name = "same-file" -version = "1.0.6" +name = "safer-ffi" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435fdd58b61a6f1d8545274c1dfa458e905ff68c166e65e294a0130ef5e675bd" +dependencies = [ + "extern-c", + "libc", + "macro_rules_attribute", + "paste", + "safer_ffi-proc_macros", + "scopeguard", + "stabby", + "uninit", + "unwind_safe", + "with_builtin_macros", +] + +[[package]] +name = "safer_ffi-proc_macros" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f25be5ba5f319542edb31925517e0380245ae37df50a9752cdbc05ef948156" +dependencies = [ + "macro_rules_attribute", + "prettyplease 0.1.25", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "same-file" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ @@ -5186,21 +5922,55 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct 0.1.1", + "der 0.6.1", + "generic-array 0.14.7", + "pkcs8 0.9.0", + "subtle", + "zeroize", +] + [[package]] name = "sec1" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "base16ct", - "der", + "base16ct 0.2.0", + "der 0.7.10", "generic-array 0.14.7", - "pkcs8", + "pkcs8 0.10.2", "serdect", "subtle", "zeroize", ] +[[package]] +name = "secp256k1" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" +dependencies = [ + "secp256k1-sys 0.6.1", +] + +[[package]] +name = "secp256k1" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894" +dependencies = [ + "rand 0.8.6", + "secp256k1-sys 0.8.2", + "serde", +] + [[package]] name = "secp256k1" version = "0.30.0" @@ -5224,6 +5994,24 @@ dependencies = [ "secp256k1-sys 0.11.0", ] +[[package]] +name = "secp256k1-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +dependencies = [ + "cc", +] + +[[package]] +name = "secp256k1-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4473013577ec77b4ee3668179ef1186df3146e2cf2d927bd200974c6fe60fd99" +dependencies = [ + "cc", +] + [[package]] name = "secp256k1-sys" version = "0.10.1" @@ -5248,7 +6036,7 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ - "bitflags", + "bitflags 2.11.1", "core-foundation", "core-foundation-sys", "libc", @@ -5299,6 +6087,28 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-aux" +version = "4.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "207f67b28fe90fb596503a9bf0bf1ea5e831e21307658e177c5dfcdfc3ab8a0a" +dependencies = [ + "chrono", + "serde", + "serde-value", + "serde_json", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + [[package]] name = "serde_bytes" version = "0.11.19" @@ -5360,8 +6170,8 @@ version = "3.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76a5c54c7310e7b8b9577c286d7e399ddd876c3e12b3ed917a8aabc4b96e9e8c" dependencies = [ - "base64", - "bs58", + "base64 0.22.1", + "bs58 0.5.1", "chrono", "hex", "indexmap 1.9.3", @@ -5392,7 +6202,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" dependencies = [ - "base16ct", + "base16ct 0.2.0", "serde", ] @@ -5418,6 +6228,22 @@ dependencies = [ "digest 0.11.3", ] +[[package]] +name = "sha2-const-stable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9" + +[[package]] +name = "sha3" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874" +dependencies = [ + "digest 0.10.7", + "keccak 0.1.6", +] + [[package]] name = "sha3" version = "0.11.0" @@ -5425,7 +6251,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be176f1a57ce4e3d31c1a166222d9768de5954f811601fb7ca06fc8203905ce1" dependencies = [ "digest 0.11.3", - "keccak", + "keccak 0.2.0", ] [[package]] @@ -5491,6 +6317,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + [[package]] name = "signature" version = "2.2.0" @@ -5529,6 +6365,23 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" +[[package]] +name = "sled" +version = "0.34.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935" +dependencies = [ + "crc32fast", + "crossbeam-epoch", + "crossbeam-utils", + "fs2", + "fxhash", + "libc", + "log", + "parking_lot 0.11.2", + "zstd", +] + [[package]] name = "smallvec" version = "1.15.1" @@ -5538,6 +6391,17 @@ dependencies = [ "serde", ] +[[package]] +name = "smart-default" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "socket2" version = "0.6.4" @@ -5548,6 +6412,25 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der 0.6.1", +] + [[package]] name = "spki" version = "0.7.3" @@ -5555,7 +6438,69 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", - "der", + "der 0.7.10", +] + +[[package]] +name = "sscanf" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "569fdd714955aad3acdde5d13129eaa6c4576b759c0585488c84ad395263138a" +dependencies = [ + "const_format", + "lazy_static", + "regex", + "sscanf_macro", +] + +[[package]] +name = "sscanf_macro" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77faf04b02dc0dd55e6713fcae44aa6e8882570bae2bd873949924d6e57cca82" +dependencies = [ + "convert_case 0.6.0", + "proc-macro2", + "quote", + "regex-syntax 0.6.29", + "strsim", + "syn 2.0.117", + "unicode-width 0.1.14", +] + +[[package]] +name = "stabby" +version = "36.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b7e94eaf470c2e76b5f15fb2fb49714471a36cc512df5ee231e62e82ec79f8" +dependencies = [ + "rustversion", + "stabby-abi", +] + +[[package]] +name = "stabby-abi" +version = "36.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc7a63b8276b54e51bfffe3d85da56e7906b2dcfcb29018a8ab666c06734c1a" +dependencies = [ + "rustc_version 0.4.1", + "rustversion", + "sha2-const-stable", + "stabby-macros", +] + +[[package]] +name = "stabby-macros" +version = "36.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eecb7ec5611ec93ec79d120fbe55f31bea234dc1bed1001d4a071bb688651615" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "rand 0.8.6", + "syn 1.0.109", ] [[package]] @@ -5789,6 +6734,15 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinystr" version = "0.8.3" @@ -5845,7 +6799,9 @@ dependencies = [ "bytes", "libc", "mio", + "parking_lot 0.12.5", "pin-project-lite", + "signal-hook-registry", "socket2", "tokio-macros", "windows-sys 0.61.2", @@ -5948,7 +6904,7 @@ version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" dependencies = [ - "bitflags", + "bitflags 2.11.1", "bytes", "futures-util", "http", @@ -6015,6 +6971,15 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + [[package]] name = "tracing-subscriber" version = "0.3.23" @@ -6110,6 +7075,15 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "uninit" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e130f2ed46ca5d8ec13c7ff95836827f92f5f5f37fd2b2bf16f33c408d98bb6" +dependencies = [ + "extension-traits", +] + [[package]] name = "universal-hash" version = "0.5.1" @@ -6120,12 +7094,24 @@ dependencies = [ "subtle", ] +[[package]] +name = "unsigned-varint" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" + [[package]] name = "untrusted" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "unwind_safe" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0976c77def3f1f75c4ef892a292c31c0bbe9e3d0702c63044d7c76db298171a3" + [[package]] name = "url" version = "2.5.8" @@ -6162,6 +7148,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vacp2p_pmtree" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47145034d8885c2f7ff7562c504ee8be6e78b564a60cc26fc174f861c61bdec2" + [[package]] name = "valuable" version = "0.1.1" @@ -6189,6 +7181,36 @@ dependencies = [ "libc", ] +[[package]] +name = "waku-bindings" +version = "1.0.0" +source = "git+https://github.com/logos-messaging/logos-delivery-rust-bindings?rev=0f4f421fa278bb0d5de4da51f11d98e27fc5d756#0f4f421fa278bb0d5de4da51f11d98e27fc5d756" +dependencies = [ + "aes-gcm", + "base64 0.21.7", + "cc", + "chrono", + "ciborium", + "enr", + "flume", + "hex", + "libc", + "multiaddr", + "once_cell", + "rand 0.8.6", + "regex", + "rln", + "secp256k1 0.26.0", + "serde", + "serde-aux", + "serde_json", + "smart-default", + "sscanf", + "tokio", + "url", + "uuid", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -6315,7 +7337,7 @@ version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ - "bitflags", + "bitflags 2.11.1", "hashbrown 0.15.5", "indexmap 2.14.0", "semver 1.0.28", @@ -6329,7 +7351,7 @@ checksum = "1c598d6b99ea013e35844697fc4670d08339d5cda15588f193c6beedd12f644b" dependencies = [ "futures", "js-sys", - "parking_lot", + "parking_lot 0.12.5", "pin-utils", "slab", "wasm-bindgen", @@ -6604,7 +7626,7 @@ dependencies = [ "anyhow", "heck", "indexmap 2.14.0", - "prettyplease", + "prettyplease 0.2.37", "syn 2.0.117", "wasm-metadata", "wit-bindgen-core", @@ -6618,7 +7640,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" dependencies = [ "anyhow", - "prettyplease", + "prettyplease 0.2.37", "proc-macro2", "quote", "syn 2.0.117", @@ -6633,7 +7655,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", - "bitflags", + "bitflags 2.11.1", "indexmap 2.14.0", "log", "serde", @@ -6663,6 +7685,26 @@ dependencies = [ "wasmparser", ] +[[package]] +name = "with_builtin_macros" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a59d55032495429b87f9d69954c6c8602e4d3f3e0a747a12dea6b0b23de685da" +dependencies = [ + "with_builtin_macros-proc_macros", +] + +[[package]] +name = "with_builtin_macros-proc_macros" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bd7679c15e22924f53aee34d4e448c45b674feb6129689af88593e129f8f42" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "writeable" version = "0.6.3" @@ -6807,6 +7849,21 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "zerokit_utils" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6acb5f70fd3183429f9495e1df68281db875b8eb4a54bce01cb0569e9b4e0c5" +dependencies = [ + "ark-ff 0.5.0", + "num-bigint", + "rayon", + "serde_json", + "sled", + "thiserror", + "vacp2p_pmtree", +] + [[package]] name = "zerotrie" version = "0.2.4" @@ -6846,6 +7903,35 @@ version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" +[[package]] +name = "zstd" +version = "0.9.2+zstd.1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2390ea1bf6c038c39674f22d95f0564725fc06034a47129179810b2fc58caa54" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "4.1.3+zstd.1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e99d81b99fb3c2c2c794e3fe56c305c63d5173a16a46b5850b07c935ffc7db79" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "1.6.2+zstd.1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2daf2f248d9ea44454bfcb2516534e8b8ad2fc91bf818a1885495fc42bc8ac9f" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "zune-core" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index 47d84ea..528aae4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ members = [ "crates/generic-chat", "extensions/components", "extensions/embedded-logos-delivery", + "extensions/logos-delivery-bindings", "extensions/logos-delivery-rust", ] @@ -40,7 +41,7 @@ crypto = { path = "core/crypto" } embedded-logos-delivery = { path = "extensions/embedded-logos-delivery" } libchat = { path = "core/conversations" } logos-chat = { path = "crates/logos-chat" } -logos-delivery = { path = "extensions/logos-delivery-rust"} +logos-delivery = { path = "extensions/logos-delivery-bindings", package = "logos-delivery-bindings" } logos-generic-chat = { path = "crates/generic-chat" } shared-traits = { path = "core/shared-traits" } storage = { path = "core/storage" } diff --git a/extensions/logos-delivery-bindings/Cargo.toml b/extensions/logos-delivery-bindings/Cargo.toml new file mode 100644 index 0000000..af2d1b8 --- /dev/null +++ b/extensions/logos-delivery-bindings/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "logos-delivery-bindings" +version = "0.1.0" +edition = "2024" +publish = false + +[dependencies] +base64 = "0.22" +crossbeam-channel = "0.5" +serde_json = "1.0" +thiserror = "2" +tracing = "0.1" +waku-bindings = { git = "https://github.com/logos-messaging/logos-delivery-rust-bindings", rev = "0f4f421fa278bb0d5de4da51f11d98e27fc5d756" } diff --git a/extensions/logos-delivery-bindings/build.rs b/extensions/logos-delivery-bindings/build.rs new file mode 100644 index 0000000..48330f8 --- /dev/null +++ b/extensions/logos-delivery-bindings/build.rs @@ -0,0 +1,18 @@ +//! Links the macOS frameworks `waku-bindings` needs. +//! +//! Upstream declares them via `rustflags` in its own `.cargo/config.toml`, +//! which cargo ignores for a dependency, so the link fails on +//! `_SecRandomCopyBytes` from Nim's `std/sysrand` without this. +//! +//! `rustc-link-lib` rather than `rustc-link-arg`: rustc records it in crate +//! metadata, so dependents link the frameworks with no build script of their +//! own. + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + + if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") { + println!("cargo:rustc-link-lib=framework=Security"); + println!("cargo:rustc-link-lib=framework=CoreFoundation"); + } +} diff --git a/extensions/logos-delivery-bindings/src/bin/probe.rs b/extensions/logos-delivery-bindings/src/bin/probe.rs new file mode 100644 index 0000000..f51ece7 --- /dev/null +++ b/extensions/logos-delivery-bindings/src/bin/probe.rs @@ -0,0 +1,112 @@ +//! Manual end-to-end check: starts a node, subscribes, optionally publishes, +//! and prints whatever arrives on the inbound queue. +//! +//! Run two instances on different ports to watch a message cross the network: +//! +//! ```sh +//! cargo run --bin probe -- --port 60010 +//! cargo run --bin probe -- --port 60020 --send "hello" +//! ``` + +use std::time::Duration; + +use logos_delivery_bindings::{P2pConfig, ThreadedDeliveryWrapper, WakuEvent}; + +const CHAT_TOPIC_PREFIX: &str = "/logos-chat/1/"; + +fn content_topic_for(delivery_address: &str) -> String { + format!("{CHAT_TOPIC_PREFIX}{delivery_address}/proto") +} + +struct Args { + port: u16, + address: String, + send: Option, + send_after: u64, + linger: u64, + log_level: String, +} + +fn parse_args() -> Args { + let mut args = Args { + port: 60010, + address: "bindings-probe".into(), + send: None, + send_after: 8, + linger: 20, + log_level: "ERROR".into(), + }; + let mut argv = std::env::args().skip(1); + while let Some(flag) = argv.next() { + let mut value = || { + argv.next() + .unwrap_or_else(|| panic!("{flag} needs a value")) + }; + match flag.as_str() { + "--port" => args.port = value().parse().expect("--port must be a u16"), + "--address" => args.address = value(), + "--send" => args.send = Some(value()), + "--send-after" => args.send_after = value().parse().expect("--send-after is seconds"), + "--linger" => args.linger = value().parse().expect("--linger must be seconds"), + "--log-level" => args.log_level = value(), + other => panic!("unknown flag: {other}"), + } + } + args +} + +fn main() -> Result<(), Box> { + let args = parse_args(); + let topic = content_topic_for(&args.address); + + let cfg = P2pConfig { + port: args.port, + log_level: args.log_level.clone(), + ..P2pConfig::default() + }; + println!("[probe] starting node on port {}", cfg.port); + + let mut delivery = ThreadedDeliveryWrapper::start(cfg, |event: WakuEvent| { + let msg = event.into_received()?; + if !msg.content_topic().starts_with(CHAT_TOPIC_PREFIX) { + return None; + } + msg.into_payload() + })?; + + let inbound = delivery.inbound_queue(); + + println!("[probe] subscribe {topic}"); + delivery.subscribe(&topic)?; + + if let Some(text) = &args.send { + // Publishing too soon after start can reach only this node: `start` + // waits a fixed 3s, which need not be long enough for the mesh. + println!("[probe] waiting {}s for the mesh to form", args.send_after); + std::thread::sleep(Duration::from_secs(args.send_after)); + println!("[probe] publish {text:?}"); + delivery.publish(&topic, text.as_bytes())?; + } + + println!("[probe] listening for {}s", args.linger); + let deadline = std::time::Instant::now() + Duration::from_secs(args.linger); + while let Some(remaining) = deadline.checked_duration_since(std::time::Instant::now()) { + match inbound.recv_timeout(remaining) { + Ok(bytes) => println!( + "[probe] received {} bytes: {}", + bytes.len(), + String::from_utf8_lossy(&bytes) + ), + Err(crossbeam_channel::RecvTimeoutError::Timeout) => break, + Err(crossbeam_channel::RecvTimeoutError::Disconnected) => { + println!("[probe] inbound queue disconnected"); + break; + } + } + } + + println!("[probe] unsubscribe + shut down"); + delivery.unsubscribe(&topic)?; + // Node teardown (stop + destroy) happens when the last clone drops. + Ok(()) +} diff --git a/extensions/logos-delivery-bindings/src/lib.rs b/extensions/logos-delivery-bindings/src/lib.rs new file mode 100644 index 0000000..ee15986 --- /dev/null +++ b/extensions/logos-delivery-bindings/src/lib.rs @@ -0,0 +1,320 @@ +//! An embedded logos-delivery node, driven through the `waku-bindings` FFI. +//! +//! [`ThreadedDeliveryWrapper`] starts the node, publishes and subscribes by +//! content topic, and hands mapped inbound messages back on a queue. +//! +//! There is no node thread: `LogosDeliveryCtx` is `Send + Sync` and serialises +//! calls internally, so operations run on the caller's thread and the wrapper +//! is an `Arc` handle plus the queue. + +use std::sync::{Arc, Mutex}; +use std::thread; +use std::time::Duration; + +use base64::Engine; +use base64::engine::general_purpose::STANDARD as BASE64; +use crossbeam_channel::Receiver; +use tracing::{debug, error, info, warn}; +use waku_bindings::{LogosDeliveryCtx, MessageReceivedPayload, SendRequest, WakuMessagePayload}; + +/// `LogosDeliveryCtx` stores this at creation and reuses it for every call. +const NODE_CALL_TIMEOUT: Duration = Duration::from_secs(30); + +const INBOUND_CAPACITY: usize = 1024; + +// ── Error ──────────────────────────────────────────────────────────────────── + +#[derive(Debug, thiserror::Error)] +pub enum DeliveryError { + #[error("node startup failed: {0}")] + StartupFailed(String), + #[error("publish failed: {0}")] + PublishFailed(String), + #[error("subscribe failed: {0}")] + SubscribeFailed(String), + #[error("unsubscribe failed: {0}")] + UnsubscribeFailed(String), + #[error("send channel closed")] + ChannelClosed, +} + +// ── P2pConfig ─────────────────────────────────────────────────────────────── + +#[derive(Debug, Clone)] +pub struct P2pConfig { + pub preset: String, + pub port: u16, + pub log_level: String, +} + +impl Default for P2pConfig { + /// Joins `logos.dev` on an OS-assigned port, so instances do not collide. + fn default() -> Self { + const DEFAULT_NETWORK_PRESET: &str = "logos.dev"; + const DEFAULT_PORT: u16 = 0; + Self { + preset: DEFAULT_NETWORK_PRESET.into(), + port: DEFAULT_PORT, + log_level: "ERROR".into(), + } + } +} + +impl P2pConfig { + /// The node config JSON handed to `LogosDeliveryCtx::create`. + fn to_json(&self) -> String { + // discv5UdpPort defaults to 9000 in libwaku, so a second instance with + // a distinct --port still collides on UDP. Bind it to tcp_port so a + // single --port knob keeps both ports distinct across instances. + serde_json::json!({ + "logLevel": self.log_level, + "mode": "Core", + "preset": self.preset, + "tcpPort": self.port, + "discv5UdpPort": self.port, + }) + .to_string() + } +} + +// ── Wire types ────────────────────────────────────────────────────────────── + +/// A received-message event from the node. +#[derive(Debug, Clone)] +pub struct WakuEvent { + message: WakuMessagePayload, +} + +impl WakuEvent { + /// The received message. Always `Some`: the listener only fires for this + /// one event, so there is nothing to narrow. + pub fn into_received(self) -> Option { + Some(ReceivedMessage { + message: self.message, + }) + } +} + +/// Message payload from a received-message event. +#[derive(Debug, Clone)] +pub struct ReceivedMessage { + message: WakuMessagePayload, +} + +impl ReceivedMessage { + pub fn content_topic(&self) -> &str { + &self.message.content_topic + } + + /// Decode the base64 payload to raw bytes. + pub fn into_payload(self) -> Option> { + BASE64.decode(self.message.payload).ok() + } +} + +// ── Node ──────────────────────────────────────────────────────────────────── + +/// Owns the context so teardown is stop-then-destroy: this `Drop` runs first, +/// then the field's own `Drop` calls `logosdelivery_destroy`. +struct Node { + ctx: LogosDeliveryCtx, +} + +impl Drop for Node { + fn drop(&mut self) { + if let Err(e) = self.ctx.stop_node() { + warn!("stop_node failed during drop: {e}"); + } + info!("logos-delivery node stopped"); + } +} + +// ── ThreadedDeliveryWrapper ───────────────────────────────────────────────── + +/// Owns the embedded node. `T` is whatever the mapper passed to [`Self::start`] +/// produces; mapping runs on the callback thread, so filtering and decoding +/// happen inline. Cheap to clone — all clones share one node. +pub struct ThreadedDeliveryWrapper { + node: Arc, + inbound_rx: Option>, +} + +// Manual impls so `T` carries no `Clone`/`Debug` bound at the struct level — +// `Receiver` is `Clone` for every `T`. +impl Clone for ThreadedDeliveryWrapper { + fn clone(&self) -> Self { + Self { + node: self.node.clone(), + inbound_rx: self.inbound_rx.clone(), + } + } +} + +impl std::fmt::Debug for ThreadedDeliveryWrapper { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("ThreadedDeliveryWrapper") + .field("has_inbound", &self.inbound_rx.is_some()) + .finish_non_exhaustive() + } +} + +impl ThreadedDeliveryWrapper { + /// Start the embedded logos-delivery node. `map` runs on the node's event + /// callback for every received event; return `Some(item)` to enqueue it for + /// [`Self::inbound_queue`], or `None` to drop it. It must be non-blocking. + pub fn start(cfg: P2pConfig, map: F) -> Result + where + T: Clone + Send + 'static, + F: FnMut(WakuEvent) -> Option + Send + 'static, + { + let (inbound_tx, inbound_rx) = crossbeam_channel::bounded::(INBOUND_CAPACITY); + + let ctx = LogosDeliveryCtx::create(cfg.to_json(), NODE_CALL_TIMEOUT) + .map_err(DeliveryError::StartupFailed)?; + + // Registered before starting so no event can arrive unlistened. The ctx + // owns the closure, so the handle is unused. The mutex is because the + // listener wants `Fn` while the mapper is `FnMut`. + let mapper = Mutex::new(map); + let _handle = + ctx.add_on_message_received_listener(move |event: &MessageReceivedPayload| { + let item = match mapper.lock() { + Ok(mut map) => map(WakuEvent { + message: event.message.clone(), + }), + Err(e) => { + error!("mapper mutex poisoned: {e}"); + return; + } + }; + let Some(item) = item else { + return; + }; + match inbound_tx.try_send(item) { + Ok(()) => {} + Err(crossbeam_channel::TrySendError::Full(_)) => { + warn!("inbound queue full; dropping message") + } + Err(crossbeam_channel::TrySendError::Disconnected(_)) => {} + } + }); + + ctx.start_node().map_err(DeliveryError::StartupFailed)?; + info!("logos-delivery node started (preset={})", cfg.preset); + + // FIXME: stand-in for peer-connectivity detection. Should wait on + // `add_on_connection_change_listener` until a peer is reachable, with + // this duration as the timeout. + thread::sleep(Duration::from_secs(3)); + + Ok(Self { + node: Arc::new(Node { ctx }), + inbound_rx: Some(inbound_rx), + }) + } + + /// Start delivering messages on `content_topic`. Blocks until acknowledged. + pub fn subscribe(&self, content_topic: &str) -> Result<(), DeliveryError> { + debug!(?content_topic, "Subscribe"); + self.node + .ctx + .subscribe(content_topic.to_string()) + .map(|_| ()) + .map_err(DeliveryError::SubscribeFailed) + } + + /// Stop delivering messages on `content_topic`. Blocks until acknowledged. + pub fn unsubscribe(&self, content_topic: &str) -> Result<(), DeliveryError> { + debug!(?content_topic, "Unsubscribe"); + self.node + .ctx + .unsubscribe(content_topic.to_string()) + .map(|_| ()) + .map_err(DeliveryError::UnsubscribeFailed) + } + + /// Publish `payload` on `content_topic`. Blocks until the node acknowledges. + pub fn publish(&self, content_topic: &str, payload: &[u8]) -> Result<(), DeliveryError> { + let req = SendRequest { + content_topic: content_topic.to_string(), + payload: BASE64.encode(payload), + ephemeral: false, + }; + + debug!(content_topic = ?req.content_topic, payload = ?req.payload, ephemeral = ?req.ephemeral, "Publish"); + + self.node + .ctx + .send(req) + .map(|_| ()) + .map_err(DeliveryError::PublishFailed) + } + + /// Take the inbound queue of mapped items. Callable once. + pub fn inbound_queue(&mut self) -> Receiver { + self.inbound_rx + .take() + .expect("inbound_queue called more than once") + } +} + +#[cfg(test)] +mod tests { + use super::*; + + /// A mapper that filters by content topic and decodes to bytes has to be + /// accepted by `start`'s bound. + #[test] + fn accepts_a_filtering_mapper() { + const CHAT_TOPIC_PREFIX: &str = "/logos-chat/1/"; + + fn accepts(_map: F) + where + F: FnMut(WakuEvent) -> Option> + Send + 'static, + { + } + + accepts(|event: WakuEvent| { + let msg = event.into_received()?; + if !msg.content_topic().starts_with(CHAT_TOPIC_PREFIX) { + return None; + } + msg.into_payload() + }); + } + + #[test] + fn config_json_has_the_keys_the_node_expects() { + let cfg = P2pConfig { + preset: "logos.dev".into(), + port: 60010, + log_level: "ERROR".into(), + }; + let json: serde_json::Value = serde_json::from_str(&cfg.to_json()).unwrap(); + + assert_eq!(json["preset"], "logos.dev"); + assert_eq!(json["mode"], "Core"); + assert_eq!(json["logLevel"], "ERROR"); + // Both ports track `port`, so one knob keeps instances from colliding. + assert_eq!(json["tcpPort"], 60010); + assert_eq!(json["discv5UdpPort"], 60010); + } + + #[test] + fn received_message_decodes_base64_payload() { + let msg = ReceivedMessage { + message: WakuMessagePayload { + payload: BASE64.encode(b"hello"), + content_topic: "/logos-chat/1/demo/proto".into(), + version: 0, + timestamp: 0, + ephemeral: false, + meta: String::new(), + proof: String::new(), + }, + }; + + assert_eq!(msg.content_topic(), "/logos-chat/1/demo/proto"); + assert_eq!(msg.into_payload().unwrap(), b"hello"); + } +}