From 4c116c20a7cbf542a627931aefdcbf2648c100e3 Mon Sep 17 00:00:00 2001 From: hopeyen Date: Thu, 14 Dec 2023 22:24:33 -0600 Subject: [PATCH] refactor: split a subfile_server package --- Cargo.lock | 869 ++++++++++-------- Cargo.toml | 1 + docs/client_guide.md | 9 +- subfile-exchange/src/config.rs | 55 +- subfile-exchange/src/ipfs.rs | 7 +- subfile-exchange/src/lib.rs | 2 +- subfile-exchange/src/main.rs | 7 +- subfile-exchange/src/subfile.rs | 49 +- subfile-exchange/src/subfile_client/mod.rs | 2 +- subfile-exchange/src/subfile_finder/mod.rs | 13 +- subfile-exchange/src/util.rs | 16 + subfile-exchange/tests/discovery.rs | 10 +- subfile-service/Cargo.toml | 69 ++ subfile-service/build.rs | 5 + subfile-service/src/config.rs | 147 +++ subfile-service/src/errors.rs | 75 ++ subfile-service/src/lib.rs | 2 + subfile-service/src/main.rs | 20 + .../src/subfile_server/admin.rs | 29 +- .../src/subfile_server/mod.rs | 47 +- .../src/subfile_server/range.rs | 16 +- .../src/subfile_server/util.rs | 35 +- 22 files changed, 951 insertions(+), 534 deletions(-) create mode 100644 subfile-exchange/src/util.rs create mode 100644 subfile-service/Cargo.toml create mode 100644 subfile-service/build.rs create mode 100644 subfile-service/src/config.rs create mode 100644 subfile-service/src/errors.rs create mode 100644 subfile-service/src/lib.rs create mode 100644 subfile-service/src/main.rs rename {subfile-exchange => subfile-service}/src/subfile_server/admin.rs (90%) rename {subfile-exchange => subfile-service}/src/subfile_server/mod.rs (90%) rename {subfile-exchange => subfile-service}/src/subfile_server/range.rs (92%) rename {subfile-exchange => subfile-service}/src/subfile_server/util.rs (70%) diff --git a/Cargo.lock b/Cargo.lock index 8ffe142..48d5580 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -87,11 +87,11 @@ dependencies = [ "const-hex", "dunce", "heck", - "indexmap 2.0.2", + "indexmap", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", "syn-solidity", "tiny-keccak", ] @@ -131,9 +131,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", @@ -151,30 +151,30 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -330,13 +330,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -345,7 +345,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "pharos", "rustc_version 0.4.0", ] @@ -403,9 +403,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -451,9 +451,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "bitvec" @@ -503,10 +503,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b69d6331ec579144d39e1c128f343d23e9b837617df1bed4ed032e141f83f06a" dependencies = [ "anyhow", - "base64 0.21.4", + "base64 0.21.5", "bincode", "build-info-common", - "cargo_metadata 0.18.1", + "cargo_metadata", "chrono", "git2", "glob", @@ -535,7 +535,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc1874cb1995691fb01f9bb56e75f9660d2614e74607fa71c08a8b3bd7e30e4" dependencies = [ "anyhow", - "base64 0.21.4", + "base64 0.21.5", "bincode", "build-info-common", "chrono", @@ -545,7 +545,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.38", + "syn 2.0.41", "zstd 0.12.4", ] @@ -614,25 +614,11 @@ checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad" [[package]] name = "cargo-platform" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.17.0" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" +checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.20", "serde", - "serde_json", - "thiserror", ] [[package]] @@ -683,7 +669,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -725,9 +711,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.6" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ "clap_builder", "clap_derive", @@ -735,9 +721,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" dependencies = [ "anstream", "anstyle", @@ -750,21 +736,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.2" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "coins-bip32" @@ -804,7 +790,7 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bech32", "bs58", "digest 0.10.7", @@ -885,9 +871,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -895,9 +881,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core2" @@ -910,9 +896,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -964,9 +950,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -975,22 +961,21 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" dependencies = [ "cfg-if", ] @@ -1003,9 +988,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28f85c3514d2a6e64160359b45a3918c3b4178bcbf4ae5d03ab2d02e521c479a" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core", @@ -1034,15 +1019,15 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "data-encoding-macro" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c904b33cc60130e1aeea4956ab803d08a3f4a0ca82d64ed757afac3891f2bb99" +checksum = "20c01c06f5f429efdf2bae21eb67c28b3df3cf85b7dd2d8ef09c0838dac5d33e" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -1050,9 +1035,9 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fdf3fce3ce863539ec1d7fd1b6dcc3c645663376b43ed376bbf887733e4f772" +checksum = "0047d07f2c89b17dd631c80450d69841a6b5d7fb17278cbc43d7e4cfcf2576f3" dependencies = [ "data-encoding", "syn 1.0.109", @@ -1070,9 +1055,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ "powerfmt", ] @@ -1196,7 +1181,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1224,9 +1209,9 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", "digest 0.10.7", @@ -1244,9 +1229,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" -version = "0.13.6" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", @@ -1285,7 +1270,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes", "hex", "k256", @@ -1305,12 +1290,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1385,9 +1370,9 @@ dependencies = [ [[package]] name = "ethers" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad13497f6e0a24292fc7b408e30d22fe9dc262da1f40d7b542c3a44e7fc0476" +checksum = "1a5344eea9b20effb5efeaad29418215c4d27017639fd1f908260f59cbbd226e" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -1401,9 +1386,9 @@ dependencies = [ [[package]] name = "ethers-addressbook" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e9e8acd0ed348403cc73a670c24daba3226c40b98dc1a41903766b3ab6240a" +checksum = "8c405f24ea3a517899ba7985385c43dc4a7eb1209af3b1e0a1a32d7dcc7f8d09" dependencies = [ "ethers-core", "once_cell", @@ -1413,9 +1398,9 @@ dependencies = [ [[package]] name = "ethers-contract" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79269278125006bb0552349c03593ffa9702112ca88bc7046cc669f148fb47c" +checksum = "0111ead599d17a7bff6985fd5756f39ca7033edc79a31b23026a8d5d64fa95cd" dependencies = [ "const-hex", "ethers-contract-abigen", @@ -1432,9 +1417,9 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95a43c939b2e4e2f3191c5ad4a1f279780b8a39139c9905b43a7433531e2ab" +checksum = "51258120c6b47ea9d9bec0d90f9e8af71c977fbefbef8213c91bfed385fe45eb" dependencies = [ "Inflector", "const-hex", @@ -1449,16 +1434,16 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.38", - "toml 0.7.8", + "syn 2.0.41", + "toml 0.8.8", "walkdir", ] [[package]] name = "ethers-contract-derive" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9ce44906fc871b3ee8c69a695ca7ec7f70e50cb379c9b9cb5e532269e492f6" +checksum = "936e7a0f1197cee2b62dc89f63eff3201dbf87c283ff7e18d86d38f83b845483" dependencies = [ "Inflector", "const-hex", @@ -1467,18 +1452,18 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "ethers-core" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a17f0708692024db9956b31d7a20163607d2745953f5ae8125ab368ba280ad" +checksum = "2f03e0bdc216eeb9e355b90cf610ef6c5bb8aca631f97b5ae9980ce34ea7878d" dependencies = [ "arrayvec", "bytes", - "cargo_metadata 0.17.0", + "cargo_metadata", "chrono", "const-hex", "elliptic-curve", @@ -1493,7 +1478,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.38", + "syn 2.0.41", "tempfile", "thiserror", "tiny-keccak", @@ -1502,10 +1487,11 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045" +checksum = "abbac2c890bdbe0f1b8e549a53b00e2c4c1de86bb077c1094d1f38cdf9381a56" dependencies = [ + "chrono", "ethers-core", "reqwest", "semver 1.0.20", @@ -1517,9 +1503,9 @@ dependencies = [ [[package]] name = "ethers-middleware" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "473f1ccd0c793871bbc248729fa8df7e6d2981d6226e4343e3bbaa9281074d5d" +checksum = "681ece6eb1d10f7cf4f873059a77c04ff1de4f35c63dd7bccde8f438374fcb93" dependencies = [ "async-trait", "auto_impl", @@ -1544,13 +1530,13 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6838fa110e57d572336178b7c79e94ff88ef976306852d8cb87d9e5b1fc7c0b5" +checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" dependencies = [ "async-trait", "auto_impl", - "base64 0.21.4", + "base64 0.21.5", "bytes", "const-hex", "enr", @@ -1581,9 +1567,9 @@ dependencies = [ [[package]] name = "ethers-signers" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea44bec930f12292866166f9ddbea6aa76304850e4d8dcd66dc492b43d00ff1" +checksum = "0cb1b714e227bbd2d8c53528adb580b203009728b17d0d0e4119353aa9bc5532" dependencies = [ "async-trait", "coins-bip32", @@ -1600,9 +1586,9 @@ dependencies = [ [[package]] name = "ethers-solc" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de34e484e7ae3cab99fbfd013d6c5dc7f9013676a4e0e414d8b12e1213e8b3ba" +checksum = "a64f710586d147864cff66540a6d64518b9ff37d73ef827fee430538265b595f" dependencies = [ "cfg-if", "const-hex", @@ -1632,9 +1618,9 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +checksum = "b6267a1fa6f59179ea4afc8e50fd8612a3cc60bc858f786ff877a4a8cb042799" dependencies = [ "indenter", "once_cell", @@ -1718,9 +1704,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -1749,9 +1735,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -1764,9 +1750,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -1774,15 +1760,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -1791,9 +1777,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-locks" @@ -1807,26 +1793,26 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-timer" @@ -1840,9 +1826,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures 0.1.31", "futures-channel", @@ -1879,9 +1865,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", @@ -1890,9 +1876,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git2" @@ -1900,7 +1886,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "libc", "libgit2-sys", "log", @@ -1938,9 +1924,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", @@ -1948,7 +1934,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap", "slab", "tokio", "tokio-util", @@ -1963,15 +1949,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "hashers" @@ -2024,14 +2004,14 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "http" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", @@ -2040,9 +2020,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -2078,7 +2058,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -2150,9 +2130,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2204,22 +2184,12 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.1", + "hashbrown", ] [[package]] @@ -2249,7 +2219,7 @@ dependencies = [ "async-trait", "base64 0.13.1", "bytes", - "futures 0.3.28", + "futures 0.3.29", "http", "hyper", "hyper-multipart-rfc7578", @@ -2268,7 +2238,7 @@ dependencies = [ "cfg-if", "common-multipart-rfc7578", "dirs 4.0.0", - "futures 0.3.28", + "futures 0.3.29", "http", "multiaddr", "multibase", @@ -2284,9 +2254,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" @@ -2296,7 +2266,7 @@ checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2319,9 +2289,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" @@ -2334,9 +2304,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -2347,7 +2317,7 @@ version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "pem", "ring 0.16.20", "serde", @@ -2357,9 +2327,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" dependencies = [ "cfg-if", "ecdsa", @@ -2414,9 +2384,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libgit2-sys" @@ -2436,6 +2406,17 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall", +] + [[package]] name = "libz-sys" version = "1.1.12" @@ -2450,9 +2431,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "lock_api" @@ -2540,13 +2521,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2596,7 +2577,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d6d4752e6230d8ef7adf7bd5d8c4b1f6561c1014c5ba9a37445ccefe18aa1db" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.1.3", "proc-macro-error", "proc-macro2", "quote", @@ -2694,10 +2675,10 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -2711,9 +2692,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oorandom" @@ -2748,11 +2729,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if", "foreign-types", "libc", @@ -2769,7 +2750,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -2780,9 +2761,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" dependencies = [ "cc", "libc", @@ -2804,9 +2785,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parity-scale-codec" -version = "3.6.5" +version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" +checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" dependencies = [ "arrayvec", "bitvec", @@ -2818,11 +2799,11 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.5" +version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" +checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", "syn 1.0.109", @@ -2846,9 +2827,9 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -2907,9 +2888,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" @@ -2929,7 +2910,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.2", + "indexmap", ] [[package]] @@ -2938,7 +2919,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "rustc_version 0.4.0", ] @@ -2972,7 +2953,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -3010,7 +2991,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -3104,7 +3085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -3131,6 +3112,15 @@ dependencies = [ "toml 0.5.11", ] +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +dependencies = [ + "toml_edit 0.20.7", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -3157,9 +3147,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] @@ -3172,13 +3162,13 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.0", + "bitflags 2.4.1", "lazy_static", "num-traits", "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.1", + "regex-syntax 0.8.2", "rusty-fork", "tempfile", "unarray", @@ -3264,24 +3254,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -3293,25 +3265,25 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ "getrandom", - "redox_syscall 0.2.16", + "libredox", "thiserror", ] [[package]] name = "regex" -version = "1.10.0" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.1", - "regex-syntax 0.8.1", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -3325,13 +3297,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.1", + "regex-syntax 0.8.2", ] [[package]] @@ -3348,9 +3320,9 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "regex-syntax" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d84fdd47036b038fc80dd333d10b6aab10d5d31f4a366e20014def75328d33" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" @@ -3358,7 +3330,7 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes", "encoding_rs", "futures-core", @@ -3425,16 +3397,16 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.5" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", "getrandom", "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -3474,7 +3446,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de1bb486a691878cd320c2f0d319ba91eeaa2e894066d8b5f8f117c000e9d962" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "futures-timer", "rstest_macros", "rustc_version 0.4.0", @@ -3556,36 +3528,36 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.19" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.8" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring 0.17.5", + "ring 0.17.7", "rustls-webpki", "sct", ] [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", ] [[package]] @@ -3594,7 +3566,7 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.5", + "ring 0.17.7", "untrusted 0.9.0", ] @@ -3618,9 +3590,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "salsa20" @@ -3658,7 +3630,7 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.1.3", "proc-macro2", "quote", "syn 1.0.109", @@ -3670,7 +3642,7 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -3697,7 +3669,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.5", + "ring 0.17.7", "untrusted 0.9.0", ] @@ -3797,29 +3769,29 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -3849,11 +3821,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.25" +version = "0.9.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" +checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" dependencies = [ - "indexmap 2.0.2", + "indexmap", "itoa", "ryu", "serde", @@ -3903,9 +3875,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", "rand_core", @@ -3940,9 +3912,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "smol_str" @@ -3955,9 +3927,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -3965,19 +3937,19 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "solang-parser" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cb9fa2fa2fa6837be8a2495486ff92e3ffe68a99b6eeba288e139efdd842457" +checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" dependencies = [ "itertools 0.11.0", "lalrpop", @@ -4001,9 +3973,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spki" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -4072,7 +4044,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -4082,7 +4054,52 @@ dependencies = [ "alloy-primitives", "alloy-sol-types", "anyhow", - "base64 0.21.4", + "base64 0.21.5", + "build-info", + "build-info-build", + "bytes", + "cargo-husky", + "chrono", + "clap", + "confy", + "criterion", + "derive-getters", + "dotenv", + "ethers", + "ethers-core", + "futures 0.3.29", + "hex", + "http", + "hyper", + "ipfs-api-backend-hyper", + "ipfs-api-prelude", + "merkle-cbt", + "rand", + "reqwest", + "rustls", + "rustls-pemfile", + "secp256k1", + "serde", + "serde_json", + "serde_yaml", + "sha2", + "tap_core", + "tempfile", + "tokio", + "tokio-retry", + "toml 0.7.8", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "subfile-service" +version = "0.0.1" +dependencies = [ + "alloy-primitives", + "alloy-sol-types", + "anyhow", + "base64 0.21.5", "build-info", "build-info-build", "bytes", @@ -4095,7 +4112,7 @@ dependencies = [ "dotenv", "ethers", "ethers-core", - "futures 0.3.28", + "futures 0.3.29", "hex", "http", "hyper", @@ -4111,6 +4128,7 @@ dependencies = [ "serde_json", "serde_yaml", "sha2", + "subfile-exchange", "tap_core", "tempfile", "tokio", @@ -4159,9 +4177,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" dependencies = [ "proc-macro2", "quote", @@ -4177,7 +4195,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -4245,15 +4263,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -4274,27 +4292,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -4372,9 +4390,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" dependencies = [ "backtrace", "bytes", @@ -4382,20 +4400,20 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -4446,9 +4464,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -4476,7 +4494,19 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.19.15", +] + +[[package]] +name = "toml" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.21.0", ] [[package]] @@ -4494,7 +4524,31 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.2", + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +dependencies = [ + "indexmap", "serde", "serde_spanned", "toml_datetime", @@ -4509,11 +4563,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4521,20 +4574,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -4552,12 +4605,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -4573,9 +4626,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -4594,9 +4647,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" @@ -4659,9 +4712,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-ident" @@ -4692,9 +4745,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unsafe-libyaml" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" +checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" [[package]] name = "unsigned-varint" @@ -4716,9 +4769,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -4801,9 +4854,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4811,24 +4864,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" dependencies = [ "cfg-if", "js-sys", @@ -4838,9 +4891,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4848,22 +4901,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "wasm-streams" @@ -4880,9 +4933,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", @@ -4890,9 +4943,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "winapi" @@ -4931,7 +4984,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -4940,7 +4993,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", ] [[package]] @@ -4949,13 +5011,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -4964,47 +5041,89 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "winnow" -version = "0.5.19" +version = "0.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" +checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" dependencies = [ "memchr", ] @@ -5016,7 +5135,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -5026,7 +5145,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" dependencies = [ "async_io_stream", - "futures 0.3.28", + "futures 0.3.29", "js-sys", "log", "pharos", @@ -5055,9 +5174,9 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zeroize" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" dependencies = [ "zeroize_derive", ] @@ -5070,7 +5189,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index bfd8bb3..e273978 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ "subfile-exchange", + "subfile-service", ] resolver = "2" diff --git a/docs/client_guide.md b/docs/client_guide.md index 42f8dde..0ec0257 100644 --- a/docs/client_guide.md +++ b/docs/client_guide.md @@ -26,9 +26,12 @@ After determining the subfile CID, client should supply a local path for writing ### CLI example ``` ➜ subfile-exchange git:(main) ✗ cargo run -p subfile-exchange downloader \ - --ipfs-hash QmakV6VEwnydfe7PXFR3TRxHbhVm7mQRXqVHdsizhTRrGw \ - --indexer-endpoints http://localhost:5678 \ - --free-query-auth-token 'Bearer imfreeee' + --ipfs-hash QmeaPp764FjQjPB66M9ijmQKmLhwBpHQhA7dEbH2FA1j3v \ + --indexer-endpoints http://localhost:5678,http://localhost:5677 \ + --free-query-auth-token 'Bearer imfreeee' \ + --mnemonic "sheriff obscure trick beauty army fat wink legal flee leader section suit" \ + --chain-id 421614 \ + --verifier 0xfC24cE7a4428A6B89B52645243662A02BA734ECF ``` diff --git a/subfile-exchange/src/config.rs b/subfile-exchange/src/config.rs index 07decbd..feb3e11 100644 --- a/subfile-exchange/src/config.rs +++ b/subfile-exchange/src/config.rs @@ -2,14 +2,11 @@ use clap::{arg, ValueEnum}; use clap::{command, Args, Parser, Subcommand}; use serde::{Deserialize, Serialize}; use std::fmt; -use std::path::PathBuf; -use std::str::FromStr; + use tracing::subscriber::SetGlobalDefaultError; use tracing_subscriber::EnvFilter; use tracing_subscriber::FmtSubscriber; -use crate::errors::Error; - #[derive(Clone, Debug, Parser, Serialize, Deserialize)] #[command( name = "subfile-exchange", @@ -370,53 +367,3 @@ impl fmt::Display for LogFormat { } } } - -/// Validate the subfile configurations at initialization -pub fn validate_subfile_entries(entries: Vec) -> Result, Error> { - let mut results = Vec::new(); - - for entry in entries { - results.push(validate_subfile_entry(entry)?); - } - - Ok(results) -} - -/// Subfile entry must be in the format of "valid_ipfs_hash:valid_local_path" -pub fn validate_subfile_entry(entry: String) -> Result<(String, PathBuf), Error> { - let parts: Vec<&str> = entry.split(':').collect(); - if parts.len() != 2 { - return Err(Error::InvalidConfig(format!( - "Invalid format for entry: {}", - entry - ))); - } - - let ipfs_hash = parts[0]; - let local_path = parts[1]; - - // Validate IPFS hash (this is a placeholder, you'll need to define what a valid IPFS hash is) - if !is_valid_ipfs_hash(ipfs_hash) { - return Err(Error::InvalidConfig(format!( - "Invalid IPFS hash: {}", - ipfs_hash - ))); - } - - // Validate local path - let path = PathBuf::from_str(local_path).map_err(|e| Error::InvalidConfig(e.to_string()))?; - if !path.exists() { - return Err(Error::InvalidConfig(format!( - "Path do not exist: {}", - local_path - ))); - } - - Ok((ipfs_hash.to_string(), path)) -} - -pub fn is_valid_ipfs_hash(hash: &str) -> bool { - // Basic validation for IPFS hash - // Note: This is a simplified check and may not cover all cases. - hash.starts_with("Qm") && hash.len() == 46 -} diff --git a/subfile-exchange/src/ipfs.rs b/subfile-exchange/src/ipfs.rs index 17394e6..bd1096a 100644 --- a/subfile-exchange/src/ipfs.rs +++ b/subfile-exchange/src/ipfs.rs @@ -8,7 +8,12 @@ use serde::Deserialize; use std::time::Duration; use std::{str::FromStr, sync::Arc}; -/// Reference type, clones will share the connection pool. +pub fn is_valid_ipfs_hash(hash: &str) -> bool { + // Basic validation for IPFS hash + // Note: This is a simplified check and may not cover all cases. + hash.starts_with("Qm") && hash.len() == 46 +} + #[derive(Clone, Debug)] pub struct IpfsClient { base: Arc, diff --git a/subfile-exchange/src/lib.rs b/subfile-exchange/src/lib.rs index d0c7c0d..383eac4 100644 --- a/subfile-exchange/src/lib.rs +++ b/subfile-exchange/src/lib.rs @@ -8,5 +8,5 @@ pub mod subfile; pub mod subfile_client; pub mod subfile_finder; pub mod subfile_reader; -pub mod subfile_server; pub mod test_util; +pub mod util; diff --git a/subfile-exchange/src/main.rs b/subfile-exchange/src/main.rs index 5b4f7b4..be887bc 100644 --- a/subfile-exchange/src/main.rs +++ b/subfile-exchange/src/main.rs @@ -1,11 +1,10 @@ -use subfile_exchange::{subfile_client::SubfileDownloader, subfile_server::init_server}; - use dotenv::dotenv; use subfile_exchange::{ config::{Cli, Role}, ipfs::IpfsClient, publisher::SubfilePublisher, + subfile_client::SubfileDownloader, }; #[tokio::main] @@ -57,10 +56,8 @@ async fn main() { Role::Server(server_args) => { tracing::info!( server = tracing::field::debug(&server_args), - "Tracker request" + "Use subfile-service crate" ); - - let _ = init_server(&client, server_args).await; } } } diff --git a/subfile-exchange/src/subfile.rs b/subfile-exchange/src/subfile.rs index 6009b5e..ae13850 100644 --- a/subfile-exchange/src/subfile.rs +++ b/subfile-exchange/src/subfile.rs @@ -1,4 +1,7 @@ -use std::path::{Path, PathBuf}; +use std::{ + path::{Path, PathBuf}, + str::FromStr, +}; use serde::{Deserialize, Serialize}; @@ -6,6 +9,7 @@ use crate::{ errors::Error, file_hasher::{hash_chunk, verify_chunk}, file_reader::{chunk_file, format_path, read_chunk}, + ipfs::is_valid_ipfs_hash, }; /* Public Manifests */ @@ -161,6 +165,49 @@ impl Subfile { } } +/// Validate the subfile configurations at initialization +pub fn validate_subfile_entries(entries: Vec) -> Result, Error> { + let mut results = Vec::new(); + + for entry in entries { + results.push(validate_subfile_entry(entry)?); + } + + Ok(results) +} + +/// Subfile entry must be in the format of "valid_ipfs_hash:valid_local_path" +pub fn validate_subfile_entry(entry: String) -> Result<(String, PathBuf), Error> { + let parts: Vec<&str> = entry.split(':').collect(); + if parts.len() != 2 { + return Err(Error::InvalidConfig(format!( + "Invalid format for entry: {}", + entry + ))); + } + + let ipfs_hash = parts[0]; + let local_path = parts[1]; + + if !is_valid_ipfs_hash(ipfs_hash) { + return Err(Error::InvalidConfig(format!( + "Invalid IPFS hash: {}", + ipfs_hash + ))); + } + + // Validate local path + let path = PathBuf::from_str(local_path).map_err(|e| Error::InvalidConfig(e.to_string()))?; + if !path.exists() { + return Err(Error::InvalidConfig(format!( + "Path do not exist: {}", + local_path + ))); + } + + Ok((ipfs_hash.to_string(), path)) +} + #[cfg(test)] mod tests { use crate::test_util::simple_subfile; diff --git a/subfile-exchange/src/subfile_client/mod.rs b/subfile-exchange/src/subfile_client/mod.rs index 5b005fc..2eea790 100644 --- a/subfile-exchange/src/subfile_client/mod.rs +++ b/subfile-exchange/src/subfile_client/mod.rs @@ -21,7 +21,7 @@ use crate::ipfs::IpfsClient; use crate::subfile::{ChunkFileMeta, Subfile}; use crate::subfile_finder::{IndexerEndpoint, SubfileFinder}; use crate::subfile_reader::read_subfile; -use crate::subfile_server::util::build_wallet; +use crate::util::build_wallet; use self::signer::ReceiptSigner; diff --git a/subfile-exchange/src/subfile_finder/mod.rs b/subfile-exchange/src/subfile_finder/mod.rs index 74a8c84..2b694c0 100644 --- a/subfile-exchange/src/subfile_finder/mod.rs +++ b/subfile-exchange/src/subfile_finder/mod.rs @@ -1,4 +1,5 @@ use futures::{stream, StreamExt}; +use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -12,7 +13,6 @@ use crate::errors::Error; use crate::ipfs::IpfsClient; use crate::subfile_reader::{fetch_subfile_from_ipfs, read_subfile}; -use crate::subfile_server::util::Operator; // Pair indexer operator address and indexer service endpoint (operator, indexer_url) // persumeably this should not be handled by clients themselves @@ -149,7 +149,7 @@ impl SubfileFinder { } } - match unavailble_files(&file_map).await { + match unavailable_files(&file_map).await { files if !files.is_empty() => { return Err(Error::DataUnavilable(format!( "File availability incomplete, missing files: {:#?}", @@ -217,7 +217,7 @@ impl SubfileFinder { } /// Check if there is a key in target_hashes where the corresponding availability is empty -pub async fn unavailble_files(file_map: &FileAvailbilityMap) -> Vec { +pub async fn unavailable_files(file_map: &FileAvailbilityMap) -> Vec { let mut missing_file = vec![]; let hashes = file_map.lock().await; for (key, inner_map_arc) in hashes.iter() { @@ -228,3 +228,10 @@ pub async fn unavailble_files(file_map: &FileAvailbilityMap) -> Vec { } missing_file } + +//TODO: directly access the field instead +#[derive(Serialize, Deserialize)] +pub struct Operator { + #[serde(alias = "publicKey")] + pub public_key: String, +} diff --git a/subfile-exchange/src/util.rs b/subfile-exchange/src/util.rs new file mode 100644 index 0000000..1f695fe --- /dev/null +++ b/subfile-exchange/src/util.rs @@ -0,0 +1,16 @@ +use ethers::signers::{ + coins_bip39::English, LocalWallet, MnemonicBuilder, Signer, Wallet, WalletError, +}; +use ethers_core::k256::ecdsa::SigningKey; + +/// Build Wallet from Private key or Mnemonic +pub fn build_wallet(value: &str) -> Result, WalletError> { + value + .parse::() + .or(MnemonicBuilder::::default().phrase(value).build()) +} + +/// Get wallet public address to String +pub fn wallet_address(wallet: &Wallet) -> String { + format!("{:?}", wallet.address()) +} diff --git a/subfile-exchange/tests/discovery.rs b/subfile-exchange/tests/discovery.rs index 9985d66..c5a61fe 100644 --- a/subfile-exchange/tests/discovery.rs +++ b/subfile-exchange/tests/discovery.rs @@ -4,7 +4,7 @@ mod tests { use subfile_exchange::{ ipfs::IpfsClient, - subfile_finder::{unavailble_files, FileAvailbilityMap, IndexerEndpoint, SubfileFinder}, + subfile_finder::{unavailable_files, FileAvailbilityMap, IndexerEndpoint, SubfileFinder}, test_util::server_ready, }; @@ -188,12 +188,12 @@ mod tests { ) .await .unwrap(); - let unavailble_files = unavailble_files(&map).await; - assert!(unavailble_files.len() == 2); - assert!(unavailble_files.contains(&String::from( + let unavailable_files = unavailable_files(&map).await; + assert!(unavailable_files.len() == 2); + assert!(unavailable_files.contains(&String::from( "QmSydRNSzjozo5d7W4AyCK8BkgfpEU8KQp9kvSHzf2Ch4g" ))); - assert!(unavailble_files.contains(&String::from( + assert!(unavailable_files.contains(&String::from( "QmSuyvzDpuDBoka2rCimRXPmX2icL7Vu6RUxoFWFQD7YBb" ))); diff --git a/subfile-service/Cargo.toml b/subfile-service/Cargo.toml new file mode 100644 index 0000000..ad78230 --- /dev/null +++ b/subfile-service/Cargo.toml @@ -0,0 +1,69 @@ +[package] +name = "subfile-service" +version = "0.0.1" +edition = "2021" +authors = ["hopeyen "] +rust-version = "1.72" +description = "Subfile data service" +readme = "README.md" +license = "Apache-2.0" + +[[bin]] +name = "subfile-service" +path = "src/main.rs" + +[dependencies] +subfile-exchange = { path = "../subfile-exchange" } +alloy-sol-types = { version = "0.5.0", features = ["eip712-serde"] } +alloy-primitives = { version = "0.5.0", features = ["serde"] } +anyhow = "1.0" +base64 = "0.21" +build-info = "0.0.34" +bytes = "1.0" +chrono = "0.4.31" +clap = { version = "4.4", features = ["cargo", "unstable-doc"] } +confy = "0.5" +derive-getters = "0.3.0" +dotenv = "0.15" +ethers = "2.0.10" +ethers-core = "2.0.10" +futures = { version = "0.3", features = ["compat"] } +hex = "0.4.3" +http = "0.2" +hyper = { version = "0.14.27", features = [ "server" ]} +ipfs-api-backend-hyper = "0.6" +ipfs-api-prelude = "0.6" +merkle-cbt = "0.3.2" +rand = "0.8.4" +reqwest = { version = "0.11", features = ["json", "stream", "multipart"] } +rustls = "0.21.8" +rustls-pemfile = "1.0.3" +secp256k1 = "0.28.0" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +serde_yaml = "0.9" +sha2 = "0.10.8" +tap_core = { version = "0.7.0", git = "https://github.com/semiotic-ai/timeline-aggregation-protocol" } +tempfile = "3.2.0" +tokio = { version = "1.28", features = ["time", "sync", "macros", "test-util", "rt-multi-thread"] } +tokio-retry = "0.3" +toml = "0.7.4" +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = [ + "env-filter", + "ansi", + "fmt", + "std", + "json", +] } + +[dev-dependencies] +criterion = "0.5" + +[dev-dependencies.cargo-husky] +version = "1" +default-features = false +features = ["precommit-hook", "run-cargo-fmt", "run-cargo-clippy"] + +[build-dependencies] +build-info-build = "0.0.34" diff --git a/subfile-service/build.rs b/subfile-service/build.rs new file mode 100644 index 0000000..0b2af0d --- /dev/null +++ b/subfile-service/build.rs @@ -0,0 +1,5 @@ +use build_info_build::DependencyDepth; + +fn main() { + build_info_build::build_script().collect_dependencies(DependencyDepth::Depth(1)); +} diff --git a/subfile-service/src/config.rs b/subfile-service/src/config.rs new file mode 100644 index 0000000..d755540 --- /dev/null +++ b/subfile-service/src/config.rs @@ -0,0 +1,147 @@ +use clap::arg; +use clap::{command, Args, Parser}; +use serde::{Deserialize, Serialize}; +use std::fmt; + +use tracing::subscriber::SetGlobalDefaultError; +use tracing_subscriber::EnvFilter; +use tracing_subscriber::FmtSubscriber; + +#[derive(Clone, Debug, Parser, Serialize, Deserialize)] +#[command( + name = "subfile-service", + about = "Indexers subfile service", + author = "hopeyen" +)] +#[command(author, version, about, long_about = None, arg_required_else_help = true)] +pub struct Cli { + #[command(flatten)] + pub server: ServerArgs, + #[arg( + long, + value_name = "IPFS_GATEWAY_URL", + default_value = "https://ipfs.network.thegraph.com", + env = "IPFS_GATEWAY_URL", + help = "IPFS gateway to interact with" + )] + pub ipfs_gateway: String, + #[arg( + long, + value_name = "LOG_FORMAT", + env = "LOG_FORMAT", + help = "Support logging formats: pretty, json, full, compact", + long_help = "pretty: verbose and human readable; json: not verbose and parsable; compact: not verbose and not parsable; full: verbose and not parsible", + default_value = "pretty" + )] + pub log_format: LogFormat, +} + +impl Cli { + /// Parse config arguments + pub fn args() -> Self { + let config = Cli::parse(); + // Enables tracing under RUST_LOG variable + init_tracing(config.log_format.to_string()).expect("Could not set up global default subscriber for logger, check environmental variable `RUST_LOG` or the CLI input `log-level`"); + config + } +} + +#[derive(Clone, Debug, Args, Serialize, Deserialize, Default)] +#[group(required = false, multiple = true)] +pub struct ServerArgs { + #[arg( + long, + value_name = "HOST", + default_value = "127.0.0.1", + env = "HOST", + help = "Subfile server host" + )] + pub host: String, + #[arg( + long, + value_name = "PORT", + default_value = "5678", + env = "PORT", + help = "Subfile server port" + )] + pub port: usize, + // Taking from config right now, later can read from DB table for managing server states + #[arg( + long, + value_name = "SUBFILES", + env = "SUBFILES", + value_delimiter = ',', + help = "Comma separated list of IPFS hashes and local location of the subfiles to serve upon start-up; format: [ipfs_hash:local_path]" + )] + pub subfiles: Vec, + #[clap( + long, + value_name = "free-query-auth-token", + env = "FREE_QUERY_AUTH_TOKEN", + help = "Auth token that clients can use to query for free" + )] + pub free_query_auth_token: Option, + #[clap( + long, + value_name = "admin-auth-token", + env = "ADMIN_AUTH_TOKEN", + help = "Admin Auth token for server management" + )] + pub admin_auth_token: Option, + #[clap( + long, + value_name = "mnemonic", + env = "MNEMONIC", + help = "Mnemonic for the operator wallet" + )] + pub mnemonic: String, + //TODO: More complex price management + #[arg( + long, + value_name = "PRICE_PER_BYTE", + default_value = "1", + env = "PRICE_PER_BYTE", + help = "Price per byte; price do not currently have a unit, perhaps use DAI or GRT, refer to TAP" + )] + pub price_per_byte: f32, +} + +/// Sets up tracing, allows log level to be set from the environment variables +pub fn init_tracing(format: String) -> Result<(), SetGlobalDefaultError> { + let filter = EnvFilter::from_default_env(); + + let subscriber_builder: tracing_subscriber::fmt::SubscriberBuilder< + tracing_subscriber::fmt::format::DefaultFields, + tracing_subscriber::fmt::format::Format, + EnvFilter, + > = FmtSubscriber::builder().with_env_filter(filter); + + match format.as_str() { + "json" => tracing::subscriber::set_global_default(subscriber_builder.json().finish()), + "full" => tracing::subscriber::set_global_default(subscriber_builder.finish()), + "compact" => tracing::subscriber::set_global_default(subscriber_builder.compact().finish()), + _ => tracing::subscriber::set_global_default( + subscriber_builder.with_ansi(true).pretty().finish(), + ), + } +} + +#[derive(clap::ValueEnum, Clone, Debug, Serialize, Deserialize, Default)] +pub enum LogFormat { + Compact, + #[default] + Pretty, + Json, + Full, +} + +impl fmt::Display for LogFormat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + LogFormat::Compact => write!(f, "compact"), + LogFormat::Pretty => write!(f, "pretty"), + LogFormat::Json => write!(f, "json"), + LogFormat::Full => write!(f, "full"), + } + } +} diff --git a/subfile-service/src/errors.rs b/subfile-service/src/errors.rs new file mode 100644 index 0000000..77ba109 --- /dev/null +++ b/subfile-service/src/errors.rs @@ -0,0 +1,75 @@ +use std::{error::Error as StdError, fmt}; + +#[derive(Debug)] +pub enum Error { + InvalidConfig(String), + FileIOError(std::io::Error), + InvalidRange(String), + IPFSError(reqwest::Error), + SubfileError(String), + Request(reqwest::Error), + DataUnavilable(String), + ChunkInvalid(String), + ServerError(ServerError), + JsonError(serde_json::Error), + YamlError(serde_yaml::Error), + InvalidPriceFormat(String), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::InvalidConfig(ref msg) => write!(f, "Invalid configuration: {}", msg), + Error::FileIOError(ref err) => write!(f, "File IO error: {}", err), + Error::InvalidRange(ref msg) => write!(f, "Invalid range: {}", msg), + Error::IPFSError(ref err) => write!(f, "IPFS error: {}", err), + Error::SubfileError(ref msg) => write!(f, "Subfile error: {}", msg), + Error::Request(ref err) => write!(f, "Client error: {}", err), + Error::DataUnavilable(ref err) => write!(f, "Client error: {}", err), + Error::ChunkInvalid(ref err) => write!(f, "Chunk invalid error: {}", err), + Error::ServerError(ref err) => write!(f, "Server error: {}", err), + Error::JsonError(ref err) => write!(f, "JSON error: {}", err), + Error::YamlError(ref err) => write!(f, "YAML error: {}", err), + Error::InvalidPriceFormat(ref msg) => write!(f, "Price format error: {}", msg), + } + } +} + +impl StdError for Error { + fn source(&self) -> Option<&(dyn StdError + 'static)> { + match *self { + Error::FileIOError(ref e) => Some(e), + Error::IPFSError(ref e) => Some(e), + Error::JsonError(ref e) => Some(e), + Error::YamlError(ref e) => Some(e), + Error::Request(ref e) => Some(e), + Error::ServerError(ref e) => e.source(), + _ => None, + } + } +} + +impl fmt::Display for ServerError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + ServerError::ContextError(ref msg) => write!(f, "Context error: {}", msg), + ServerError::RequestBodyError(ref msg) => write!(f, "Request body error: {}", msg), + ServerError::HeaderParseError(ref msg) => write!(f, "Header parse error: {}", msg), + ServerError::MethodParseError(ref msg) => write!(f, "Method parse error: {}", msg), + ServerError::ParamsParseError(ref msg) => write!(f, "Params parse error: {}", msg), + ServerError::BuildResponseError(ref msg) => write!(f, "Build response error: {}", msg), + } + } +} + +impl StdError for ServerError {} + +#[derive(Debug)] +pub enum ServerError { + ContextError(String), + RequestBodyError(String), + HeaderParseError(String), + MethodParseError(String), + ParamsParseError(String), + BuildResponseError(String), +} diff --git a/subfile-service/src/lib.rs b/subfile-service/src/lib.rs new file mode 100644 index 0000000..5ee3458 --- /dev/null +++ b/subfile-service/src/lib.rs @@ -0,0 +1,2 @@ +pub mod config; +pub mod subfile_server; diff --git a/subfile-service/src/main.rs b/subfile-service/src/main.rs new file mode 100644 index 0000000..41544b1 --- /dev/null +++ b/subfile-service/src/main.rs @@ -0,0 +1,20 @@ +use dotenv::dotenv; + +use subfile_exchange::ipfs::IpfsClient; +use subfile_service::{config::Cli, subfile_server::init_server}; + +#[tokio::main] +async fn main() { + dotenv().ok(); + let cli: Cli = Cli::args(); + + tracing::info!(cli = tracing::field::debug(&cli), "Running cli"); + + let client = if let Ok(client) = IpfsClient::new(&cli.ipfs_gateway) { + client + } else { + IpfsClient::localhost() + }; + + let _ = init_server(&client, cli.server).await; +} diff --git a/subfile-exchange/src/subfile_server/admin.rs b/subfile-service/src/subfile_server/admin.rs similarity index 90% rename from subfile-exchange/src/subfile_server/admin.rs rename to subfile-service/src/subfile_server/admin.rs index 27967db..d4a4036 100644 --- a/subfile-exchange/src/subfile_server/admin.rs +++ b/subfile-service/src/subfile_server/admin.rs @@ -1,10 +1,11 @@ use hyper::body::to_bytes; use hyper::{Body, Request, Response, StatusCode}; use serde_json::{json, Value}; - -use crate::config::{is_valid_ipfs_hash, validate_subfile_entries}; -use crate::errors::Error; -use crate::subfile_reader::read_subfile; +use subfile_exchange::errors::ServerError; +use subfile_exchange::{ + errors::Error, ipfs::is_valid_ipfs_hash, subfile::validate_subfile_entries, + subfile_reader::read_subfile, +}; use super::{create_error_response, ServerContext}; @@ -31,11 +32,7 @@ pub async fn handle_admin_request( return Response::builder() .status(StatusCode::UNAUTHORIZED) .body("Require admin authentication".into()) - .map_err(|e| { - Error::ServerError(crate::errors::ServerError::BuildResponseError( - e.to_string(), - )) - }); + .map_err(|e| Error::ServerError(ServerError::BuildResponseError(e.to_string()))); } let (method, params) = match parse_admin_request(req).await { @@ -62,23 +59,19 @@ pub async fn handle_admin_request( _ => Ok(hyper::Response::builder() .status(hyper::StatusCode::METHOD_NOT_ALLOWED) .body("Method not supported".into()) - .map_err(|e| { - Error::ServerError(crate::errors::ServerError::BuildResponseError( - e.to_string(), - )) - })?), + .map_err(|e| Error::ServerError(ServerError::BuildResponseError(e.to_string())))?), } } async fn parse_admin_request(req: Request) -> Result<(String, Option), Error> { - let body_bytes = to_bytes(req.into_body()).await.map_err(|e| { - Error::ServerError(crate::errors::ServerError::RequestBodyError(e.to_string())) - })?; + let body_bytes = to_bytes(req.into_body()) + .await + .map_err(|e| Error::ServerError(ServerError::RequestBodyError(e.to_string())))?; let json: Value = serde_json::from_slice(&body_bytes).map_err(Error::JsonError)?; let method = json.get("method").and_then(Value::as_str).ok_or_else(|| { - Error::ServerError(crate::errors::ServerError::MethodParseError( + Error::ServerError(ServerError::MethodParseError( "Method not found in request".to_string(), )) })?; diff --git a/subfile-exchange/src/subfile_server/mod.rs b/subfile-service/src/subfile_server/mod.rs similarity index 90% rename from subfile-exchange/src/subfile_server/mod.rs rename to subfile-service/src/subfile_server/mod.rs index 9d79607..f9662c5 100644 --- a/subfile-exchange/src/subfile_server/mod.rs +++ b/subfile-service/src/subfile_server/mod.rs @@ -6,13 +6,16 @@ use std::collections::HashMap; use std::sync::Arc; use tokio::sync::Mutex; -use crate::config::{validate_subfile_entries, ServerArgs}; -use crate::errors::Error; -use crate::ipfs::IpfsClient; -use crate::subfile::Subfile; -use crate::subfile_reader::read_subfile; -use crate::subfile_server::admin::handle_admin_request; -use crate::subfile_server::util::{public_key, Health, Operator}; +use subfile_exchange::errors::{Error, ServerError}; +use subfile_exchange::ipfs::IpfsClient; +use subfile_exchange::subfile::{validate_subfile_entries, Subfile}; +use subfile_exchange::subfile_reader::read_subfile; + +use crate::config::ServerArgs; +use crate::subfile_server::{ + admin::handle_admin_request, + util::{public_key, Health, Operator}, +}; // #![cfg(feature = "acceptor")] // use hyper_rustls::TlsAcceptor; use hyper::{Body, Request, Response, StatusCode}; @@ -160,11 +163,7 @@ pub async fn health() -> Result, Error> { Response::builder() .status(StatusCode::OK) .body(Body::from(health_json)) - .map_err(|e| { - Error::ServerError(crate::errors::ServerError::BuildResponseError( - e.to_string(), - )) - }) + .map_err(|e| Error::ServerError(ServerError::BuildResponseError(e.to_string()))) } /// Endpoint for package version @@ -173,11 +172,7 @@ pub async fn version(context: &ServerContext) -> Result, Error> { Response::builder() .status(StatusCode::OK) .body(Body::from(version)) - .map_err(|e| { - Error::ServerError(crate::errors::ServerError::BuildResponseError( - e.to_string(), - )) - }) + .map_err(|e| Error::ServerError(ServerError::BuildResponseError(e.to_string()))) } /// Endpoint for cost to download per byte @@ -186,11 +181,7 @@ pub async fn cost(context: &ServerContext) -> Result, Error> { Response::builder() .status(StatusCode::OK) .body(Body::from(price)) - .map_err(|e| { - Error::ServerError(crate::errors::ServerError::BuildResponseError( - e.to_string(), - )) - }) + .map_err(|e| Error::ServerError(ServerError::BuildResponseError(e.to_string()))) } /// Endpoint for status availability @@ -206,11 +197,7 @@ pub async fn status(context: &ServerContext) -> Result, Error> { Response::builder() .status(StatusCode::OK) .body(Body::from(json)) - .map_err(|e| { - Error::ServerError(crate::errors::ServerError::BuildResponseError( - e.to_string(), - )) - }) + .map_err(|e| Error::ServerError(ServerError::BuildResponseError(e.to_string()))) } // Define a handler function for the `/info` route @@ -222,11 +209,7 @@ pub async fn operator_info(context: &ServerContext) -> Result, Er Response::builder() .status(StatusCode::OK) .body(Body::from(json)) - .map_err(|e| { - Error::ServerError(crate::errors::ServerError::BuildResponseError( - e.to_string(), - )) - }) + .map_err(|e| Error::ServerError(ServerError::BuildResponseError(e.to_string()))) } // Serve file requests diff --git a/subfile-exchange/src/subfile_server/range.rs b/subfile-service/src/subfile_server/range.rs similarity index 92% rename from subfile-exchange/src/subfile_server/range.rs rename to subfile-service/src/subfile_server/range.rs index 39e7976..33f3f0b 100644 --- a/subfile-exchange/src/subfile_server/range.rs +++ b/subfile-service/src/subfile_server/range.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, SeekFrom}; use std::path::Path; -use crate::errors::Error; +use subfile_exchange::errors::{Error, ServerError}; // Function to parse the Range header and return the start and end bytes pub fn parse_range_header(range_header: &hyper::header::HeaderValue) -> Result<(u64, u64), Error> { @@ -121,11 +121,7 @@ pub async fn serve_file_range( ) .header(CONTENT_LENGTH, length.to_string()) .body(Body::from(buffer)) - .map_err(|e| { - Error::ServerError(crate::errors::ServerError::BuildResponseError( - e.to_string(), - )) - }) + .map_err(|e| Error::ServerError(ServerError::BuildResponseError(e.to_string()))) } pub async fn serve_file(file_path: &Path) -> Result, Error> { @@ -140,9 +136,7 @@ pub async fn serve_file(file_path: &Path) -> Result, Error> { } }; - Response::builder().body(Body::from(file)).map_err(|e| { - Error::ServerError(crate::errors::ServerError::BuildResponseError( - e.to_string(), - )) - }) + Response::builder() + .body(Body::from(file)) + .map_err(|e| Error::ServerError(ServerError::BuildResponseError(e.to_string()))) } diff --git a/subfile-exchange/src/subfile_server/util.rs b/subfile-service/src/subfile_server/util.rs similarity index 70% rename from subfile-exchange/src/subfile_server/util.rs rename to subfile-service/src/subfile_server/util.rs index 68e8f2e..0f9e029 100644 --- a/subfile-exchange/src/subfile_server/util.rs +++ b/subfile-service/src/subfile_server/util.rs @@ -1,25 +1,12 @@ use build_info::BuildInfo; -use ethers::signers::{ - coins_bip39::English, LocalWallet, MnemonicBuilder, Signer, Wallet, WalletError, -}; -use ethers_core::k256::ecdsa::SigningKey; +use ethers::signers::WalletError; + use serde::{Deserialize, Serialize}; use std::fs; use std::{collections::HashMap, io}; +use subfile_exchange::util::{build_wallet, wallet_address}; -use crate::errors::Error; - -/// Build Wallet from Private key or Mnemonic -pub fn build_wallet(value: &str) -> Result, WalletError> { - value - .parse::() - .or(MnemonicBuilder::::default().phrase(value).build()) -} - -/// Get wallet public address to String -pub fn wallet_address(wallet: &Wallet) -> String { - format!("{:?}", wallet.address()) -} +use subfile_exchange::errors::{Error, ServerError}; #[derive(Serialize, Deserialize)] pub struct Health { @@ -59,7 +46,7 @@ impl From<&BuildInfo> for PackageVersion { fn load_certs(filename: &str) -> Result, Error> { // Open certificate file. let certfile = fs::File::open(filename).map_err(|e| { - Error::ServerError(crate::errors::ServerError::ContextError(format!( + Error::ServerError(ServerError::ContextError(format!( "failed to open {}: {}", filename, e ))) @@ -68,7 +55,7 @@ fn load_certs(filename: &str) -> Result, Error> { // Load and return certificate. let certs = rustls_pemfile::certs(&mut reader).map_err(|e| { - Error::ServerError(crate::errors::ServerError::ContextError(format!( + Error::ServerError(ServerError::ContextError(format!( "failed to load certificate: {:#?}", e ))) @@ -81,7 +68,7 @@ fn load_certs(filename: &str) -> Result, Error> { fn load_private_key(filename: &str) -> Result { // Open keyfile. let keyfile = fs::File::open(filename).map_err(|e| { - Error::ServerError(crate::errors::ServerError::ContextError(format!( + Error::ServerError(ServerError::ContextError(format!( "failed to open {}: {}", filename, e ))) @@ -90,15 +77,15 @@ fn load_private_key(filename: &str) -> Result { // Load and return a single private key. let keys = rustls_pemfile::rsa_private_keys(&mut reader).map_err(|e| { - Error::ServerError(crate::errors::ServerError::ContextError(format!( + Error::ServerError(ServerError::ContextError(format!( "failed to load private key: {:#?}", e ))) })?; if keys.len() != 1 { - return Err(Error::ServerError( - crate::errors::ServerError::ContextError("Expected a single private key".to_string()), - )); + return Err(Error::ServerError(ServerError::ContextError( + "Expected a single private key".to_string(), + ))); } Ok(rustls::PrivateKey(keys[0].clone()))