diff --git a/.gitignore b/.gitignore index ca47641..4ea0f70 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ local.toml -db.sled/ +state.db diff --git a/Cargo.lock b/Cargo.lock index 68af862..869ba91 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,13 +4,14 @@ version = 3 [[package]] name = "actix" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f728064aca1c318585bf4bb04ffcfac9e75e508ab4e8b1bd9ba5dfe04e2cbed5" +checksum = "cba56612922b907719d4a01cf11c8d5b458e7d3dba946d0435f20f58d6795ed2" dependencies = [ + "actix-macros", "actix-rt", "actix_derive", - "bitflags 1.3.2", + "bitflags 2.4.1", "bytes", "crossbeam-channel", "futures-core", @@ -23,14 +24,24 @@ dependencies = [ "pin-project-lite", "smallvec", "tokio", - "tokio-util 0.7.8", + "tokio-util 0.7.10", +] + +[[package]] +name = "actix-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" +dependencies = [ + "quote", + "syn 2.0.46", ] [[package]] name = "actix-rt" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15265b6b8e2347670eb363c47fc8c75208b4a4994b27192f345fcbe707804f3e" +checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" dependencies = [ "futures-core", "tokio", @@ -38,13 +49,13 @@ dependencies = [ [[package]] name = "actix_derive" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7" +checksum = "7c7db3d5a9718568e4cf4a537cfd7070e6e6ff7481510d0237fb529ac850f6d3" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.46", ] [[package]] @@ -55,31 +66,41 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", "once_cell", "version_check", + "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.0.2" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "aho-corasick" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -99,6 +120,12 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -116,73 +143,72 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +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 = "1.0.2" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "arbitrary" -version = "1.3.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" dependencies = [ "derive_arbitrary", ] [[package]] name = "async-compression" -version = "0.4.1" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b74f44609f0f91493e3082d3734d98497e094777144380ea4db9f9905dd5b6" +checksum = "bc2d0cfb2a7388d34f590e76686704c494ed7aaceed62ee1ba35cbf363abc2a5" dependencies = [ "brotli", "flate2", @@ -211,18 +237,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] name = "async-trait" -version = "0.1.72" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] @@ -249,13 +275,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.3.4", "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d09dbe0e490df5da9d69b36dca48a76635288a82f92eca90024883a56202026d" +dependencies = [ + "async-trait", + "axum-core 0.4.2", + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.1.0", + "hyper-util", "itoa", "matchit", "memchr", @@ -272,6 +331,7 @@ dependencies = [ "tower", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -283,12 +343,33 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.11", + "http-body 0.4.6", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87c8503f93e6d144ee5690907ba22db7ba79ab001a932ab99034f0fe836b3df" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", "mime", + "pin-project-lite", "rustversion", + "sync_wrapper", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -299,9 +380,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "bitflags" @@ -311,9 +392,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "blake2" @@ -391,9 +472,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.3.4" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -402,9 +483,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.4" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -418,27 +499,27 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "bytesize" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" +checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" dependencies = [ "serde", ] @@ -455,9 +536,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] @@ -468,26 +549,19 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", - "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets 0.48.5", ] [[package]] @@ -501,20 +575,19 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.21" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" +checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.21" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" dependencies = [ "anstream", "anstyle", @@ -524,21 +597,57 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "coerce" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "ba30a4bf4bebf9112b9f42124de78b0e5dccad05c86181072663c7d8567aedec" +dependencies = [ + "anyhow", + "async-trait", + "axum 0.6.20", + "byteorder", + "bytes", + "chrono", + "futures", + "hashring", + "hmac", + "jwt", + "lazy_static", + "metrics", + "metrics-exporter-prometheus", + "metrics-util", + "parking_lot 0.12.1", + "protobuf 3.2.0", + "rand 0.8.5", + "serde", + "serde_json", + "sha2 0.10.8", + "tokio", + "tokio-stream", + "tokio-util 0.7.10", + "tracing", + "utoipa", + "utoipa-swagger-ui", + "uuid", + "valuable", +] [[package]] name = "colorchoice" @@ -548,9 +657,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "config" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" +checksum = "23738e11972c7643e4ec947840fc463b6a571afcd3e735bdfce7d03c7a784aca" dependencies = [ "async-trait", "json5", @@ -573,9 +682,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", @@ -583,15 +692,15 @@ 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 = "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", ] @@ -607,9 +716,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2" dependencies = [ "cfg-if", "crossbeam-utils", @@ -617,22 +726,20 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" dependencies = [ "cfg-if", ] @@ -697,7 +804,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] @@ -708,27 +815,28 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] name = "deranged" -version = "0.3.7" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ + "powerfmt", "serde", ] [[package]] name = "derive_arbitrary" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] @@ -761,6 +869,27 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", ] [[package]] @@ -809,41 +938,47 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + [[package]] name = "enum-map" -version = "2.6.1" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9705d8de4776df900a4a0b2384f8b0ab42f775e93b083b42f8ce71bdc32a47e3" +checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.13.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb14d927583dd5c2eac0f2cf264fc4762aefe1ae14c47a8a20fc1939d3a5fc0" +checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] name = "env_logger" -version = "0.7.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ - "atty", "humantime", + "is-terminal", "log", "regex", "termcolor", @@ -857,30 +992,19 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fixed-hash" @@ -899,9 +1023,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -943,22 +1067,13 @@ 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", ] -[[package]] -name = "fs-err" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5fd9bcbe8b1087cbd395b51498c01bc997cef73e778a80b77a811af5e2d29f" -dependencies = [ - "autocfg", -] - [[package]] name = "fs2" version = "0.4.3" @@ -971,9 +1086,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -986,9 +1101,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -996,15 +1111,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1013,38 +1128,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1090,9 +1205,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", "js-sys", @@ -1103,20 +1218,39 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.20" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", - "indexmap 1.9.3", + "http 0.2.11", + "indexmap 2.1.0", + "slab", + "tokio", + "tokio-util 0.7.10", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d308f63daf4181410c242d34c11f928dcb3aa105852019e043c9d1f4e4368a" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.0.0", + "indexmap 2.1.0", "slab", "tokio", - "tokio-util 0.7.8", + "tokio-util 0.7.10", "tracing", ] @@ -1126,7 +1260,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", ] [[package]] @@ -1135,14 +1269,27 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.7", ] [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.7", + "allocator-api2", +] + +[[package]] +name = "hashring" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa283406d74fcfeb4778f4e300beaae30db96793371da168d003cbc833e149e0" +dependencies = [ + "siphasher", +] [[package]] name = "heck" @@ -1170,9 +1317,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -1183,11 +1330,40 @@ dependencies = [ "serde", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.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", + "itoa", +] + +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" dependencies = [ "bytes", "fnv", @@ -1196,12 +1372,35 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.11", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.0.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" dependencies = [ "bytes", - "http", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -1213,37 +1412,34 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" -version = "1.3.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.22", + "http 0.2.11", + "http-body 0.4.6", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -1251,42 +1447,79 @@ dependencies = [ ] [[package]] -name = "hyper-timeout" -version = "0.4.1" +name = "hyper" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" dependencies = [ - "hyper", + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.0", + "http 1.0.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", "pin-project-lite", "tokio", - "tokio-io-timeout", ] [[package]] -name = "hyper-tls" -version = "0.5.0" +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper 0.14.28", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.28", "native-tls", "tokio", "tokio-native-tls", ] +[[package]] +name = "hyper-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "hyper 1.1.0", + "pin-project-lite", + "socket2 0.5.5", + "tokio", + "tracing", +] + [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -1306,9 +1539,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[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", @@ -1327,12 +1560,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.3", "serde", ] @@ -1347,19 +1580,19 @@ 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" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.3", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1371,15 +1604,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.0" @@ -1391,15 +1615,15 @@ 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 = "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", ] @@ -1417,9 +1641,24 @@ dependencies = [ [[package]] name = "json_comments" -version = "0.2.1" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dbbfed4e59ba9750e15ba154fdfd9329cee16ff3df539c2666b70f58cc32105" + +[[package]] +name = "jwt" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ee439ee368ba4a77ac70d04f14015415af8600d6c894dc1f11bd79758c57d5" +checksum = "6204285f77fe7d9784db3fdc449ecce1a0114927a51d5a41c4c7a292011c015f" +dependencies = [ + "base64 0.13.1", + "crypto-common", + "digest 0.10.7", + "hmac", + "serde", + "serde_json", + "sha2 0.10.8", +] [[package]] name = "lazy_static" @@ -1429,9 +1668,20 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" + +[[package]] +name = "libredox" +version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] [[package]] name = "linked-hash-map" @@ -1441,15 +1691,15 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -1457,9 +1707,18 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "mach2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] [[package]] name = "matchers" @@ -1472,23 +1731,73 @@ dependencies = [ [[package]] name = "matchit" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] -name = "memoffset" -version = "0.9.0" +name = "metrics" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" dependencies = [ - "autocfg", + "ahash 0.8.7", + "metrics-macros", + "portable-atomic", +] + +[[package]] +name = "metrics-exporter-prometheus" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" +dependencies = [ + "base64 0.21.5", + "hyper 0.14.28", + "indexmap 1.9.3", + "ipnet", + "metrics", + "metrics-util", + "quanta", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "metrics-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.46", +] + +[[package]] +name = "metrics-util" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111cb375987443c3de8d503580b536f77dc8416d32db62d9456db5d93bd7ac47" +dependencies = [ + "aho-corasick 0.7.20", + "crossbeam-epoch", + "crossbeam-utils", + "hashbrown 0.13.2", + "indexmap 1.9.3", + "metrics", + "num_cpus", + "ordered-float", + "quanta", + "radix_trie", + "sketches-ddsketch", ] [[package]] @@ -1497,6 +1806,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1514,13 +1833,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 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1535,7 +1854,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", ] [[package]] @@ -1583,7 +1902,7 @@ dependencies = [ "once_cell", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "smart-default", "tracing", ] @@ -1672,39 +1991,14 @@ dependencies = [ ] [[package]] -name = "near-o11y" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7d35397b02b131c188c72f3885e97daeccab134ec2fc8cc0073a94cf1cfe19" -dependencies = [ - "actix", - "atty", - "clap", - "near-crypto", - "near-primitives-core", - "once_cell", - "opentelemetry", - "opentelemetry-otlp", - "opentelemetry-semantic-conventions", - "prometheus", - "serde", - "strum", - "thiserror", - "tokio", - "tracing", - "tracing-appender", - "tracing-opentelemetry", - "tracing-subscriber", -] - -[[package]] -name = "near-offchain-lightclient" -version = "0.1.0" +name = "near-light-client" +version = "0.2.0" dependencies = [ "anyhow", "async-trait", - "axum", + "axum 0.7.3", "borsh", + "coerce", "config", "either", "flume", @@ -1717,19 +2011,42 @@ dependencies = [ "near-primitives", "near-primitives-core", "pretty_env_logger", - "prost 0.11.9", + "protobuf 3.2.0", "rand 0.8.5", - "reed-solomon-novelpoly", "reqwest", - "rustc-hex", "serde", "serde_json", - "sha256", "sled", "thiserror", "tokio", ] +[[package]] +name = "near-o11y" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7d35397b02b131c188c72f3885e97daeccab134ec2fc8cc0073a94cf1cfe19" +dependencies = [ + "actix", + "atty", + "clap", + "near-crypto", + "near-primitives-core", + "once_cell", + "opentelemetry", + "opentelemetry-otlp", + "opentelemetry-semantic-conventions", + "prometheus", + "serde", + "strum", + "thiserror", + "tokio", + "tracing", + "tracing-appender", + "tracing-opentelemetry", + "tracing-subscriber", +] + [[package]] name = "near-primitives" version = "0.17.0" @@ -1763,7 +2080,7 @@ dependencies = [ "smart-default", "strum", "thiserror", - "time 0.3.25", + "time", "tracing", ] @@ -1774,7 +2091,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "775fec19ef51a341abdbf792a9dda5b4cb89f488f681b2fd689b9321d24db47b" dependencies = [ "arbitrary", - "base64 0.21.2", + "base64 0.21.5", "borsh", "bs58", "derive_more", @@ -1784,7 +2101,7 @@ dependencies = [ "serde", "serde_repr", "serde_with", - "sha2 0.10.7", + "sha2 0.10.8", "strum", "thiserror", ] @@ -1797,7 +2114,7 @@ checksum = "84c1eda300e2e78f4f945ae58117d49e806899f4a51ee2faa09eda5ebc2e6571" dependencies = [ "quote", "serde", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] @@ -1809,7 +2126,7 @@ dependencies = [ "fs2", "near-rpc-error-core", "serde", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] @@ -1832,6 +2149,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + [[package]] name = "nom" version = "7.1.3" @@ -1888,9 +2214,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -1901,15 +2227,15 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.3", "libc", ] [[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 = "opaque-debug" @@ -1919,11 +2245,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.56" +version = "0.10.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "cfg-if", "foreign-types", "libc", @@ -1940,7 +2266,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] @@ -1951,9 +2277,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.91" +version = "0.9.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" dependencies = [ "cc", "libc", @@ -1991,9 +2317,9 @@ dependencies = [ "async-trait", "futures", "futures-util", - "http", + "http 0.2.11", "opentelemetry", - "prost 0.9.0", + "prost", "thiserror", "tokio", "tonic", @@ -2009,6 +2335,15 @@ dependencies = [ "opentelemetry", ] +[[package]] +name = "ordered-float" +version = "3.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" +dependencies = [ + "num-traits", +] + [[package]] name = "ordered-multimap" version = "0.4.3" @@ -2043,7 +2378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", + "parking_lot_core 0.9.9", ] [[package]] @@ -2062,15 +2397,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -2081,25 +2416,26 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[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" -version = "2.7.2" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.2" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" +checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" dependencies = [ "pest", "pest_generator", @@ -2107,36 +2443,36 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.2" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" +checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] name = "pest_meta" -version = "2.7.2" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" +checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" dependencies = [ "once_cell", "pest", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] name = "petgraph" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 1.9.3", + "indexmap 2.1.0", ] [[package]] @@ -2156,14 +2492,14 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] name = "pin-project-lite" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c516611246607d0c04186886dbb3a754368ef82c79e9827a802c6d836dd111c" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2173,9 +2509,21 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" + +[[package]] +name = "portable-atomic" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" @@ -2185,9 +2533,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "pretty_env_logger" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" +checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" dependencies = [ "env_logger", "log", @@ -2212,11 +2560,35 @@ dependencies = [ "toml", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" dependencies = [ "unicode-ident", ] @@ -2232,7 +2604,7 @@ dependencies = [ "lazy_static", "memchr", "parking_lot 0.12.1", - "protobuf", + "protobuf 2.28.0", "thiserror", ] @@ -2243,17 +2615,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" dependencies = [ "bytes", - "prost-derive 0.9.0", -] - -[[package]] -name = "prost" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" -dependencies = [ - "bytes", - "prost-derive 0.11.9", + "prost-derive", ] [[package]] @@ -2269,7 +2631,7 @@ dependencies = [ "log", "multimap", "petgraph", - "prost 0.9.0", + "prost", "prost-types", "regex", "tempfile", @@ -2289,19 +2651,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "prost-derive" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" -dependencies = [ - "anyhow", - "itertools 0.10.5", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "prost-types" version = "0.9.0" @@ -2309,7 +2658,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" dependencies = [ "bytes", - "prost 0.9.0", + "prost", ] [[package]] @@ -2319,20 +2668,60 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" [[package]] -name = "quick-error" -version = "1.2.3" +name = "protobuf" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e" +dependencies = [ + "once_cell", + "protobuf-support", + "thiserror", +] + +[[package]] +name = "protobuf-support" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372" +dependencies = [ + "thiserror", +] + +[[package]] +name = "quanta" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" +dependencies = [ + "crossbeam-utils", + "libc", + "mach2", + "once_cell", + "raw-cpuid", + "wasi 0.11.0+wasi-snapshot-preview1", + "web-sys", + "winapi", +] [[package]] name = "quote" -version = "1.0.32" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + [[package]] name = "rand" version = "0.7.3" @@ -2392,7 +2781,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", ] [[package]] @@ -2405,7 +2794,16 @@ dependencies = [ ] [[package]] -name = "redox_syscall" +name = "raw-cpuid" +version = "10.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" @@ -2415,45 +2813,43 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] -name = "reed-solomon-erasure" -version = "4.0.2" +name = "redox_users" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "smallvec", + "getrandom 0.2.11", + "libredox", + "thiserror", ] [[package]] -name = "reed-solomon-novelpoly" -version = "1.0.2" +name = "reed-solomon-erasure" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58130877ca403ab42c864fbac74bb319a0746c07a634a92a5cfc7f54af272582" +checksum = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" dependencies = [ - "derive_more", - "fs-err", - "itertools 0.11.0", - "static_init", - "thiserror", + "smallvec", ] [[package]] name = "regex" -version = "1.9.3" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.2", "memchr", - "regex-automata 0.3.6", - "regex-syntax 0.7.4", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -2467,13 +2863,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.2", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.8.2", ] [[package]] @@ -2484,26 +2880,26 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ "async-compression", - "base64 0.21.2", + "base64 0.21.5", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.22", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-tls", "ipnet", "js-sys", @@ -2516,9 +2912,10 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-native-tls", - "tokio-util 0.7.8", + "tokio-util 0.7.10", "tower-service", "url", "wasm-bindgen", @@ -2538,6 +2935,41 @@ dependencies = [ "serde", ] +[[package]] +name = "rust-embed" +version = "6.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a36224c3276f8c4ebc8c20f158eca7ca4359c8db89991c4925132aaaf6702661" +dependencies = [ + "rust-embed-impl", + "rust-embed-utils", + "walkdir", +] + +[[package]] +name = "rust-embed-impl" +version = "6.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49b94b81e5b2c284684141a2fb9e2a31be90638caf040bf9afbc5a0416afe1ac" +dependencies = [ + "proc-macro2", + "quote", + "rust-embed-utils", + "shellexpand", + "syn 2.0.46", + "walkdir", +] + +[[package]] +name = "rust-embed-utils" +version = "7.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d38ff6bf570dc3bb7100fce9f7b60c33fa71d80e88da3f2580df4ff2bdded74" +dependencies = [ + "sha2 0.10.8", + "walkdir", +] + [[package]] name = "rust-ini" version = "0.18.0" @@ -2548,12 +2980,6 @@ dependencies = [ "ordered-multimap", ] -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - [[package]] name = "rustc_version" version = "0.4.0" @@ -2565,15 +2991,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.7" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -2584,17 +3010,26 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[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 = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -2647,35 +3082,35 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "6fbd975230bada99c8bb618e0c365c2eefa219158d5c6c29610fd09ff1833257" dependencies = [ "itoa", "ryu", @@ -2684,9 +3119,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" +checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" dependencies = [ "itoa", "serde", @@ -2694,13 +3129,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.16" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" +checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] @@ -2717,40 +3152,40 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1402f54f9a3b9e2efe71c1cea24e648acce55887983553eeb858cf3115acfd49" +checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" dependencies = [ - "base64 0.21.2", + "base64 0.21.5", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.0.0", + "indexmap 2.1.0", "serde", "serde_json", "serde_with_macros", - "time 0.3.25", + "time", ] [[package]] name = "serde_with_macros" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9197f1ad0e3c173a0222d3c4404fb04c3afe87e962bcb327af73e8301fa203c7" +checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] name = "serde_yaml" -version = "0.9.25" +version = "0.9.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" +checksum = "b1bf28c79a99f70ee1f1d83d10c875d2e70618417fda01ad1785e027579d9d38" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.1.0", "itoa", "ryu", "serde", @@ -2772,9 +3207,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -2782,25 +3217,21 @@ dependencies = [ ] [[package]] -name = "sha256" -version = "1.3.0" +name = "sharded-slab" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f5ed5ebbe2d9fb5c5e67be64aa462053d707941e02ffb5e65b6200c00b6161c" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ - "async-trait", - "bytes", - "hex", - "sha2 0.10.7", - "tokio", + "lazy_static", ] [[package]] -name = "sharded-slab" -version = "0.1.4" +name = "shellexpand" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" dependencies = [ - "lazy_static", + "dirs", ] [[package]] @@ -2818,11 +3249,23 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "sketches-ddsketch" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" + [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -2845,9 +3288,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "smart-default" @@ -2862,14 +3305,24 @@ 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", ] +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "spin" version = "0.9.8" @@ -2885,34 +3338,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "static_init" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" -dependencies = [ - "bitflags 1.3.2", - "cfg_aliases", - "libc", - "parking_lot 0.11.2", - "parking_lot_core 0.8.6", - "static_init_macro", - "winapi", -] - -[[package]] -name = "static_init_macro" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a2595fc3aa78f2d0e45dd425b22282dd863273761cc77780914b2cf3003acf" -dependencies = [ - "cfg_aliases", - "memchr", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "strsim" version = "0.10.0" @@ -2960,9 +3385,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" dependencies = [ "proc-macro2", "quote", @@ -2975,46 +3400,67 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tempfile" -version = "3.7.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.2.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] @@ -3029,23 +3475,13 @@ dependencies = [ [[package]] name = "time" -version = "0.1.45" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa", + "powerfmt", "serde", "time-core", "time-macros", @@ -3053,15 +3489,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.11" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -3095,9 +3531,9 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.4.10", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -3118,7 +3554,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", ] [[package]] @@ -3158,14 +3594,18 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", + "futures-io", "futures-sink", + "futures-util", + "hashbrown 0.14.3", "pin-project-lite", + "slab", "tokio", "tracing", ] @@ -3191,15 +3631,15 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.22", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.9.0", - "prost-derive 0.9.0", + "prost", + "prost-derive", "tokio", "tokio-stream", "tokio-util 0.6.10", @@ -3236,7 +3676,7 @@ dependencies = [ "rand 0.8.5", "slab", "tokio", - "tokio-util 0.7.8", + "tokio-util 0.7.10", "tower-layer", "tower-service", "tracing", @@ -3256,11 +3696,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", "log", "pin-project-lite", "tracing-attributes", @@ -3269,31 +3708,32 @@ dependencies = [ [[package]] name = "tracing-appender" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" +checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" dependencies = [ "crossbeam-channel", - "time 0.3.25", + "thiserror", + "time", "tracing-subscriber", ] [[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.28", + "syn 2.0.46", ] [[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", @@ -3311,12 +3751,23 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" dependencies = [ - "lazy_static", "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", "tracing-core", ] @@ -3330,15 +3781,15 @@ dependencies = [ "opentelemetry", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.1.4", "tracing-subscriber", ] [[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", @@ -3349,20 +3800,20 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.2.0", ] [[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 = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" @@ -3382,17 +3833,26 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + [[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" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -3411,15 +3871,15 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[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 = "url" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -3432,11 +3892,76 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "utoipa" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82b1bc5417102a73e8464c686eef947bdfb99fcdfc0a4f228e81afa9526470a" +dependencies = [ + "indexmap 2.1.0", + "serde", + "serde_json", + "utoipa-gen", +] + +[[package]] +name = "utoipa-gen" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d96dcd6fc96f3df9b3280ef480770af1b7c5d14bc55192baa9b067976d920c" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "regex", + "syn 2.0.46", +] + +[[package]] +name = "utoipa-swagger-ui" +version = "3.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84614caa239fb25b2bb373a52859ffd94605ceb256eeb1d63436325cf81e3653" +dependencies = [ + "axum 0.6.20", + "mime_guess", + "regex", + "rust-embed", + "serde", + "serde_json", + "utoipa", + "zip", +] + +[[package]] +name = "uuid" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +dependencies = [ + "getrandom 0.2.11", + "serde", +] + [[package]] name = "valuable" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +dependencies = [ + "valuable-derive", +] + +[[package]] +name = "valuable-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d44690c645190cfce32f91a1582281654b2338c6073fa250b0949fd25c55b32" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "vcpkg" @@ -3450,6 +3975,16 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -3465,12 +4000,6 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3479,9 +4008,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", @@ -3489,24 +4018,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.28", + "syn 2.0.46", "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", @@ -3516,9 +4045,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", @@ -3526,28 +4055,28 @@ 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.28", + "syn 2.0.46", "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 = "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", @@ -3555,13 +4084,14 @@ dependencies = [ [[package]] name = "which" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ "either", - "libc", + "home", "once_cell", + "rustix", ] [[package]] @@ -3582,9 +4112,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -3596,12 +4126,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets", + "windows-targets 0.52.0", ] [[package]] @@ -3610,73 +4140,140 @@ 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]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +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]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +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 = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +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 = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +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 = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +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.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +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.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +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.0" +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 = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys 0.48.0", ] [[package]] @@ -3688,6 +4285,26 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.46", +] + [[package]] name = "zeroize" version = "1.3.0" @@ -3705,5 +4322,17 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.46", +] + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", + "flate2", ] diff --git a/Cargo.toml b/Cargo.toml index 4d98a1f..8685447 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,7 @@ [package] edition = "2021" -name = "near-offchain-lightclient" -version = "0.1.0" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +name = "near-light-client" +version = "0.2.0" [dependencies] anyhow = "1.0" @@ -12,13 +10,12 @@ config = "0.13" either = { version = "1.9", features = [ "serde" ] } itertools = "0.12" log = "0.4" -pretty_env_logger = "0.4" -reed-solomon-novelpoly = "1.0.1" -sha256 = "*" -sled = "0.34" +pretty_env_logger = "0.5" +sled = "0.34" # TODO: maybe heavy thiserror = "1.0" # Async +coerce = { version = "0.8", features = ["full"] } axum = "*" flume = "0.10" futures = "0.3.28" @@ -26,18 +23,18 @@ reqwest = { version = "0.11.17", features = [ "gzip", "brotli", "deflate", "json tokio = { version = "1", features = [ "full" ] } # Codec -borsh = { version = "0.10.2", features = [ "rc" ] } +borsh = { version = "0.10", features = [ "rc" ] } +protobuf = "=3.2.0" hex = { version = "0.4", features = [ "serde" ] } -prost = "0.11" -rustc-hex = "2.1.0" serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" +# TODO: upgrade # Near specific -near-crypto = "0.17.0" -near-jsonrpc-client = "0.6.0" -near-primitives = "0.17.0" -near-primitives-core = "0.17.0" +near-crypto = "0.17" +near-jsonrpc-client = "0.6" +near-primitives = "0.17" +near-primitives-core = "0.17" [dev-dependencies] rand = "*" diff --git a/default.toml b/default.toml index dd47d44..11609af 100644 --- a/default.toml +++ b/default.toml @@ -1,4 +1,4 @@ -debug = false +catchup = false network = "Testnet" starting_head = "4zwZQzjQDpimeLK3tX39nzok6UjDU9edS57EFhkAa4Sk" -state_path = "db.sled" +state_path = "state.db" diff --git a/fixtures/batch.json b/fixtures/batch.json index d8a3bfa..022afa8 100644 --- a/fixtures/batch.json +++ b/fixtures/batch.json @@ -1,5 +1,5 @@ { - "client_block_merkle_root": "WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L", + "head_block_root": "WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L", "batch": [ { "outcome_proof_block_hash": "3r5dS7bXYG2w35qLXx78nHjPPs8psdYZUdStUYkvHr8N", @@ -1312,4 +1312,4 @@ "direction": "Right" } ] -} +} \ No newline at end of file diff --git a/flake.lock b/flake.lock index a6622fe..260077f 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700390070, - "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", + "lastModified": 1703961334, + "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", + "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", "type": "github" }, "original": { @@ -81,11 +81,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1700446608, - "narHash": "sha256-q/87GqBvQoUNBYiI3hwhsDqfyfk972RuZK+EwKab5s0=", + "lastModified": 1704075545, + "narHash": "sha256-L3zgOuVKhPjKsVLc3yTm2YJ6+BATyZBury7wnhyc8QU=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e17bfe3baa0487f0671c9ed0e9057d10987ba7f7", + "rev": "a0df72e106322b67e9c6e591fe870380bd0da0d5", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a093b6e..b5e880b 100644 --- a/flake.nix +++ b/flake.nix @@ -20,13 +20,10 @@ rustc = rustVersion; }; in { - # stdenv = pkgs.clangStdenv; + stdenv = pkgs.fastStdenv; devShell = pkgs.mkShell { LIBCLANG_PATH = pkgs.libclang.lib + "/lib/"; - NIXPKGS_ALLOW_INSECURE=1; - SEQUENCER_BATCH_INBOX_ADDRESS="0xff00000000000000000000000000000000000000"; - L2OO_ADDRESS="0x70997970C51812dc3A010C7d01b50e0d17dc79C"; - # LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib/:$LD_LIBRARY_PATH"; + PROTOC = pkgs.protobuf + "/bin/protoc"; nativeBuildInputs = with pkgs; [ bashInteractive diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5685cde..037198b 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,6 +2,5 @@ # This specifies the version of Rust we use to build. # Individual crates in the workspace may support a lower version, as indicated by `rust-version` field in each crate's `Cargo.toml`. # The version specified below, should be at least as high as the maximum `rust-version` within the workspace. -channel = "1.72.0" -components = [ "rustfmt", "rust-src" ] -targets = [ "wasm32-unknown-unknown" ] +channel = "1.75.0" +components = [ "rustfmt", "clippy"] diff --git a/src/client/error.rs b/src/client/error.rs index 79432f9..8bf62b5 100644 --- a/src/client/error.rs +++ b/src/client/error.rs @@ -4,7 +4,7 @@ use thiserror::Error; pub enum Error { #[error("Block already verified")] BlockAlreadyVerified, - #[error("Block not current or next epoch")] + #[error("Block not in current or next epoch")] BlockNotCurrentOrNextEpoch, #[error("Signature invalid")] SignatureInvalid, @@ -12,10 +12,6 @@ pub enum Error { NotEnoughApprovedStake, #[error("Block is in the next epoch but no new set")] NextBpsInvalid, - #[error("Signature len mismatch")] - SignatureLenMismatch, - #[error("Invalid proof")] - InvalidProof, #[error("Validator not signed")] ValidatorNotSigned, } diff --git a/src/client/message.rs b/src/client/message.rs new file mode 100644 index 0000000..2ad5895 --- /dev/null +++ b/src/client/message.rs @@ -0,0 +1,58 @@ +use super::{protocol::experimental::Proof as ExperimentalProof, Header, Proof}; +use anyhow::Result; +use coerce::actor::message::Message; +use near_primitives::types::TransactionOrReceiptId; +use near_primitives_core::hash::CryptoHash; +use serde::{Deserialize, Serialize}; + +pub struct Shutdown; + +impl Message for Shutdown { + type Result = Result<()>; +} + +pub struct Head; + +impl Message for Head { + type Result = Option
; +} + +pub struct Archive { + pub epoch: CryptoHash, +} + +impl Message for Archive { + type Result = Option
; +} + +#[derive(Debug, Deserialize, Serialize)] +pub struct GetProof(pub TransactionOrReceiptId); + +impl Message for GetProof { + type Result = Option; +} + +#[derive(Debug, Deserialize, Serialize)] +pub struct BatchGetProof(pub Vec); + +impl Message for BatchGetProof { + type Result = Option<(ExperimentalProof, Vec)>; +} + +pub struct VerifyProof { + pub proof: Proof, +} + +impl Message for VerifyProof { + type Result = Result; +} + +// TODO: batch messages +// +// +#[cfg(test)] +mod tests { + + #[test] + fn test_name() {} +} diff --git a/src/client/mod.rs b/src/client/mod.rs index 758533d..e2034a9 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -1,31 +1,50 @@ -use crate::{client::protocol::Protocol, config::Config}; +use self::{ + message::BatchGetProof, protocol::experimental::Proof as ExperimentalProof, store::Store, +}; +use crate::{ + client::{ + protocol::Protocol, + store::{head_key, Collection, Entity}, + }, + config::Config, +}; use anyhow::{anyhow, Result}; -use borsh::{BorshDeserialize, BorshSerialize}; -use flume::{Receiver, Sender}; +use async_trait::async_trait; +use coerce::actor::{context::ActorContext, message::Handler, Actor}; +use itertools::Itertools; +use message::{Archive, GetProof, Head, Shutdown, VerifyProof}; use near_jsonrpc_client::methods::light_client_proof::RpcLightClientExecutionProofResponse as BasicProof; -use near_primitives::{types::validator_stake::ValidatorStake, views::LightClientBlockLiteView}; -use near_primitives_core::{hash::CryptoHash, types::AccountId}; +use near_primitives::views::{validator_stake_view::ValidatorStakeView, LightClientBlockLiteView}; +use near_primitives_core::hash::CryptoHash; use serde::{Deserialize, Serialize}; -use sled::Tree; -use std::{path::PathBuf, str::FromStr}; +use std::{str::FromStr, sync::Arc}; use tokio::time; pub mod error; +pub mod message; pub mod protocol; pub mod rpc; +mod store; -pub const STATE_PATH: &str = "state.json"; pub type Header = LightClientBlockLiteView; +pub type BlockMerkleRoot = CryptoHash; #[derive(Debug, Serialize, Deserialize)] +#[serde(untagged)] pub enum Proof { - Basic(BasicProof), + Basic { + head_block_root: BlockMerkleRoot, + proof: Box, + }, Experimental(protocol::experimental::Proof), } -impl From for Proof { - fn from(proof: BasicProof) -> Self { - Self::Basic(proof) +impl From<(CryptoHash, BasicProof)> for Proof { + fn from((head_block_root, proof): (CryptoHash, BasicProof)) -> Self { + Self::Basic { + head_block_root, + proof: Box::new(proof), + } } } @@ -35,302 +54,303 @@ impl From for Proof { } } -pub enum ProofType { - Transaction { - transaction_id: CryptoHash, - sender_id: AccountId, - }, - Receipt { - receipt_id: CryptoHash, - receiver_id: AccountId, - }, -} - -pub enum Message { - Shutdown(Option), - Head { - tx: Sender
, - }, - Archive { - tx: Sender>, - epoch: CryptoHash, - }, - GetProof { - tx: Sender>, - proof: ProofType, - }, - ValidateProof { - tx: Sender, - proof: Box, - }, +impl Proof { + pub fn block_merkle_root(&self) -> &CryptoHash { + match self { + Self::Basic { + head_block_root, .. + } => head_block_root, + Self::Experimental(proof) => &proof.head_block_root, + } + } } -#[derive(Debug, Clone)] pub struct LightClient { + config: Config, client: rpc::NearRpcClient, - store: sled::Db, - head: LightClientBlockLiteView, - block_producers: Tree, - archival_headers: Tree, + store: Arc>, } -pub enum TreeKind { - BlockProducers, - ArchivalHeaders, +#[async_trait] +impl Actor for LightClient { + async fn started(&mut self, _ctx: &mut ActorContext) { + self.bootstrap_store().await.unwrap(); + // TODO: anonymous ctx.spawn(id, actor) + let catchup = self.config.catchup; + let store = self.store.clone(); + let client = self.client.clone(); + tokio::task::spawn(async move { Self::start_syncing(catchup, store, client).await }); + } } -impl LightClient { - pub fn start(mut self, mut is_fast: bool, rx: Receiver) { - tokio::spawn(async move { - // TODO: make configurable, currently set to ~block time - let default_duration = time::Duration::from_secs(2); +#[async_trait] +impl Handler for LightClient { + async fn handle( + &mut self, + _message: Head, + _ctx: &mut ActorContext, + ) -> ::Result { + self.store.head().await.ok() + } +} - let mut duration = if is_fast { - time::Duration::from_millis(100) - } else { - default_duration - }; +#[async_trait] +impl Handler for LightClient { + async fn handle( + &mut self, + message: Archive, + _ctx: &mut ActorContext, + ) -> ::Result { + self.header(message.epoch).await + } +} - loop { - tokio::select! { - Ok(msg) = rx.recv_async() => match msg { - Message::Shutdown(_path) => { - if let Err(e) = self.shutdown().await { - log::error!("Failed to shutdown: {:?}", e); - } - } - Message::Head { tx } => { - if let Err(e) = tx.send_async(self.head().clone()).await { - log::error!("Failed to send head: {:?}", e); - } - }, - Message::Archive { tx, epoch } => { - if let Err(e) = tx.send_async(self.header(epoch)).await { - log::error!("Failed to send archival header: {:?}", e); - } - }, - Message::GetProof { - tx, - proof: ProofType::Transaction { transaction_id, sender_id } - } => { - if let Err(e) = tx.send_async(self.get_transaction_proof(transaction_id, sender_id).await.map(Into::into)).await { - log::error!("Failed to send proof: {:?}", e); - } - }, - Message::GetProof { - tx, proof: ProofType::Receipt { receipt_id, receiver_id } - } => { - if let Err(e) = tx.send_async(self.get_receipt_proof(receipt_id, receiver_id).await.map(Into::into)).await { - log::error!("Failed to send proof: {:?}", e); - } - } - Message::ValidateProof { tx, proof } => { - if let Err(e) = tx.send_async(self.verify_proof(*proof).await).await { - log::error!("Failed to send validation result: {:?}", e); - } - } - }, - r = self.sync() => { - tokio::time::sleep(duration).await; - match r { - Err(e) => log::error!("Error syncing: {:?}", e), - Ok(false) if is_fast => { - log::debug!("Slowing down sync interval to {:?}", default_duration); - duration = default_duration; - is_fast = false; - } - _ => (), - } - } - } - } - }); +#[async_trait] +impl Handler for LightClient { + async fn handle( + &mut self, + _message: Shutdown, + ctx: &mut ActorContext, + ) -> ::Result { + self.store.shutdown().await; + ctx.stop(None); + Ok(()) } +} - // TODO: move to store module - pub fn get, T: BorshDeserialize>(&self, key: K, kind: TreeKind) -> Option { - let tree = match kind { - TreeKind::BlockProducers => &self.block_producers, - TreeKind::ArchivalHeaders => &self.archival_headers, - }; - tree.get(key) +#[async_trait] +impl Handler for LightClient { + async fn handle( + &mut self, + message: GetProof, + _ctx: &mut ActorContext, + ) -> ::Result { + self.get_proofs(BatchGetProof(vec![message])) + .await .ok() - .unwrap_or_default() - .and_then(|v| BorshDeserialize::try_from_slice(&v).ok()) + .and_then(|proofs| proofs.into_iter().next()) } +} - pub fn insert, T: BorshSerialize>( +#[async_trait] +impl Handler for LightClient { + async fn handle( &mut self, - key: K, - value: &T, - kind: TreeKind, - ) -> Result<()> { - let tree = match kind { - TreeKind::BlockProducers => &self.block_producers, - TreeKind::ArchivalHeaders => &self.archival_headers, - }; - Ok(tree - .insert(key, BorshSerialize::try_to_vec(value)?) - .map(|_| ())?) + message: VerifyProof, + _ctx: &mut ActorContext, + ) -> ::Result { + self.verify_proof(message.proof).await.map_err(|e| { + log::error!("{:?}", e); + e + }) } +} + +#[async_trait] +impl Handler for LightClient { + async fn handle( + &mut self, + message: BatchGetProof, + _ctx: &mut ActorContext, + ) -> ::Result { + self.experimental_get_proofs(message).await.ok() + } +} - pub async fn init(config: &Config) -> Result { - let sled = sled::open(config.state_path.clone().unwrap_or(STATE_PATH.into())) - .expect("Failed to open store"); +impl LightClient { + pub fn new(config: &Config) -> Result { let client = rpc::NearRpcClient::new(config.network.clone()); - let head = sled.get("head")?; - let block_producers = sled.open_tree("bps")?; - let archival_headers = sled.open_tree("archive")?; - - if let Some(head) = head { - let head: LightClientBlockLiteView = - borsh::BorshDeserialize::try_from_slice(&head).expect("Failed to deserialize head"); - Ok(Self { - client, - store: sled, - head, - block_producers, - archival_headers, - }) - } else { - let starting_head = client - .fetch_latest_header(&CryptoHash::from_str(&config.starting_head).unwrap()) + // TODO: store selector in config + let store = store::sled::init(config)?; + + Ok(Self { + client, + config: config.clone(), + store: Store(store.into()).into(), + }) + } + + async fn bootstrap_store(&mut self) -> Result<()> { + let head = self.store.head().await; + if head.is_err() { + let sync_from = + CryptoHash::from_str(&self.config.starting_head).map_err(anyhow::Error::msg)?; + + let starting_head = self + .client + .fetch_latest_header(&sync_from) .await - .expect("We need a starting header"); + .ok_or_else(|| anyhow::anyhow!("We need a starting header"))?; - log::info!("Got starting head: {:?}", starting_head.inner_lite.height); + log::info!("starting head: {:?}", starting_head.inner_lite.height); - block_producers.insert( + let mut inserts: Vec<(CryptoHash, Entity)> = vec![]; + + inserts.push(( starting_head.inner_lite.epoch_id, - borsh::to_vec(&starting_head.next_bps.clone().unwrap())?, - )?; - - Ok(Self { - client, - store: sled, - head: LightClientBlockLiteView { - prev_block_hash: starting_head.prev_block_hash, - inner_rest_hash: starting_head.inner_rest_hash, - inner_lite: starting_head.inner_lite, - }, - block_producers, - archival_headers, - }) + starting_head + .next_bps + .unwrap() + .into_iter() + .map(ValidatorStakeView::into_validator_stake) + .collect_vec() + .into(), + )); + + let boostrapped_head = LightClientBlockLiteView { + prev_block_hash: starting_head.prev_block_hash, + inner_rest_hash: starting_head.inner_rest_hash, + inner_lite: starting_head.inner_lite, + }; + + inserts.push((head_key(), boostrapped_head.into())); + + self.store.insert(&inserts).await?; } - } - pub async fn sync(&mut self) -> Result { - log::trace!("Current head: {:#?}", self.head.inner_lite); + Ok(()) + } - let next_header = self - .client + // TODO: dynamically determine if should catchup + pub async fn start_syncing( + mut catching_up: bool, + store: Arc>, + client: rpc::NearRpcClient, + ) { + // TODO: make configurable, currently set to ~block time + let default_duration = time::Duration::from_secs(2); + + loop { + let duration = if catching_up { + time::Duration::from_millis(100) + } else { + default_duration + }; + tokio::select! { + r = Self::sync(store.clone(), client.clone()) => { + tokio::time::sleep(duration).await; + match r { + Err(e) => { + log::error!("Error syncing: {:?}", e); + catching_up = false; + }, + Ok(false) if catching_up => { + log::debug!("Slowing down sync interval to {:?}", default_duration); + catching_up = false; + } + _ => (), + } + } + } + } + } + pub async fn sync( + store: Arc>, + client: rpc::NearRpcClient, + ) -> Result { + let head = store.head().await?; + log::debug!("Current head: {:#?}", head.inner_lite); + + let next_header = client .fetch_latest_header( - &CryptoHash::from_str(&format!("{}", self.head.hash())) + &CryptoHash::from_str(&format!("{}", head.hash())) .map_err(|e| anyhow!("Failed to parse hash: {:?}", e))?, ) .await .ok_or_else(|| anyhow!("Failed to fetch latest header"))?; log::trace!("Got new header: {:#?}", next_header.inner_lite); - let bps = self - .get::<_, Vec>(&self.head.inner_lite.epoch_id, TreeKind::BlockProducers) - .ok_or_else(|| anyhow!("Failed to get block producers"))?; + let bps = store + .get(&Collection::BlockProducers, &head.inner_lite.epoch_id) + .await + .and_then(|x| x.bps())?; + + let synced = Protocol::sync(&head, &bps, next_header)?; - let synced = Protocol::sync(&self.head, &bps, next_header)?; + let mut inserts: Vec<(CryptoHash, Entity)> = vec![]; if let Some((epoch, next_bps)) = synced.next_bps { log::debug!("storing next bps[{:?}]", epoch); - self.insert(epoch, &next_bps, TreeKind::BlockProducers)?; + inserts.push((epoch.0, next_bps.into())); } - self.insert( - self.head.inner_lite.epoch_id, - &synced.new_head, - TreeKind::ArchivalHeaders, - )?; - self.head = synced.new_head; - self.store.insert("head", self.head.try_to_vec()?)?; + inserts.push((head.inner_lite.epoch_id, synced.new_head.clone().into())); + inserts.push((head_key(), synced.new_head.into())); + store.insert(&inserts).await?; Ok(true) } - fn head(&self) -> &Header { - &self.head + async fn header(&self, epoch: CryptoHash) -> Option
{ + self.store + .get(&Collection::Headers, &epoch) + .await + .and_then(|e| e.header()) + .ok() } - fn header(&self, epoch: CryptoHash) -> Option
{ - self.get::<_, LightClientBlockLiteView>(&epoch, TreeKind::ArchivalHeaders) - } + pub async fn batch_fetch_proofs( + &self, + last_verified_hash: &CryptoHash, + p: BatchGetProof, + collect_errors: bool, + ) -> Result<(Vec, Vec)> { + let mut futs = vec![]; + for req in p.0 { + let proof = self + .client + .fetch_light_client_proof(req, *last_verified_hash); + futs.push(proof); + } + let unpin_futs: Vec<_> = futs.into_iter().map(Box::pin).collect(); - // TODO: memoize these in a real cache - pub async fn get_transaction_proof( - &mut self, - transaction_id: CryptoHash, - sender_id: AccountId, - ) -> Option { - // TODO: we need much more logic here for headers in different epochs & the head - // since there are race conditions when we come to validate the proof header, we'd need to short-cache the proof validation - let last_verified_hash = self.head.hash(); - - self.client - .fetch_light_client_tx_proof(transaction_id, sender_id, last_verified_hash) - .await - .map(|proof| { - if let Err(e) = self.insert( - proof.outcome_proof.block_hash, - &self.head.clone(), - TreeKind::ArchivalHeaders, - ) { - log::warn!("Failed to insert archival header: {:?}", e) - } - proof - }) + let proofs: Vec> = futures::future::join_all(unpin_futs).await; + let (proofs, errors): (Vec<_>, Vec<_>) = if collect_errors { + proofs.into_iter().partition_result() + } else { + (proofs.into_iter().collect::>>()?, vec![]) + }; + Ok((proofs, errors)) } - pub async fn get_receipt_proof( - &mut self, - receipt_id: CryptoHash, - receiver_id: AccountId, - ) -> Option { - let last_verified_hash = self.head.hash(); - self.client - .fetch_light_client_receipt_proof(receipt_id, receiver_id, last_verified_hash) - .await - .map(|proof| { - if let Err(e) = self.insert( - proof.outcome_proof.block_hash, - &self.head.clone(), - TreeKind::ArchivalHeaders, - ) { - log::warn!("Failed to insert archival header: {:?}", e) - } - proof - }) + pub async fn verify_proof(&self, p: Proof) -> Result { + anyhow::ensure!( + self.store + .contains(&Collection::UsedRoots, p.block_merkle_root()) + .await?, + "Root {:?} is not known", + p.block_merkle_root() + ); + Protocol::inclusion_proof_verify(p) } - pub async fn verify_proof(&mut self, p: Proof) -> bool { - // TODO: this is a hack - let archive = match &p { - Proof::Basic(p) => self.get::<_, LightClientBlockLiteView>( - p.outcome_proof.block_hash, - TreeKind::ArchivalHeaders, - ), - Proof::Experimental(_) => None, - }; - Protocol::inclusion_proof_verify(&self.head, archive.as_ref(), p) - .inspect_err(|e| log::warn!("Failed to verify proof: {:?}", e)) - .unwrap_or_default() + // TODO: this and below are the same except from two lines + pub async fn get_proofs(&self, p: BatchGetProof) -> Result> { + let head = self.store.head().await?; + let proofs = self.batch_fetch_proofs(&head.hash(), p, false).await?.0; + + self.store + .insert(&[(head.inner_lite.block_merkle_root, Entity::UsedRoot)]) + .await?; + Ok(proofs + .into_iter() + .map(|x| (head.inner_lite.block_merkle_root, x)) + .map(Into::into) + .collect()) } - pub async fn shutdown(&self) -> Result<()> { - log::info!("Shutting down light client"); - if let Err(e) = self.store.insert("head", self.head.try_to_vec()?) { - log::warn!("Failed to insert head: {:?}", e) - } - log::info!("Head: {:?}", self.head.inner_lite.height); - self.store.flush_async().await?; - log::info!("Flushed store"); - todo!("Deliberate panic here, need to make this graceful"); + pub async fn experimental_get_proofs( + &self, + p: BatchGetProof, + ) -> Result<(ExperimentalProof, Vec)> { + let head = self.store.head().await?; + let (proofs, errors) = self.batch_fetch_proofs(&head.hash(), p, true).await?; + let p = protocol::experimental::Proof::new(head.inner_lite.block_merkle_root, proofs); + self.store + .insert(&[(head.inner_lite.block_merkle_root, Entity::UsedRoot)]) + .await?; + + Ok((p, errors)) } } diff --git a/src/client/protocol/experimental.rs b/src/client/protocol/experimental.rs index 89a17ba..d75fd60 100644 --- a/src/client/protocol/experimental.rs +++ b/src/client/protocol/experimental.rs @@ -34,7 +34,7 @@ impl From for LightweightHeader { fn from(header: LightClientBlockLiteView) -> Self { let full_inner: BlockHeaderInnerLite = header.inner_lite.clone().into(); Self { - inner_lite_hash: CryptoHash::hash_borsh(&full_inner), + inner_lite_hash: CryptoHash::hash_borsh(full_inner), inner_rest_hash: header.inner_rest_hash, prev_block_hash: header.prev_block_hash, outcome_root: header.inner_lite.outcome_root, @@ -67,12 +67,14 @@ pub enum Header { } impl Header { + #[allow(unused)] fn hash(&self) -> CryptoHash { match self { Header::Lightweight(header) => header.hash(), Header::Lightest(header) => header.block_hash, } } + #[allow(unused)] fn outcome_root(&self) -> CryptoHash { match self { Header::Lightweight(header) => header.outcome_root, @@ -99,12 +101,11 @@ struct MerkleCache { } impl MerkleCache { - fn cache(&mut self, batch: &mut Vec) { + fn cache(&mut self, batch: &mut [BlindedProof]) { let duplicates = batch .iter() .cloned() - .map(|fp| [fp.outcome_proof, fp.outcome_root_proof, fp.block_proof].concat()) - .flatten() + .flat_map(|fp| [fp.outcome_proof, fp.outcome_root_proof, fp.block_proof].concat()) // TODO: this is super inefficient, we had a nice one without duplicates but // Unfortunately duplicates clones the array, so we can't do this zero // copy @@ -113,23 +114,20 @@ impl MerkleCache { batch .iter_mut() - .map(|fp| { + .flat_map(|fp| { fp.outcome_proof .iter_mut() .chain(fp.outcome_root_proof.iter_mut()) .chain(fp.block_proof.iter_mut()) }) - .flatten() .for_each(|item| { - duplicates - .iter() - .position(|dup| dup == item) - .map(|i| item.0 = Either::Left(i as u32)); + if let Some(i) = duplicates.iter().position(|dup| dup == item) { + item.0 = Either::Left(i as u32); + } }); self.items = duplicates.into_iter().map(|x| x.0.unwrap_right()).collect(); } - // TODO: no panic fn collect<'a>( &'a self, path: &'a [LookupMerklePathItem], @@ -232,7 +230,7 @@ impl BorshDeserialize for LookupMerklePathItem { pub struct Proof { /// The block_merkle_root of the header used to create the proof batch /// It should be at least the header for the latest transactions proven + 1 - client_block_merkle_root: CryptoHash, + pub head_block_root: CryptoHash, batch: Vec, // common ancestry if there is a common ancestry line in the batch // we can save g as costs by only passing this once @@ -264,7 +262,7 @@ impl Proof { common_ancestry } - fn new(created_from: CryptoHash, mut batch: Vec) -> Self { + pub fn new(head_block_root: CryptoHash, mut batch: Vec) -> Self { // First decide common ancestry among all batches let ancestry = batch .iter() @@ -285,7 +283,7 @@ impl Proof { cache.cache(&mut batch); Proof { - client_block_merkle_root: created_from, + head_block_root, batch, ancestry, cache, @@ -310,7 +308,7 @@ pub fn verify_proof(proof: Proof) -> bool { ); let block_verified = Protocol::verify_block( - &proof.client_block_merkle_root, + &proof.head_block_root, proof .cache .collect(&blinded.block_proof) @@ -336,6 +334,7 @@ pub(crate) mod tests { rpc::{NearRpcClient, Network}, }; use futures::FutureExt; + use near_primitives::types::TransactionOrReceiptId; use near_primitives_core::types::AccountId; use std::{path::Path, str::FromStr}; @@ -463,7 +462,7 @@ pub(crate) mod tests { // Util for rewriting the original bridge proofs fn _rewrite_bridge_proofs(rainbow_prover_fixture_path: &str) { - let rewritten = vec![ + let rewritten = [ ( "22f00dd154366d758cd3e4fe81c1caed8e0db6227fe4b2b52a8e5a468aa0a723", "proof2.json", @@ -555,8 +554,14 @@ pub(crate) mod tests { .map(Result::unwrap) .map(|receipt_id| { client - .fetch_light_client_receipt_proof(receipt_id.clone(), receiver_id.clone(), head) - .map(Option::unwrap) + .fetch_light_client_proof( + crate::client::message::GetProof(TransactionOrReceiptId::Receipt { + receipt_id, + receiver_id: receiver_id.clone(), + }), + head, + ) + .map(Result::unwrap) }) .collect_vec(); diff --git a/src/client/protocol/merkle_util.rs b/src/client/protocol/merkle_util.rs index cbae81c..1ff444c 100644 --- a/src/client/protocol/merkle_util.rs +++ b/src/client/protocol/merkle_util.rs @@ -3,18 +3,16 @@ pub use near_primitives::merkle::combine_hash; use near_primitives::merkle::{Direction, MerklePathItem}; use near_primitives_core::{hash::CryptoHash, types::MerkleHash}; -pub trait PathIterator<'a> = Iterator; - pub fn verify_hash<'a>( root: MerkleHash, - path: impl PathIterator<'a>, + path: impl Iterator, item_hash: MerkleHash, ) -> bool { compute_root_from_path(path, item_hash) == root } pub fn compute_root_from_path<'a>( - path: impl PathIterator<'a>, + path: impl Iterator, item_hash: MerkleHash, ) -> MerkleHash { let mut res = item_hash; @@ -32,7 +30,7 @@ pub fn compute_root_from_path<'a>( } pub fn compute_root_from_path_and_item<'a, T: BorshSerialize>( - path: impl PathIterator<'a>, + path: impl Iterator, item: T, ) -> MerkleHash { compute_root_from_path(path, CryptoHash::hash_borsh(item)) diff --git a/src/client/protocol/mod.rs b/src/client/protocol/mod.rs index 3014083..ac7e9f8 100644 --- a/src/client/protocol/mod.rs +++ b/src/client/protocol/mod.rs @@ -5,6 +5,7 @@ use merkle_util::*; use near_crypto::{PublicKey, Signature}; use near_primitives::{ block_header::ApprovalInner, + merkle::MerklePathItem, types::{validator_stake::ValidatorStake, EpochId}, views::{ validator_stake_view::ValidatorStakeView, LightClientBlockLiteView, LightClientBlockView, @@ -31,12 +32,10 @@ impl Protocol { epoch_bps: &[ValidatorStake], next_block: LightClientBlockView, ) -> Result { - println!("current_head: {:?}", head.inner_lite.height); - println!("next_block: {:?}", next_block.inner_lite.height); - Self::ensure_not_already_verified(&head, &next_block.inner_lite.height)?; - Self::ensure_epoch_is_current_or_next(&head, &next_block.inner_lite.epoch_id)?; + Self::ensure_not_already_verified(head, &next_block.inner_lite.height)?; + Self::ensure_epoch_is_current_or_next(head, &next_block.inner_lite.epoch_id)?; Self::ensure_if_next_epoch_contains_next_bps( - &head, + head, &next_block.inner_lite.epoch_id, &next_block.next_bps, )?; @@ -53,12 +52,11 @@ impl Protocol { &next_block.approvals_after_next, epoch_bps, &approval_message, - )?; - println!("total_stake: {:?}", total); - println!("approved_stake: {:?}", approved); + ); + Self::ensure_stake_is_sufficient(&total, &approved)?; - log::debug!( + log::trace!( "prev/current head: {}/{}", head.inner_lite.height, new_head.inner_lite.height @@ -73,17 +71,19 @@ impl Protocol { .map(|next_bps| next_bps.into_iter().map(Into::into).collect()) .map(|next_bps| (EpochId(head.inner_lite.next_epoch_id), next_bps)), }) - .inspect(|synced| log::debug!("Synced new head: {:?}", synced)) + .map(|synced| { + log::debug!("Synced new head: {:?}", synced.new_head); + synced + }) } - pub fn inclusion_proof_verify( - head: &LightClientBlockLiteView, - archive_header: Option<&LightClientBlockLiteView>, - proof: Proof, - ) -> Result { + pub fn inclusion_proof_verify(proof: Proof) -> Result { match proof { Proof::Experimental(proof) => Ok(experimental::verify_proof(proof)), - Proof::Basic(proof) => { + Proof::Basic { + head_block_root, + proof, + } => { let block_hash = proof.block_header_lite.hash(); let block_hash_matches = block_hash == proof.outcome_proof.block_hash; @@ -96,51 +96,26 @@ impl Protocol { &proof.block_header_lite.inner_lite.outcome_root, ); - let mut block_verified = Self::verify_block( - &head.inner_lite.block_merkle_root, - proof.block_proof.iter(), - &block_hash, - ); - - // TODO: refactor me - // Functionality to cover race conditions between previously synced heads since the current head may of changed - // since the proof was generated - match archive_header { - Some(archive_header) if !block_verified => { - log::debug!( - "Trying to verify against archival header: {:?}", - archive_header.inner_lite.height - ); - if verify_hash( - archive_header.inner_lite.block_merkle_root, - proof.block_proof.iter(), - block_hash, - ) { - log::debug!("Verified against archival header"); - block_verified = true; - } else { - return Err(Error::InvalidProof.into()); - } - } - Some(_) => {} - None => return Err(Error::InvalidProof.into()), - } + let block_verified = + Self::verify_block(&head_block_root, proof.block_proof.iter(), &block_hash); log::debug!( "shard outcome included: {:?}, block included: {:?}", outcome_verified, block_verified ); - Ok(block_hash_matches && outcome_verified && block_verified) - .inspect(|verified| log::debug!("Verified proof {:?}", verified)) + Ok(block_hash_matches && outcome_verified && block_verified).map(|verified| { + log::debug!("Verified proof {:?}", verified); + verified + }) } } } pub(crate) fn verify_outcome<'a>( outcome_hash: &CryptoHash, - outcome_proof: impl PathIterator<'a>, - outcome_root_proof: impl PathIterator<'a>, + outcome_proof: impl Iterator, + outcome_root_proof: impl Iterator, expected_outcome_root: &CryptoHash, ) -> bool { let outcome_root = compute_root_from_path(outcome_proof, *outcome_hash); @@ -153,7 +128,7 @@ impl Protocol { pub(crate) fn verify_block<'a>( block_merkle_root: &CryptoHash, - block_proof: impl PathIterator<'a>, + block_proof: impl Iterator, block_hash: &CryptoHash, ) -> bool { verify_hash(*block_merkle_root, block_proof, *block_hash) @@ -170,7 +145,7 @@ impl Protocol { temp_vec.extend_from_slice(&(current_block_hash.0)); temp_vec }); - let new = combine_hash(&block_view.next_block_inner_hash, ¤t_block_hash); + let new = combine_hash(&block_view.next_block_inner_hash, current_block_hash); assert_eq!(old, new); log::debug!("Current block hash: {}", current_block_hash); new @@ -183,7 +158,7 @@ impl Protocol { inner_lite: block_view.inner_lite.clone(), }; - let next_block_hash = Self::next_block_hash(&new_head.hash(), &block_view); + let next_block_hash = Self::next_block_hash(&new_head.hash(), block_view); let endorsement = ApprovalInner::Endorsement(next_block_hash); let approval_message = { @@ -215,7 +190,7 @@ impl Protocol { ) -> Result<(), Error> { if ![head.inner_lite.epoch_id, head.inner_lite.next_epoch_id].contains(epoch_id) { log::debug!("Block is not in the current or next epoch"); - Err(Error::BlockNotCurrentOrNextEpoch.into()) + Err(Error::BlockNotCurrentOrNextEpoch) } else { Ok(()) } @@ -238,18 +213,8 @@ impl Protocol { signatures: &[Option], epoch_bps: &[ValidatorStake], approval_message: &[u8], - ) -> Result { - // Signatures can contain more than the number of bps due to epoch switch - if signatures.len() < epoch_bps.len() { - log::debug!( - "Signature len {} does not match BPS len {}", - signatures.len(), - epoch_bps.len() - ); - return Err(Error::SignatureLenMismatch); - } - - Ok(signatures + ) -> StakeInfo { + signatures .iter() .zip(epoch_bps.iter()) .fold((0, 0), |(total_stake, approved_stake), (sig, vs)| { @@ -265,7 +230,7 @@ impl Protocol { (total_stake, approved_stake) }) - .into()) + .into() } fn validate_signature( @@ -297,7 +262,7 @@ impl Protocol { if approved_stake <= &threshold { log::debug!("Not enough stake approved"); - Err(Error::NotEnoughApprovedStake.into()) + Err(Error::NotEnoughApprovedStake) } else { Ok(()) } @@ -314,7 +279,7 @@ impl Protocol { Ok(Some(next_bps)) } else { log::warn!("Next block producers hash is invalid"); - return Err(Error::NextBpsInvalid); + Err(Error::NextBpsInvalid) } } else { Ok(None) @@ -492,7 +457,7 @@ mod tests { Protocol::validate_signature( &b"bogus approval message"[..], &next_block.approvals_after_next[0], - &next_bps[0].public_key(), + next_bps[0].public_key(), ), Err(Error::SignatureInvalid) ); @@ -517,8 +482,7 @@ mod tests { &next_block.approvals_after_next, &next_bps.clone(), &approval_message.unwrap(), - ) - .unwrap(); + ); assert_eq!((total, approved), (512915271547861520119028536348929, 0)); } @@ -535,8 +499,7 @@ mod tests { &next_block.approvals_after_next, &next_bps, &approval_message.unwrap(), - ) - .unwrap(); + ); assert_eq!( (total, approved), @@ -604,7 +567,7 @@ mod tests { let req = r#"{"outcome_proof":{"proof":[],"block_hash":"5CY72FinjVV2Hd5zRikYYMaKh67pftXJsw8vwRXAUAQF","id":"9UhBumQ3eEmPH5ALc3NwiDCQfDrFakteRD7rHE9CfZ32","outcome":{"logs":[],"receipt_ids":["2mrt6jXKwWzkGrhucAtSc8R3mjrhkwCjnqVckPdCMEDo"],"gas_burnt":2434069818500,"tokens_burnt":"243406981850000000000","executor_id":"datayalla.testnet","status":{"SuccessReceiptId":"2mrt6jXKwWzkGrhucAtSc8R3mjrhkwCjnqVckPdCMEDo"},"metadata":{"version":1,"gas_profile":null}}},"outcome_root_proof":[{"hash":"9f7YjLvzvSspJMMJ3DDTrFaEyPQ5qFqQDNoWzAbSTjTy","direction":"Right"},{"hash":"67ZxFmzWXbWJSyi7Wp9FTSbbJx2nMr7wSuW3EP1cJm4K","direction":"Left"}],"block_header_lite":{"prev_block_hash":"AEnTyGRrk2roQkYSWoqYhzkbp5SWWJtCd71ZYyj1P26i","inner_rest_hash":"G25j8jSWRyrXV317cPC3qYA4SyJWXsBfErjhBYQkxw5A","inner_lite":{"height":134481525,"epoch_id":"4tBzDozzGED3QiCRURfViVuyJy5ikaN9dVH7m2MYkTyw","next_epoch_id":"9gYJSiT3TQbKbwui5bdbzBA9PCMSSfiffWhBdMtcasm2","prev_state_root":"EwkRecSP8GRvaxL7ynCEoHhsL1ksU6FsHVLCevcccF5q","outcome_root":"8Eu5qpDUMpW5nbmTrTKmDH2VYqFEHTKPETSTpPoyGoGc","timestamp":1691615068679535000,"timestamp_nanosec":"1691615068679535094","next_bp_hash":"8LCFsP6LeueT4X3PEni9CMvH7maDYpBtfApWZdXmagss","block_merkle_root":"583vb6csYnczHyt5z6Msm4LzzGkceTZHdvXjC8vcWeGK"}},"block_proof":[{"hash":"AEnTyGRrk2roQkYSWoqYhzkbp5SWWJtCd71ZYyj1P26i","direction":"Left"},{"hash":"HgZaHXpb5zs4rxUQTeW69XBNLBJoo4sz2YEDh7aFnMpC","direction":"Left"},{"hash":"EYNXYsnESQkXo7B27a9xu6YgbDSyynNcByW5Q2SqAaKH","direction":"Right"},{"hash":"AbKbsD7snoSnmzAtwNqXLBT5sm7bZr48GCCLSdksFuzi","direction":"Left"},{"hash":"7KKmS7n3MtCfv7UqciidJ24Abqsk8m85jVQTh94KTjYS","direction":"Left"},{"hash":"5nKA1HCZMJbdCccZ16abZGEng4sMoZhKez74rcCFjnhL","direction":"Left"},{"hash":"BupagAycSLD7v42ksgMKJFiuCzCdZ6ksrGLwukw7Vfe3","direction":"Right"},{"hash":"D6v37P4kcVJh8N9bV417eqJoyMeQbuZ743oNsbKxsU7z","direction":"Right"},{"hash":"8sWxxbe1rdquP5VdYfQbw1UvtcXDRansJYJV5ySzyow4","direction":"Right"},{"hash":"CmKVKWRqEqi4UaeKKYXpPSesYqdQYwHQM3E4xLKEUAj8","direction":"Left"},{"hash":"3TvjFzVyPBvPpph5zL6VCASLCxdNeiKV6foPwUpAGqRv","direction":"Left"},{"hash":"AnzSG9f91ePS6L6ii3eAkocp4iKjp6wjzSwWsDYWLnMX","direction":"Right"},{"hash":"FYVJDL4T6c87An3pdeBvntB68NzpcPtpvLP6ifjxxNkr","direction":"Left"},{"hash":"2YMF6KE8XTz7Axj3uyAoFbZisWej9Xo8mxgVtauWCZaV","direction":"Left"},{"hash":"4BHtLcxqNfWSneBdW76qsd8om8Gjg58Qw5BX8PHz93hf","direction":"Left"},{"hash":"7G3QUT7NQSHyXNQyzm8dsaYrFk5LGhYaG7aVafKAekyG","direction":"Left"},{"hash":"3XaMNnvnX69gGqBJX43Na1bSTJ4VUe7z6h5ZYJsaSZZR","direction":"Left"},{"hash":"FKu7GtfviPioyAGXGZLBVTJeG7KY5BxGwuL447oAZxiL","direction":"Right"},{"hash":"BePd7DPKUQnGtnSds5fMJGBUwHGxSNBpaNLwceJGUcJX","direction":"Left"},{"hash":"2BVKWMd9pXZTEyE9D3KL52hAWAyMrXj1NqutamyurrY1","direction":"Left"},{"hash":"EWavHKhwQiT8ApnXvybvc9bFY6aJYJWqBhcrZpubKXtA","direction":"Left"},{"hash":"83Fsd3sdx5tsJkb6maBE1yViKiqbWCCNfJ4XZRsKnRZD","direction":"Left"},{"hash":"AaT9jQmUvVpgDHdFkLR2XctaUVdTti49enmtbT5hsoyL","direction":"Left"}]}"#; let p: RpcLightClientExecutionProofResponse = serde_json::from_str(req).unwrap(); - let outcome_hash = CryptoHash::hash_borsh(&p.outcome_proof.to_hashes()); + let outcome_hash = CryptoHash::hash_borsh(p.outcome_proof.to_hashes()); let root_matches = Protocol::verify_outcome( &outcome_hash, diff --git a/src/client/rpc.rs b/src/client/rpc.rs index 030b740..5e61013 100644 --- a/src/client/rpc.rs +++ b/src/client/rpc.rs @@ -1,14 +1,19 @@ +use anyhow::Result; use futures::TryFutureExt; use log::debug; use near_jsonrpc_client::{ methods::{self, light_client_proof::RpcLightClientExecutionProofResponse}, JsonRpcClient, }; -use near_primitives::{types::TransactionOrReceiptId, views::LightClientBlockView}; -use near_primitives_core::{hash::CryptoHash, types::AccountId}; +use near_primitives::views::LightClientBlockView; +use near_primitives_core::hash::CryptoHash; use serde::Deserialize; use std::fmt::{Display, Formatter}; +use super::message::GetProof; + +// TODO: retry, failover rpcs + #[derive(Debug, Clone, Deserialize, Default)] pub enum Network { Mainnet, @@ -75,6 +80,7 @@ impl NearRpcClient { let req = methods::next_light_client_block::RpcLightClientNextBlockRequest { last_block_hash: *latest_verified, }; + log::debug!("requesting next block: {:?}", req); self.client .call(&req) .or_else(|e| { @@ -82,42 +88,20 @@ impl NearRpcClient { self.archive.call(&req) }) .await + .map_err(|e| { + log::error!("Error fetching latest header: {:?}", e); + e + }) .ok()? } - pub async fn fetch_light_client_tx_proof( - &self, - transaction_id: CryptoHash, - sender_id: AccountId, - latest_verified: CryptoHash, - ) -> Option { - let req = methods::light_client_proof::RpcLightClientExecutionProofRequest { - id: TransactionOrReceiptId::Transaction { - transaction_hash: transaction_id, - sender_id, - }, - light_client_head: latest_verified, - }; - self.client - .call(&req) - .or_else(|e| { - debug!("Error hitting main rpc, falling back to archive: {:?}", e); - self.archive.call(&req) - }) - .await - .ok() - } - pub async fn fetch_light_client_receipt_proof( + pub async fn fetch_light_client_proof( &self, - receipt_id: CryptoHash, - receiver_id: AccountId, + req: GetProof, latest_verified: CryptoHash, - ) -> Option { + ) -> Result { let req = methods::light_client_proof::RpcLightClientExecutionProofRequest { - id: TransactionOrReceiptId::Receipt { - receipt_id, - receiver_id, - }, + id: req.0, light_client_head: latest_verified, }; self.client @@ -127,6 +111,6 @@ impl NearRpcClient { self.archive.call(&req) }) .await - .ok() + .map_err(|e| anyhow::format_err!("{:?}:{}", req.id, e)) } } diff --git a/src/client/store.rs b/src/client/store.rs new file mode 100644 index 0000000..f29f869 --- /dev/null +++ b/src/client/store.rs @@ -0,0 +1,291 @@ +use super::Header; +use ::sled::IVec; +use anyhow::Result; +use borsh::{BorshDeserialize, BorshSerialize}; +use near_primitives::types::validator_stake::ValidatorStake; +use near_primitives_core::hash::CryptoHash; +use tokio::sync::RwLock; + +pub struct Store(pub RwLock); + +impl Store { + pub async fn head(&self) -> Result
{ + self.get(&Collection::Headers, &head_key()) + .await + .and_then(|e| e.header()) + } + + pub async fn insert(&self, entries: &[(CryptoHash, Entity)]) -> Result<()> { + self.0.write().await.insert(entries) + } + + pub async fn get(&self, collection: &Collection, k: &CryptoHash) -> Result { + self.0.read().await.get(collection, k) + } + + pub async fn shutdown(&self) { + self.0.write().await.shutdown(); + } + + pub async fn contains(&self, collection: &Collection, k: &CryptoHash) -> Result { + self.0.read().await.contains(collection, k) + } +} + +#[derive(Debug)] +pub enum Collection { + BlockProducers, + Headers, + UsedRoots, +} + +#[derive(Debug, BorshSerialize, BorshDeserialize)] +pub enum Entity { + BlockProducers(Vec), + Header(Box
), + UsedRoot, +} + +// Maybe tryinto +impl Entity { + pub fn bps(self) -> Result> { + match self { + Entity::BlockProducers(stake) => Ok(stake), + _ => Err(anyhow::format_err!("Not a block producer")), + } + } + pub fn header(self) -> Result
{ + match self { + Entity::Header(header) => Ok(*header), + _ => Err(anyhow::format_err!("Not a header")), + } + } +} + +impl From> for Entity { + fn from(stake: Vec) -> Self { + Self::BlockProducers(stake) + } +} + +impl From
for Entity { + fn from(header: Header) -> Self { + Self::Header(Box::new(header)) + } +} + +pub trait LightClientStore { + fn insert(&mut self, entries: &[(CryptoHash, Entity)]) -> Result<()>; + fn get(&self, collection: &Collection, k: &CryptoHash) -> Result; + fn head(&self) -> Result
; + fn contains(&self, collection: &Collection, k: &CryptoHash) -> Result; + fn shutdown(&mut self); +} + +pub trait DatabaseOperations { + fn raw_insert, V: Into>( + &mut self, + inserts: Vec<(Collection, Vec<(K, V)>)>, + ) -> Result<()>; + fn raw_get, T: BorshDeserialize>( + &self, + collection: &Collection, + key: K, + ) -> Result; + fn raw_contains>(&self, collection: &Collection, key: K) -> Result; + fn shutdown(&mut self); +} + +fn encode(x: &T) -> Result> { + x.try_to_vec().map_err(|e| { + let e = anyhow::format_err!("Failed to encode: {:?}", e); + log::error!("{:?}", e); + e + }) +} + +fn decode(x: &[u8]) -> Result { + T::try_from_slice(x).map_err(|e| { + let e = anyhow::format_err!("Failed to decode: {:?}", e); + log::error!("{:?}", e); + e + }) +} + +pub fn head_key() -> CryptoHash { + CryptoHash::default() +} + +pub mod sled { + use super::*; + use ::sled::{open, transaction::TransactionError, Batch, Db, Transactional, Tree}; + use itertools::Itertools; + + pub struct Store { + db: Db, + block_producers: Tree, + headers: Tree, + used_roots: Tree, + } + + pub(crate) fn init(config: &crate::config::Config) -> Result { + log::info!("Opening store at {:?}", config.state_path); + let db = open(&config.state_path)?; + + log::debug!("Initializing block producers tree"); + let block_producers = db.open_tree("bps")?; + + log::debug!("Initializing headers tree"); + let headers = db.open_tree("archive")?; + + log::debug!("Initializing used_roots tree"); + let used_roots = db.open_tree("used_roots")?; + used_roots.set_merge_operator(increment_ref); + + Ok(Store { + db, + block_producers, + headers, + used_roots, + }) + } + + impl DatabaseOperations for Store { + fn raw_get, T: BorshDeserialize>( + &self, + collection: &Collection, + key: K, + ) -> Result { + log::debug!("Get {:?} {:?}", collection, key.as_ref()); + + match collection { + Collection::BlockProducers => self.block_producers.get(key), + Collection::Headers => self.headers.get(key), + Collection::UsedRoots => self.used_roots.get(key), + }? + .ok_or_else(|| anyhow::anyhow!("Key not found")) + .and_then(|value| decode(&value)) + } + + fn shutdown(&mut self) { + self.db.flush().unwrap(); + } + + fn raw_insert(&mut self, inserts: Vec<(Collection, Vec<(K, V)>)>) -> Result<()> + where + K: Into, + V: Into, + { + let mut used_roots_entries = vec![]; + let batches = inserts + .into_iter() + .filter_map(|(collection, entries)| { + if let Collection::UsedRoots = collection { + used_roots_entries = entries; + None + } else { + let mut b = Batch::default(); + for (k, v) in entries { + b.insert(k, v); + } + Some((collection, b)) + } + }) + .collect_vec(); + (&self.block_producers, &self.headers) + .transaction(|(bps, headers)| { + for (collection, b) in &batches { + match collection { + Collection::BlockProducers => bps.apply_batch(b)?, + Collection::Headers => headers.apply_batch(b)?, + Collection::UsedRoots => {} + }; + } + Ok(()) + }) + .map_err(|e: TransactionError| anyhow::anyhow!("{:?}", e))?; + + if !used_roots_entries.is_empty() { + for (k, v) in used_roots_entries { + self.used_roots.merge(k.into(), v.into())?; + } + } + Ok(()) + } + + fn raw_contains>(&self, collection: &Collection, key: K) -> Result { + match collection { + Collection::BlockProducers => self.block_producers.contains_key(key), + Collection::Headers => self.headers.contains_key(key), + Collection::UsedRoots => self.used_roots.contains_key(key), + } + .map_err(|e| anyhow::anyhow!("Contains: {:?}", e)) + } + } + + impl LightClientStore for Store { + fn insert(&mut self, inserts: &[(CryptoHash, Entity)]) -> Result<()> { + let inserts = inserts + .iter() + .map(|(k, v)| { + log::debug!("Insert {:?}", k); + log::trace!("Insert {:?}", v); + encode(k).and_then(|ek| { + encode(v).map(|ev| { + let collection = match v { + Entity::BlockProducers(_) => Collection::BlockProducers, + Entity::Header(_) => Collection::Headers, + Entity::UsedRoot => Collection::UsedRoots, + }; + (collection, ek, ev) + }) + }) + }) + .fold_ok(vec![], |mut acc, (collection, k, v)| { + acc.push((collection, vec![(k, v)])); + acc + })?; + self.raw_insert(inserts) + } + + fn get(&self, collection: &Collection, k: &CryptoHash) -> Result { + self.raw_get(collection, encode(k)?) + } + + fn head(&self) -> Result
{ + let head = self + .headers + .get(encode(&head_key())?)? + .ok_or_else(|| anyhow::anyhow!("Failed to get head, no head in store"))?; + let h: Entity = decode(&head)?; + h.header() + } + + fn shutdown(&mut self) { + ::shutdown(self); + } + + fn contains(&self, collection: &Collection, k: &CryptoHash) -> Result { + self.raw_contains(collection, encode(k)?) + } + } + + fn increment_ref( + key: &[u8], // the key being merged + old_ref: Option<&[u8]>, // the previous value, if one existed + _merged_bytes: &[u8], // the new bytes being merged in + ) -> Option> { + let ref_count = old_ref + .map(|ov| ov.to_vec()) + .and_then(|ov| u32::try_from_slice(&ov).ok()) + .unwrap_or_else(|| 0); + log::debug!("Incrementing ref count for {:?}, {}", key, ref_count); + (ref_count + 1).try_to_vec().ok() + } + #[cfg(test)] + mod tests { + + #[test] + fn test_name() {} + } +} diff --git a/src/config.rs b/src/config.rs index e632c04..3bd48b6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,30 +1,40 @@ +use crate::client::rpc::Network; use config::{Config as ConfigTrait, ConfigError, Environment, File}; use serde::Deserialize; use std::{env, path::PathBuf}; -use crate::client::rpc::Network; - #[derive(Debug, Deserialize, Clone)] -#[allow(unused)] pub struct Config { - pub debug: bool, - pub state_path: Option, + #[serde(default = "default_db_path")] + pub state_path: PathBuf, pub starting_head: String, pub network: Network, + #[serde(default = "default_host")] + pub host: String, + pub catchup: bool, +} + +fn default_db_path() -> PathBuf { + "state.db".into() +} + +fn default_host() -> String { + "0.0.0.0:3000".into() } impl Config { pub fn new() -> Result { - let run_mode = env::var("NEAR_LIGHT_CLIENT_NETWORK").unwrap_or_else(|_| "Testnet".into()); + let run_mode = env::var("NEAR_LIGHT_CLIENT_NETWORK") + .unwrap_or_else(|_| "testnet".into()) + .to_lowercase(); let default_path = env::var("NEAR_LIGHT_CLIENT_CONFIG_FILE").unwrap_or_else(|_| "default".to_string()); let s = ConfigTrait::builder() - .add_source(File::with_name(&default_path)) - .add_source(File::with_name(&run_mode.to_string()).required(false)) + .add_source(File::with_name(&default_path).required(false)) + .add_source(File::with_name(&run_mode).required(false)) // This file shouldn't be checked in to git .add_source(File::with_name("local").required(false)) - // Eg.. `RELAYER_DEBUG=1 ./target/app` would set the `debug` key .add_source(Environment::with_prefix("NEAR_LIGHT_CLIENT")) .build()?; diff --git a/src/controller.rs b/src/controller.rs index 880bb0b..94f2a21 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -1,3 +1,5 @@ +use crate::{client::LightClient, config::Config}; +use anyhow::Result; use axum::{ extract::{Path, State}, http::StatusCode, @@ -5,43 +7,37 @@ use axum::{ routing::{get, post}, Router, }; -use flume::Sender; +use coerce::actor::LocalActorRef; use near_primitives_core::hash::CryptoHash; use serde::{Deserialize, Serialize}; use tokio::task::JoinHandle; -use crate::client::Message; - -type ClientState = flume::Sender; - // TODO: replace with jsonrpc -pub(crate) fn init(ctx: Sender) -> JoinHandle> { - let proof_channel = flume::bounded(64); - +pub(crate) fn init(config: &Config, ctx: LocalActorRef) -> JoinHandle> { let controller = Router::new() .route("/health", get(health_check)) .route("/head", get(header::get_head)) - .with_state((ctx.clone(), flume::bounded(64))) + .with_state(ctx.clone()) .route("/header/:epoch", get(header::get_by_epoch)) - .with_state((ctx.clone(), flume::bounded(64))) - .route( - "/proof/tx/:transaction_id/:sender_id", - get(proof::get_tx_proof), - ) - .with_state((ctx.clone(), proof_channel.clone())) - .route( - "/proof/receipt/:receipt_id/:receiver_id", - get(proof::get_receipt_proof), - ) - .with_state((ctx.clone(), proof_channel)) - .route("/proof", post(proof::post_proof)) - .with_state((ctx.clone(), flume::bounded(64))); - + .with_state(ctx.clone()) + .route("/proof", post(proof::post_get_proof)) + .with_state(ctx.clone()) + .route("/proof/verify", post(proof::post_verify_proof)) + .with_state(ctx.clone()) + .route("/proof/experimental", post(proof::post_get_batch_proof)) + .with_state(ctx.clone()); + + let host = config.host.clone(); tokio::spawn(async { - let r = axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()) - .serve(controller.into_make_service()) - .await; - r.map_err(|e| todo!("{:?}", e)) + let listener = tokio::net::TcpListener::bind(host).await.map_err(|e| { + log::error!("Failed to start server: {:?}", e); + anyhow::anyhow!(e) + })?; + println!("listening on {}", listener.local_addr().unwrap()); + axum::serve(listener, controller).await.map_err(|e| { + log::error!("Failed to start server: {:?}", e); + anyhow::anyhow!(e) + }) }) } @@ -51,17 +47,7 @@ async fn health_check() -> StatusCode { mod header { use super::*; - use near_primitives::views::LightClientBlockLiteView; - - pub type HeadChannel = ( - flume::Sender, - flume::Receiver, - ); - - pub type HeaderChannel = ( - flume::Sender>, - flume::Receiver>, - ); + use crate::client::message::{Archive, Head}; #[derive(Debug, Deserialize, Serialize)] pub struct Params { @@ -69,127 +55,98 @@ mod header { } pub(super) async fn get_by_epoch( - State((client, (tx, rx))): State<(ClientState, HeaderChannel)>, + State(client): State>, Path(params): Path, ) -> impl IntoResponse { - log::debug!("get_by_epoch: {:?}", params); - if let Err(e) = client - .send_async(Message::Archive { - tx, + client + .send(Archive { epoch: params.epoch, }) .await - { - log::error!("Failed to send get_by_epoch: {:?}", e); - } - - rx.recv_async().await.map(axum::Json).map_err(|_| { - log::error!("Failed to receive result, channel closed"); - internal_server_error() - }) + .map(axum::Json) + .map_err(|_| internal_server_error()) } pub(super) async fn get_head( - State((client, (tx, rx))): State<(ClientState, HeadChannel)>, + State(client): State>, ) -> impl IntoResponse { - log::debug!("get_head"); - if let Err(e) = client.send_async(Message::Head { tx }).await { - log::error!("Failed to send get_head: {:?}", e); - } - - rx.recv_async().await.map(axum::Json).map_err(|_| { - log::error!("Failed to receive result, channel closed"); - internal_server_error() - }) + client + .send(Head) + .await + .map(axum::Json) + .map_err(ErrorMapper) + .map_err(IntoResponse::into_response) } } mod proof { use super::*; - use crate::client::{Proof, ProofType}; + use crate::client::{ + message::{BatchGetProof, GetProof, VerifyProof}, + Proof, + }; use axum::Json; - use near_primitives_core::types::AccountId; - - pub type ProofChannel = (flume::Sender>, flume::Receiver>); - pub type ValidateProofChannel = (flume::Sender, flume::Receiver); - - #[derive(Debug, Deserialize, Serialize)] - pub struct TransactionParams { - transaction_id: CryptoHash, - sender_id: AccountId, - } - #[derive(Debug, Deserialize, Serialize)] - pub struct ReceiptParams { - receipt_id: CryptoHash, - receiver_id: AccountId, - } - - pub(super) async fn get_tx_proof( - State((client, (tx, rx))): State<(ClientState, ProofChannel)>, - Path(params): Path, + pub(super) async fn post_get_proof( + State(client): State>, + Json(params): Json, ) -> impl IntoResponse { - log::debug!("get_proof: {:?}", params); - if let Err(e) = client - .send_async(Message::GetProof { - tx, - proof: ProofType::Transaction { - transaction_id: params.transaction_id, - sender_id: params.sender_id, - }, - }) + client + .send(params) .await - { - log::error!("Failed to send get_proof: {:?}", e); - } - rx.recv_async().await.map(axum::Json).map_err(|_| { - log::error!("Failed to receive result, channel closed"); - internal_server_error() - }) + .map(axum::Json) + .map_err(ErrorMapper) + .map_err(IntoResponse::into_response) } - pub(super) async fn get_receipt_proof( - State((client, (tx, rx))): State<(ClientState, ProofChannel)>, - Path(params): Path, + pub(super) async fn post_verify_proof( + State(client): State>, + Json(proof): Json, ) -> impl IntoResponse { - log::debug!("get_proof: {:?}", params); - if let Err(e) = client - .send_async(Message::GetProof { - tx, - proof: ProofType::Receipt { - receipt_id: params.receipt_id, - receiver_id: params.receiver_id, - }, - }) + client + .send(VerifyProof { proof }) .await - { - log::error!("Failed to send get_proof: {:?}", e); - } - rx.recv_async().await.map(axum::Json).map_err(|_| { - log::error!("Failed to receive result, channel closed"); - internal_server_error() - }) + .map_err(|e| anyhow::anyhow!(e)) + .and_then(|x| x) + .map(axum::Json) + .map_err(ErrorMapper) + .map_err(IntoResponse::into_response) } - pub(super) async fn post_proof( - State((client, (tx, rx))): State<(ClientState, ValidateProofChannel)>, - Json(proof): Json, + #[derive(Debug, Serialize)] + pub struct BatchProofWithErrors { + proofs: crate::client::protocol::experimental::Proof, + errors: Vec, + } + + pub(super) async fn post_get_batch_proof( + State(client): State>, + Json(body): Json, ) -> impl IntoResponse { - log::debug!("post_proof: {:?}", proof); - if let Err(e) = client - .send_async(Message::ValidateProof { - tx, - proof: Box::new(proof), - }) + client + .send(body) .await - { - log::error!("Failed to send post_proof: {:?}", e); - } + .map_err(|e| anyhow::anyhow!(e)) + .and_then(|x| x.ok_or_else(|| anyhow::anyhow!("Failed to get batch proof"))) + .map_err(ErrorMapper) + .map_err(IntoResponse::into_response) + .map(|(proofs, errors)| BatchProofWithErrors { + proofs, + errors: errors.into_iter().map(|e| e.to_string()).collect(), + }) + .map(axum::Json) + } +} - rx.recv_async().await.map(axum::Json).map_err(|_| { - log::error!("Failed to receive result, channel closed"); - internal_server_error() - }) +struct ErrorMapper(pub T); +impl IntoResponse for ErrorMapper +where + T: ToString, +{ + fn into_response(self) -> Response { + let mut r = Response::new(self.0.to_string().into()); + *r.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; + r } } diff --git a/src/erasure.rs b/src/erasure.rs deleted file mode 100644 index f1df845..0000000 --- a/src/erasure.rs +++ /dev/null @@ -1,116 +0,0 @@ -use anyhow::Result; -use near_primitives::merkle::{self, MerklePath}; -use near_primitives_core::hash::CryptoHash; -use reed_solomon_novelpoly::WrappedShard; - -/// Here we provide a module which can create optimal erasure codes for a given number of expected code validators. -/// -/// We also provide merkleization functionality to generate a succint commitment to the erasure -/// coding scheme. -/// -/// Note: the current merkleization is not optimal, we can do better. -#[allow(unused)] -pub struct Erasure { - shards: Vec>, -} - -#[allow(unused)] -impl Erasure { - pub fn encodify(data: &[u8]) -> Result { - Ok(Self { - shards: reed_solomon_novelpoly::encode(data, VALIDATORS)? - .into_iter() - .map(Some) - .collect(), - }) - } - - pub fn recover(&self) -> Result> { - Ok(reed_solomon_novelpoly::reconstruct( - self.shards.clone(), - VALIDATORS, - )?) - } - - pub fn merklize(&self) -> (CryptoHash, Vec) { - let flattened_data: Vec> = self - .shards - .clone() - .into_iter() - .filter(|s| s.is_some()) - .map(|x| x.unwrap().into_inner()) - .collect(); - merkle::merklize(&flattened_data) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_encode_recover() { - let e = Erasure::<4>::encodify(b"hello").unwrap(); - - let recover = e.recover().unwrap(); - - assert!(recover.starts_with(b"hello")); - } - - #[test] - fn test_encode_recover_one_third() { - let data = b"he1lohe2lohe3lohe4lohe5lohe6lohe7lohe8lo"; - println!("original {:?}", data); - const N: usize = 8; - - let mut codewords = Erasure::::encodify(data).unwrap(); - - println!( - "codewords {:#?}({})", - codewords.shards, - codewords.shards.len() - ); - - codewords.shards[0] = None; - codewords.shards[1] = None; - codewords.shards[2] = None; - codewords.shards[N - 3] = None; - codewords.shards[N - 2] = None; - codewords.shards[N - 1] = None; - println!( - "codewords {:#?}({})", - codewords.shards, - codewords.shards.len() - ); - - let recover = codewords.recover().unwrap(); - println!("recover {:?}", recover); - } - - #[test] - fn test_root() { - let data = b"he1lohe2lohe3lohe4lohe5lohe6lohe7lohe8lo"; - println!("original {:?}", data); - const N: usize = 8; - - let codewords = Erasure::::encodify(data).unwrap(); - let (root, _path) = codewords.merklize(); - - println!("root {:?}", root); - } - - #[test] - fn test_path_len() { - let data = b"he1lohe2lohe3lohe4lohe5lohe6lohe7lohe8lo"; - println!("original {:?}", data); - const N: usize = 8; - - let codewords = Erasure::::encodify(data).unwrap(); - let (_root, path) = codewords.merklize(); - - println!("path {:#?}", path); - let size = std::mem::size_of_val(&*path); - println!("proof size {}", size); - assert_eq!(size, 192); - } -} diff --git a/src/main.rs b/src/main.rs index 6505b3f..56697f3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,9 @@ -#![feature(slice_partition_dedup)] -#![feature(trait_alias)] - -use crate::client::LightClient; -use client::Message; +use crate::client::{message::Shutdown, LightClient}; +use coerce::actor::{system::ActorSystem, IntoActor}; mod client; mod config; mod controller; -mod erasure; pub struct ShutdownMsg; @@ -16,16 +12,19 @@ async fn main() -> anyhow::Result<()> { pretty_env_logger::init(); let config = config::Config::new()?; + let system = ActorSystem::builder() + .system_name("near-light-client") + .build(); - let (ctx, crx) = flume::bounded::(256); - - LightClient::init(&config).await?.start(true, crx); - let webapi = controller::init(ctx.clone()); + let client_actor = LightClient::new(&config)? + .into_actor(Some("light-client"), &system) + .await?; + let webapi = controller::init(&config, client_actor.clone()); if tokio::signal::ctrl_c().await.is_ok() { - log::info!("Shutting down due to ctrlc"); - let _ = ctx.send(Message::Shutdown(config.state_path)); + log::info!("Shutting down.."); webapi.abort(); + client_actor.notify(Shutdown)?; } Ok(()) diff --git a/testnet.toml b/testnet.toml index 1ce246f..c22ad3a 100644 --- a/testnet.toml +++ b/testnet.toml @@ -1,4 +1,5 @@ -debug = false +catchup = true +host = "0.0.0.0:3030" network = "Testnet" -starting_head = "HaWkNoZujD1t9ftJAuZH1Wy2xnXrht8qzENZSDrka3y5" -state_path = "db.sled" +starting_head = "4bM5eXMDGxpFZXbWNT6TqX1HdZsWoHZ11KerCHJ8RKmU" +state_path = "state.db"