diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 1b824a70c..f55e79c92 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -9,11 +9,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout Repository uses: actions/checkout@v3 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 767134654..bf654a4e5 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -16,21 +16,15 @@ jobs: runs-on: ubuntu-latest steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout Repository uses: actions/checkout@v3 - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 - with: - override: true - toolchain: nightly - components: llvm-tools-preview - profile: minimal + id: toolchain + uses: dtolnay/rust-toolchain@nightly + + - name: Override rust-toolchain.toml + run: rustup override set ${{steps.toolchain.outputs.name}} - name: Cache Project uses: Swatinem/rust-cache@v2 @@ -51,10 +45,9 @@ jobs: run: "./grcov . --llvm --binary-path target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '/*' -o lcov.info" - name: Install covfix - uses: actions-rs/install@v0.1 + uses: dtolnay/install@master with: crate: rust-covfix - use-tool-cache: true - name: Run covfix run: rust-covfix lcov.info -o lcov.info --verbose diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 2670e7b9c..23f2cf5a9 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -17,11 +17,6 @@ jobs: strategy: fail-fast: false steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout Repository uses: actions/checkout@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b6e8a218..d0e961a8e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,19 +60,14 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 - with: - override: true - profile: minimal - toolchain: stable + uses: dtolnay/rust-toolchain@stable - name: Install Cargo Workspaces env: RUSTFLAGS: '-Copt-level=1' - uses: actions-rs/cargo@v1 + uses: dtolnay/install@master with: - args: --force cargo-workspaces - command: install + crate: cargo-workspaces - name: Verify Publishing of crates uses: katyo/publish-crates@v2 diff --git a/.github/workflows/tests_and_checks.yml b/.github/workflows/tests_and_checks.yml index d44d71b79..f6beef45f 100644 --- a/.github/workflows/tests_and_checks.yml +++ b/.github/workflows/tests_and_checks.yml @@ -23,11 +23,6 @@ jobs: # minimum version - 1.66 steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout Repository uses: actions/checkout@v3 @@ -36,28 +31,21 @@ jobs: - name: Cache Project uses: Swatinem/rust-cache@v2 - # Widely adopted suite of Rust-specific boilerplate actions, especially - # toolchain/cargo use: https://actions-rs.github.io/ - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 + id: toolchain + uses: dtolnay/rust-toolchain@master with: - override: true components: rustfmt, clippy toolchain: ${{ matrix.rust-toolchain }} + - name: Override rust-toolchain.toml + run: rustup override set ${{steps.toolchain.outputs.name}} + - name: Check Format - uses: actions-rs/cargo@v1 - with: - args: --all -- --check - command: fmt - toolchain: ${{ matrix.rust-toolchain }} + run: cargo fmt --all -- --check - name: Run Linter - uses: actions-rs/cargo@v1 - with: - args: --all -- -D warnings - command: clippy - toolchain: ${{ matrix.rust-toolchain }} + run: cargo clippy --all -- -D warnings # Check for security advisories - name: Check Advisories @@ -88,28 +76,21 @@ jobs: - stable - nightly steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout Repository uses: actions/checkout@v3 - - name: Install Environment Packages - run: | - sudo apt-get update -qqy - sudo apt-get install jq - - name: Cache Project uses: Swatinem/rust-cache@v2 - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 + id: toolchain + uses: dtolnay/rust-toolchain@master with: - override: true toolchain: ${{ matrix.rust-toolchain }} + - name: Override rust-toolchain.toml + run: rustup override set ${{steps.toolchain.outputs.name}} + - name: Install nextest uses: taiki-e/install-action@nextest @@ -128,30 +109,43 @@ jobs: - stable - nightly steps: - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout Repository uses: actions/checkout@v3 - - name: Install Environment Packages - run: | - sudo apt-get update -qqy - sudo apt-get install jq - - name: Cache Project uses: Swatinem/rust-cache@v2 - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 + id: toolchain + uses: dtolnay/rust-toolchain@master with: - override: true toolchain: ${{ matrix.rust-toolchain }} + - name: Override rust-toolchain.toml + run: rustup override set ${{steps.toolchain.outputs.name}} + - name: Install nextest uses: taiki-e/install-action@nextest - name: Run Tests run: cargo nextest run --no-default-features + + run-docs: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Cache Project + uses: Swatinem/rust-cache@v2 + + - name: Install Rust Toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Run Doc(s) compilation + env: + RUSTDOCFLAGS: -Dwarnings + run: cargo doc --document-private-items diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 93f2756d1..14b774b3a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,6 +27,14 @@ repos: args: ["--workspace", "--", "-D", "warnings"] types: [rust] pass_filenames: false + - id: docs + name: docs + description: Check docs for warnings. + entry: env RUSTDOCFLAGS=-Dwarnings cargo doc + language: system + args: ["--document-private-items"] + types: [rust] + pass_filenames: false - id: alejandra name: alejandra description: Format nix files. diff --git a/Cargo.lock b/Cargo.lock index b1d246132..f57cede34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,15 +26,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aead" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" -dependencies = [ - "generic-array", -] - [[package]] name = "aead" version = "0.4.3" @@ -42,28 +33,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array", - "rand_core 0.6.4", -] - -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" -dependencies = [ - "aes-soft", - "aesni", - "cipher 0.2.5", ] [[package]] @@ -73,70 +42,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher", "cpufeatures", "opaque-debug", ] -[[package]] -name = "aes" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" -dependencies = [ - "cfg-if", - "cipher 0.4.4", - "cpufeatures", -] - -[[package]] -name = "aes-gcm" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" -dependencies = [ - "aead 0.4.3", - "aes 0.7.5", - "cipher 0.3.0", - "ctr 0.8.0", - "ghash 0.4.4", - "subtle", -] - [[package]] name = "aes-gcm" -version = "0.10.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209b47e8954a928e1d72e86eca7000ebb6655fe1436d33eefc2201cad027e237" +checksum = "bc3be92e19a7ef47457b8e6f90707e12b6ac5d20c6f3866584fa3be0787d839f" dependencies = [ - "aead 0.5.2", - "aes 0.8.3", - "cipher 0.4.4", - "ctr 0.9.2", - "ghash 0.5.0", + "aead", + "aes", + "cipher", + "ctr", + "ghash", "subtle", ] -[[package]] -name = "aes-soft" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" -dependencies = [ - "cipher 0.2.5", - "opaque-debug", -] - -[[package]] -name = "aesni" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" -dependencies = [ - "cipher 0.2.5", - "opaque-debug", -] - [[package]] name = "ahash" version = "0.7.6" @@ -268,12 +192,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" -[[package]] -name = "arc-swap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" - [[package]] name = "arrayref" version = "0.3.7" @@ -286,73 +204,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "asn1-rs" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" -dependencies = [ - "asn1-rs-derive 0.1.0", - "asn1-rs-impl", - "displaydoc", - "nom", - "num-traits", - "rusticata-macros", - "thiserror", - "time", -] - -[[package]] -name = "asn1-rs" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" -dependencies = [ - "asn1-rs-derive 0.4.0", - "asn1-rs-impl", - "displaydoc", - "nom", - "num-traits", - "rusticata-macros", - "thiserror", - "time", -] - -[[package]] -name = "asn1-rs-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - -[[package]] -name = "asn1-rs-derive" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - -[[package]] -name = "asn1-rs-impl" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "asn1_der" version = "0.7.6" @@ -423,12 +274,6 @@ dependencies = [ "pin-project-lite 0.2.10", ] -[[package]] -name = "atomic-waker" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" - [[package]] name = "atomic_refcell" version = "0.1.10" @@ -515,12 +360,6 @@ 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" @@ -661,22 +500,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-modes" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" -dependencies = [ - "block-padding", - "cipher 0.2.5", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - [[package]] name = "borsh" version = "0.10.3" @@ -722,12 +545,6 @@ dependencies = [ "syn 1.0.109", ] -[[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.0" @@ -879,17 +696,6 @@ dependencies = [ "jobserver", ] -[[package]] -name = "ccm" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca1a8fbc20b50ac9673ff014abfb2b5f4085ee1a850d408f14a159c5853ac7" -dependencies = [ - "aead 0.3.2", - "cipher 0.2.5", - "subtle", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -903,7 +709,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher", "cpufeatures", "zeroize", ] @@ -914,9 +720,9 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ - "aead 0.4.3", + "aead", "chacha20", - "cipher 0.3.0", + "cipher", "poly1305", "zeroize", ] @@ -989,15 +795,6 @@ dependencies = [ "unsigned-varint", ] -[[package]] -name = "cipher" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" -dependencies = [ - "generic-array", -] - [[package]] name = "cipher" version = "0.3.0" @@ -1007,16 +804,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - [[package]] name = "clap" version = "4.3.11" @@ -1144,7 +931,7 @@ dependencies = [ "futures", "hdrhistogram", "humantime", - "parking_lot 0.12.1", + "parking_lot", "prost-types", "serde", "serde_json", @@ -1326,21 +1113,6 @@ dependencies = [ "wasmtime-types", ] -[[package]] -name = "crc" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" - [[package]] name = "crc32fast" version = "1.3.2" @@ -1459,18 +1231,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -1478,7 +1238,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "rand_core 0.6.4", "typenum", ] @@ -1492,32 +1251,13 @@ dependencies = [ "subtle", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher 0.3.0", -] - [[package]] name = "ctr" -version = "0.9.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +checksum = "a232f92a03f37dd7d7dd2adc67166c77e9cd88de5b019b9a9eecfaeaf7bfd481" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -1559,38 +1299,14 @@ dependencies = [ "snafu", ] -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core 0.14.4", - "darling_macro 0.14.4", -] - [[package]] name = "darling" version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0558d22a7b463ed0241e993f76f09f30b126687447751a8638587b864e4b3944" dependencies = [ - "darling_core 0.20.1", - "darling_macro 0.20.1", -] - -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -1607,24 +1323,13 @@ dependencies = [ "syn 2.0.23", ] -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core 0.14.4", - "quote", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" dependencies = [ - "darling_core 0.20.1", + "darling_core", "quote", "syn 2.0.23", ] @@ -1639,7 +1344,7 @@ dependencies = [ "hashbrown 0.12.3", "lock_api", "once_cell", - "parking_lot_core 0.9.8", + "parking_lot_core", ] [[package]] @@ -1677,17 +1382,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "der" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" -dependencies = [ - "const-oid", - "pem-rfc7468 0.6.0", - "zeroize", -] - [[package]] name = "der" version = "0.7.7" @@ -1695,69 +1389,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" dependencies = [ "const-oid", - "pem-rfc7468 0.7.0", + "pem-rfc7468", "zeroize", ] -[[package]] -name = "der-parser" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" -dependencies = [ - "asn1-rs 0.3.1", - "displaydoc", - "nom", - "num-bigint", - "num-traits", - "rusticata-macros", -] - -[[package]] -name = "der-parser" -version = "8.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" -dependencies = [ - "asn1-rs 0.5.2", - "displaydoc", - "nom", - "num-bigint", - "num-traits", - "rusticata-macros", -] - -[[package]] -name = "derive_builder" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" -dependencies = [ - "darling 0.14.4", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_builder_macro" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" -dependencies = [ - "derive_builder_core", - "syn 1.0.109", -] - [[package]] name = "diesel" version = "2.1.0" @@ -1863,17 +1498,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "displaydoc" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.23", -] - [[package]] name = "dlv-list" version = "0.3.0" @@ -1904,18 +1528,6 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "519b83cd10f5f6e969625a409f735182bea5558cd8b64c655806ceaae36f1999" -[[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", - "rfc6979", - "signature 1.6.4", -] - [[package]] name = "ed25519" version = "1.5.3" @@ -1945,28 +1557,6 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" -[[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", - "der 0.6.1", - "digest 0.10.7", - "ff", - "generic-array", - "group", - "hkdf", - "pem-rfc7468 0.6.0", - "pkcs8 0.9.0", - "rand_core 0.6.4", - "sec1 0.3.0", - "subtle", - "zeroize", -] - [[package]] name = "encoding_rs" version = "0.8.32" @@ -2070,9 +1660,9 @@ dependencies = [ [[package]] name = "exr" -version = "1.6.5" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a7b44a196573e272e0cf0bcf130281c71e9a0c67062954b3323fd364bfdac9" +checksum = "d1e481eb11a482815d3e9d618db8c42a93207134662873809335a92327440c18" dependencies = [ "bit_field", "flume", @@ -2119,16 +1709,6 @@ 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 = "fiat-crypto" version = "0.1.20" @@ -2152,7 +1732,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", - "libz-sys", "miniz_oxide", ] @@ -2298,8 +1877,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" dependencies = [ "futures-io", - "rustls 0.20.8", - "webpki 0.22.0", + "rustls", + "webpki", ] [[package]] @@ -2314,6 +1893,17 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +[[package]] +name = "futures-ticker" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9763058047f713632a52e916cc7f6a4b3fc6e9fc1ff8c5b1dc49e5a89041682e" +dependencies = [ + "futures", + "futures-timer", + "instant", +] + [[package]] name = "futures-timer" version = "3.0.2" @@ -2402,17 +1992,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug", - "polyval 0.5.3", -] - -[[package]] -name = "ghash" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" -dependencies = [ - "opaque-debug", - "polyval 0.6.1", + "polyval", ] [[package]] @@ -2436,17 +2016,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "group" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "h2" version = "0.3.20" @@ -2576,44 +2145,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" -[[package]] -name = "hkdf" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" -dependencies = [ - "hmac 0.12.1", -] - [[package]] name = "hmac" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" dependencies = [ - "crypto-mac 0.8.0", + "crypto-mac", "digest 0.9.0", ] -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - [[package]] name = "hmac-drbg" version = "0.3.0" @@ -2622,7 +2163,7 @@ checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", "generic-array", - "hmac 0.8.1", + "hmac", ] [[package]] @@ -2701,7 +2242,7 @@ dependencies = [ "proptest", "rand 0.8.5", "reqwest", - "sec1 0.7.2", + "sec1", "semver", "serde", "serde_ipld_dagcbor", @@ -2994,15 +2535,6 @@ dependencies = [ "hashbrown 0.14.0", ] -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array", -] - [[package]] name = "instant" version = "0.1.12" @@ -3015,25 +2547,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "interceptor" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8a11ae2da61704edada656798b61c94b35ecac2c58eb955156987d5e6be90b" -dependencies = [ - "async-trait", - "bytes", - "log", - "rand 0.8.5", - "rtcp", - "rtp", - "thiserror", - "tokio", - "waitgroup", - "webrtc-srtp", - "webrtc-util", -] - [[package]] name = "io-extras" version = "0.17.4" @@ -3112,7 +2625,7 @@ dependencies = [ "dirs", "futures", "http", - "multiaddr", + "multiaddr 0.17.1", "multibase", "serde", "serde_json", @@ -3367,9 +2880,9 @@ checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libp2p" -version = "0.51.3" +version = "0.52.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f210d259724eae82005b5c48078619b7745edb7b76de370b03f8ba59ea103097" +checksum = "38039ba2df4f3255842050845daef4a004cc1f26da03dbc645535088b51910ef" dependencies = [ "bytes", "futures", @@ -3386,24 +2899,21 @@ dependencies = [ "libp2p-kad", "libp2p-mdns", "libp2p-metrics", - "libp2p-mplex", "libp2p-noise", - "libp2p-quic", "libp2p-request-response", "libp2p-swarm", "libp2p-tcp", - "libp2p-webrtc", "libp2p-websocket", "libp2p-yamux", - "multiaddr", + "multiaddr 0.18.0", "pin-project", ] [[package]] name = "libp2p-allow-block-list" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "510daa05efbc25184458db837f6f9a5143888f1caa742426d92e1833ddd38a50" +checksum = "55b46558c5c0bf99d3e2a1a38fd54ff5476ca66dd1737b12466a1824dd219311" dependencies = [ "libp2p-core", "libp2p-identity", @@ -3413,9 +2923,9 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4caa33f1d26ed664c4fe2cca81a08c8e07d4c1c04f2f4ac7655c2dd85467fda0" +checksum = "d45dd90e8f0e1fa59e85ff5316dd4d1ac41a9a507e79cda1b0e9b7be43ad1a56" dependencies = [ "libp2p-core", "libp2p-identity", @@ -3425,9 +2935,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.39.2" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c1df63c0b582aa434fb09b2d86897fa2b419ffeccf934b36f87fcedc8e835c2" +checksum = "ef7dd7b09e71aac9271c60031d0e558966cdb3253ba0308ab369bb2de80630d0" dependencies = [ "either", "fnv", @@ -3436,11 +2946,11 @@ dependencies = [ "instant", "libp2p-identity", "log", - "multiaddr", - "multihash 0.17.0", + "multiaddr 0.18.0", + "multihash 0.19.0", "multistream-select", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "pin-project", "quick-protobuf", "rand 0.8.5", @@ -3453,23 +2963,24 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.39.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146ff7034daae62077c415c2376b8057368042df6ab95f5432ad5e88568b1554" +checksum = "fd4394c81c0c06d7b4a60f3face7e8e8a9b246840f98d2c80508d0721b032147" dependencies = [ "futures", "libp2p-core", + "libp2p-identity", "log", - "parking_lot 0.12.1", + "parking_lot", "smallvec", "trust-dns-resolver", ] [[package]] name = "libp2p-gossipsub" -version = "0.44.4" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70b34b6da8165c0bde35c82db8efda39b824776537e73973549e76cadb3a77c5" +checksum = "8e378da62e8c9251f6e885ed173a561663f29b251e745586cf6ae6150b295c37" dependencies = [ "asynchronous-codec", "base64 0.21.2", @@ -3478,6 +2989,8 @@ dependencies = [ "either", "fnv", "futures", + "futures-ticker", + "getrandom 0.2.10", "hex_fmt", "instant", "libp2p-core", @@ -3491,17 +3004,15 @@ dependencies = [ "regex", "sha2 0.10.7", "smallvec", - "thiserror", "unsigned-varint", "void", - "wasm-timer", ] [[package]] name = "libp2p-identify" -version = "0.42.2" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5455f472243e63b9c497ff320ded0314254a9eb751799a39c283c6f20b793f3c" +checksum = "6a29675a32dbcc87790db6cf599709e64308f1ae9d5ecea2d259155889982db8" dependencies = [ "asynchronous-codec", "either", @@ -3521,17 +3032,16 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.1.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e2d584751cecb2aabaa56106be6be91338a60a0f4e420cf2af639204f596fc1" +checksum = "d2874d9c6575f1d7a151022af5c42bb0ffdcdfbafe0a6fd039de870b384835a2" dependencies = [ "asn1_der", - "bs58 0.4.0", + "bs58", "ed25519-dalek", "libsecp256k1", "log", - "multiaddr", - "multihash 0.17.0", + "multihash 0.19.0", "quick-protobuf", "rand 0.8.5", "sha2 0.10.7", @@ -3541,9 +3051,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.43.3" +version = "0.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39d5ef876a2b2323d63c258e63c2f8e36f205fe5a11f0b3095d59635650790ff" +checksum = "5588b884dcb1dadc04e49de342f634f60cf28b6beaaca5a4fe3dd1f09bb30041" dependencies = [ "arrayvec", "asynchronous-codec", @@ -3569,9 +3079,9 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.43.1" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19983e1f949f979a928f2c603de1cf180cc0dc23e4ac93a62651ccb18341460b" +checksum = "42a2567c305232f5ef54185e9604579a894fd0674819402bb0ac0246da82f52a" dependencies = [ "data-encoding", "futures", @@ -3582,7 +3092,7 @@ dependencies = [ "log", "rand 0.8.5", "smallvec", - "socket2 0.4.9", + "socket2 0.5.3", "tokio", "trust-dns-proto", "void", @@ -3590,41 +3100,26 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a42ec91e227d7d0dafa4ce88b333cdf5f277253873ab087555c92798db2ddd46" +checksum = "3787ea81798dcc5bf1d8b40a8e8245cf894b168d04dd70aa48cb3ff2fff141d2" dependencies = [ + "instant", "libp2p-core", "libp2p-gossipsub", "libp2p-identify", + "libp2p-identity", "libp2p-kad", "libp2p-swarm", + "once_cell", "prometheus-client", ] -[[package]] -name = "libp2p-mplex" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d34780b514b159e6f3fd70ba3e72664ec89da28dca2d1e7856ee55e2c7031ba" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures", - "libp2p-core", - "log", - "nohash-hasher", - "parking_lot 0.12.1", - "rand 0.8.5", - "smallvec", - "unsigned-varint", -] - [[package]] name = "libp2p-noise" -version = "0.42.2" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3673da89d29936bc6435bafc638e2f184180d554ce844db65915113f86ec5e" +checksum = "87945db2b3f977af09b62b9aa0a5f3e4870995a577ecd845cdeba94cdf6bbca7" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -3632,6 +3127,8 @@ dependencies = [ "libp2p-core", "libp2p-identity", "log", + "multiaddr 0.18.0", + "multihash 0.19.0", "once_cell", "quick-protobuf", "rand 0.8.5", @@ -3639,37 +3136,15 @@ dependencies = [ "snow", "static_assertions", "thiserror", - "x25519-dalek 1.1.1", + "x25519-dalek", "zeroize", ] -[[package]] -name = "libp2p-quic" -version = "0.7.0-alpha.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6b26abd81cd2398382a1edfe739b539775be8a90fa6914f39b2ab49571ec735" -dependencies = [ - "bytes", - "futures", - "futures-timer", - "if-watch", - "libp2p-core", - "libp2p-identity", - "libp2p-tls", - "log", - "parking_lot 0.12.1", - "quinn-proto", - "rand 0.8.5", - "rustls 0.20.8", - "thiserror", - "tokio", -] - [[package]] name = "libp2p-request-response" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffdb374267d42dc5ed5bc53f6e601d4a64ac5964779c6e40bb9e4f14c1e30d5" +checksum = "20bd837798cdcce4283d2675f08bcd3756a650d56eab4d4367e1b3f27eed6887" dependencies = [ "async-trait", "futures", @@ -3677,15 +3152,19 @@ dependencies = [ "libp2p-core", "libp2p-identity", "libp2p-swarm", + "log", "rand 0.8.5", + "serde", + "serde_cbor", "smallvec", + "void", ] [[package]] name = "libp2p-swarm" -version = "0.42.2" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903b3d592d7694e56204d211f29d31bc004be99386644ba8731fc3e3ef27b296" +checksum = "a6f1fe3817492f88c5298c8b5fbaa5ff3a0c802ecf4e79be4e341cf07abfa82f" dependencies = [ "either", "fnv", @@ -3696,6 +3175,8 @@ dependencies = [ "libp2p-identity", "libp2p-swarm-derive", "log", + "multistream-select", + "once_cell", "rand 0.8.5", "smallvec", "tokio", @@ -3704,93 +3185,47 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fba456131824ab6acd4c7bf61e9c0f0a3014b5fc9868ccb8e10d344594cdc4f" +checksum = "c4d5ec2a3df00c7836d7696c136274c9c59705bac69133253696a6c932cd1d74" dependencies = [ "heck", + "proc-macro-warning", + "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.23", ] [[package]] name = "libp2p-tcp" -version = "0.39.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d33698596d7722d85d3ab0c86c2c322254fce1241e91208e3679b4eb3026cf" +checksum = "09bfdfb6f945c5c014b87872a0bdb6e0aef90e92f380ef57cd9013f118f9289d" dependencies = [ "futures", "futures-timer", "if-watch", "libc", "libp2p-core", - "log", - "socket2 0.4.9", - "tokio", -] - -[[package]] -name = "libp2p-tls" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff08d13d0dc66e5e9ba6279c1de417b84fa0d0adc3b03e5732928c180ec02781" -dependencies = [ - "futures", - "futures-rustls", - "libp2p-core", "libp2p-identity", - "rcgen 0.10.0", - "ring", - "rustls 0.20.8", - "thiserror", - "webpki 0.22.0", - "x509-parser 0.14.0", - "yasna", -] - -[[package]] -name = "libp2p-webrtc" -version = "0.4.0-alpha.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba48592edbc2f60b4bc7c10d65445b0c3964c07df26fdf493b6880d33be36f8" -dependencies = [ - "async-trait", - "asynchronous-codec", - "bytes", - "futures", - "futures-timer", - "hex", - "if-watch", - "libp2p-core", - "libp2p-identity", - "libp2p-noise", "log", - "multihash 0.17.0", - "quick-protobuf", - "quick-protobuf-codec", - "rand 0.8.5", - "rcgen 0.9.3", - "serde", - "stun", - "thiserror", - "tinytemplate", + "socket2 0.5.3", "tokio", - "tokio-util", - "webrtc", ] [[package]] name = "libp2p-websocket" -version = "0.41.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111273f7b3d3510524c752e8b7a5314b7f7a1fee7e68161c01a7d72cbb06db9f" +checksum = "956d981ebc84abc3377e5875483c06d94ff57bc6b25f725047f9fd52592f72d4" dependencies = [ "either", "futures", "futures-rustls", "libp2p-core", + "libp2p-identity", "log", - "parking_lot 0.12.1", + "parking_lot", "quicksink", "rw-stream-sink", "soketto", @@ -3800,9 +3235,9 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.43.1" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd21d950662700a385d4c6d68e2f5f54d778e97068cdd718522222ef513bda" +checksum = "c0a9b42ab6de15c6f076d8fb11dc5f48d899a10b55a2e16b12be9012a05287b0" dependencies = [ "futures", "libp2p-core", @@ -3870,17 +3305,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "libz-sys" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -3975,15 +3399,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" -[[package]] -name = "md-5" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" -dependencies = [ - "digest 0.10.7", -] - [[package]] name = "md5" version = "0.7.0" @@ -4005,15 +3420,6 @@ dependencies = [ "rustix 0.37.23", ] -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.7.1" @@ -4107,16 +3513,35 @@ dependencies = [ [[package]] name = "multiaddr" -version = "0.17.1" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b36f567c7099511fa8612bbbb52dda2419ce0bdbacf31714e3a5ffdb766d3bd" +dependencies = [ + "arrayref", + "byteorder", + "data-encoding", + "log", + "multibase", + "multihash 0.17.0", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint", + "url", +] + +[[package]] +name = "multiaddr" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b36f567c7099511fa8612bbbb52dda2419ce0bdbacf31714e3a5ffdb766d3bd" +checksum = "92a651988b3ed3ad1bc8c87d016bb92f6f395b84ed1db9b926b32b1fc5a2c8b5" dependencies = [ "arrayref", "byteorder", "data-encoding", - "log", + "libp2p-identity", "multibase", - "multihash 0.17.0", + "multihash 0.19.0", "percent-encoding", "serde", "static_assertions", @@ -4155,9 +3580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" dependencies = [ "core2", - "digest 0.10.7", "multihash-derive", - "sha2 0.10.7", "unsigned-varint", ] @@ -4180,6 +3603,16 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "multihash" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd59dcc2bbe70baabeac52cd22ae52c55eefe6c38ff11a9439f16a350a939f2" +dependencies = [ + "core2", + "unsigned-varint", +] + [[package]] name = "multihash-derive" version = "0.8.1" @@ -4196,9 +3629,9 @@ dependencies = [ [[package]] name = "multistream-select" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" +checksum = "ea0df8e5eec2298a62b326ee4f0d7fe1a6b90a09dfcf9df37b38f947a8c42f19" dependencies = [ "bytes", "futures", @@ -4310,7 +3743,6 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset 0.6.5", ] [[package]] @@ -4353,17 +3785,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-integer" version = "0.1.45" @@ -4426,24 +3847,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "oid-registry" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" -dependencies = [ - "asn1-rs 0.3.1", -] - -[[package]] -name = "oid-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" -dependencies = [ - "asn1-rs 0.5.2", -] - [[package]] name = "once_cell" version = "1.18.0" @@ -4532,28 +3935,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "p256" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" -dependencies = [ - "ecdsa", - "elliptic-curve", - "sha2 0.10.7", -] - -[[package]] -name = "p384" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" -dependencies = [ - "ecdsa", - "elliptic-curve", - "sha2 0.10.7", -] - [[package]] name = "packed_simd_2" version = "0.3.8" @@ -4570,17 +3951,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" -[[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.1" @@ -4588,21 +3958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", -] - -[[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", + "parking_lot_core", ] [[package]] @@ -4630,24 +3986,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" -[[package]] -name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" -dependencies = [ - "base64 0.13.1", -] - -[[package]] -name = "pem-rfc7468" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" -dependencies = [ - "base64ct", -] - [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -4745,24 +4083,14 @@ 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 0.7.7", - "spki 0.7.2", + "der", + "spki", ] [[package]] @@ -4842,7 +4170,7 @@ checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ "cpufeatures", "opaque-debug", - "universal-hash 0.4.1", + "universal-hash", ] [[package]] @@ -4854,19 +4182,7 @@ dependencies = [ "cfg-if", "cpufeatures", "opaque-debug", - "universal-hash 0.4.1", -] - -[[package]] -name = "polyval" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash 0.5.1", + "universal-hash", ] [[package]] @@ -4918,6 +4234,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-warning" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70550716265d1ec349c41f70dd4f964b4fd88394efe4405f0c1da679c4799a07" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.23", +] + [[package]] name = "proc-macro2" version = "1.0.63" @@ -4929,13 +4256,13 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.19.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6fa99d535dd930d1249e6c79cb3c2915f9172a540fe2b02a4c8f9ca954721e" +checksum = "78c2f43e8969d51935d2a7284878ae053ba30034cd563f673cde37ba5205685e" dependencies = [ "dtoa", "itoa", - "parking_lot 0.12.1", + "parking_lot", "prometheus-client-derive-encode", ] @@ -5068,9 +4395,9 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1693116345026436eb2f10b677806169c1a1260c1c60eaaffe3fb5a29ae23d8b" +checksum = "f8ededb1cd78531627244d51dd0c7139fbe736c7d57af0092a76f0ffb2f56e98" dependencies = [ "asynchronous-codec", "bytes", @@ -5090,24 +4417,6 @@ dependencies = [ "pin-project-lite 0.1.12", ] -[[package]] -name = "quinn-proto" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c10f662eee9c94ddd7135043e544f3c82fa839a1e7b865911331961b53186c" -dependencies = [ - "bytes", - "rand 0.8.5", - "ring", - "rustc-hash", - "rustls 0.20.8", - "slab", - "thiserror", - "tinyvec", - "tracing", - "webpki 0.22.0", -] - [[package]] name = "quote" version = "1.0.29" @@ -5124,7 +4433,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" dependencies = [ "log", - "parking_lot 0.12.1", + "parking_lot", "scheduled-thread-pool", ] @@ -5236,31 +4545,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "rcgen" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" -dependencies = [ - "pem", - "ring", - "time", - "x509-parser 0.13.2", - "yasna", -] - -[[package]] -name = "rcgen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" -dependencies = [ - "pem", - "ring", - "time", - "yasna", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -5305,13 +4589,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89089e897c013b3deb627116ae56a6955a72b8bed395c9526af31c9fe528b484" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.0", + "regex-automata 0.3.2", "regex-syntax 0.7.3", ] @@ -5326,9 +4610,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa250384981ea14565685dea16a9ccc4d1c541a13f82b9c168572264d1df8c56" +checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" dependencies = [ "aho-corasick", "memchr", @@ -5403,17 +4687,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "rfc6979" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" -dependencies = [ - "crypto-bigint", - "hmac 0.12.1", - "zeroize", -] - [[package]] name = "ring" version = "0.16.20" @@ -5468,17 +4741,6 @@ dependencies = [ "serde", ] -[[package]] -name = "rtcp" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1919efd6d4a6a85d13388f9487549bb8e359f17198cc03ffd72f79b553873691" -dependencies = [ - "bytes", - "thiserror", - "webrtc-util", -] - [[package]] name = "rtnetlink" version = "0.10.1" @@ -5494,20 +4756,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "rtp" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a095411ff00eed7b12e4c6a118ba984d113e1079582570d56a5ee723f11f80" -dependencies = [ - "async-trait", - "bytes", - "rand 0.8.5", - "serde", - "thiserror", - "webrtc-util", -] - [[package]] name = "rust-ini" version = "0.18.0" @@ -5557,15 +4805,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rusticata-macros" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" -dependencies = [ - "nom", -] - [[package]] name = "rustix" version = "0.37.23" @@ -5597,27 +4836,24 @@ dependencies = [ [[package]] name = "rustls" -version = "0.19.1" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" dependencies = [ - "base64 0.13.1", "log", "ring", - "sct 0.6.1", - "webpki 0.21.4", + "sct", + "webpki", ] [[package]] -name = "rustls" -version = "0.20.8" +name = "rustls-webpki" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" dependencies = [ - "log", "ring", - "sct 0.7.0", - "webpki 0.22.0", + "untrusted", ] [[package]] @@ -5640,9 +4876,9 @@ dependencies = [ [[package]] name = "rw-stream-sink" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" +checksum = "d8c9026ff5d2f23da5e45bbc283f156383001bfb09c4e44256d02c1a685fe9a1" dependencies = [ "futures", "pin-project", @@ -5679,7 +4915,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" dependencies = [ - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -5688,16 +4924,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "sct" version = "0.7.0" @@ -5708,48 +4934,22 @@ dependencies = [ "untrusted", ] -[[package]] -name = "sdp" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d22a5ef407871893fd72b4562ee15e4742269b173959db4b8df6f538c414e13" -dependencies = [ - "rand 0.8.5", - "substring", - "thiserror", - "url", -] - [[package]] name = "seahash" version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[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", - "pkcs8 0.9.0", - "subtle", - "zeroize", -] - [[package]] name = "sec1" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" dependencies = [ - "base16ct 0.2.0", - "der 0.7.7", + "base16ct", + "der", "generic-array", - "pkcs8 0.10.2", + "pkcs8", "zeroize", ] @@ -5809,6 +5009,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half 1.8.2", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.167" @@ -5896,7 +5106,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070" dependencies = [ - "darling 0.20.1", + "darling", "proc-macro2", "quote", "syn 2.0.23", @@ -5992,10 +5202,6 @@ 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" @@ -6064,7 +5270,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" dependencies = [ - "aes-gcm 0.9.4", + "aes-gcm", "blake2", "chacha20poly1305", "curve25519-dalek 4.0.0-rc.1", @@ -6103,7 +5309,6 @@ checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ "base64 0.13.1", "bytes", - "flate2", "futures", "httparse", "log", @@ -6117,23 +5322,13 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - -[[package]] -name = "spki" -version = "0.6.0" +[[package]] +name = "spin" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" dependencies = [ - "base64ct", - "der 0.6.1", + "lock_api", ] [[package]] @@ -6143,7 +5338,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", - "der 0.7.7", + "der", ] [[package]] @@ -6202,39 +5397,11 @@ dependencies = [ "syn 2.0.23", ] -[[package]] -name = "stun" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" -dependencies = [ - "base64 0.13.1", - "crc", - "lazy_static", - "md-5", - "rand 0.8.5", - "ring", - "subtle", - "thiserror", - "tokio", - "url", - "webrtc-util", -] - -[[package]] -name = "substring" -version = "1.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" -dependencies = [ - "autocfg", -] - [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" @@ -6466,7 +5633,6 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot 0.12.1", "pin-project-lite 0.2.10", "signal-hook-registry", "socket2 0.4.9", @@ -6549,7 +5715,6 @@ checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", "pin-project-lite 0.2.10", "tokio", @@ -6736,7 +5901,7 @@ dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "regex", "sharded-slab", "smallvec", @@ -6783,7 +5948,7 @@ dependencies = [ "ipconfig", "lazy_static", "lru-cache", - "parking_lot 0.12.1", + "parking_lot", "resolv-conf", "smallvec", "thiserror", @@ -6847,25 +6012,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "turn" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" -dependencies = [ - "async-trait", - "base64 0.13.1", - "futures", - "log", - "md-5", - "rand 0.8.5", - "ring", - "stun", - "thiserror", - "tokio", - "webrtc-util", -] - [[package]] name = "typed-builder" version = "0.10.0" @@ -6893,7 +6039,7 @@ dependencies = [ "async-recursion", "async-trait", "base64 0.21.2", - "bs58 0.5.0", + "bs58", "cid 0.10.1", "futures", "getrandom 0.2.10", @@ -6912,9 +6058,9 @@ dependencies = [ [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "uint" @@ -6984,24 +6130,14 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "universal-hash" -version = "0.4.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" dependencies = [ "generic-array", "subtle", ] -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - [[package]] name = "unsigned-varint" version = "0.7.1" @@ -7091,15 +6227,6 @@ dependencies = [ "libc", ] -[[package]] -name = "waitgroup" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1f50000a783467e6c0200f9d10642f4bc424e39efc1b770203e88b488f79292" -dependencies = [ - "atomic-waker", -] - [[package]] name = "waker-fn" version = "1.1.0" @@ -7286,21 +6413,6 @@ dependencies = [ "wasmparser", ] -[[package]] -name = "wasm-timer" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" -dependencies = [ - "futures", - "js-sys", - "parking_lot 0.11.2", - "pin-utils", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "wasmparser" version = "0.107.0" @@ -7666,16 +6778,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki" version = "0.22.0" @@ -7688,220 +6790,11 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki 0.22.0", -] - -[[package]] -name = "webrtc" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3bc9049bdb2cea52f5fd4f6f728184225bdb867ed0dc2410eab6df5bdd67bb" -dependencies = [ - "arc-swap", - "async-trait", - "bytes", - "hex", - "interceptor", - "lazy_static", - "log", - "rand 0.8.5", - "rcgen 0.9.3", - "regex", - "ring", - "rtcp", - "rtp", - "rustls 0.19.1", - "sdp", - "serde", - "serde_json", - "sha2 0.10.7", - "stun", - "thiserror", - "time", - "tokio", - "turn", - "url", - "waitgroup", - "webrtc-data", - "webrtc-dtls", - "webrtc-ice", - "webrtc-mdns", - "webrtc-media", - "webrtc-sctp", - "webrtc-srtp", - "webrtc-util", -] - -[[package]] -name = "webrtc-data" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef36a4d12baa6e842582fe9ec16a57184ba35e1a09308307b67d43ec8883100" -dependencies = [ - "bytes", - "derive_builder", - "log", - "thiserror", - "tokio", - "webrtc-sctp", - "webrtc-util", -] - -[[package]] -name = "webrtc-dtls" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942be5bd85f072c3128396f6e5a9bfb93ca8c1939ded735d177b7bcba9a13d05" -dependencies = [ - "aes 0.6.0", - "aes-gcm 0.10.2", - "async-trait", - "bincode", - "block-modes", - "byteorder", - "ccm", - "curve25519-dalek 3.2.0", - "der-parser 8.2.0", - "elliptic-curve", - "hkdf", - "hmac 0.12.1", - "log", - "oid-registry 0.6.1", - "p256", - "p384", - "rand 0.8.5", - "rand_core 0.6.4", - "rcgen 0.9.3", - "ring", - "rustls 0.19.1", - "sec1 0.3.0", - "serde", - "sha1", - "sha2 0.10.7", - "signature 1.6.4", - "subtle", - "thiserror", - "tokio", - "webpki 0.21.4", - "webrtc-util", - "x25519-dalek 2.0.0-pre.1", - "x509-parser 0.13.2", -] - -[[package]] -name = "webrtc-ice" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465a03cc11e9a7d7b4f9f99870558fe37a102b65b93f8045392fef7c67b39e80" -dependencies = [ - "arc-swap", - "async-trait", - "crc", - "log", - "rand 0.8.5", - "serde", - "serde_json", - "stun", - "thiserror", - "tokio", - "turn", - "url", - "uuid", - "waitgroup", - "webrtc-mdns", - "webrtc-util", -] - -[[package]] -name = "webrtc-mdns" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" -dependencies = [ - "log", - "socket2 0.4.9", - "thiserror", - "tokio", - "webrtc-util", -] - -[[package]] -name = "webrtc-media" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f72e1650a8ae006017d1a5280efb49e2610c19ccc3c0905b03b648aee9554991" -dependencies = [ - "byteorder", - "bytes", - "rand 0.8.5", - "rtp", - "thiserror", -] - -[[package]] -name = "webrtc-sctp" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d47adcd9427eb3ede33d5a7f3424038f63c965491beafcc20bc650a2f6679c0" -dependencies = [ - "arc-swap", - "async-trait", - "bytes", - "crc", - "log", - "rand 0.8.5", - "thiserror", - "tokio", - "webrtc-util", -] - -[[package]] -name = "webrtc-srtp" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6183edc4c1c6c0175f8812eefdce84dfa0aea9c3ece71c2bf6ddd3c964de3da5" -dependencies = [ - "aead 0.4.3", - "aes 0.7.5", - "aes-gcm 0.9.4", - "async-trait", - "byteorder", - "bytes", - "ctr 0.8.0", - "hmac 0.11.0", - "log", - "rtcp", - "rtp", - "sha-1", - "subtle", - "thiserror", - "tokio", - "webrtc-util", -] - -[[package]] -name = "webrtc-util" -version = "0.7.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" dependencies = [ - "async-trait", - "bitflags 1.3.2", - "bytes", - "cc", - "ipnet", - "lazy_static", - "libc", - "log", - "nix 0.24.3", - "rand 0.8.5", - "thiserror", - "tokio", - "winapi", + "rustls-webpki", ] [[package]] @@ -8125,9 +7018,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9482fe6ceabdf32f3966bfdd350ba69256a97c30253dc616fe0005af24f164e" +checksum = "81a2094c43cc94775293eaa0e499fbc30048a6d824ac82c0351a8c0bf9112529" dependencies = [ "memchr", ] @@ -8303,54 +7196,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "x25519-dalek" -version = "2.0.0-pre.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" -dependencies = [ - "curve25519-dalek 3.2.0", - "rand_core 0.6.4", - "zeroize", -] - -[[package]] -name = "x509-parser" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" -dependencies = [ - "asn1-rs 0.3.1", - "base64 0.13.1", - "data-encoding", - "der-parser 7.0.0", - "lazy_static", - "nom", - "oid-registry 0.4.0", - "ring", - "rusticata-macros", - "thiserror", - "time", -] - -[[package]] -name = "x509-parser" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" -dependencies = [ - "asn1-rs 0.5.2", - "base64 0.13.1", - "data-encoding", - "der-parser 8.2.0", - "lazy_static", - "nom", - "oid-registry 0.6.1", - "rusticata-macros", - "thiserror", - "time", -] - [[package]] name = "xid" version = "1.0.3" @@ -8385,20 +7230,11 @@ dependencies = [ "futures", "log", "nohash-hasher", - "parking_lot 0.12.1", + "parking_lot", "rand 0.8.5", "static_assertions", ] -[[package]] -name = "yasna" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" -dependencies = [ - "time", -] - [[package]] name = "zeroize" version = "1.6.0" diff --git a/flake.nix b/flake.nix index 5083851e8..0120ead93 100644 --- a/flake.nix +++ b/flake.nix @@ -73,6 +73,10 @@ diesel migration run ''; + doc = pkgs.writeScriptBin "doc" '' + cargo doc --no-deps --document-private-items --open + ''; + compileWasm = pkgs.writeScriptBin "compile-wasm" '' cargo build -p homestar-functions --target wasm32-unknown-unknown --release ''; @@ -155,6 +159,7 @@ ci db dbReset + doc compileWasm (builtins.map (arch: dockerBuild arch) ["amd64" "arm64"]) (builtins.map (cmd: xFunc cmd) ["build" "check" "run" "clippy"]) @@ -187,7 +192,6 @@ rust-analyzer pkg-config pre-commit - protobuf diesel-cli direnv self.packages.${system}.irust diff --git a/homestar-runtime/Cargo.toml b/homestar-runtime/Cargo.toml index babc13b51..6e2a06e09 100644 --- a/homestar-runtime/Cargo.toml +++ b/homestar-runtime/Cargo.toml @@ -55,7 +55,9 @@ indexmap = "2.0" ipfs-api = { version = "0.17", optional = true } ipfs-api-backend-hyper = { version = "0.6", features = ["with-builder", "with-send-sync"], optional = true } libipld = { workspace = true } -libp2p = { version = "0.51", default-features = false, features = ["kad", "request-response", "macros", "identify", "mdns", "gossipsub", "tokio", "dns", "mplex", "tcp", "noise", "yamux", "websocket", "ed25519", "secp256k1"] } +libp2p = { version = "0.52", default-features = false, features = ["kad", "request-response", "macros", + "identify", "ed25519", "secp256k1", "mdns", "gossipsub", "request-response", "tokio", "dns", "tcp", + "noise", "cbor", "yamux", "websocket"] } libsqlite3-sys = { version = "0.26", features = ["bundled"] } openssl = { version = "0.10", features = ["vendored"] } proptest = { version = "1.2", optional = true } diff --git a/homestar-runtime/src/db.rs b/homestar-runtime/src/db.rs index db92ce049..90c48d221 100644 --- a/homestar-runtime/src/db.rs +++ b/homestar-runtime/src/db.rs @@ -32,12 +32,13 @@ PRAGMA foreign_keys = ON; -- enforce foreign keys /// A Sqlite connection [pool]. /// /// [pool]: r2d2::Pool -pub type Pool = r2d2::Pool>; +pub(crate) type Pool = r2d2::Pool>; /// A [connection] from the Sqlite connection [pool]. /// /// [connection]: r2d2::PooledConnection /// [pool]: r2d2::Pool -pub type Connection = r2d2::PooledConnection>; +pub(crate) type Connection = + r2d2::PooledConnection>; /// The database object, which wraps an inner [Arc] to the connection pool. #[derive(Debug)] @@ -64,21 +65,16 @@ impl Db { } } -/// Database trait for working with different Sqlite [pool] and [connection] -/// configurations. -/// -/// [pool]: Pool -/// [connection]: Connection -pub trait Database: Send + Clone { +/// Database trait for working with different Sqlite connection pool and +/// connection configurations. +pub trait Database: Send + Sync + Clone { /// Establish a pooled connection to Sqlite database. fn setup_connection_pool(settings: &settings::Node) -> Result where Self: Sized; - /// Get a [pooled connection] for the database. - /// - /// [pooled connection]: Connection + /// Get a pooled connection for the database. fn conn(&self) -> Result; - /// Store receipt given a [Connection] to the DB [Pool]. + /// Store receipt given a connection to the database pool. /// /// On conflicts, do nothing. fn store_receipt(receipt: Receipt, conn: &mut Connection) -> Result { @@ -90,7 +86,7 @@ pub trait Database: Send + Clone { .map_err(Into::into) } - /// Store receipts given a [Connection] to the DB [Pool]. + /// Store receipts given a connection to the Database pool. fn store_receipts(receipts: Vec, conn: &mut Connection) -> Result { diesel::insert_into(schema::receipts::table) .values(&receipts) @@ -159,10 +155,7 @@ pub trait Database: Send + Clone { } /// Join workflow information with number of receipts emitted. - fn join_workflow_with_receipts( - workflow_cid: Cid, - conn: &mut Connection, - ) -> Result<(workflow::Stored, Vec)> { + fn get_workflow_info(workflow_cid: Cid, conn: &mut Connection) -> Result { let wf = Self::select_workflow(workflow_cid, conn)?; let associated_receipts = workflow::StoredReceipt::belonging_to(&wf) .inner_join(schema::receipts::dsl::receipts) @@ -173,7 +166,8 @@ pub trait Database: Send + Clone { .into_iter() .map(|pointer: Pointer| pointer.cid()) .collect(); - Ok((wf, cids)) + + Ok(workflow::Info::new(workflow_cid, cids, wf.num_tasks as u32)) } } @@ -207,7 +201,7 @@ impl Database for Db { /// Database connection options. #[derive(Debug, Clone, PartialEq)] -pub struct ConnectionCustomizer; +pub(crate) struct ConnectionCustomizer; impl CustomizeConnection for ConnectionCustomizer where diff --git a/homestar-runtime/src/event_handler.rs b/homestar-runtime/src/event_handler.rs index 673bd2870..3bda138a4 100644 --- a/homestar-runtime/src/event_handler.rs +++ b/homestar-runtime/src/event_handler.rs @@ -6,18 +6,20 @@ use crate::{db::Database, network::swarm::ComposedBehaviour, settings}; use anyhow::Result; use async_trait::async_trait; use fnv::FnvHashMap; -use libp2p::{futures::StreamExt, kad::QueryId, swarm::Swarm}; -use std::sync::Arc; +use libipld::Cid; +use libp2p::{futures::StreamExt, kad::QueryId, request_response::RequestId, swarm::Swarm}; +use std::{sync::Arc, time::Duration}; +use swarm_event::SwarmResponseEvent; use tokio::{select, sync::mpsc}; pub(crate) mod channel; pub(crate) mod event; pub(crate) mod swarm_event; - pub(crate) use event::Event; -type P2PSender = channel::BoundedChannelSender; +type P2PSender = channel::BoundedChannelSender; +/// Handler trait for [EventHandler] events. #[async_trait] pub(crate) trait Handler where @@ -32,14 +34,16 @@ where /// Event loop handler for [libp2p] network events and commands. #[allow(dead_code)] #[allow(missing_debug_implementations)] -pub struct EventHandler { +pub(crate) struct EventHandler { + receipt_quorum: usize, + workflow_quorum: usize, + p2p_provider_timeout: Duration, db: DB, + swarm: Swarm, sender: Arc>, receiver: mpsc::Receiver, - receipt_quorum: usize, - swarm: Swarm, - workflow_quorum: usize, - worker_swarm_senders: FnvHashMap, + query_senders: FnvHashMap, + request_response_senders: FnvHashMap, } impl EventHandler @@ -54,13 +58,15 @@ where pub(crate) fn new(swarm: Swarm, db: DB, settings: &settings::Node) -> Self { let (sender, receiver) = Self::setup_channel(settings); Self { + receipt_quorum: settings.network.receipt_quorum, + workflow_quorum: settings.network.workflow_quorum, + p2p_provider_timeout: settings.network.p2p_provider_timeout, db, + swarm, sender: Arc::new(sender), receiver, - receipt_quorum: settings.network.receipt_quorum, - swarm, - workflow_quorum: settings.network.workflow_quorum, - worker_swarm_senders: FnvHashMap::default(), + query_senders: FnvHashMap::default(), + request_response_senders: FnvHashMap::default(), } } diff --git a/homestar-runtime/src/event_handler/event.rs b/homestar-runtime/src/event_handler/event.rs index f76d38332..2ea2bbd47 100644 --- a/homestar-runtime/src/event_handler/event.rs +++ b/homestar-runtime/src/event_handler/event.rs @@ -1,16 +1,25 @@ +//! Internal [Event] type and [Handler] implementation. + +use super::EventHandler; #[cfg(feature = "ipfs")] use crate::network::IpfsCli; use crate::{ db::{Connection, Database, Db}, event_handler::{Handler, P2PSender}, - network::{pubsub, swarm::TopicMessage}, - workflow, EventHandler, Receipt, + network::{ + pubsub, + swarm::{RequestResponseKey, TopicMessage}, + }, + workflow, Receipt, }; use anyhow::{anyhow, Result}; use async_trait::async_trait; use homestar_core::workflow::Receipt as InvocationReceipt; use libipld::Cid; -use libp2p::kad::{record::Key, Quorum, Record}; +use libp2p::{ + kad::{record::Key, Quorum, Record}, + PeerId, +}; use std::{num::NonZeroUsize, sync::Arc}; use tokio::sync::oneshot; use tracing::{error, info}; @@ -20,6 +29,7 @@ use tracing::{error, info}; pub struct Captured { pub(crate) receipt: Receipt, pub(crate) workflow: Arc, + pub(crate) sender: P2PSender, } /// A structured query for finding a [Record] in the DHT and @@ -30,6 +40,18 @@ pub struct QueryRecord { pub(crate) sender: P2PSender, } +/// A structured query for finding a [Record] in the DHT and +/// returning to a [P2PSender]. +#[derive(Debug, Clone)] +pub struct OutboundRequest { + /// The peer to send a request to. + pub(crate) peer: PeerId, + /// The request key, which is a [Cid]. + pub(crate) request: RequestResponseKey, + /// The channel to send the response to. + pub(crate) sender: P2PSender, +} + /// Internal events to capture. #[derive(Debug)] pub enum Event { @@ -42,8 +64,10 @@ pub enum Event { /// [Record]: libp2p::kad::Record /// [Receipt]: homestar_core::workflow::Receipt FindRecord(QueryRecord), - /// TODO + /// Remove a [Record] from the DHT, e.g. a [Receipt]. RemoveRecord(QueryRecord), + /// Outbound request event to pull data from peers. + OutboundRequest(OutboundRequest), } impl Event { @@ -66,6 +90,22 @@ impl Event { } Event::FindRecord(record) => record.find(event_handler), Event::RemoveRecord(record) => record.remove(event_handler), + Event::OutboundRequest(OutboundRequest { + peer, + request, + sender, + }) => { + let request_cid = request.cid; + let request_id = event_handler + .swarm + .behaviour_mut() + .request_response + .send_request(&peer, request); + + event_handler + .request_response_senders + .insert(request_id, (request_cid, sender)); + } } Ok(()) } @@ -73,8 +113,12 @@ impl Event { impl Captured { /// `Captured` structure, containing a [Receipt] and [workflow::Info]. - pub fn with(receipt: Receipt, workflow: Arc) -> Self { - Self { receipt, workflow } + pub fn with(receipt: Receipt, workflow: Arc, sender: P2PSender) -> Self { + Self { + receipt, + workflow, + sender, + } } fn store( @@ -131,14 +175,26 @@ impl Captured { let _ = Db::store_workflow_receipt(self.workflow.cid, receipt_cid, conn); Arc::make_mut(&mut self.workflow).increment_progress(receipt_cid); - let wf_cid_bytes = self.workflow.cid_as_bytes(); - let wf_bytes = self.workflow.capsule()?; + let workflow_cid_bytes = self.workflow.cid_as_bytes(); + let workflow_bytes = self.workflow.capsule()?; + + let query_id = event_handler + .swarm + .behaviour_mut() + .kademlia + .start_providing(Key::new(&workflow_cid_bytes)) + .map_err(anyhow::Error::msg)?; + + event_handler.query_senders.insert(query_id, self.sender); let _id = event_handler .swarm .behaviour_mut() .kademlia - .put_record(Record::new(wf_cid_bytes, wf_bytes), workflow_quorum) + .put_record( + Record::new(workflow_cid_bytes, workflow_bytes), + workflow_quorum, + ) .map_err(anyhow::Error::msg)?; // TODO: Handle Workflow Complete / Num of Tasks finished. @@ -165,7 +221,7 @@ impl QueryRecord { .behaviour_mut() .kademlia .get_record(Key::new(&self.cid.to_bytes())); - event_handler.worker_swarm_senders.insert(id, self.sender); + event_handler.query_senders.insert(id, self.sender); } fn remove(self, event_handler: &mut EventHandler) @@ -177,6 +233,12 @@ impl QueryRecord { .behaviour_mut() .kademlia .remove_record(&Key::new(&self.cid.to_bytes())); + + event_handler + .swarm + .behaviour_mut() + .kademlia + .stop_providing(&Key::new(&self.cid.to_bytes())); } } diff --git a/homestar-runtime/src/event_handler/swarm_event.rs b/homestar-runtime/src/event_handler/swarm_event.rs index ad649c078..b16c66057 100644 --- a/homestar-runtime/src/event_handler/swarm_event.rs +++ b/homestar-runtime/src/event_handler/swarm_event.rs @@ -1,3 +1,6 @@ +//! Internal libp2p [SwarmEvent] handling and [Handler] implementation. + +use super::EventHandler; #[cfg(feature = "ipfs")] use crate::network::IpfsCli; use crate::{ @@ -7,9 +10,9 @@ use crate::{ receipt::{RECEIPT_TAG, VERSION_KEY}, workflow, workflow::WORKFLOW_TAG, - Db, EventHandler, Receipt, + Db, Receipt, }; -use anyhow::{anyhow, Result}; +use anyhow::{anyhow, bail, Result}; use async_trait::async_trait; use homestar_core::{ consts, @@ -24,11 +27,20 @@ use libp2p::{ }, mdns, multiaddr::Protocol, + request_response, swarm::SwarmEvent, + PeerId, }; -use std::fmt; +use std::{collections::HashSet, fmt}; use tracing::{debug, error, info}; +/// TODO +#[derive(Debug)] +pub enum SwarmResponseEvent { + Found(Result), + Providers(Result>), +} + /// Internal events within the [SwarmEvent] context related to finding results /// on the DHT. #[derive(Debug, Clone, PartialEq)] @@ -47,38 +59,7 @@ pub(crate) trait FoundRecord { impl FoundRecord for PeerRecord { fn found_record(&self) -> Result { let key_cid = Cid::try_from(self.record.key.as_ref())?; - match serde_ipld_dagcbor::de::from_reader(&*self.record.value) { - Ok(Ipld::Map(mut map)) => match map.pop_first() { - Some((code, Ipld::Map(mut rest))) if code == RECEIPT_TAG => { - if rest.remove(VERSION_KEY) - == Some(Ipld::String(consts::INVOCATION_VERSION.to_string())) - { - let invocation_receipt = InvocationReceipt::try_from(Ipld::Map(rest))?; - let receipt = - Receipt::try_with(Pointer::new(key_cid), &invocation_receipt)?; - Ok(FoundEvent::Receipt(receipt)) - } else { - Err(anyhow!( - "record version mismatch, current version: {}", - consts::INVOCATION_VERSION - )) - } - } - Some((code, Ipld::Map(rest))) if code == WORKFLOW_TAG => { - let workflow_info = workflow::Info::try_from(Ipld::Map(rest))?; - Ok(FoundEvent::Workflow(workflow_info)) - } - Some((code, _)) => Err(anyhow!("decode mismatch: {code} is not known")), - None => Err(anyhow!("invalid record value")), - }, - Ok(ipld) => Err(anyhow!( - "decode mismatch: expected an Ipld map, got {ipld:#?}", - )), - Err(err) => { - error!(error=?err, "error deserializing record value"); - Err(anyhow!("error deserializing record value")) - } - } + return_capsule_found(key_cid, &self.record.value) } } @@ -86,7 +67,7 @@ impl FoundRecord for PeerRecord { impl Handler for SwarmEvent where THandlerErr: fmt::Debug + Send, - DB: Database, + DB: Database + Sync, { #[cfg(feature = "ipfs")] async fn handle_event(self, event_handler: &mut EventHandler, _ipfs: IpfsCli) { @@ -104,32 +85,29 @@ async fn handle_swarm_event( event_handler: &mut EventHandler, ) { match event { - SwarmEvent::Behaviour(ComposedEvent::Gossipsub(gossipsub::Event::Message { - message, - propagation_source, - message_id, - })) => match Receipt::try_from(message.data) { - Ok(receipt) => { - info!( - "got message: {receipt} from {propagation_source} with message id: {message_id}" - ); + SwarmEvent::Behaviour(ComposedEvent::Gossipsub(gossip_event)) => match *gossip_event { + gossipsub::Event::Message { + message, + propagation_source, + message_id, + } => match Receipt::try_from(message.data) { + Ok(receipt) => { + info!("got message: {receipt} from {propagation_source} with message id: {message_id}"); - // Store gossiped receipt. - let _ = event_handler - .db - .conn() - .as_mut() - .map(|conn| Db::store_receipt(receipt, conn)); + // Store gossiped receipt. + let _ = event_handler + .db + .conn() + .as_mut() + .map(|conn| Db::store_receipt(receipt, conn)); + } + Err(err) => info!(err=?err, "cannot handle incoming event message"), + }, + gossipsub::Event::Subscribed { peer_id, topic } => { + debug!("{peer_id} subscribed to topic {topic} over gossipsub") } - Err(err) => info!(err=?err, "cannot handle incoming event message"), + _ => {} }, - SwarmEvent::Behaviour(ComposedEvent::Gossipsub(gossipsub::Event::Subscribed { - peer_id, - topic, - })) => { - debug!("{peer_id} subscribed to topic {topic} over gossipsub") - } - SwarmEvent::Behaviour(ComposedEvent::Gossipsub(_)) => {} SwarmEvent::Behaviour(ComposedEvent::Kademlia( KademliaEvent::OutboundQueryProgressed { id, result, .. }, )) => match result { @@ -137,16 +115,30 @@ async fn handle_swarm_event( debug!("successfully bootstrapped peer: {peer}") } QueryResult::GetProviders(Ok(GetProvidersOk::FoundProviders { - key, + key: _, providers, .. })) => { - for peer in providers { - debug!("peer {peer} provides key: {key:#?}"); - } + let _ = event_handler + .query_senders + .remove(&id) + .map(|sender| sender.send(SwarmResponseEvent::Providers(Ok(providers)))); + + // Finish the query. We are only interested in the first result. + let _ = event_handler + .swarm + .behaviour_mut() + .kademlia + .query_mut(&id) + .map(|mut query| query.finish()); } QueryResult::GetProviders(Err(err)) => { - error!("error retrieving outbound query providers: {err}") + error!(err=?err, "error retrieving outbound query providers"); + + let _ = event_handler + .query_senders + .remove(&id) + .map(|sender| sender.send(SwarmResponseEvent::Providers(Err(err.into())))); } QueryResult::GetRecord(Ok(GetRecordOk::FoundRecord(peer_record))) => { debug!( @@ -155,19 +147,28 @@ async fn handle_swarm_event( ); match peer_record.found_record() { Ok(event) => { - info!("event: {event:#?}"); - if let Some(sender) = event_handler.worker_swarm_senders.remove(&id) { - let _ = sender.send(event); - } else { - error!("error converting key {:#?} to cid", peer_record.record.key) - } + debug!("event: {event:#?}"); + let _ = event_handler + .query_senders + .remove(&id) + .map(|sender| sender.send(SwarmResponseEvent::Found(Ok(event)))); + } + Err(err) => { + error!(err=?err, "error retrieving record"); + let _ = event_handler + .query_senders + .remove(&id) + .map(|sender| sender.send(SwarmResponseEvent::Found(Err(err)))); } - Err(err) => error!(err=?err, "error retrieving record"), } } QueryResult::GetRecord(Ok(_)) => {} QueryResult::GetRecord(Err(err)) => { - error!("error retrieving record: {err}"); + error!(err=?err, "error retrieving record"); + let _ = event_handler + .query_senders + .remove(&id) + .map(|sender| sender.send(SwarmResponseEvent::Found(Err(err.into())))); } QueryResult::PutRecord(Ok(PutRecordOk { key })) => { debug!("successfully put record {key:#?}"); @@ -176,17 +177,88 @@ async fn handle_swarm_event( error!("error putting record: {err}") } QueryResult::StartProviding(Ok(AddProviderOk { key })) => { - debug!("successfully put provider record {key:#?}"); + // Currently, we don't send anything to the channel, + // once they key is provided. + let _ = event_handler.query_senders.remove(&id); + debug!("successfully providing {key:#?}"); } QueryResult::StartProviding(Err(err)) => { - error!("error putting provider record: {err}"); + // Currently, we don't send anything to the channel, + // once they key is provided. + let _ = event_handler.query_senders.remove(&id); + error!("error providing key: {:#?}", err.key()); } _ => {} }, + SwarmEvent::Behaviour(ComposedEvent::RequestResponse( + request_response::Event::Message { + message, + peer: _peer, + }, + )) => match message { + request_response::Message::Request { + request, channel, .. + } => { + event_handler + .db + .conn() + .as_mut() + .map(|conn| async move { + match workflow::Info::gather( + request.cid, + event_handler.p2p_provider_timeout, + event_handler.sender.clone(), + conn, + |cid, _| bail!("timeout retrieving workflow info for {}", cid), + ) + .await + { + Ok(workflow_info) => { + if let Ok(bytes) = workflow_info.capsule() { + let _ = event_handler + .swarm + .behaviour_mut() + .request_response + .send_response(channel, bytes); + } else { + let _ = event_handler + .swarm + .behaviour_mut() + .request_response + .send_response(channel, vec![]); + } + } + Err(err) => { + error!(err=?err, cid=?request, "error retrieving workflow info"); + + let _ = event_handler + .swarm + .behaviour_mut() + .request_response + .send_response(channel, vec![]); + } + } + }) + .unwrap() + .await; + } + request_response::Message::Response { + request_id, + response, + } => { + event_handler + .request_response_senders + .remove(&request_id) + .map(|(key_cid, sender)| { + return_capsule_found(key_cid, &response) + .map(|event| sender.send(SwarmResponseEvent::Found(Ok(event)))) + .map_err(|err| sender.send(SwarmResponseEvent::Found(Err(err)))) + }); + } + }, SwarmEvent::Behaviour(ComposedEvent::Mdns(mdns::Event::Discovered(list))) => { for (peer_id, _multiaddr) in list { info!("mDNS discovered a new peer: {peer_id}"); - event_handler .swarm .behaviour_mut() @@ -197,7 +269,6 @@ async fn handle_swarm_event( SwarmEvent::Behaviour(ComposedEvent::Mdns(mdns::Event::Expired(list))) => { for (peer_id, _multiaddr) in list { info!("mDNS discover peer has expired: {peer_id}"); - event_handler .swarm .behaviour_mut() @@ -206,10 +277,10 @@ async fn handle_swarm_event( } } SwarmEvent::NewListenAddr { address, .. } => { - let local_peer_id = *event_handler.swarm.local_peer_id(); + let local_peer = *event_handler.swarm.local_peer_id(); info!( "local node is listening on {:?}", - address.with(Protocol::P2p(local_peer_id.into())) + address.with(Protocol::P2p(local_peer)) ); } SwarmEvent::IncomingConnection { .. } => {} @@ -217,6 +288,40 @@ async fn handle_swarm_event( } } +fn return_capsule_found(key_cid: Cid, value: &Vec) -> Result { + match serde_ipld_dagcbor::de::from_reader(&**value) { + Ok(Ipld::Map(mut map)) => match map.pop_first() { + Some((code, Ipld::Map(mut rest))) if code == RECEIPT_TAG => { + if rest.remove(VERSION_KEY) + == Some(Ipld::String(consts::INVOCATION_VERSION.to_string())) + { + let invocation_receipt = InvocationReceipt::try_from(Ipld::Map(rest))?; + let receipt = Receipt::try_with(Pointer::new(key_cid), &invocation_receipt)?; + Ok(FoundEvent::Receipt(receipt)) + } else { + Err(anyhow!( + "record version mismatch, current version: {}", + consts::INVOCATION_VERSION + )) + } + } + Some((code, Ipld::Map(rest))) if code == WORKFLOW_TAG => { + let workflow_info = workflow::Info::try_from(Ipld::Map(rest))?; + Ok(FoundEvent::Workflow(workflow_info)) + } + Some((code, _)) => Err(anyhow!("decode mismatch: {code} is not known")), + None => Err(anyhow!("invalid record value")), + }, + Ok(ipld) => Err(anyhow!( + "decode mismatch: expected an Ipld map, got {ipld:#?}", + )), + Err(err) => { + error!(error=?err, "error deserializing record value"); + Err(anyhow!("error deserializing record value")) + } + } +} + #[cfg(test)] mod test { use super::*; diff --git a/homestar-runtime/src/lib.rs b/homestar-runtime/src/lib.rs index f7111c743..4039467c3 100644 --- a/homestar-runtime/src/lib.rs +++ b/homestar-runtime/src/lib.rs @@ -24,14 +24,13 @@ pub mod logger; mod network; mod receipt; pub mod runner; -pub mod scheduler; +mod scheduler; mod settings; -pub mod tasks; +mod tasks; mod worker; pub mod workflow; pub use db::Db; -pub use event_handler::{event::Event, EventHandler}; #[cfg(feature = "websocket-server")] pub use network::ws; pub use receipt::{Receipt, RECEIPT_TAG, VERSION_KEY}; diff --git a/homestar-runtime/src/network/swarm.rs b/homestar-runtime/src/network/swarm.rs index 0a3008319..fdfd58f5f 100644 --- a/homestar-runtime/src/network/swarm.rs +++ b/homestar-runtime/src/network/swarm.rs @@ -3,14 +3,17 @@ use crate::{network::pubsub, settings, Receipt}; use anyhow::{anyhow, Context, Result}; +use libipld::Cid; use libp2p::{ core::upgrade, gossipsub::{self, MessageId, SubscriptionError, TopicHash}, kad::{record::store::MemoryStore, Kademlia, KademliaEvent}, mdns, noise, + request_response::{self, ProtocolSupport}, swarm::{NetworkBehaviour, Swarm, SwarmBuilder}, - tcp, yamux, Transport, + tcp, yamux, StreamProtocol, Transport, }; +use serde::{Deserialize, Serialize}; /// Build a new [Swarm] with a given transport and a tokio executor. pub(crate) async fn new(settings: &settings::Node) -> Result> { @@ -34,6 +37,13 @@ pub(crate) async fn new(settings: &settings::Node) -> Result Result), /// [KademliaEvent] event. Kademlia(KademliaEvent), + /// TODO + RequestResponse(request_response::Event>), /// [mdns::Event] event. Mdns(mdns::Event), } @@ -72,12 +91,14 @@ pub(crate) enum TopicMessage { /// Custom behaviours for [Swarm]. #[allow(missing_debug_implementations)] #[derive(NetworkBehaviour)] -#[behaviour(out_event = "ComposedEvent")] +#[behaviour(to_swarm = "ComposedEvent")] pub(crate) struct ComposedBehaviour { /// [gossipsub::Behaviour] behaviour. pub(crate) gossipsub: gossipsub::Behaviour, /// In-memory [kademlia: Kademlia] behaviour. pub(crate) kademlia: Kademlia, + /// TODO + pub(crate) request_response: request_response::cbor::Behaviour>, /// [mdns::tokio::Behaviour] behaviour. pub(crate) mdns: mdns::tokio::Behaviour, } @@ -114,7 +135,7 @@ impl ComposedBehaviour { impl From for ComposedEvent { fn from(event: gossipsub::Event) -> Self { - ComposedEvent::Gossipsub(event) + ComposedEvent::Gossipsub(Box::new(event)) } } @@ -124,6 +145,12 @@ impl From for ComposedEvent { } } +impl From>> for ComposedEvent { + fn from(event: request_response::Event>) -> Self { + ComposedEvent::RequestResponse(event) + } +} + impl From for ComposedEvent { fn from(event: mdns::Event) -> Self { ComposedEvent::Mdns(event) diff --git a/homestar-runtime/src/network/ws.rs b/homestar-runtime/src/network/ws.rs index 105d2e0a4..1ed174efb 100644 --- a/homestar-runtime/src/network/ws.rs +++ b/homestar-runtime/src/network/ws.rs @@ -26,9 +26,8 @@ use tracing::{debug, info}; pub(crate) type WsSender = Arc>; /// Message type for messages sent back from the -/// [websocket server] to the [runner] for example. +/// websocket server to the [runner] for example. /// -/// [websocket server]: WebSocketServer /// [runner]: crate::Runner #[derive(Debug, Clone, PartialEq)] pub enum WsMessage { diff --git a/homestar-runtime/src/runner.rs b/homestar-runtime/src/runner.rs index bc8f3b241..4b363335a 100644 --- a/homestar-runtime/src/runner.rs +++ b/homestar-runtime/src/runner.rs @@ -3,7 +3,12 @@ #[cfg(feature = "ipfs")] use crate::network::IpfsCli; -use crate::{db::Database, network::swarm, Event, EventHandler, Settings}; +use crate::{ + db::Database, + event_handler::{Event, EventHandler}, + network::swarm, + Settings, +}; #[cfg(feature = "websocket-server")] use crate::{ event_handler::channel::{BoundedChannel, BoundedChannelReceiver}, @@ -41,9 +46,8 @@ impl ModifiedSet for RunningSet { } /// Runner interface. -/// Used to manage [Workers] and execute/run [Workflows]. +/// Used to manage workers and execute/run [Workflows]. /// -/// [Workers]: crate::Worker /// [Workflows]: homestar_core::Workflow #[cfg(feature = "websocket-server")] #[derive(Debug)] @@ -58,9 +62,8 @@ pub struct Runner { } /// Runner interface. -/// Used to manage [Workers] and execute/run [Workflows]. +/// Used to manage workers and execute/run [Workflows]. /// -/// [Workers]: crate::Worker /// [Workflows]: homestar_core::Workflow #[cfg(not(feature = "websocket-server"))] #[derive(Debug)] @@ -125,11 +128,9 @@ impl Runner { } /// Sequence for shutting down a [Runner], including: - /// a) [EventHandler] channels, + /// a) event-handler channels, /// b) Running workers /// c) [Runner] channels. - /// - /// [EventHandler]: crate::EventHandler pub async fn shutdown(&mut self) -> Result<()> { let (shutdown_sender, shutdown_receiver) = oneshot::channel(); self.event_sender @@ -147,9 +148,7 @@ impl Runner { } /// Captures shutdown signals for [Runner] and other sub-processes like - /// the [webSocket server]. - /// - /// [websocket server]: WebSocketServer + /// the webSocket server. pub async fn shutdown_signal() -> Result<()> { let mut sigint = signal(SignalKind::interrupt())?; let mut sigterm = signal(SignalKind::terminate())?; @@ -172,9 +171,8 @@ impl Runner { } /// Garbage-collect task [AbortHandle]s in the [RunningSet] for a specific - /// [Worker]-workflow [Cid]. + /// workflow [Cid], running on a worker. /// - /// [Worker]: crate::Worker pub fn gc_worker(&mut self, cid: Cid) { if let Some(mut handles) = self.running_set.get_mut(&cid) { handles.retain(|handle| !handle.is_finished()); @@ -182,9 +180,7 @@ impl Runner { self.running_set.retain(|_cid, handles| !handles.is_empty()); } - /// Abort all [Workers]. - /// - /// [Workers]: crate::Worker + /// Abort all tasks running within all workers. pub fn abort_all_tasks(&mut self) { self.running_set.iter_mut().for_each(|handles| { for abort_handle in &*handles { @@ -193,9 +189,7 @@ impl Runner { }); } - /// Abort a specific [Worker]'s tasks given a [Cid]. - /// - /// [Worker]: crate::Worker + /// Abort a specific worker's tasks given a [Cid]. pub fn abort_worker_tasks(&mut self, cid: Cid) { if let Some(handles) = self.running_set.get_mut(&cid) { for abort_handle in &*handles { @@ -204,27 +198,24 @@ impl Runner { } } - /// [mpsc::Sender] of the [EventHandler]. + /// [mpsc::Sender] of the event-handler. /// /// [EventHandler]: crate::EventHandler pub fn event_sender(&self) -> Arc> { self.event_sender.clone() } - /// [tokio::broadcast::Sender] for sending messages through the - /// [webSocket server] to subscribers. - /// - /// [websocket server]: WebSocketServer + /// [tokio::sync::broadcast::Sender] for sending messages through the + /// webSocket server to subscribers. #[cfg(feature = "websocket-server")] pub fn ws_sender(&self) -> &ws::WsSender { &self.ws_sender } - /// [BoundedChannel] for receiving [messages] back from the - /// [webSocket server]. + /// Channel for receiving [messages] back from the + /// webSocket server. /// /// [messages]: ws::WsMessage - /// [websocket server]: WebSocketServer #[cfg(feature = "websocket-server")] pub fn ws_receiver(&mut self) -> &mut BoundedChannelReceiver { &mut self.ws_receiver diff --git a/homestar-runtime/src/scheduler.rs b/homestar-runtime/src/scheduler.rs index f45052375..57d6f24d7 100644 --- a/homestar-runtime/src/scheduler.rs +++ b/homestar-runtime/src/scheduler.rs @@ -5,9 +5,14 @@ use crate::{ db::{Connection, Database}, - event_handler::{channel::BoundedChannel, event::QueryRecord, swarm_event::FoundEvent}, + event_handler::{ + channel::BoundedChannel, + event::QueryRecord, + swarm_event::{FoundEvent, SwarmResponseEvent}, + Event, + }, workflow::{self, Builder, Resource, Vertex}, - Db, Event, + Db, }; use anyhow::Result; use dagga::Node; @@ -19,14 +24,9 @@ use homestar_core::{ use homestar_wasm::io::Arg; use indexmap::IndexMap; use libipld::Cid; -use std::{ - ops::ControlFlow, - str::FromStr, - sync::Arc, - time::{Duration, Instant}, -}; +use std::{ops::ControlFlow, str::FromStr, sync::Arc, time::Instant}; use tokio::sync::mpsc; -use tracing::info; +use tracing::debug; type Schedule<'a> = Vec, usize>>>; @@ -35,7 +35,7 @@ type Schedule<'a> = Vec, usize>>>; /// /// [instruction]: homestar_core::workflow::Instruction #[derive(Debug, Clone, Default)] -pub struct ExecutionGraph<'a> { +pub(crate) struct ExecutionGraph<'a> { /// A built-up [Dag] [Schedule] of batches. /// /// [Dag]: dagga::Dag @@ -51,7 +51,7 @@ pub struct ExecutionGraph<'a> { /// and what's been executed in memory. #[allow(dead_code)] #[derive(Debug, Clone, Default)] -pub struct TaskScheduler<'a> { +pub(crate) struct TaskScheduler<'a> { /// In-memory map of task/instruction results. pub(crate) linkmap: Arc>>, /// [ExecutionGraph] of what's been run so far for a [Workflow] of `batched` @@ -82,7 +82,7 @@ impl<'a> TaskScheduler<'a> { /// Initialize Task Scheduler, given [Receipt] cache. /// /// [Receipt]: crate::Receipt - pub async fn init( + pub(crate) async fn init( workflow: Workflow<'a, Arg>, settings: Arc, event_sender: Arc>, @@ -131,7 +131,7 @@ impl<'a> TaskScheduler<'a> { } } Err(_) => { - info!("receipt not available in the database"); + debug!("receipt not available in the database"); let channel = BoundedChannel::new(pointers_len); for ptr in &pointers { let _ = event_sender.blocking_send(Event::FindRecord( @@ -141,10 +141,12 @@ impl<'a> TaskScheduler<'a> { let mut linkmap = LinkMap::>::new(); let mut counter = 0; - while let Ok(FoundEvent::Receipt(found)) = channel.rx.recv_deadline( - Instant::now() - + Duration::from_secs(settings.p2p_check_timeout_secs), - ) { + while let Ok(SwarmResponseEvent::Found(Ok(FoundEvent::Receipt( + found, + )))) = channel + .rx + .recv_deadline(Instant::now() + settings.p2p_check_timeout) + { if pointers.contains(&Pointer::new(found.cid())) { if let Ok(cid) = found.instruction().try_into() { let _ = linkmap.insert(cid, found.output_as_arg()); diff --git a/homestar-runtime/src/settings.rs b/homestar-runtime/src/settings.rs index 6483ca8c1..b0e2185e1 100644 --- a/homestar-runtime/src/settings.rs +++ b/homestar-runtime/src/settings.rs @@ -28,7 +28,7 @@ impl Settings { &self.monitoring } - /// Node + /// Node settings getter. pub fn node(&self) -> &Node { &self.node } @@ -67,6 +67,9 @@ pub struct Network { /// [Swarm]: libp2p::swarm::Swarm #[serde(with = "http_serde::uri")] pub(crate) listen_address: Uri, + /// Timeout for p2p requests for a provided record. + #[serde_as(as = "DurationSeconds")] + pub(crate) p2p_provider_timeout: Duration, /// Pub/sub duplicate cache time. #[serde_as(as = "DurationSeconds")] pub(crate) pubsub_duplication_cache_time: Duration, @@ -159,6 +162,7 @@ impl Default for Network { Self { events_buffer_len: 100, listen_address: Uri::from_static("/ip4/0.0.0.0/tcp/0"), + p2p_provider_timeout: Duration::new(30, 0), pubsub_duplication_cache_time: Duration::new(1, 0), pubsub_heartbeat: Duration::new(60, 0), pubsub_idle_timeout: Duration::new(60 * 60 * 24, 0), diff --git a/homestar-runtime/src/tasks.rs b/homestar-runtime/src/tasks.rs index 94d7aa9b7..7c0a1c55f 100644 --- a/homestar-runtime/src/tasks.rs +++ b/homestar-runtime/src/tasks.rs @@ -17,7 +17,7 @@ const WASM_OP: &str = "wasm/run"; #[allow(missing_debug_implementations)] #[derive(Assoc)] #[func(pub fn ability(s: &str) -> Option)] -pub enum RegisteredTasks { +pub(crate) enum RegisteredTasks { /// Basic `wasm/run` task-type. #[assoc(ability = WASM_OP)] WasmRun, @@ -25,7 +25,7 @@ pub enum RegisteredTasks { /// Trait for loading files for different task-types directly. #[async_trait] -pub trait FileLoad { +pub(crate) trait FileLoad { /// Load file asynchronously. async fn load(file: PathBuf) -> Result> { tokio::fs::read(file).await.map_err(|e| anyhow!(e)) diff --git a/homestar-runtime/src/test_utils/event.rs b/homestar-runtime/src/test_utils/event.rs index e84c9ba02..ce39fa790 100644 --- a/homestar-runtime/src/test_utils/event.rs +++ b/homestar-runtime/src/test_utils/event.rs @@ -1,6 +1,7 @@ -use crate::{settings::Settings, Event}; +use crate::{event_handler::Event, settings::Settings}; use tokio::sync::mpsc; +/// Create an [mpsc::Sender], [mpsc::Receiver] pair for [Event]s. pub fn setup_channel(settings: Settings) -> (mpsc::Sender, mpsc::Receiver) { mpsc::channel(settings.node().network.events_buffer_len) } diff --git a/homestar-runtime/src/worker.rs b/homestar-runtime/src/worker.rs index e23d58e12..b0faeaf1a 100644 --- a/homestar-runtime/src/worker.rs +++ b/homestar-runtime/src/worker.rs @@ -1,3 +1,9 @@ +//! Worker that runs a [Workflow]'s tasks scheduled by the [TaskScheduler] and +//! sends [Event]'s to the [EventHandler]. +//! +//! [Workflow]: homestar_core::Workflow +//! [EventHandler]: crate::event_handler::EventHandler + #[cfg(feature = "ipfs")] use crate::network::IpfsCli; #[cfg(feature = "ipfs")] @@ -7,7 +13,7 @@ use crate::{ event_handler::{ channel::BoundedChannel, event::{Captured, QueryRecord}, - swarm_event::FoundEvent, + swarm_event::{FoundEvent, SwarmResponseEvent}, Event, }, runner::{ModifiedSet, RunningSet}, @@ -36,13 +42,7 @@ use homestar_wasm::{ }; use indexmap::IndexMap; use libipld::{Cid, Ipld}; -use std::{ - collections::BTreeMap, - sync::Arc, - thread, - time::{Duration, Instant}, - vec, -}; +use std::{collections::BTreeMap, sync::Arc, thread, time::Instant, vec}; use tokio::{sync::mpsc, task::JoinSet}; use tracing::{debug, error}; #[cfg(feature = "ipfs")] @@ -175,11 +175,16 @@ impl<'a> Worker<'a> { .blocking_send(Event::FindRecord(QueryRecord::with(cid, channel.tx))) .map_err(|err| ResolveError::TransportError(err.to_string()))?; - let found = match channel.rx.recv_deadline( - Instant::now() - + Duration::from_secs(workflow_settings.p2p_timeout_secs), - ) { - Ok(FoundEvent::Receipt(found)) => found, + let found = match channel + .rx + .recv_deadline(Instant::now() + workflow_settings.p2p_timeout) + { + Ok(SwarmResponseEvent::Found(Ok(FoundEvent::Receipt(found)))) => found, + Ok(SwarmResponseEvent::Found(Err(err))) => { + bail!(ResolveError::UnresolvedCidError(format!( + "failure in attempting to find event: {err}" + ))) + } Ok(_) => bail!(ResolveError::UnresolvedCidError( "wrong or unexpected event message received".to_string(), )), @@ -302,10 +307,12 @@ impl<'a> Worker<'a> { let stored_receipt = Db::store_receipt(receipt, &mut db.conn()?)?; // send internal event + let channel = BoundedChannel::oneshot(); self.event_sender .send(Event::CapturedReceipt(Captured::with( stored_receipt, self.workflow_info.clone(), + channel.tx, ))) .await?; } @@ -370,10 +377,8 @@ impl<'a> Worker<'a> { }) .with_config( RetryFutureConfig::new(settings.retries) - .exponential_backoff(Duration::from_millis( - settings.retry_initial_delay_ms, - )) - .max_delay(Duration::from_secs(settings.retry_max_delay_secs)), + .exponential_backoff(settings.retry_initial_delay) + .max_delay(settings.retry_max_delay), ) .await } @@ -385,8 +390,8 @@ impl<'a> Worker<'a> { }) .with_config( RetryFutureConfig::new(settings.retries) - .fixed_backoff(Duration::from_millis(settings.retry_initial_delay_ms)) - .max_delay(Duration::from_secs(settings.retry_max_delay_secs)), + .fixed_backoff(settings.retry_initial_delay) + .max_delay(settings.retry_max_delay), ) .await } @@ -398,8 +403,8 @@ impl<'a> Worker<'a> { }) .with_config( RetryFutureConfig::new(settings.retries) - .linear_backoff(Duration::from_millis(settings.retry_initial_delay_ms)) - .max_delay(Duration::from_secs(settings.retry_max_delay_secs)), + .linear_backoff(settings.retry_initial_delay) + .max_delay(settings.retry_max_delay), ) .await } @@ -484,9 +489,9 @@ mod test { #[cfg(feature = "ipfs")] let ipfs = IpfsCli::default(); - let workflow_info = wf::Info::gather( + let workflow_info = wf::Info::init( workflow.clone(), - workflow_settings.clone(), + workflow_settings.p2p_timeout, tx.clone().into(), &mut conn, ) @@ -581,14 +586,14 @@ mod test { assert!(rx.recv().await.is_none()); let mut conn = db.conn().unwrap(); - let (stored_info, receipt_cids) = - test_utils::db::MemoryDb::join_workflow_with_receipts(workflow_cid, &mut conn) - .unwrap(); + let workflow_info = + test_utils::db::MemoryDb::get_workflow_info(workflow_cid, &mut conn).unwrap(); - assert_eq!(stored_info.num_tasks, 2); - assert_eq!(stored_info.cid.cid(), workflow_cid); - assert_eq!(receipt_cids.len(), 2); + assert_eq!(workflow_info.num_tasks, 2); + assert_eq!(workflow_info.cid, workflow_cid); + assert_eq!(workflow_info.progress.len(), 2); assert_eq!(wf_info.progress_count, 2); + assert_eq!(wf_info.progress_count, workflow_info.progress_count); } } @@ -653,9 +658,9 @@ mod test { #[cfg(feature = "ipfs")] let ipfs = IpfsCli::default(); - let workflow_info = wf::Info::gather( + let workflow_info = wf::Info::init( workflow.clone(), - workflow_settings.clone(), + workflow_settings.p2p_timeout, tx.clone().into(), &mut conn, ) @@ -727,14 +732,14 @@ mod test { assert!(rx.recv().await.is_none()); let mut conn = db.conn().unwrap(); - let (stored_info, receipt_cids) = - test_utils::db::MemoryDb::join_workflow_with_receipts(workflow_cid, &mut conn) - .unwrap(); + let workflow_info = + test_utils::db::MemoryDb::get_workflow_info(workflow_cid, &mut conn).unwrap(); - assert_eq!(stored_info.num_tasks, 2); - assert_eq!(stored_info.cid.cid(), workflow_cid); - assert_eq!(receipt_cids.len(), 2); + assert_eq!(workflow_info.num_tasks, 2); + assert_eq!(workflow_info.cid, workflow_cid); + assert_eq!(workflow_info.progress.len(), 2); assert_eq!(wf_info.progress_count, 2); + assert_eq!(wf_info.progress_count, workflow_info.progress_count); } } @@ -823,9 +828,9 @@ mod test { #[cfg(feature = "ipfs")] let ipfs = IpfsCli::default(); - let workflow_info = wf::Info::gather( + let workflow_info = wf::Info::init( workflow.clone(), - workflow_settings.clone(), + workflow_settings.p2p_timeout, tx.clone().into(), &mut conn, ) @@ -870,13 +875,12 @@ mod test { assert_eq!(worker.workflow_info.num_tasks, 2); let mut conn = db.conn().unwrap(); - let (stored_info, receipt_cids) = - test_utils::db::MemoryDb::join_workflow_with_receipts(workflow_cid, &mut conn).unwrap(); - - assert_eq!(stored_info.num_tasks, 2); - assert_eq!(stored_info.cid.cid(), workflow_cid); - assert_eq!(receipt_cids.len(), 2); + let workflow_info = + test_utils::db::MemoryDb::get_workflow_info(workflow_cid, &mut conn).unwrap(); + assert_eq!(workflow_info.num_tasks, 2); + assert_eq!(workflow_info.cid, workflow_cid); + assert_eq!(workflow_info.progress.len(), 2); assert!(rx.try_recv().is_err()) } } diff --git a/homestar-runtime/src/workflow.rs b/homestar-runtime/src/workflow.rs index 00d3c4b2a..13c7d0fa9 100644 --- a/homestar-runtime/src/workflow.rs +++ b/homestar-runtime/src/workflow.rs @@ -22,8 +22,7 @@ use url::Url; mod info; pub(crate) mod settings; -pub use info::{Info, WORKFLOW_TAG}; -pub(crate) use info::{Stored, StoredReceipt}; +pub(crate) use info::{Info, Stored, StoredReceipt, WORKFLOW_TAG}; #[allow(unused_imports)] pub use settings::Settings; @@ -38,7 +37,8 @@ pub struct Builder<'a>(Workflow<'a, Arg>); /// /// [URI]: #[derive(Debug, Clone, Eq, Hash, PartialEq)] -pub enum Resource { +#[allow(dead_code)] +pub(crate) enum Resource { /// Resource fetched by [Url]. Url(Url), /// Resource fetched by [Cid]. @@ -53,7 +53,7 @@ pub enum Resource { /// [Dag]: dagga::Dag /// [Task]: homestar_core::workflow::Task #[derive(Debug, Clone)] -pub struct AOTContext<'a> { +pub(crate) struct AOTContext<'a> { dag: Dag<'a>, resources: Vec, } @@ -63,7 +63,8 @@ impl AOTContext<'static> { /// /// [Dag]: dagga::Dag /// [dot]: - pub fn dot(&self, name: &str, path: &Path) -> anyhow::Result<()> { + #[allow(dead_code)] + pub(crate) fn dot(&self, name: &str, path: &Path) -> anyhow::Result<()> { DagLegend::new(self.dag.nodes()) .with_name(name) .save_to( @@ -78,7 +79,7 @@ impl AOTContext<'static> { /// /// [Dag]: dagga::Dag #[derive(Debug, Clone, PartialEq)] -pub struct Vertex<'a> { +pub(crate) struct Vertex<'a> { pub(crate) instruction: Instruction<'a, Arg>, pub(crate) parsed: Parsed, pub(crate) invocation: Pointer, @@ -115,7 +116,7 @@ impl<'a> Builder<'a> { } /// Convert the [Workflow] into an batch-separated [ExecutionGraph]. - pub fn graph(self) -> anyhow::Result> { + pub(crate) fn graph(self) -> anyhow::Result> { let aot = self.aot()?; match aot.dag.build_schedule() { Ok(schedule) => Ok(ExecutionGraph { diff --git a/homestar-runtime/src/workflow/info.rs b/homestar-runtime/src/workflow/info.rs index 3e704caae..032ef0889 100644 --- a/homestar-runtime/src/workflow/info.rs +++ b/homestar-runtime/src/workflow/info.rs @@ -1,9 +1,14 @@ use crate::{ db::{Connection, Database}, - event_handler::{channel::BoundedChannel, event::QueryRecord, swarm_event::FoundEvent, Event}, + event_handler::{ + channel::BoundedChannel, + event::QueryRecord, + swarm_event::{FoundEvent, SwarmResponseEvent}, + Event, + }, Db, Receipt, }; -use anyhow::{anyhow, bail, Result}; +use anyhow::{anyhow, bail, Context, Result}; use diesel::{Associations, Identifiable, Insertable, Queryable, Selectable}; use homestar_core::{ipld::DagCbor, workflow::Pointer, Workflow}; use homestar_wasm::io::Arg; @@ -19,7 +24,7 @@ use tracing::info; /// [Workflow Info] header tag, for sharing over libp2p. /// /// [Workflow Info]: Info -pub const WORKFLOW_TAG: &str = "ipvm/workflow"; +pub(crate) const WORKFLOW_TAG: &str = "ipvm/workflow"; const CID_KEY: &str = "cid"; const PROGRESS_KEY: &str = "progress"; @@ -103,32 +108,33 @@ impl Info { /// Get unique identifier, [Cid], of [Workflow]. /// /// [Workflow]: homestar_core::Workflow - pub fn cid(&self) -> Cid { + pub(crate) fn cid(&self) -> Cid { self.cid } /// Get the [Cid] of a [Workflow] as a [String]. /// /// [Workflow]: homestar_core::Workflow - pub fn cid_as_string(&self) -> String { + #[allow(dead_code)] + pub(crate) fn cid_as_string(&self) -> String { self.cid.to_string() } /// Get the [Cid] of a [Workflow] as bytes. /// /// [Workflow]: homestar_core::Workflow - pub fn cid_as_bytes(&self) -> Vec { + pub(crate) fn cid_as_bytes(&self) -> Vec { self.cid().to_bytes() } /// Set the progress / step of the [Workflow] completed, which /// may not be the same as the `progress` vector of [Cid]s. - pub fn set_progress_count(&mut self, progress_count: u32) { + pub(crate) fn set_progress_count(&mut self, progress_count: u32) { self.progress_count = progress_count; } /// Set the progress / step of the [Info]. - pub fn increment_progress(&mut self, new_cid: Cid) { + pub(crate) fn increment_progress(&mut self, new_cid: Cid) { self.progress.push(new_cid); self.progress_count = self.progress.len() as u32 + 1; } @@ -137,7 +143,7 @@ impl Info { /// [DagCbor] encoded bytes. /// /// [DagCbor]: DagCborCodec - pub fn capsule(&self) -> anyhow::Result> { + pub(crate) fn capsule(&self) -> anyhow::Result> { let info_ipld = Ipld::from(self.to_owned()); let capsule = if let Ipld::Map(map) = info_ipld { Ok(Ipld::Map(BTreeMap::from([( @@ -151,65 +157,108 @@ impl Info { DagCborCodec.encode(&capsule) } - /// Gather available [Info] from the database or [libp2p] given a - /// [Workflow] and [workflow settings]. + /// [Gather] available [Info] from the database or [libp2p] given a + /// [Workflow], or return a default/new version of [Info] if none is found. /// - /// [workflow settings]: super::Settings - pub async fn gather<'a>( - workflow: Workflow<'_, Arg>, - workflow_settings: Arc, + /// [Gather]: Self::gather + #[allow(dead_code)] + pub(crate) async fn init<'a>( + workflow: Workflow<'a, Arg>, + p2p_timeout: Duration, event_sender: Arc>, conn: &mut Connection, ) -> Result { let workflow_len = workflow.len(); let workflow_cid = workflow.to_cid()?; + let handle_timeout_fn = |workflow_cid, reused_conn| { + let workflow_info = Self::default(workflow_cid, workflow_len); + // store workflow from info + match Db::store_workflow( + Stored::new( + Pointer::new(workflow_info.cid), + workflow_info.num_tasks as i32, + ), + reused_conn, + ) { + Ok(_) => Ok(workflow_info), + Err(err) => bail!("failed to store workflow: {err}"), + } + }; + + Self::gather( + workflow_cid, + p2p_timeout, + event_sender, + conn, + handle_timeout_fn, + ) + .await + } - let workflow_info = match Db::join_workflow_with_receipts(workflow_cid, conn) { - Ok((wf_info, receipts)) => Info::new(workflow_cid, receipts, wf_info.num_tasks as u32), - Err(_err) => { - info!("workflow information not available in the database"); - let channel = BoundedChannel::oneshot(); - event_sender - .send(Event::FindRecord(QueryRecord::with( - workflow_cid, - channel.tx, - ))) - .await?; - - match channel.rx.recv_deadline( - Instant::now() + Duration::from_secs(workflow_settings.p2p_timeout_secs), - ) { - Ok(FoundEvent::Workflow(workflow_info)) => { - // store workflow from info - Db::store_workflow( - Stored::new( - Pointer::new(workflow_info.cid), - workflow_info.num_tasks as i32, - ), - conn, - )?; - - workflow_info - } - Ok(event) => { - bail!("received unexpected event {event:?} for workflow {workflow_cid}") - } - Err(err) => { - info!(error=?err, "no information found for {workflow_cid}, setting default"); - let workflow_info = Info::default(workflow_cid, workflow_len); - // store workflow from info - Db::store_workflow( - Stored::new( - Pointer::new(workflow_info.cid), - workflow_info.num_tasks as i32, - ), - conn, - )?; - - workflow_info - } + /// Gather available [Info] from the database or [libp2p] given a + /// workflow [Cid]. + /// + pub(crate) async fn gather<'a>( + workflow_cid: Cid, + p2p_timeout: Duration, + event_sender: Arc>, + conn: &'a mut Connection, + handle_timeout_fn: impl FnOnce(Cid, &'a mut Connection) -> Result, + ) -> Result { + async fn retrieve_from_query<'a>( + workflow_cid: Cid, + p2p_timeout: Duration, + event_sender: Arc>, + conn: &'a mut Connection, + handle_timeout_fn: impl FnOnce(Cid, &'a mut Connection) -> Result, + ) -> Result { + let channel = BoundedChannel::oneshot(); + event_sender + .send(Event::FindRecord(QueryRecord::with( + workflow_cid, + channel.tx, + ))) + .await?; + + match channel.rx.recv_deadline(Instant::now() + p2p_timeout) { + Ok(SwarmResponseEvent::Found(Ok(FoundEvent::Workflow(workflow_info)))) => { + // store workflow from info + Db::store_workflow( + Stored::new( + Pointer::new(workflow_info.cid), + workflow_info.num_tasks as i32, + ), + conn, + )?; + + Ok(workflow_info) + } + Ok(SwarmResponseEvent::Found(Err(err))) => { + bail!("failure in attempting to find event: {err}") + } + Ok(event) => { + bail!("received unexpected event {event:?} for workflow {workflow_cid}") } + Err(err) => handle_timeout_fn(workflow_cid, conn).context(err), } + } + + let workflow_info = if let Ok(info) = Db::get_workflow_info(workflow_cid, conn) { + info + } else { + info!( + cid = workflow_cid.to_string(), + "workflow information not available in the database" + ); + + retrieve_from_query( + workflow_cid, + p2p_timeout, + event_sender, + conn, + handle_timeout_fn, + ) + .await? }; Ok(workflow_info) diff --git a/homestar-runtime/src/workflow/settings.rs b/homestar-runtime/src/workflow/settings.rs index c404ac6df..27438803f 100644 --- a/homestar-runtime/src/workflow/settings.rs +++ b/homestar-runtime/src/workflow/settings.rs @@ -1,16 +1,18 @@ //! [Workflow] settings for a worker's run/execution. //! -//! [Workflow]: crate::Workflow +//! [Workflow]: homestar_core::Workflow + +use std::time::Duration; /// Workflow settings. #[derive(Debug, Clone, PartialEq)] pub struct Settings { pub(crate) retries: u32, pub(crate) retry_backoff_strategy: BackoffStrategy, - pub(crate) retry_max_delay_secs: u64, - pub(crate) retry_initial_delay_ms: u64, - pub(crate) p2p_check_timeout_secs: u64, - pub(crate) p2p_timeout_secs: u64, + pub(crate) retry_max_delay: Duration, + pub(crate) retry_initial_delay: Duration, + pub(crate) p2p_check_timeout: Duration, + pub(crate) p2p_timeout: Duration, } #[cfg(not(test))] @@ -19,10 +21,10 @@ impl Default for Settings { Self { retries: 10, retry_backoff_strategy: BackoffStrategy::Exponential, - retry_max_delay_secs: 60, - retry_initial_delay_ms: 500, - p2p_check_timeout_secs: 5, - p2p_timeout_secs: 120, + retry_max_delay: Duration::new(60, 0), + retry_initial_delay: Duration::from_millis(500), + p2p_check_timeout: Duration::new(5, 0), + p2p_timeout: Duration::new(60, 0), } } } @@ -33,10 +35,10 @@ impl Default for Settings { Self { retries: 1, retry_backoff_strategy: BackoffStrategy::Exponential, - retry_max_delay_secs: 1, - retry_initial_delay_ms: 50, - p2p_check_timeout_secs: 1, - p2p_timeout_secs: 1, + retry_max_delay: Duration::new(1, 0), + retry_initial_delay: Duration::from_millis(50), + p2p_check_timeout: Duration::new(1, 0), + p2p_timeout: Duration::new(1, 0), } } }