diff --git a/Cargo.lock b/Cargo.lock index 8fa6ffd..80972ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,51 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +[[package]] +name = "actix" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f728064aca1c318585bf4bb04ffcfac9e75e508ab4e8b1bd9ba5dfe04e2cbed5" +dependencies = [ + "actix-rt", + "actix_derive", + "bitflags", + "bytes", + "crossbeam-channel", + "futures-core", + "futures-sink", + "futures-task", + "futures-util", + "log", + "once_cell", + "parking_lot", + "pin-project-lite", + "smallvec", + "tokio", + "tokio-util 0.7.3", +] + +[[package]] +name = "actix-rt" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15265b6b8e2347670eb363c47fc8c75208b4a4994b27192f345fcbe707804f3e" +dependencies = [ + "futures-core", + "tokio", +] + +[[package]] +name = "actix_derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "addr2line" version = "0.19.0" @@ -29,16 +74,27 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if 1.0.0", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" dependencies = [ "memchr", ] @@ -52,17 +108,75 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" -version = "1.0.69" +version = "1.0.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" + +[[package]] +name = "arbitrary" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" +dependencies = [ + "derive_arbitrary", +] [[package]] name = "arrayref" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" @@ -89,22 +203,22 @@ dependencies = [ [[package]] name = "async-io" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock", "autocfg", + "cfg-if 1.0.0", "concurrent-queue", "futures-lite", - "libc", "log", "parking", "polling", + "rustix", "slab", "socket2", "waker-fn", - "windows-sys 0.42.0", ] [[package]] @@ -118,9 +232,9 @@ dependencies = [ [[package]] name = "async-process" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4" +checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" dependencies = [ "async-io", "async-lock", @@ -129,49 +243,81 @@ dependencies = [ "cfg-if 1.0.0", "event-listener", "futures-lite", - "libc", + "rustix", "signal-hook", - "windows-sys 0.42.0", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", ] [[package]] name = "async-task" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" +checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.66" +version = "0.1.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84f9ebcc6c1f5b8cb160f6990096a5c127f423fcb6e1ccc46c370cbdfb75dfc" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "atomic-waker" -version = "1.1.0" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" + +[[package]] +name = "atty" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] [[package]] name = "aurora-engine-migration-tool" version = "0.1.0" -source = "git+https://github.com/aurora-is-near/aurora-engine-migration-tool.git#58fe260a0b9b2a0637bc04cb8ee6c9f33a6cc484" +source = "git+https://github.com/aurora-is-near/aurora-engine-migration-tool.git#3c3f7f771ff985d510bb1f051811767fdfbe911b" dependencies = [ "anyhow", - "aurora-engine-types 1.0.0 (git+https://github.com/aurora-is-near/aurora-engine.git?rev=904010fa86199a848d3709272d36548daf24359e)", + "aurora-engine-types", "base64 0.13.1", - "borsh", - "clap", + "clap 4.2.5", "libc", - "near-crypto 0.15.0", - "near-jsonrpc-client", - "near-jsonrpc-primitives", - "near-primitives 0.15.0", + "near-crypto 0.16.1", + "near-jsonrpc-client 0.5.1", + "near-jsonrpc-primitives 0.16.1", + "near-primitives 0.16.1", "near-sdk", "serde", "serde_derive", @@ -182,30 +328,21 @@ dependencies = [ [[package]] name = "aurora-engine-types" version = "1.0.0" -source = "git+https://github.com/aurora-is-near/aurora-engine.git?branch=develop#c70804af2d333dc56d9844b047bdacf397e6f56c" +source = "git+https://github.com/aurora-is-near/aurora-engine.git?tag=2.9.0#5b0054859b779b2aed2c819d12751cebd00be42d" dependencies = [ - "borsh", + "borsh 0.10.3", + "borsh 0.9.3", "hex 0.4.3", "primitive-types 0.12.1", "serde", "serde_json", ] -[[package]] -name = "aurora-engine-types" -version = "1.0.0" -source = "git+https://github.com/aurora-is-near/aurora-engine.git?rev=904010fa86199a848d3709272d36548daf24359e#904010fa86199a848d3709272d36548daf24359e" -dependencies = [ - "borsh", - "hex 0.4.3", - "primitive-types 0.11.1", -] - [[package]] name = "aurora-eth-connector" version = "0.4.1" dependencies = [ - "aurora-engine-types 1.0.0 (git+https://github.com/aurora-is-near/aurora-engine.git?branch=develop)", + "aurora-engine-types", "byte-slice-cast", "ethabi", "hex 0.4.3", @@ -223,13 +360,13 @@ version = "0.4.1" dependencies = [ "anyhow", "aurora-engine-migration-tool", - "aurora-engine-types 1.0.0 (git+https://github.com/aurora-is-near/aurora-engine.git?branch=develop)", + "aurora-engine-types", "aurora-eth-connector", "byte-slice-cast", "ethabi", "hex 0.4.3", "near-contract-standards", - "near-primitives 0.5.0", + "near-primitives 0.16.1", "near-sdk", "near-units", "rlp", @@ -253,7 +390,7 @@ dependencies = [ "cc", "cfg-if 1.0.0", "libc", - "miniz_oxide", + "miniz_oxide 0.6.2", "object", "rustc-demangle", ] @@ -365,9 +502,9 @@ dependencies = [ [[package]] name = "blocking" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" +checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" dependencies = [ "async-channel", "async-lock", @@ -375,6 +512,7 @@ dependencies = [ "atomic-waker", "fastrand", "futures-lite", + "log", ] [[package]] @@ -383,21 +521,44 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" dependencies = [ - "borsh-derive", + "borsh-derive 0.9.3", "hashbrown 0.11.2", ] +[[package]] +name = "borsh" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" +dependencies = [ + "borsh-derive 0.10.3", + "hashbrown 0.13.2", +] + [[package]] name = "borsh-derive" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", + "borsh-derive-internal 0.9.3", + "borsh-schema-derive-internal 0.9.3", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" +dependencies = [ + "borsh-derive-internal 0.10.3", + "borsh-schema-derive-internal 0.10.3", "proc-macro-crate 0.1.5", "proc-macro2", - "syn", + "syn 1.0.109", ] [[package]] @@ -408,7 +569,18 @@ checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -419,7 +591,18 @@ checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -430,9 +613,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" [[package]] name = "byte-slice-cast" @@ -457,6 +640,9 @@ name = "bytesize" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" +dependencies = [ + "serde", +] [[package]] name = "bzip2" @@ -518,7 +704,7 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time", + "time 0.1.45", "wasm-bindgen", "winapi", ] @@ -534,27 +720,72 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.9" +version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9d6ada83c1edcce028902ea27dd929069c70df4c7600b131b4d9a1ad2879cc" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ + "atty", "bitflags", - "clap_lex", - "is-terminal", + "clap_derive", + "clap_lex 0.2.4", + "indexmap", "once_cell", "strsim", "termcolor", + "textwrap", +] + +[[package]] +name = "clap" +version = "4.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a1f23fa97e1d1641371b51f35535cb26959b8e27ab50d167a8b996b5bada819" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fdc5d93c358224b4d6867ef1356d740de2303e9892edc06c5340daeccd96bab" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex 0.4.1", + "once_cell", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" +dependencies = [ + "heck 0.4.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] name = "clap_lex" -version = "0.3.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "033f6b7a4acb1f358c742aaca805c939ee73b4c6209ae4318ec7aca81c42e646" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" dependencies = [ "os_str_bytes", ] +[[package]] +name = "clap_lex" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" + [[package]] name = "codespan-reporting" version = "0.11.1" @@ -565,11 +796,17 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "concurrent-queue" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" dependencies = [ "crossbeam-utils", ] @@ -598,15 +835,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" dependencies = [ "libc", ] @@ -620,6 +857,16 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.15" @@ -672,9 +919,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.60+curl-7.88.1" +version = "0.4.61+curl-8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "717abe2cb465a5da6ce06617388a3980c9a2844196734bec8ccb8e575250f13f" +checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79" dependencies = [ "cc", "libc", @@ -700,9 +947,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a140f260e6f3f79013b8bfc65e7ce630c9ab4388c6a89c71e07226f49487b72" +checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" dependencies = [ "cc", "cxxbridge-flags", @@ -712,9 +959,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da6383f459341ea689374bf0a42979739dc421874f112ff26f829b8040b8e613" +checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" dependencies = [ "cc", "codespan-reporting", @@ -722,24 +969,35 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn", + "syn 2.0.15", ] [[package]] name = "cxxbridge-flags" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90201c1a650e95ccff1c8c0bb5a343213bdd317c6e600a93075bca2eff54ec97" +checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" [[package]] name = "cxxbridge-macro" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b75aed41bb2e6367cae39e6326ef817a851db13c13e4f3263714ca3cfb8de56" +checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", +] + +[[package]] +name = "derive_arbitrary" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cdeb9ec472d588e539a818b2dee436825730da08ad0017c4b1a17676bdc8b7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -752,7 +1010,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn", + "syn 1.0.109", ] [[package]] @@ -840,6 +1098,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "either" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" + [[package]] name = "encoding_rs" version = "0.8.32" @@ -849,15 +1113,35 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "enum-map" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "988f0d17a0fa38291e5f41f71ea8d46a5d5497b9054d5a759fae2cbb819f2356" +dependencies = [ + "enum-map-derive", +] + +[[package]] +name = "enum-map-derive" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a4da76b3b6116d758c7ba93f7ec6a35d2e2cf24feda76c6e38a375f4d5c59f2" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "errno" -version = "0.2.8" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -938,7 +1222,7 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "synstructure", ] @@ -953,14 +1237,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.2.16", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -987,14 +1271,20 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.7.1", ] [[package]] @@ -1050,31 +1340,57 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] -name = "futures-channel" -version = "0.3.27" +name = "futures" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ + "futures-channel", "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", ] [[package]] -name = "futures-core" -version = "0.3.27" +name = "futures-channel" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] [[package]] -name = "futures-io" -version = "0.3.27" +name = "futures-core" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] -name = "futures-lite" -version = "1.12.0" +name = "futures-executor" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ "fastrand", "futures-core", @@ -1087,33 +1403,38 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ + "futures-channel", "futures-core", + "futures-io", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", + "slab", ] [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -1132,9 +1453,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if 1.0.0", "libc", @@ -1149,9 +1470,9 @@ checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "h2" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b91535aa35fea1523ad1b86cb6b53c28e0ae566ba4a460f4457e936cad7c6f" +checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" dependencies = [ "bytes", "fnv", @@ -1162,7 +1483,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util", + "tokio-util 0.7.3", "tracing", ] @@ -1172,7 +1493,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash", + "ahash 0.7.6", ] [[package]] @@ -1181,12 +1502,39 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.2.6" @@ -1213,14 +1561,17 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] [[package]] name = "home" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -1259,9 +1610,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.25" +version = "0.14.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" dependencies = [ "bytes", "futures-channel", @@ -1281,6 +1632,18 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -1296,16 +1659,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows", ] [[package]] @@ -1318,17 +1681,6 @@ dependencies = [ "cxx-build", ] -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.3.0" @@ -1383,14 +1735,14 @@ checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", @@ -1407,31 +1759,31 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.7" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e86b86ae312accbf05ade23ce76b625e0e47a255712b7414037385a1c05380" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "ipnet" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" [[package]] name = "is-terminal" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1443,6 +1795,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.6" @@ -1458,6 +1819,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json_comments" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ee439ee368ba4a77ac70d04f14015415af8600d6c894dc1f11bd79758c57d5" + [[package]] name = "keccak" version = "0.1.3" @@ -1478,15 +1845,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.140" +version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" [[package]] name = "libz-sys" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" dependencies = [ "cc", "libc", @@ -1505,9 +1872,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "b64f40e5e03e0d54f03845c8197d0291253cdbedfb1cb46b13c2c117554a9f4c" [[package]] name = "lock_api" @@ -1529,10 +1896,13 @@ dependencies = [ ] [[package]] -name = "matches" -version = "0.1.10" +name = "matchers" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata", +] [[package]] name = "memchr" @@ -1548,9 +1918,9 @@ checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" @@ -1561,6 +1931,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.6" @@ -1573,6 +1952,12 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + [[package]] name = "native-tls" version = "0.2.11" @@ -1597,7 +1982,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "885db39b08518fa700b73fa2214e8adbbfba316ba82dd510f50519173eadaf73" dependencies = [ - "borsh", + "borsh 0.9.3", "schemars", "semver", "serde", @@ -1605,31 +1990,32 @@ dependencies = [ [[package]] name = "near-account-id" -version = "0.5.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fbe33ba04b086e082aabe4167f03d8e7f5af2db4fffb5e6061226e46e7f5ff" +checksum = "71d258582a1878e6db67400b0504a5099db85718d22c2e07f747fe1706ae7150" dependencies = [ - "borsh", + "borsh 0.9.3", "serde", ] [[package]] name = "near-account-id" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d258582a1878e6db67400b0504a5099db85718d22c2e07f747fe1706ae7150" +checksum = "1d924011380de759c3dc6fdbcda37a19a5c061f56dab69d28a34ecee765e23e4" dependencies = [ - "borsh", + "borsh 0.9.3", "serde", ] [[package]] name = "near-account-id" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d924011380de759c3dc6fdbcda37a19a5c061f56dab69d28a34ecee765e23e4" +checksum = "12791d0f273e04609010d68deb6e1cd940659ad420edfa2e48238117154f1d5b" dependencies = [ - "borsh", + "arbitrary", + "borsh 0.10.3", "serde", ] @@ -1652,6 +2038,40 @@ dependencies = [ "tracing", ] +[[package]] +name = "near-chain-configs" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84781ba3321e28640c5f0453d4d84305135db6edc399c51b7ee405ebb9381eaa" +dependencies = [ + "anyhow", + "chrono", + "derive_more", + "near-config-utils", + "near-crypto 0.16.1", + "near-o11y", + "near-primitives 0.16.1", + "num-rational", + "once_cell", + "serde", + "serde_json", + "sha2 0.10.6", + "smart-default", + "tracing", +] + +[[package]] +name = "near-config-utils" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "137b6bbd477dc0ff1149e22c5e1f3f168a1f37d9d67f1519f058a5db81df3506" +dependencies = [ + "anyhow", + "json_comments", + "thiserror", + "tracing", +] + [[package]] name = "near-contract-standards" version = "4.1.1" @@ -1666,21 +2086,20 @@ dependencies = [ [[package]] name = "near-crypto" -version = "0.5.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e44231c19aa95e0ff3b1a46209a8edb44f5e02fca8a60a19386ba38b2ee1942" +checksum = "1e75673d69fd7365508f3d32483669fe45b03bfb34e4d9363e90adae9dfb416c" dependencies = [ "arrayref", "blake2", - "borsh", + "borsh 0.9.3", "bs58", "c2-chacha", "curve25519-dalek", "derive_more", "ed25519-dalek", - "lazy_static", - "libc", - "near-account-id 0.5.0", + "near-account-id 0.14.0", + "once_cell", "parity-secp256k1", "primitive-types 0.10.1", "rand 0.7.3", @@ -1693,24 +2112,23 @@ dependencies = [ [[package]] name = "near-crypto" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e75673d69fd7365508f3d32483669fe45b03bfb34e4d9363e90adae9dfb416c" +checksum = "7754612b47737d277fb818e9fdbb1406e90f9e57151c55c3584d714421976cb6" dependencies = [ "arrayref", "blake2", - "borsh", + "borsh 0.9.3", "bs58", "c2-chacha", "curve25519-dalek", "derive_more", "ed25519-dalek", - "near-account-id 0.14.0", + "near-account-id 0.15.0", "once_cell", - "parity-secp256k1", "primitive-types 0.10.1", "rand 0.7.3", - "rand_core 0.5.1", + "secp256k1", "serde", "serde_json", "subtle", @@ -1719,19 +2137,21 @@ dependencies = [ [[package]] name = "near-crypto" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7754612b47737d277fb818e9fdbb1406e90f9e57151c55c3584d714421976cb6" +checksum = "659a96750c4d933e4f00a50c66ba9948a32b862e5ecd6a952beee881b1cd2aaf" dependencies = [ - "arrayref", "blake2", - "borsh", + "borsh 0.10.3", "bs58", "c2-chacha", "curve25519-dalek", "derive_more", "ed25519-dalek", - "near-account-id 0.15.0", + "hex 0.4.3", + "near-account-id 0.16.1", + "near-config-utils", + "near-stdx", "once_cell", "primitive-types 0.10.1", "rand 0.7.3", @@ -1748,12 +2168,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1335ffce1476da6516dcd22b26cece1a495fc725c0e8fec1879073752ac068d" dependencies = [ - "borsh", + "borsh 0.9.3", "lazy_static", "log", - "near-chain-configs", + "near-chain-configs 0.15.0", "near-crypto 0.15.0", - "near-jsonrpc-primitives", + "near-jsonrpc-primitives 0.15.0", "near-primitives 0.15.0", "reqwest", "serde", @@ -1762,13 +2182,32 @@ dependencies = [ "uuid", ] +[[package]] +name = "near-jsonrpc-client" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf020bd5fb7952c8f005ab789ac6f7a2015557630571362bcbaf2ead27c5cb6" +dependencies = [ + "borsh 0.10.3", + "lazy_static", + "log", + "near-chain-configs 0.16.1", + "near-crypto 0.16.1", + "near-jsonrpc-primitives 0.16.1", + "near-primitives 0.16.1", + "reqwest", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "near-jsonrpc-primitives" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ada226c74f05508c516f109a97b9f23335120d0bfda208f0d187b6bbfe6eef5a" dependencies = [ - "near-chain-configs", + "near-chain-configs 0.15.0", "near-crypto 0.15.0", "near-primitives 0.15.0", "near-rpc-error-macro 0.15.0", @@ -1778,34 +2217,45 @@ dependencies = [ ] [[package]] -name = "near-primitives" -version = "0.5.0" +name = "near-jsonrpc-primitives" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f106c7bbf2a12228daf4af2a976122b030745683ede24b5dc4514e8faaa36c" +checksum = "f0968cc71825e020d75f5a1f3577ac0379859ec7b14351ed5754fef1cc89e0d7" dependencies = [ - "base64 0.13.1", - "borsh", - "bs58", - "byteorder", - "bytesize", - "chrono", - "derive_more", - "easy-ext", - "hex 0.4.3", - "near-crypto 0.5.0", - "near-primitives-core 0.5.0", - "near-rpc-error-macro 0.5.0", - "near-vm-errors 3.1.0", - "num-rational", - "primitive-types 0.10.1", - "rand 0.7.3", - "reed-solomon-erasure", - "regex", + "arbitrary", + "near-chain-configs 0.16.1", + "near-crypto 0.16.1", + "near-primitives 0.16.1", + "near-rpc-error-macro 0.16.1", "serde", "serde_json", - "sha2 0.9.9", - "smart-default", - "validator", + "thiserror", +] + +[[package]] +name = "near-o11y" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445cbd86499dbabf68d34d95d9a45c680da5446e226f4982ce488fcf8556b23f" +dependencies = [ + "actix", + "atty", + "clap 3.2.25", + "near-crypto 0.16.1", + "near-primitives-core 0.16.1", + "once_cell", + "opentelemetry", + "opentelemetry-otlp", + "opentelemetry-semantic-conventions", + "prometheus", + "serde", + "strum", + "thiserror", + "tokio", + "tracing", + "tracing-appender", + "tracing-opentelemetry", + "tracing-subscriber", ] [[package]] @@ -1814,7 +2264,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ad1a9a1640539c81f065425c31bffcfbf6b31ef1aeaade59ce905f5df6ac860" dependencies = [ - "borsh", + "borsh 0.9.3", "byteorder", "bytesize", "chrono", @@ -1843,7 +2293,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97670b302dce15f09bba50f24c67aa08130fd01528cc61d4415892401e88e974" dependencies = [ - "borsh", + "borsh 0.9.3", "byteorder", "bytesize", "cfg-if 1.0.0", @@ -1868,22 +2318,40 @@ dependencies = [ ] [[package]] -name = "near-primitives-core" -version = "0.5.0" +name = "near-primitives" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "108d06655885c1174823e41941fd44a82e13e850b12fa068a95194c96e247c68" +checksum = "c4c030f28e8f988698145e7753b83bb54c05838c3afdd44835cc7c32c327ea1e" dependencies = [ - "base64 0.11.0", - "borsh", - "bs58", + "arbitrary", + "borsh 0.10.3", + "bytesize", + "cfg-if 1.0.0", + "chrono", "derive_more", + "easy-ext", + "enum-map", "hex 0.4.3", - "lazy_static", - "near-account-id 0.5.0", + "near-crypto 0.16.1", + "near-o11y", + "near-primitives-core 0.16.1", + "near-rpc-error-macro 0.16.1", + "near-stdx", + "near-vm-errors 0.16.1", "num-rational", + "once_cell", + "primitive-types 0.10.1", + "rand 0.8.5", + "reed-solomon-erasure", "serde", "serde_json", - "sha2 0.9.9", + "serde_yaml", + "smart-default", + "strum", + "thiserror", + "time 0.3.20", + "tokio", + "tracing", ] [[package]] @@ -1893,7 +2361,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91d508f0fc340f6461e4e256417685720d3c4c00bb5a939b105160e49137caba" dependencies = [ "base64 0.11.0", - "borsh", + "borsh 0.9.3", "bs58", "derive_more", "near-account-id 0.14.0", @@ -1910,7 +2378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7929e19d862221949734c4a0063a8f55e7069de3a2ebc2d4f4c13497a5e953cb" dependencies = [ "base64 0.13.1", - "borsh", + "borsh 0.9.3", "bs58", "derive_more", "near-account-id 0.15.0", @@ -1922,15 +2390,24 @@ dependencies = [ ] [[package]] -name = "near-rpc-error-core" -version = "0.5.0" +name = "near-primitives-core" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1db59973d0e8d8bd4be5ae508600add29f96737722d30e05cfc49e5044ded955" +checksum = "fe2059d16efc42ef7f9514f30910d32b67c01fee9b70c1fd28d50545ca145d88" dependencies = [ - "proc-macro2", - "quote", + "arbitrary", + "base64 0.13.1", + "borsh 0.10.3", + "bs58", + "derive_more", + "enum-map", + "near-account-id 0.16.1", + "num-rational", "serde", - "syn", + "serde_repr", + "sha2 0.10.6", + "strum", + "thiserror", ] [[package]] @@ -1941,7 +2418,7 @@ checksum = "93ee0b41c75ef859c193a8ff1dadfa0c8207bc0ac447cc22259721ad769a1408" dependencies = [ "quote", "serde", - "syn", + "syn 1.0.109", ] [[package]] @@ -1952,21 +2429,18 @@ checksum = "36addf90cc04bd547a627b3a292f59d7de4dd6fb5042115419ae901b93ce6c2d" dependencies = [ "quote", "serde", - "syn", + "syn 1.0.109", ] [[package]] -name = "near-rpc-error-macro" -version = "0.5.0" +name = "near-rpc-error-core" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bde9eb491ab7ccccd48ee6d438dc07aa74318faa0ff007717c3d5b538d3951" +checksum = "28f8f38dcfeba3d0d3bc60ce292ddb1f76a428a590e32de7fc3d5d431b9635ea" dependencies = [ - "near-rpc-error-core 0.5.0", - "proc-macro2", "quote", "serde", - "serde_json", - "syn", + "syn 1.0.109", ] [[package]] @@ -1977,7 +2451,7 @@ checksum = "8e837bd4bacd807073ec5ceb85708da7f721b46a4c2a978de86027fb0034ce31" dependencies = [ "near-rpc-error-core 0.14.0", "serde", - "syn", + "syn 1.0.109", ] [[package]] @@ -1988,14 +2462,26 @@ checksum = "0b5beb352f3b91d8c491646c2fa4fdbbbf463c7b9c0226951c28f0197de44f99" dependencies = [ "near-rpc-error-core 0.15.0", "serde", - "syn", + "syn 1.0.109", +] + +[[package]] +name = "near-rpc-error-macro" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca4e8d6887b344f3e2f8281c1ad2cc93dcbcb683b546726a4ce1ab1dfa623a" +dependencies = [ + "fs2", + "near-rpc-error-core 0.16.1", + "serde", + "syn 1.0.109", ] [[package]] name = "near-sandbox-utils" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b2da180a368a12da1949e9940af2457cbce83acb85743b8834b6c9b4111e9f" +checksum = "7479b0a2c52890000d410c6e4ba4f851334280530fa7446b78bcaf4683fe69b0" dependencies = [ "anyhow", "async-process", @@ -2013,7 +2499,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15eb3de2defe3626260cc209a6cdb985c6b27b0bd4619fad97dcfae002c3c5bd" dependencies = [ "base64 0.13.1", - "borsh", + "borsh 0.9.3", "bs58", "near-abi", "near-crypto 0.14.0", @@ -2038,9 +2524,15 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] +[[package]] +name = "near-stdx" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc1279be274b9a49c2cb4b62541241a1ff6745cb77ca81ece7f949cfbc229bff" + [[package]] name = "near-sys" version = "0.2.0" @@ -2076,7 +2568,7 @@ dependencies = [ "near-units-core", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2085,7 +2577,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0da466a30f0446639cbd788c30865086fac3e8dcb07a79e51d2b0775ed4261e" dependencies = [ - "borsh", + "borsh 0.9.3", "near-account-id 0.14.0", "near-rpc-error-macro 0.14.0", "serde", @@ -2097,7 +2589,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5591c9c8afa83a040cb5c3f29bc52b2efae2c32d4bcaee1bba723738da1a5cf6" dependencies = [ - "borsh", + "borsh 0.9.3", "near-account-id 0.15.0", "near-rpc-error-macro 0.15.0", "serde", @@ -2106,15 +2598,16 @@ dependencies = [ [[package]] name = "near-vm-errors" -version = "3.1.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffec816703a13b6ca5b3dbd0005e6eb5360087058203c93e859a019dbfd88300" +checksum = "8b2d3eab1e050fdc3e036c803784cf45582661ae2dd07bac3bd373ba9c049715" dependencies = [ - "borsh", - "hex 0.4.3", - "near-account-id 0.5.0", - "near-rpc-error-macro 0.5.0", + "borsh 0.10.3", + "near-account-id 0.16.1", + "near-rpc-error-macro 0.16.1", "serde", + "strum", + "thiserror", ] [[package]] @@ -2124,7 +2617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81b534828419bacbf1f7b11ef7b00420f248c548c485d3f0cfda8bb6931152f2" dependencies = [ "base64 0.13.1", - "borsh", + "borsh 0.9.3", "bs58", "byteorder", "near-account-id 0.14.0", @@ -2139,6 +2632,16 @@ dependencies = [ "zeropool-bn", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.3.3" @@ -2225,9 +2728,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.48" +version = "0.10.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518915b97df115dd36109bfa429a48b8f737bd05508cf9588977b599648926d2" +checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -2240,13 +2743,13 @@ dependencies = [ [[package]] name = "openssl-macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] @@ -2257,11 +2760,10 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.83" +version = "0.9.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666416d899cf077260dac8698d60a60b435a46d57e82acb1be3d0dad87284e5b" +checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" dependencies = [ - "autocfg", "cc", "libc", "pkg-config", @@ -2269,10 +2771,64 @@ dependencies = [ ] [[package]] -name = "os_str_bytes" -version = "6.4.1" +name = "opentelemetry" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project", + "rand 0.8.5", + "thiserror", + "tokio", + "tokio-stream", +] + +[[package]] +name = "opentelemetry-otlp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1a6ca9de4c8b00aa7f1a153bd76cb263287155cec642680d79d98706f3d28a" +dependencies = [ + "async-trait", + "futures", + "futures-util", + "http", + "opentelemetry", + "prost", + "thiserror", + "tokio", + "tonic", + "tonic-build", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985cc35d832d412224b2cffe2f9194b1b89b6aa5d0bef76d080dce09d90e62bd" +dependencies = [ + "opentelemetry", +] + +[[package]] +name = "os_str_bytes" +version = "6.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parity-scale-codec" @@ -2311,7 +2867,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2323,7 +2879,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2340,9 +2896,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" [[package]] name = "parking_lot" @@ -2373,6 +2929,16 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "petgraph" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" +dependencies = [ + "fixedbitset", + "indexmap", +] + [[package]] name = "pin-project" version = "1.0.12" @@ -2390,7 +2956,7 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2413,9 +2979,9 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "polling" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e1f879b2998099c2d69ab9605d145d5b661195627eccc680002c4918a7fb6fa" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", "bitflags", @@ -2424,7 +2990,7 @@ dependencies = [ "libc", "log", "pin-project-lite", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2453,17 +3019,6 @@ dependencies = [ "uint", ] -[[package]] -name = "primitive-types" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" -dependencies = [ - "fixed-hash 0.7.0", - "impl-rlp", - "uint", -] - [[package]] name = "primitive-types" version = "0.12.1" @@ -2496,15 +3051,113 @@ dependencies = [ "toml_edit", ] +[[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.52" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] +[[package]] +name = "prometheus" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" +dependencies = [ + "cfg-if 1.0.0", + "fnv", + "lazy_static", + "memchr", + "parking_lot", + "protobuf", + "thiserror", +] + +[[package]] +name = "prost" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" +dependencies = [ + "bytes", + "heck 0.3.3", + "itertools", + "lazy_static", + "log", + "multimap", + "petgraph", + "prost", + "prost-types", + "regex", + "tempfile", + "which", +] + +[[package]] +name = "prost-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prost-types" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" +dependencies = [ + "bytes", + "prost", +] + +[[package]] +name = "protobuf" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" + [[package]] name = "quote" version = "1.0.26" @@ -2585,7 +3238,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", ] [[package]] @@ -2612,6 +3265,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.3.5" @@ -2629,7 +3291,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", "redox_syscall 0.2.16", "thiserror", ] @@ -2645,26 +3307,41 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.7.1", ] +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" [[package]] name = "reqwest" -version = "0.11.14" +version = "0.11.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" dependencies = [ "base64 0.21.0", "bytes", @@ -2730,9 +3407,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hex" @@ -2751,16 +3428,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.9" +version = "0.37.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" +checksum = "8bbfc1d1c7c40c01715f47d71444744a81669ca84e8b63e25a55e169b1f86433" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2805,7 +3482,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn", + "syn 1.0.109", ] [[package]] @@ -2870,22 +3547,22 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.156" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.156" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] @@ -2896,16 +3573,15 @@ checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ - "indexmap", "itoa", "ryu", "serde", @@ -2913,13 +3589,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395627de918015623b32e7669714206363a7fc00382bf477e72c1f7533e8eafc" +checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] @@ -2934,6 +3610,19 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_yaml" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "sha2" version = "0.9.9" @@ -2960,14 +3649,23 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +checksum = "54c2bb1a323307527314a36bfb73f24febb08ce2b8a554bf4ffd6f51ad15198c" dependencies = [ "digest 0.10.6", "keccak", ] +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + [[package]] name = "signal-hook" version = "0.3.15" @@ -3022,7 +3720,7 @@ checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3068,11 +3766,11 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn", + "syn 1.0.109", ] [[package]] @@ -3092,6 +3790,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "synstructure" version = "0.12.6" @@ -3100,7 +3809,7 @@ checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "unicode-xid", ] @@ -3123,15 +3832,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if 1.0.0", "fastrand", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "rustix", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -3143,24 +3852,40 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + [[package]] name = "thiserror" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", ] [[package]] @@ -3174,6 +3899,33 @@ dependencies = [ "winapi", ] +[[package]] +name = "time" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +dependencies = [ + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +dependencies = [ + "time-core", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -3200,22 +3952,32 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.26.0" +version = "1.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" +checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" dependencies = [ - "autocfg", "bytes", "libc", "memchr", "mio", "num_cpus", + "once_cell", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.45.0", + "winapi", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", ] [[package]] @@ -3226,7 +3988,7 @@ checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3250,11 +4012,36 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-util" -version = "0.7.7" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" dependencies = [ "bytes", "futures-core", @@ -3281,15 +4068,84 @@ checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" [[package]] name = "toml_edit" -version = "0.19.7" +version = "0.19.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc18466501acd8ac6a3f615dd29a3438f8ca6bb3b19537138b3106e575621274" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" dependencies = [ "indexmap", "toml_datetime", "winnow", ] +[[package]] +name = "tonic" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a" +dependencies = [ + "async-stream", + "async-trait", + "base64 0.13.1", + "bytes", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "prost-derive", + "tokio", + "tokio-stream", + "tokio-util 0.6.10", + "tower", + "tower-layer", + "tower-service", + "tracing", + "tracing-futures", +] + +[[package]] +name = "tonic-build" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757" +dependencies = [ + "proc-macro2", + "prost-build", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project", + "pin-project-lite", + "rand 0.8.5", + "slab", + "tokio", + "tokio-util 0.7.3", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -3303,20 +4159,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if 1.0.0", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-appender" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" +dependencies = [ + "crossbeam-channel", + "time 0.3.20", + "tracing-subscriber", +] + [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] @@ -3326,6 +4194,60 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" +dependencies = [ + "once_cell", + "opentelemetry", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] @@ -3354,9 +4276,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" @@ -3373,6 +4295,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-width" version = "0.1.10" @@ -3385,6 +4313,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "unsafe-libyaml" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" + [[package]] name = "url" version = "2.3.1" @@ -3392,41 +4326,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", - "idna 0.3.0", + "idna", "percent-encoding", "serde", ] [[package]] -name = "uuid" -version = "1.3.0" +name = "utf8parse" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" -dependencies = [ - "getrandom 0.2.8", -] +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] -name = "validator" -version = "0.12.0" +name = "uuid" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d6937c33ec6039d8071bcf72933146b5bbe378d645d8fa59bdadabfc2a249" +checksum = "4dad5567ad0cf5b760e5665964bec1b47dfd077ba8a2544b513f3556d3d239a2" dependencies = [ - "idna 0.2.3", - "lazy_static", - "regex", - "serde", - "serde_derive", - "serde_json", - "url", - "validator_types", + "getrandom 0.2.9", ] [[package]] -name = "validator_types" -version = "0.12.0" +name = "valuable" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad9680608df133af2c1ddd5eaf1ddce91d60d61b6bc51494ef326458365a470a" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vcpkg" @@ -3495,7 +4419,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -3529,7 +4453,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3562,6 +4486,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "which" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +dependencies = [ + "either", + "libc", + "once_cell", +] + [[package]] name = "winapi" version = "0.3.9" @@ -3593,19 +4528,28 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.0", +] + [[package]] name = "windows-sys" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 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.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -3614,7 +4558,16 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", ] [[package]] @@ -3623,13 +4576,28 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 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.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -3638,47 +4606,89 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + [[package]] name = "winnow" -version = "0.3.6" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966" +checksum = "69af645a61644c6dd379ade8b77cc87efb5393c988707bad12d3c8e00c50f669" dependencies = [ "memchr", ] @@ -3701,7 +4711,7 @@ dependencies = [ "async-process", "async-trait", "base64 0.13.1", - "borsh", + "borsh 0.9.3", "bs58", "chrono", "dirs 3.0.2", @@ -3709,8 +4719,8 @@ dependencies = [ "libc", "near-account-id 0.15.0", "near-crypto 0.15.0", - "near-jsonrpc-client", - "near-jsonrpc-primitives", + "near-jsonrpc-client 0.4.1", + "near-jsonrpc-primitives 0.15.0", "near-primitives 0.15.0", "near-sandbox-utils", "portpicker", @@ -3760,14 +4770,13 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.3" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn", - "synstructure", + "syn 2.0.15", ] [[package]] @@ -3776,7 +4785,7 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e61de68ede9ffdd69c01664f65a178c5188b73f78faa21f0936016a888ff7c" dependencies = [ - "borsh", + "borsh 0.9.3", "byteorder", "crunchy", "lazy_static", @@ -3795,5 +4804,5 @@ dependencies = [ "crc32fast", "flate2", "thiserror", - "time", + "time 0.1.45", ] diff --git a/README.md b/README.md index c1b05fc..7536e18 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Lints](https://github.com/aurora-is-near/aurora-fungible-token/actions/workflows/lints.yml/badge.svg)](https://github.com/aurora-is-near/aurora-fungible-token/actions/workflows/lints.yml) [![Tests](https://github.com/aurora-is-near/aurora-fungible-token/actions/workflows/tests.yml/badge.svg)](https://github.com/aurora-is-near/aurora-fungible-token/actions/workflows/tests.yml) -Aurora Eth Connecotr - Fungible Token implementation is the smart contract on the NEAR Protocol for +Aurora Eth Connecotr - Fungible Token implementation is the smart contract on the NEAR Protocol for [Aurora Engine](https://github.com/aurora-is-near/aurora-engine). It is implementation for [NEP-141](https://nomicon.io/Standards/Tokens/FungibleToken/Core). @@ -25,10 +25,12 @@ cargo install --force cargo-make #### Running unit & integration tests To run tests, there are a few cargo make tasks we can run: + - `test`, tests the whole cargo workspace and ETH contracts. Requires a `--profile` argument. For example, the following will test the whole workspace and ETH contracts: + ```sh cargo make --profile mainnet test ``` @@ -38,6 +40,7 @@ cargo make --profile mainnet test Every task with `cargo make` must have a `--profile` argument. The current available `profile`s are: + - `mainnet`, suitable for mainnet. - `testnet`, suitable for testnet. - `local`, suitable for local development. @@ -49,6 +52,7 @@ other `.env` files. See `bin/local-custom.env` for more details. Every make most follow the following pattern, though `--profile` is not required for all such as cleanup: + ```sh cargo make [--profile ] ``` @@ -58,6 +62,7 @@ cargo make [--profile ] To build the binaries there are a few commands to do such following the format. The current available build `task`s are: + - `default`, does not need to be specified, runs `build`. Requires a `--profile` argument. - `build`, builds smart contract and produces the @@ -69,6 +74,7 @@ The current available build `task`s are: `aurora-.wasm` in the `bin` folder. For example, the following will build the mainnet debug binary: + ```sh cargo make --profile mainnet build ``` @@ -76,15 +82,18 @@ cargo make --profile mainnet build #### Running checks & lints To run lints and checks, the following tasks are available: + - `check`, checks the format, clippy and ETH contracts. - `check-fmt`, checks the workspace Rust format only. - `check-clippy`, checks the Rust workspace with clippy only. For example the following command will run the checks. `profile` is not required here: -``` + +```sh cargo make check ``` ## License -**aurora-eth-connector** has [**CCO-1.0** license](LICENSE) \ No newline at end of file + +**aurora-eth-connector** has [**CCO-1.0** license](LICENSE) diff --git a/eth-connector-tests/Cargo.toml b/eth-connector-tests/Cargo.toml index 1b16c8f..26b4d4d 100644 --- a/eth-connector-tests/Cargo.toml +++ b/eth-connector-tests/Cargo.toml @@ -14,13 +14,13 @@ autobenches = false [dev-dependencies] aurora-eth-connector = { path = "../eth-connector" } -aurora-engine-types = { git = "https://github.com/aurora-is-near/aurora-engine.git", branch = "develop", default-features = false, features = ["impl-serde"] } +aurora-engine-types = { git = "https://github.com/aurora-is-near/aurora-engine.git", tag = "2.9.0", default-features = false, features = ["impl-serde"] } anyhow = "1.0" near-sdk = "4.0" -near-primitives = "0.5" +near-primitives = "0.16" near-units = "0.2" near-contract-standards = "4.1" -tokio = { version = "1.24", features = ["full"] } +tokio = { version = "1", features = ["full"] } workspaces = "0.7.0" byte-slice-cast = "1.2" hex = "0.4.3" diff --git a/eth-connector-tests/src/connector.rs b/eth-connector-tests/src/connector.rs index 56d053f..b00941b 100644 --- a/eth-connector-tests/src/connector.rs +++ b/eth-connector-tests/src/connector.rs @@ -1,4 +1,8 @@ -use crate::utils::*; +use crate::utils::{ + validate_eth_address, TestContract, CONTRACT_ACC, CUSTODIAN_ADDRESS, DEFAULT_GAS, + DEPOSITED_AMOUNT, DEPOSITED_CONTRACT, DEPOSITED_EVM_AMOUNT, DEPOSITED_RECIPIENT, + PROOF_DATA_ETH, PROOF_DATA_NEAR, RECIPIENT_ETH_ADDRESS, +}; use aurora_engine_types::{ types::{Address, Fee, NEP141Wei}, H256, U256, @@ -174,7 +178,7 @@ async fn test_withdraw_eth_from_near_engine() -> anyhow::Result<()> { .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); // The purpose of this withdraw variant is that it can withdraw on behalf of a user. // In this example the contract itself withdraws on behalf of the user @@ -214,7 +218,7 @@ async fn test_deposit_eth_to_near_balance_total_supply() -> anyhow::Result<()> { "Expected not to fail because the proof should have been already used", ); - let receiver_id = AccountId::try_from(DEPOSITED_RECIPIENT.to_string()).unwrap(); + let receiver_id = DEPOSITED_RECIPIENT.parse().unwrap(); let balance = contract.get_eth_on_near_balance(&receiver_id).await?; assert_eq!(balance.0, DEPOSITED_AMOUNT); @@ -254,7 +258,7 @@ async fn test_ft_transfer_call_eth() -> anyhow::Result<()> { contract.call_deposit_eth_to_near().await?; contract.call_deposit_contract().await?; - let receiver_id = AccountId::try_from(DEPOSITED_RECIPIENT.to_string()).unwrap(); + let receiver_id = DEPOSITED_RECIPIENT.parse().unwrap(); let balance = contract.get_eth_on_near_balance(&receiver_id).await?; assert_eq!(balance.0, DEPOSITED_AMOUNT); @@ -328,7 +332,7 @@ async fn test_ft_transfer_call_without_message() -> anyhow::Result<()> { .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_INVALID_ON_TRANSFER_MESSAGE_FORMAT")); + assert!(contract.check_error_message(&res, "ERR_INVALID_ON_TRANSFER_MESSAGE_FORMAT")); // Assert balances remain unchanged @@ -341,7 +345,7 @@ async fn test_ft_transfer_call_without_message() -> anyhow::Result<()> { ); // Sending to random account should not change balances - let some_acc = AccountId::try_from("some-test-acc".to_string()).unwrap(); + let some_acc = "some-test-acc".parse().unwrap(); let res = contract .contract .call("ft_transfer_call") @@ -434,7 +438,7 @@ async fn test_ft_transfer_call_user_message() { .await .unwrap(); assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_INVALID_ON_TRANSFER_MESSAGE_FORMAT")); + assert!(contract.check_error_message(&res, "ERR_INVALID_ON_TRANSFER_MESSAGE_FORMAT")); let balance = contract.get_eth_on_near_balance(receiver_id).await.unwrap(); assert_eq!(balance.0, DEPOSITED_CONTRACT + transfer_amount.0); let balance = contract @@ -458,7 +462,7 @@ async fn test_set_and_get_engine_account() { .await .unwrap(); assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); contract .set_and_check_access_right(user_acc.id()) @@ -566,7 +570,7 @@ async fn test_deposit_with_same_proof() -> anyhow::Result<()> { .deposit_with_proof(&contract.get_proof(PROOF_DATA_NEAR)) .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_PROOF_EXIST")); + assert!(contract.check_error_message(&res, "ERR_PROOF_EXIST")); Ok(()) } @@ -582,7 +586,7 @@ async fn test_deposit_wrong_custodian_address() -> anyhow::Result<()> { .deposit_with_proof(&contract.get_proof(PROOF_DATA_NEAR)) .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_WRONG_EVENT_ADDRESS")); + assert!(contract.check_error_message(&res, "ERR_WRONG_EVENT_ADDRESS")); assert!( !contract.call_is_used_proof(PROOF_DATA_NEAR).await?, "Expected not to fail because the proof should not have been already used", @@ -645,7 +649,7 @@ async fn test_admin_controlled_only_admin_can_pause() -> anyhow::Result<()> { .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); let res = contract .contract @@ -754,7 +758,7 @@ async fn test_admin_controlled_admin_can_perform_actions_when_paused() -> anyhow .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); let res = owner_acc .call(contract.contract.id(), "engine_withdraw") @@ -805,7 +809,7 @@ async fn test_deposit_pausability() -> anyhow::Result<()> { let proof2 = contract.mock_proof(user_acc.id(), 20, 2); let res = contract.user_deposit_with_proof(&user_acc, &proof2).await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_PAUSED")); + assert!(contract.check_error_message(&res, "ERR_PAUSED")); let proof3 = contract.mock_proof(user_acc.id(), 30, 3); let res = contract @@ -878,7 +882,7 @@ async fn test_withdraw_from_near_pausability() -> anyhow::Result<()> { .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "WithdrawErrorPaused")); + assert!(contract.check_error_message(&res, "WithdrawErrorPaused")); // Unpause all let res = contract @@ -941,7 +945,7 @@ async fn test_get_accounts_counter_and_transfer() -> anyhow::Result<()> { assert_eq!(res.0, 2); let transfer_amount: U128 = 70.into(); - let receiver_id = AccountId::try_from(DEPOSITED_RECIPIENT.to_string()).unwrap(); + let receiver_id: AccountId = DEPOSITED_RECIPIENT.parse().unwrap(); let res = contract .contract .call("ft_transfer") @@ -989,7 +993,7 @@ async fn test_deposit_to_near_with_zero_fee() -> anyhow::Result<()> { ); let deposited_amount = 3000; - let receiver_id = AccountId::try_from(DEPOSITED_RECIPIENT.to_string()).unwrap(); + let receiver_id: AccountId = DEPOSITED_RECIPIENT.parse().unwrap(); let balance = contract.get_eth_on_near_balance(&receiver_id).await?; assert_eq!(balance.0, deposited_amount); @@ -1080,7 +1084,7 @@ async fn test_deposit_to_aurora_amount_zero_fee_non_zero() -> anyhow::Result<()> .deposit_with_proof(&contract.get_proof(proof_str)) .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "The amount should be a positive non zero number")); + assert!(contract.check_error_message(&res, "The amount should be a positive non zero number")); Ok(()) } @@ -1122,7 +1126,7 @@ async fn test_ft_transfer_max_value() -> anyhow::Result<()> { contract.call_deposit_contract().await?; let transfer_amount: U128 = u128::MAX.into(); - let receiver_id = AccountId::try_from(DEPOSITED_RECIPIENT.to_string()).unwrap(); + let receiver_id: AccountId = DEPOSITED_RECIPIENT.parse().unwrap(); let res = contract .contract .call("ft_transfer") @@ -1133,7 +1137,7 @@ async fn test_ft_transfer_max_value() -> anyhow::Result<()> { .await?; assert!(res.is_failure()); assert!(contract.check_error_message( - res, + &res, "Smart contract panicked: The account doesn't have enough balance" )); assert_eq!( @@ -1152,7 +1156,7 @@ async fn test_ft_transfer_empty_value() -> anyhow::Result<()> { contract.call_deposit_contract().await?; let transfer_amount = ""; - let receiver_id = AccountId::try_from(DEPOSITED_RECIPIENT.to_string()).unwrap(); + let receiver_id: AccountId = DEPOSITED_RECIPIENT.parse().unwrap(); let res = contract .contract .call("ft_transfer") @@ -1162,7 +1166,7 @@ async fn test_ft_transfer_empty_value() -> anyhow::Result<()> { .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "cannot parse integer from empty string")); + assert!(contract.check_error_message(&res, "cannot parse integer from empty string")); Ok(()) } @@ -1172,7 +1176,7 @@ async fn test_ft_transfer_wrong_u128_json_type() -> anyhow::Result<()> { contract.call_deposit_contract().await?; let transfer_amount = 200; - let receiver_id = AccountId::try_from(DEPOSITED_RECIPIENT.to_string()).unwrap(); + let receiver_id: AccountId = DEPOSITED_RECIPIENT.parse().unwrap(); let res = contract .contract .call("ft_transfer") @@ -1182,7 +1186,7 @@ async fn test_ft_transfer_wrong_u128_json_type() -> anyhow::Result<()> { .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "invalid type: integer `200`, expected a string")); + assert!(contract.check_error_message(&res, "invalid type: integer `200`, expected a string")); Ok(()) } @@ -1229,7 +1233,7 @@ async fn test_access_rights() -> anyhow::Result<()> { .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); assert_eq!( DEPOSITED_AMOUNT + transfer_amount1.0, @@ -1324,7 +1328,7 @@ async fn test_storage_withdraw() -> anyhow::Result<()> { .await?; assert!(res.is_failure()); assert!(contract.check_error_message( - res, + &res, "The amount is greater than the available storage balance" )); Ok(()) @@ -1348,7 +1352,7 @@ async fn test_engine_ft_transfer() { .await .unwrap(); assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); assert_eq!( DEPOSITED_AMOUNT, @@ -1435,7 +1439,7 @@ async fn test_engine_ft_transfer_call() { .await .unwrap(); assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); assert_eq!( DEPOSITED_AMOUNT, @@ -1513,7 +1517,7 @@ async fn test_engine_storage_deposit() { .await .unwrap(); assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); contract .set_and_check_access_right(user_acc.id()) @@ -1578,7 +1582,7 @@ async fn test_engine_storage_withdraw() { .await .unwrap(); assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); contract .set_and_check_access_right(user_acc.id()) @@ -1610,7 +1614,7 @@ async fn test_engine_storage_withdraw() { .unwrap(); assert!(res.is_failure()); assert!(contract.check_error_message( - res, + &res, "The amount is greater than the available storage balance" )); } @@ -1638,7 +1642,7 @@ async fn test_engine_storage_unregister() { .await .unwrap(); assert!(res.is_failure()); - assert!(contract.check_error_message(res, "ERR_ACCESS_RIGHT")); + assert!(contract.check_error_message(&res, "ERR_ACCESS_RIGHT")); contract .set_and_check_access_right(user_acc.id()) @@ -1669,7 +1673,7 @@ async fn test_engine_storage_unregister() { .await .unwrap(); assert!(contract.check_error_message( - res, + &res, "The amount is greater than the available storage balance" )); @@ -1692,7 +1696,7 @@ async fn test_engine_storage_unregister() { .await .unwrap(); assert!(res.is_failure()); - assert!(contract.check_error_message(res, "The account eth_recipient.root is not registered")); + assert!(contract.check_error_message(&res, "The account eth_recipient.root is not registered")); } #[tokio::test] @@ -1703,8 +1707,8 @@ async fn test_manage_engine_accounts() { .await .unwrap(); - let acc1 = AccountId::try_from("acc1.root".to_string()).unwrap(); - let acc2 = AccountId::try_from("acc2.root".to_string()).unwrap(); + let acc1 = "acc1.root".parse().unwrap(); + let acc2 = "acc2.root".parse().unwrap(); contract.set_engine_account(&acc1).await.unwrap(); contract.set_engine_account(&acc2).await.unwrap(); let res = contract @@ -1746,7 +1750,7 @@ async fn test_ft_transfer_call_insufficient_sender_balance() -> anyhow::Result<( let contract = TestContract::new().await?; contract.call_deposit_eth_to_near().await?; - let recipient_id = AccountId::try_from(DEPOSITED_RECIPIENT.to_string()).unwrap(); + let recipient_id = DEPOSITED_RECIPIENT.parse().unwrap(); let balance = contract.get_eth_on_near_balance(&recipient_id).await?; assert_eq!(balance.0, DEPOSITED_AMOUNT); @@ -1775,7 +1779,7 @@ async fn test_ft_transfer_call_insufficient_sender_balance() -> anyhow::Result<( .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "Insufficient sender balance")); + assert!(contract.check_error_message(&res, "Insufficient sender balance")); let balance = contract .get_eth_on_near_balance(contract.contract.id()) .await?; @@ -1791,7 +1795,7 @@ async fn test_ft_transfer_call_insufficient_sender_balance() -> anyhow::Result<( .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "The amount should be a positive non zero number")); + assert!(contract.check_error_message(&res, "The amount should be a positive non zero number")); let balance = contract .get_eth_on_near_balance(contract.contract.id()) .await?; diff --git a/eth-connector-tests/src/lib.rs b/eth-connector-tests/src/lib.rs index 5579283..df87e02 100644 --- a/eth-connector-tests/src/lib.rs +++ b/eth-connector-tests/src/lib.rs @@ -1,3 +1,6 @@ +#![deny(clippy::pedantic, clippy::nursery)] +#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc)] + #[cfg(test)] mod connector; #[cfg(all(test, feature = "migration-tests"))] diff --git a/eth-connector-tests/src/migration.rs b/eth-connector-tests/src/migration.rs index c68ca17..62a55d1 100644 --- a/eth-connector-tests/src/migration.rs +++ b/eth-connector-tests/src/migration.rs @@ -1,13 +1,12 @@ -use crate::utils::*; +use crate::utils::{TestContract, DEFAULT_GAS}; use aurora_engine_migration_tool::{BorshDeserialize, StateData}; -use aurora_eth_connector::migration::{MigrationCheckResult, MigrationInputData}; -use near_sdk::{AccountId, Balance}; +use aurora_eth_connector::migration::{CheckResult, InputData}; use std::collections::HashMap; #[tokio::test] async fn test_migration_access_right() -> anyhow::Result<()> { let contract = TestContract::new().await?; - let data = MigrationInputData { + let data = InputData { accounts: HashMap::new(), total_supply: None, account_storage_usage: None, @@ -22,7 +21,7 @@ async fn test_migration_access_right() -> anyhow::Result<()> { .transact() .await?; assert!(res.is_failure()); - assert!(contract.check_error_message(res, "Method migrate is private")); + assert!(contract.check_error_message(&res, "Method migrate is private")); Ok(()) } @@ -36,7 +35,7 @@ async fn test_migration() -> anyhow::Result<()> { .iter() .map(|&s| s.into()) .collect(); - let data = MigrationInputData { + let data = InputData { accounts: HashMap::new(), total_supply: None, account_storage_usage: None, @@ -51,14 +50,13 @@ async fn test_migration() -> anyhow::Result<()> { .transact() .await?; assert!(res.is_success()); - assert!(res.total_gas_burnt as f64 / 1_000_000_000_000. < 95.6); - println!( - "Gas burnt: {:.1} TGas", - res.total_gas_burnt as f64 / 1_000_000_000_000. - ); + assert!(to_tera(res.total_gas_burnt) < 95.6); + println!("Gas burnt: {:.1} TGas", to_tera(res.total_gas_burnt)); + Ok(()) } +#[allow(clippy::too_many_lines)] #[tokio::test] async fn test_migration_state() -> anyhow::Result<()> { let contract = TestContract::new().await?; @@ -79,7 +77,7 @@ async fn test_migration_state() -> anyhow::Result<()> { &data.proofs[i..i + limit] }; proofs_count += proofs.len(); - let args = MigrationInputData { + let args = InputData { accounts: HashMap::new(), total_supply: None, account_storage_usage: None, @@ -98,34 +96,33 @@ async fn test_migration_state() -> anyhow::Result<()> { println!( "Proofs: {:?} [{:.1} TGas]", proofs_count, - proofs_gas_burnt as f64 / 1_000_000_000_000. + to_tera(proofs_gas_burnt) ); if i + limit >= data.proofs.len() { break; - } else { - i += limit; } + + i += limit; } assert_eq!(proofs_count, data.proofs.len()); // INCREASED! //assert!(proofs_gas_burnt as f64 / 1_000_000_000_000. < 5416.1); - assert!(proofs_gas_burnt as f64 / 1_000_000_000_000. < 10326.0); + assert!(to_tera(proofs_gas_burnt) < 10326.0); total_gas_burnt += proofs_gas_burnt; println!(); // Accounts migration let mut accounts_gas_burnt = 0; - let mut accounts: HashMap = HashMap::new(); + let mut accounts = HashMap::new(); let mut accounts_count = 0; for (i, (account, amount)) in data.accounts.iter().enumerate() { - let account = AccountId::try_from(account.to_string()).unwrap(); accounts.insert(account.clone(), amount.as_u128()); if accounts.len() < limit && i < data.accounts.len() - 1 { continue; } accounts_count += &accounts.len(); - let args = MigrationInputData { + let args = InputData { accounts, total_supply: None, account_storage_usage: None, @@ -145,7 +142,7 @@ async fn test_migration_state() -> anyhow::Result<()> { println!( "Accounts: {:?} [{:.1} TGas]", accounts_count, - accounts_gas_burnt as f64 / 1_000_000_000_000. + to_tera(accounts_gas_burnt) ); // Clear accounts = HashMap::new(); @@ -157,15 +154,15 @@ async fn test_migration_state() -> anyhow::Result<()> { // INCREASED! // assert!(accounts_gas_burnt as f64 / 1_000_000_000_000. < 1520.); assert!( - accounts_gas_burnt as f64 / 1_000_000_000_000. < 1984., + to_tera(accounts_gas_burnt) < 1984., "{:?} < {:?}", - accounts_gas_burnt as f64 / 1_000_000_000_000., + to_tera(accounts_gas_burnt), 1984. ); total_gas_burnt += accounts_gas_burnt; // Migrate Contract data - let args = MigrationInputData { + let args = InputData { accounts: HashMap::new(), total_supply: Some(data.contract_data.total_eth_supply_on_near.as_u128()), account_storage_usage: Some(data.contract_data.account_storage_usage), @@ -185,25 +182,22 @@ async fn test_migration_state() -> anyhow::Result<()> { //assert!(total_gas_burnt as f64 / 1_000_000_000_000. < 6878.6); // INCREASED! //assert!(total_gas_burnt as f64 / 1_000_000_000_000. < 11852.6); - println!("\n{:?}", total_gas_burnt); + println!("\n{total_gas_burnt:?}"); assert!( - total_gas_burnt as f64 / 1_000_000_000_000. < 12315., + to_tera(total_gas_burnt) < 12315., "{:?} < {:?}", - total_gas_burnt as f64 / 1_000_000_000_000., + to_tera(total_gas_burnt), 12315. ); - println!( - "Total Gas burnt: {:.1} TGas\n", - total_gas_burnt as f64 / 1_000_000_000_000. - ); + println!("Total Gas burnt: {:.1} TGas\n", to_tera(total_gas_burnt)); //============================ // Verify correctness //============================ // Check basic (NEP-141) contract data - let args = MigrationInputData { + let args = InputData { accounts: HashMap::new(), total_supply: Some(data.contract_data.total_eth_supply_on_near.as_u128()), account_storage_usage: Some(data.contract_data.account_storage_usage), @@ -216,9 +210,9 @@ async fn test_migration_state() -> anyhow::Result<()> { .args_borsh(args) .view() .await? - .borsh::() + .borsh::() .unwrap(); - assert_eq!(res, MigrationCheckResult::Success); + assert_eq!(res, CheckResult::Success); // Check proofs data proofs_count = 0; @@ -230,7 +224,7 @@ async fn test_migration_state() -> anyhow::Result<()> { &data.proofs[i..i + limit] }; proofs_count += proofs.len(); - let args = MigrationInputData { + let args = InputData { accounts: HashMap::new(), total_supply: None, account_storage_usage: None, @@ -243,29 +237,28 @@ async fn test_migration_state() -> anyhow::Result<()> { .args_borsh(args) .view() .await? - .borsh::() + .borsh::() .unwrap(); - assert_eq!(res, MigrationCheckResult::Success); + assert_eq!(res, CheckResult::Success); - println!("Proofs checked: [{:?}]", proofs_count); + println!("Proofs checked: [{proofs_count:?}]"); if i + limit >= data.proofs.len() { break; - } else { - i += limit; } + + i += limit; } // Check accounts data accounts = HashMap::new(); accounts_count = 0; for (i, (account, amount)) in data.accounts.iter().enumerate() { - let account = AccountId::try_from(account.to_string()).unwrap(); - accounts.insert(account, amount.as_u128()); + accounts.insert(account.clone(), amount.as_u128()); if accounts.len() < limit && i < data.accounts.len() - 1 { continue; } accounts_count += accounts.len(); - let args = MigrationInputData { + let args = InputData { accounts, total_supply: None, account_storage_usage: None, @@ -278,12 +271,17 @@ async fn test_migration_state() -> anyhow::Result<()> { .args_borsh(args) .view() .await? - .borsh::() + .borsh::() .unwrap(); - assert_eq!(res, MigrationCheckResult::Success); + assert_eq!(res, CheckResult::Success); accounts = HashMap::new(); - println!("Accounts checked: [{:?}]", accounts_count); + println!("Accounts checked: [{accounts_count:?}]"); } Ok(()) } + +#[allow(clippy::cast_precision_loss)] +fn to_tera(gas: u64) -> f64 { + gas as f64 / 1_000_000_000_000. +} diff --git a/eth-connector-tests/src/utils.rs b/eth-connector-tests/src/utils.rs index b645a1a..b90b08b 100644 --- a/eth-connector-tests/src/utils.rs +++ b/eth-connector-tests/src/utils.rs @@ -10,7 +10,7 @@ pub const PROOF_DATA_NEAR: &str = r#"{"log_index":0,"log_entry_data":[248,251,14 pub const DEPOSITED_RECIPIENT: &str = "eth_recipient.root"; pub const CUSTODIAN_ADDRESS: &str = "096DE9C2B8A5B8c22cEe3289B101f6960d68E51E"; pub const DEFAULT_GAS: u64 = 300_000_000_000_000; -pub const DEPOSITED_AMOUNT: u128 = 800400; +pub const DEPOSITED_AMOUNT: u128 = 800_400; pub const DEPOSITED_CONTRACT: u128 = 400; pub const RECIPIENT_ETH_ADDRESS: &str = "891b2749238b27ff58e951088e55b04de71dc374"; pub const PROOF_DATA_ETH: &str = r#"{"log_index":0,"log_entry_data":[249,1,27,148,9,109,233,194,184,165,184,194,44,238,50,137,177,1,246,150,13,104,229,30,248,66,160,209,66,67,156,39,142,37,218,217,165,7,102,241,83,208,227,210,215,191,43,209,111,194,120,28,75,212,148,178,177,90,157,160,0,0,0,0,0,0,0,0,0,0,0,0,121,24,63,219,216,14,45,138,234,26,202,162,246,123,251,138,54,212,10,141,184,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,216,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,101,116,104,95,99,111,110,110,101,99,116,111,114,46,114,111,111,116,58,56,57,49,66,50,55,52,57,50,51,56,66,50,55,102,70,53,56,101,57,53,49,48,56,56,101,53,53,98,48,52,100,101,55,49,68,99,51,55,52,0,0,0,0,0],"receipt_index":0,"receipt_data":[249,2,40,1,130,121,129,185,1,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,249,1,30,249,1,27,148,9,109,233,194,184,165,184,194,44,238,50,137,177,1,246,150,13,104,229,30,248,66,160,209,66,67,156,39,142,37,218,217,165,7,102,241,83,208,227,210,215,191,43,209,111,194,120,28,75,212,148,178,177,90,157,160,0,0,0,0,0,0,0,0,0,0,0,0,121,24,63,219,216,14,45,138,234,26,202,162,246,123,251,138,54,212,10,141,184,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,216,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,101,116,104,95,99,111,110,110,101,99,116,111,114,46,114,111,111,116,58,56,57,49,66,50,55,52,57,50,51,56,66,50,55,102,70,53,56,101,57,53,49,48,56,56,101,53,53,98,48,52,100,101,55,49,68,99,51,55,52,0,0,0,0,0],"header_data":[249,2,23,160,227,118,223,171,207,47,75,187,79,185,74,198,88,140,54,97,161,196,35,70,121,178,154,141,172,91,193,252,86,64,228,227,160,29,204,77,232,222,199,93,122,171,133,181,103,182,204,212,26,211,18,69,27,148,138,116,19,240,161,66,253,64,212,147,71,148,109,150,79,199,61,172,73,162,195,49,105,169,235,252,47,207,92,249,136,136,160,232,74,213,122,210,55,65,43,78,225,85,247,174,212,229,211,176,186,250,113,21,129,16,181,52,172,217,167,148,242,153,45,160,15,198,229,127,6,235,198,161,226,121,173,106,62,0,90,25,158,11,242,44,178,3,137,22,245,126,227,91,74,156,24,115,160,65,253,74,43,97,155,196,93,59,43,202,12,155,49,115,95,124,247,230,15,1,171,150,10,56,115,247,86,81,8,39,11,185,1,0,128,32,9,2,0,0,0,0,0,0,32,16,128,32,0,0,128,2,0,0,64,51,0,0,0,129,0,32,66,32,0,14,0,144,0,0,0,2,13,34,0,128,64,200,128,4,32,16,0,64,0,0,34,0,32,0,40,0,8,0,0,32,176,0,196,1,0,0,10,1,16,8,16,0,0,72,48,0,0,36,0,17,4,128,10,68,0,16,0,1,32,0,128,0,32,0,12,64,162,8,98,2,0,32,0,0,16,136,1,16,40,0,0,0,0,4,0,0,44,32,0,0,192,49,0,8,12,64,96,129,0,2,0,0,128,0,12,64,10,8,1,132,0,32,0,1,4,33,0,4,128,140,128,0,2,66,0,0,192,0,2,16,2,0,0,0,32,16,0,0,64,0,242,4,0,0,0,0,0,0,4,128,0,32,0,14,194,0,16,10,64,32,0,0,0,2,16,96,16,129,0,16,32,32,128,128,32,0,2,68,0,32,1,8,64,16,32,2,5,2,68,0,32,0,2,16,1,0,0,16,2,0,0,16,2,0,0,0,128,0,16,0,36,128,32,0,4,64,16,0,40,16,0,17,0,16,132,25,207,98,158,131,157,85,88,131,122,17,225,131,121,11,191,132,96,174,60,127,153,216,131,1,10,1,132,103,101,116,104,134,103,111,49,46,49,54,135,119,105,110,100,111,119,115,160,33,15,129,167,71,37,0,207,110,217,101,107,71,110,48,237,4,83,174,75,131,188,213,179,154,115,243,94,107,52,238,144,136,84,114,37,115,236,166,252,105],"proof":[[248,177,160,211,36,253,39,157,18,180,1,3,139,140,168,65,238,106,111,239,53,121,48,235,96,8,115,106,93,174,165,66,207,49,216,160,172,74,129,163,113,84,7,35,23,12,83,10,253,21,57,198,143,128,73,112,84,222,23,146,164,219,89,23,138,197,111,237,160,52,220,245,245,91,231,95,169,113,225,49,168,40,77,59,232,33,210,4,93,203,94,247,212,15,42,146,32,70,206,193,54,160,6,140,29,61,156,224,194,173,129,74,84,92,11,129,184,212,37,31,23,140,226,87,230,72,30,52,97,66,185,236,139,228,128,128,128,128,160,190,114,105,101,139,216,178,42,238,75,109,119,227,138,206,144,183,82,34,173,26,173,188,231,152,171,56,163,2,179,13,190,128,128,128,128,128,128,128,128],[249,2,47,48,185,2,43,249,2,40,1,130,121,129,185,1,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,249,1,30,249,1,27,148,9,109,233,194,184,165,184,194,44,238,50,137,177,1,246,150,13,104,229,30,248,66,160,209,66,67,156,39,142,37,218,217,165,7,102,241,83,208,227,210,215,191,43,209,111,194,120,28,75,212,148,178,177,90,157,160,0,0,0,0,0,0,0,0,0,0,0,0,121,24,63,219,216,14,45,138,234,26,202,162,246,123,251,138,54,212,10,141,184,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,216,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,101,116,104,95,99,111,110,110,101,99,116,111,114,46,114,111,111,116,58,56,57,49,66,50,55,52,57,50,51,56,66,50,55,102,70,53,56,101,57,53,49,48,56,56,101,53,53,98,48,52,100,101,55,49,68,99,51,55,52,0,0,0,0,0]]}"#; @@ -24,21 +24,20 @@ pub struct TestContract { } impl TestContract { - pub async fn new() -> anyhow::Result { + pub async fn new() -> anyhow::Result { Self::new_with_custodian_and_owner(CUSTODIAN_ADDRESS, CONTRACT_ACC).await } pub async fn new_with_custodian_and_owner( eth_custodian_address: &str, owner_id: &str, - ) -> anyhow::Result { - use std::str::FromStr; + ) -> anyhow::Result { let (contract, root_account) = Self::deploy_aurora_contract().await?; - let owner_id: AccountId = AccountId::from_str(owner_id).unwrap(); + let owner_id: AccountId = owner_id.parse().unwrap(); let prover_account: AccountId = contract.id().clone(); let metadata = Self::metadata_default(); - let account_with_access_right: AccountId = AccountId::from_str(CONTRACT_ACC).unwrap(); + let account_with_access_right: AccountId = CONTRACT_ACC.parse().unwrap(); // Init eth-connector let res = contract .call("new") @@ -127,7 +126,7 @@ impl TestContract { } /// Waiting for the account creation - async fn waiting_account_creation( + async fn waiting_account_creation( worker: &Worker, account_id: &AccountId, ) -> anyhow::Result<()> { @@ -171,12 +170,14 @@ impl TestContract { .await?) } + #[must_use] pub fn get_proof(&self, proof: &str) -> Proof { serde_json::from_str(proof).unwrap() } - pub fn check_error_message(&self, res: ExecutionFinalResult, error_msg: &str) -> bool { - format!("{:?}", res).contains(error_msg) + #[must_use] + pub fn check_error_message(&self, res: &ExecutionFinalResult, error_msg: &str) -> bool { + format!("{res:?}").contains(error_msg) } pub async fn call_is_used_proof(&self, proof: &str) -> anyhow::Result { @@ -195,14 +196,14 @@ impl TestContract { pub async fn call_deposit_eth_to_aurora(&self) -> anyhow::Result<()> { let proof: Proof = serde_json::from_str(PROOF_DATA_ETH).unwrap(); let res = self.deposit_with_proof(&proof).await?; - assert!(res.is_success(), "call_deposit_eth_to_aurora: {:#?}", res); + assert!(res.is_success(), "call_deposit_eth_to_aurora: {res:#?}"); Ok(()) } pub async fn call_deposit_eth_to_near(&self) -> anyhow::Result<()> { let proof: Proof = self.get_proof(PROOF_DATA_NEAR); let res = self.deposit_with_proof(&proof).await?; - assert!(res.is_success(), "call_deposit_eth_to_near: {:#?}", res); + assert!(res.is_success(), "call_deposit_eth_to_near: {res:#?}"); Ok(()) } @@ -260,7 +261,7 @@ impl TestContract { .await?; assert!(res.is_success()); - Ok(AccountId::try_from(user.to_string())?) + Ok(user.parse()?) } pub async fn set_and_check_access_right(&self, acc: &AccountId) -> anyhow::Result<()> { @@ -300,6 +301,7 @@ impl TestContract { Ok(()) } + #[must_use] pub fn mock_proof( &self, recipient_id: &AccountId, @@ -363,17 +365,18 @@ impl TestContract { pub async fn call_deposit_contract(&self) -> anyhow::Result<()> { let proof: Proof = self.mock_proof(self.contract.id(), DEPOSITED_CONTRACT, 1); let res = self.deposit_with_proof(&proof).await?; - assert!(res.is_success(), "call_deposit_contract: {:#?}", res); + assert!(res.is_success(), "call_deposit_contract: {res:#?}"); Ok(()) } } -pub fn print_logs(res: ExecutionFinalResult) { - for log in res.logs().iter() { - println!("\t[LOG] {}", log); +pub fn print_logs(res: &ExecutionFinalResult) { + for log in res.logs() { + println!("\t[LOG] {log}"); } } +#[must_use] pub fn validate_eth_address(address: &str) -> Address { Address::decode(address).unwrap() } diff --git a/eth-connector/Cargo.toml b/eth-connector/Cargo.toml index 5206c2e..9b34c9d 100644 --- a/eth-connector/Cargo.toml +++ b/eth-connector/Cargo.toml @@ -16,18 +16,18 @@ autobenches = false crate-type = ["cdylib", "rlib"] [dependencies] -near-sdk = "4.1" +aurora-engine-types = { git = "https://github.com/aurora-is-near/aurora-engine.git", tag = "2.9.0", default-features = false, features = ["impl-serde", "borsh-compat"] } +byte-slice-cast = "1" +ethabi = { version = "18", default-features = false } +hex = "0.4" near-contract-standards = "4.1" -aurora-engine-types = { git = "https://github.com/aurora-is-near/aurora-engine.git", branch = "develop", default-features = false, features = ["impl-serde"] } +near-sdk = "4.1" +rlp = "0.5" serde = "1" serde_json = "1" -hex = "0.4.3" -rlp = "0.5.0" -byte-slice-cast = "1.0" -ethabi = { version = "18.0", default-features = false } [dev-dependencies] -rand = "0.8.5" +rand = "0.8" [features] log = [] diff --git a/eth-connector/src/admin_controlled.rs b/eth-connector/src/admin_controlled.rs index 9b8fed3..5a3194c 100644 --- a/eth-connector/src/admin_controlled.rs +++ b/eth-connector/src/admin_controlled.rs @@ -25,6 +25,10 @@ pub trait AdminControlled { } /// Asserts the passed paused flag is not set. Returns `PausedError` if paused. + /// + /// # Errors + /// + /// Error is returned if the smart contract is paused. fn assert_not_paused(&self, flag: PausedMask) -> Result<(), error::AdminControlledError> { if self.is_paused(flag) { Err(error::AdminControlledError::Paused) @@ -40,6 +44,10 @@ pub trait AdminControlled { fn get_access_right(&self) -> AccountId; /// Check access right for predecessor account + /// + /// # Errors + /// + /// Error is returned if the caller hasn't rights. fn assert_access_right(&self) -> Result<(), error::AdminControlledError> { if self.get_access_right() == near_sdk::env::predecessor_account_id() || self.is_owner() @@ -51,7 +59,11 @@ pub trait AdminControlled { } } - /// Asseert only owners of contract access right + /// Assert only owners of contract access right + /// + /// # Errors + /// + /// Error is returned if the caller isn't owner. fn assert_owner_access_right(&self) -> Result<(), error::AdminControlledError> { if self.is_owner() || near_sdk::env::predecessor_account_id() == near_sdk::env::current_account_id() @@ -91,7 +103,7 @@ fn test_pause_control() { let mut connector = EthConnector { prover_account: "prover".parse().unwrap(), - eth_custodian_address: Default::default(), + eth_custodian_address: aurora_engine_types::types::Address::default(), paused_mask: UNPAUSE_ALL, account_with_access_right: "aurora".parse().unwrap(), owner_id: "aurora".parse().unwrap(), diff --git a/eth-connector/src/connector.rs b/eth-connector/src/connector.rs index d036739..948c555 100644 --- a/eth-connector/src/connector.rs +++ b/eth-connector/src/connector.rs @@ -9,12 +9,12 @@ use near_sdk::{ }; #[ext_contract(ext_deposit)] -pub trait ConnectorDeposit { +pub trait Deposit { fn deposit(&mut self, #[serializer(borsh)] raw_proof: Proof) -> Promise; } #[ext_contract(ext_withdraw)] -pub trait ConnectorWithdraw { +pub trait Withdraw { #[result_serializer(borsh)] fn withdraw( &mut self, @@ -24,7 +24,7 @@ pub trait ConnectorWithdraw { } #[ext_contract(ext_funds_finish)] -pub trait ConnectorFundsFinish { +pub trait FundsFinish { fn finish_deposit( &mut self, #[serializer(borsh)] deposit_call: FinishDepositCallArgs, @@ -41,7 +41,7 @@ pub trait ProofVerifier { } #[ext_contract(ext_ft_statistic)] -pub trait FungibleTokeStatistic { +pub trait FungibleTokenStatistic { fn get_accounts_counter(&self) -> U64; } diff --git a/eth-connector/src/connector_impl.rs b/eth-connector/src/connector_impl.rs index c6bc56e..5e9041a 100644 --- a/eth-connector/src/connector_impl.rs +++ b/eth-connector/src/connector_impl.rs @@ -13,10 +13,10 @@ use near_sdk::{ env, AccountId, Balance, Gas, Promise, }; -/// NEAR Gas for calling `fininsh_deposit` promise. Used in the `deposit` logic. +/// NEAR Gas for calling `finish_deposit` promise. Used in the `deposit` logic. pub const GAS_FOR_FINISH_DEPOSIT: Gas = Gas(50_000_000_000_000); /// NEAR Gas for calling `verify_log_entry` promise. Used in the `deposit` logic. -// Note: Is 40Tgas always enough? +// Note: Is 40 TGas always enough? const GAS_FOR_VERIFY_LOG_ENTRY: Gas = Gas(40_000_000_000_000); /// transfer eth-connector call args @@ -48,18 +48,15 @@ pub struct WithdrawResult { /// Connector specific data. It always should contain `prover account` - #[derive(BorshSerialize, BorshDeserialize)] pub struct EthConnector { - /// It used in the Deposit flow, to verify log entry form incoming proof. + /// The account is used in the Deposit flow to verify the incoming proof's log entry. pub prover_account: AccountId, - /// It is Eth address, used in the Deposit and Withdraw logic. + /// The ETH address is used in the Deposit and Withdraw logic. pub eth_custodian_address: Address, - - /// Admin controlled + /// Admin controlled. pub paused_mask: PausedMask, - - /// Account with access right for current contract + /// Account with access right for the current contract. pub account_with_access_right: AccountId, - - /// Owner account ID + /// Owner's account id. pub owner_id: AccountId, } @@ -87,7 +84,7 @@ impl AdminControlled for EthConnector { } impl EthConnector { - pub(crate) fn deposit(&mut self, proof: Proof) -> Promise { + pub(crate) fn deposit(&mut self, proof: &Proof) -> Promise { let current_account_id = env::current_account_id(); // Check is current flow paused. If it's owner account just skip it. diff --git a/eth-connector/src/deposit_event.rs b/eth-connector/src/deposit_event.rs index 101496a..9a752b3 100644 --- a/eth-connector/src/deposit_event.rs +++ b/eth-connector/src/deposit_event.rs @@ -27,6 +27,10 @@ pub struct FtTransferMessageData { impl FtTransferMessageData { /// Get on-transfer data from arguments message field. /// Used for `ft_transfer_call` and `ft_on_transfer` + /// + /// # Errors + /// + /// Will return an error if the message has wrong format. pub fn parse_on_transfer_message( message: &str, ) -> Result { @@ -37,7 +41,8 @@ impl FtTransferMessageData { return Err(error::ParseOnTransferMessageError::TooManyParts); } // Check relayer account id from 1-th data element - let account_id = AccountId::try_from(data[0].to_string()) + let account_id = data[0] + .parse() .map_err(|_| error::ParseOnTransferMessageError::InvalidAccount)?; // Decode message array from 2-th element of data array @@ -59,16 +64,18 @@ impl FtTransferMessageData { let fee: Fee = fee_u128.into(); // Get recipient Eth address from message slice - let recipient = Address::try_from_slice(&msg[32..52]).unwrap(); + let recipient = Address::try_from_slice(&msg[32..52]) + .map_err(|_| error::ParseOnTransferMessageError::InvalidAccount)?; - Ok(FtTransferMessageData { + Ok(Self { relayer: account_id, recipient, fee, }) } - /// Encode to String with specific rules + /// Encode to String with specific rules. + #[must_use] pub fn encode(&self) -> String { // The first data section should contain fee data. // Pay attention, that for compatibility reasons we used U256 type @@ -81,16 +88,15 @@ impl FtTransferMessageData { } /// Prepare message for `ft_transfer_call` -> `ft_on_transfer` + /// + /// # Errors + /// + /// Will return an error if the `recipient` has wrong format of `Address`. pub fn prepare_message_for_on_transfer( relayer_account_id: &AccountId, fee: Fee, recipient: String, ) -> Result { - // The first data section should contain fee data. - // Pay attention, that for compatibility reasons we used U256 type - // it means 32 bytes for fee data - let mut data = U256::from(fee.as_u128()).as_byte_slice().to_vec(); - // Check message length. let address = if recipient.len() == 42 { recipient @@ -104,8 +110,6 @@ impl FtTransferMessageData { }; let recipient_address = Address::decode(&address) .map_err(error::ParseEventMessageError::EthAddressValidationError)?; - // Second data section should contain Eth address - data.extend(recipient_address.as_bytes()); Ok(Self { relayer: relayer_account_id.clone(), @@ -137,21 +141,26 @@ impl TokenMessageData { /// For Eth logic flow message validated and prepared for `ft_on_transfer` logic. /// It mean validating Eth address correctness and preparing message for /// parsing for `ft_on_transfer` message parsing with correct and validated data. + /// + /// # Errors + /// + /// Will return an error if the message has wrong format. pub fn parse_event_message_and_prepare_token_message_data( message: &str, fee: Fee, - ) -> Result { + ) -> Result { let data: Vec<_> = message.split(':').collect(); // Data array can contain 1 or 2 elements if data.len() >= 3 { return Err(error::ParseEventMessageError::TooManyParts); } - let account_id = AccountId::try_from(data[0].to_string()) + let account_id = data[0] + .parse() .map_err(|_| error::ParseEventMessageError::InvalidAccount)?; // If data array contain only one element it should return NEAR account id if data.len() == 1 { - Ok(TokenMessageData::Near(account_id)) + Ok(Self::Near(account_id)) } else { let raw_message = data[1].into(); let message = FtTransferMessageData::prepare_message_for_on_transfer( @@ -160,7 +169,7 @@ impl TokenMessageData { raw_message, )?; - Ok(TokenMessageData::Eth { + Ok(Self::Eth { receiver_id: account_id, message, }) @@ -168,6 +177,7 @@ impl TokenMessageData { } // Get recipient account id from Eth part of Token message data + #[must_use] pub fn get_recipient(&self) -> AccountId { match self { Self::Near(acc) => acc.clone(), @@ -188,6 +198,10 @@ pub struct EthEvent { #[allow(dead_code)] impl EthEvent { /// Get Ethereum event from `log_entry_data` + /// + /// # Errors + /// + /// Will return an error if the data has wrong format. pub fn fetch_log_entry_data( name: &str, params: EventParams, @@ -228,6 +242,7 @@ pub struct DepositedEvent { impl DepositedEvent { #[allow(dead_code)] + #[must_use] pub fn event_params() -> EventParams { vec![ EventParam { @@ -254,6 +269,10 @@ impl DepositedEvent { } /// Parses raw Ethereum logs proof's entry data + /// + /// # Errors + /// + /// Will return an error if the data has wrong format. pub fn from_log_entry_data(data: &[u8]) -> Result { let event = EthEvent::fetch_log_entry_data(DEPOSITED_EVENT, Self::event_params(), data) .map_err(error::ParseError::LogParseFailed)?; @@ -301,8 +320,8 @@ impl DepositedEvent { } pub mod error { - use super::*; use crate::errors; + use aurora_engine_types::types::address::error::AddressError; #[derive(Debug)] pub enum DecodeError { diff --git a/eth-connector/src/lib.rs b/eth-connector/src/lib.rs index 304c5e8..d83ceed 100644 --- a/eth-connector/src/lib.rs +++ b/eth-connector/src/lib.rs @@ -1,8 +1,9 @@ +#![deny(clippy::pedantic, clippy::nursery)] +#![allow(clippy::module_name_repetitions)] use crate::admin_controlled::{AdminControlled, PausedMask, PAUSE_WITHDRAW, UNPAUSE_ALL}; use crate::connector::{ - ConnectorDeposit, ConnectorFundsFinish, ConnectorWithdraw, EngineConnectorWithdraw, - EngineFungibleToken, EngineStorageManagement, FungibleTokeStatistic, - KnownEngineAccountsManagement, + Deposit, EngineConnectorWithdraw, EngineFungibleToken, EngineStorageManagement, FundsFinish, + FungibleTokenStatistic, KnownEngineAccountsManagement, Withdraw, }; use crate::connector_impl::{ EthConnector, FinishDepositCallArgs, TransferCallCallArgs, WithdrawResult, @@ -67,12 +68,12 @@ enum StorageKey { } impl EthConnectorContract { - /// Mint nETH tokens - fn mint_eth_on_near(&mut self, owner_id: AccountId, amount: Balance) { + /// Mint `nETH` tokens + fn mint_eth_on_near(&mut self, owner_id: &AccountId, amount: Balance) { crate::log!("Mint {} nETH tokens for: {}", amount, owner_id); // Create account to avoid panic with deposit - self.register_if_not_exists(&owner_id); - self.ft.internal_deposit(&owner_id, amount) + self.register_if_not_exists(owner_id); + self.ft.internal_deposit(owner_id, amount); } /// Record used proof as hash key @@ -123,14 +124,10 @@ impl EthConnectorContract { let _ = FtTransferMessageData::parse_on_transfer_message(&msg).sdk_unwrap(); } - // Special case, we do not fail if `sender_id = receiver_id` + // Special case, we do not fail if `sender_id == receiver_id` // if `predecessor_account_id` call `ft_transfer_call` as receiver itself // to call `ft_on_transfer`. - if sender_id != receiver_id { - // It's panic if: `sender_id == receiver_id` - self.ft - .internal_transfer(&sender_id, &receiver_id, amount, memo); - } else { + if sender_id == receiver_id { // If `sender_id == receiver_id` we should verify // that sender account has sufficient account balance. // NOTE: Related to Audit AUR-11 report issue @@ -140,6 +137,9 @@ impl EthConnectorContract { ); let balance = self.ft.ft_balance_of(sender_id.clone()); require!(balance.0 >= amount, "Insufficient sender balance"); + } else { + self.ft + .internal_transfer(&sender_id, &receiver_id, amount, memo); } let receiver_gas = env::prepaid_gas() @@ -162,12 +162,13 @@ impl EthConnectorContract { #[near_bindgen] impl EthConnectorContract { #[init] + #[must_use] pub fn new( prover_account: AccountId, - eth_custodian_address: String, - metadata: FungibleTokenMetadata, + eth_custodian_address: Address, + metadata: &FungibleTokenMetadata, account_with_access_right: AccountId, - owner_id: AccountId, + owner_id: &AccountId, ) -> Self { require!(!env::state_exists(), "Already initialized"); metadata.assert_valid(); @@ -177,7 +178,7 @@ impl EthConnectorContract { let connector_data = EthConnector { prover_account, paused_mask, - eth_custodian_address: Address::decode(ð_custodian_address).unwrap(), + eth_custodian_address, account_with_access_right, owner_id: owner_id.clone(), }; @@ -188,23 +189,24 @@ impl EthConnectorContract { account_storage_usage: 0, }, connector: connector_data, - metadata: LazyOption::new(StorageKey::Metadata, Some(&metadata)), + metadata: LazyOption::new(StorageKey::Metadata, Some(metadata)), used_proofs: LookupMap::new(StorageKey::Proof), accounts_counter: 0, known_engine_accounts: vec![], }; this.register_if_not_exists(&env::current_account_id()); - this.register_if_not_exists(&owner_id); + this.register_if_not_exists(owner_id); this } #[result_serializer(borsh)] - pub fn is_used_proof(&self, #[serializer(borsh)] proof: Proof) -> bool { + pub fn is_used_proof(&self, #[serializer(borsh)] proof: &Proof) -> bool { self.is_used_event(&proof.get_key()) } #[cfg(feature = "integration-test")] #[result_serializer(borsh)] + #[must_use] pub fn verify_log_entry() -> bool { crate::log!("Call from verify_log_entry"); true @@ -220,7 +222,7 @@ impl FungibleTokenCore for EthConnectorContract { #[payable] fn ft_transfer(&mut self, receiver_id: AccountId, amount: U128, memo: Option) { self.register_if_not_exists(&receiver_id); - self.ft.ft_transfer(receiver_id, amount, memo) + self.ft.ft_transfer(receiver_id, amount, memo); } #[payable] @@ -302,7 +304,7 @@ impl KnownEngineAccountsManagement for EthConnectorContract { } } -/// Implementations used only for EngineStorageManagement +/// Implementations used only for `EngineStorageManagement` impl EthConnectorContract { fn internal_storage_balance_of(&self, account_id: &AccountId) -> Option { if self.ft.accounts.contains_key(account_id) { @@ -347,6 +349,11 @@ impl EthConnectorContract { /// we just set `sender_id` explicitly as function parameter. #[near_bindgen] impl EngineStorageManagement for EthConnectorContract { + /// Store a deposit for account. + /// + /// # Panics + /// + /// If the attached deposit is less then the balance of the smart contract. #[allow(unused_variables)] #[payable] fn engine_storage_deposit( @@ -387,18 +394,21 @@ impl EngineStorageManagement for EthConnectorContract { self.assert_access_right().sdk_unwrap(); assert_one_yocto(); let predecessor_account_id = sender_id; - if let Some(storage_balance) = self.internal_storage_balance_of(&predecessor_account_id) { - match amount { - Some(amount) if amount.0 > 0 => { - env::panic_str("The amount is greater than the available storage balance"); - } - _ => storage_balance, - } - } else { - env::panic_str( - format!("The account {} is not registered", &predecessor_account_id).as_str(), - ); - } + self.internal_storage_balance_of(&predecessor_account_id) + .map_or_else( + || { + env::panic_str( + format!("The account {} is not registered", &predecessor_account_id) + .as_str(), + ); + }, + |storage_balance| match amount { + Some(amount) if amount.0 > 0 => { + env::panic_str("The amount is greater than the available storage balance"); + } + _ => storage_balance, + }, + ) } #[payable] @@ -439,7 +449,7 @@ impl FungibleTokenMetadataProvider for EthConnectorContract { } #[near_bindgen] -impl FungibleTokeStatistic for EthConnectorContract { +impl FungibleTokenStatistic for EthConnectorContract { #[result_serializer(borsh)] fn get_accounts_counter(&self) -> U64 { self.accounts_counter.into() @@ -455,12 +465,12 @@ impl AdminControlled for EthConnectorContract { fn set_paused_flags(&mut self, #[serializer(borsh)] paused: PausedMask) { self.connector.assert_owner_access_right().sdk_unwrap(); - self.connector.set_paused_flags(paused) + self.connector.set_paused_flags(paused); } fn set_access_right(&mut self, account: &AccountId) { self.connector.assert_owner_access_right().sdk_unwrap(); - self.connector.set_access_right(account) + self.connector.set_access_right(account); } fn get_access_right(&self) -> AccountId { @@ -473,7 +483,7 @@ impl AdminControlled for EthConnectorContract { } #[near_bindgen] -impl ConnectorWithdraw for EthConnectorContract { +impl Withdraw for EthConnectorContract { #[payable] #[result_serializer(borsh)] fn withdraw( @@ -527,14 +537,14 @@ impl EngineConnectorWithdraw for EthConnectorContract { } #[near_bindgen] -impl ConnectorDeposit for EthConnectorContract { +impl Deposit for EthConnectorContract { fn deposit(&mut self, #[serializer(borsh)] raw_proof: Proof) -> Promise { - self.connector.deposit(raw_proof) + self.connector.deposit(&raw_proof) } } #[near_bindgen] -impl ConnectorFundsFinish for EthConnectorContract { +impl FundsFinish for EthConnectorContract { #[private] fn finish_deposit( &mut self, @@ -549,46 +559,43 @@ impl ConnectorFundsFinish for EthConnectorContract { crate::log!("Finish deposit with the amount: {}", deposit_call.amount); + // Mint - calculate new balances + self.mint_eth_on_near(&deposit_call.new_owner_id, deposit_call.amount); + // Store proof only after `mint` calculations + self.record_proof(deposit_call.proof_key).sdk_unwrap(); + // Mint tokens to recipient minus fee - if let Some(msg) = deposit_call.msg { - // Mint - calculate new balances - self.mint_eth_on_near(deposit_call.new_owner_id, deposit_call.amount); - // Store proof only after `mint` calculations - self.record_proof(deposit_call.proof_key).sdk_unwrap(); - - let data: TransferCallCallArgs = TransferCallCallArgs::try_from_slice(&msg) - .map_err(|_| crate::errors::ERR_BORSH_DESERIALIZE) - .sdk_unwrap(); - let promise = self.internal_ft_transfer_call( - env::predecessor_account_id(), - data.receiver_id, - data.amount.into(), - data.memo, - data.msg, - ); - match promise { - PromiseOrValue::Promise(p) => PromiseOrValue::Promise(p), - PromiseOrValue::Value(v) => PromiseOrValue::Value(Some(v)), - } - } else { - // Mint - calculate new balances - self.mint_eth_on_near(deposit_call.new_owner_id.clone(), deposit_call.amount); - // Store proof only after `mint` calculations - self.record_proof(deposit_call.proof_key).sdk_unwrap(); - PromiseOrValue::Value(None) - } + deposit_call.msg.map_or_else( + || PromiseOrValue::Value(None), + |msg| { + let data: TransferCallCallArgs = TransferCallCallArgs::try_from_slice(&msg) + .map_err(|_| crate::errors::ERR_BORSH_DESERIALIZE) + .sdk_unwrap(); + let promise = self.internal_ft_transfer_call( + env::predecessor_account_id(), + data.receiver_id, + data.amount.into(), + data.memo, + data.msg, + ); + match promise { + PromiseOrValue::Promise(p) => PromiseOrValue::Promise(p), + PromiseOrValue::Value(v) => PromiseOrValue::Value(Some(v)), + } + }, + ) } } #[cfg(feature = "migration")] -use crate::migration::{Migration, MigrationCheckResult, MigrationInputData}; +use crate::migration::{CheckResult, InputData, Migration}; #[cfg(feature = "migration")] #[near_bindgen] impl Migration for EthConnectorContract { /// Migrate contract data #[private] - fn migrate(&mut self, #[serializer(borsh)] data: MigrationInputData) { + fn migrate(&mut self, #[serializer(borsh)] data: InputData) { // Insert account for (account, amount) in &data.accounts { self.ft.accounts.insert(account, amount); @@ -630,30 +637,28 @@ impl Migration for EthConnectorContract { } #[result_serializer(borsh)] - fn check_migration_correctness( - &self, - #[serializer(borsh)] data: MigrationInputData, - ) -> MigrationCheckResult { + fn check_migration_correctness(&self, #[serializer(borsh)] data: InputData) -> CheckResult { use std::collections::HashMap; // Check accounts let mut accounts_not_found: Vec = vec![]; - let mut accounts_with_amount_not_found: HashMap = HashMap::new(); + let mut accounts_with_amount_not_found = HashMap::new(); + for (account, amount) in &data.accounts { - match self.ft.accounts.get(account) { - Some(ref value) => { + self.ft.accounts.get(account).as_ref().map_or_else( + || accounts_not_found.push(account.clone()), + |value| { if value != amount { accounts_with_amount_not_found.insert(account.clone(), *value); } - } - _ => accounts_not_found.push(account.clone()), - } + }, + ); } if !accounts_not_found.is_empty() { - return MigrationCheckResult::AccountNotExist(accounts_not_found); + return CheckResult::AccountNotExist(accounts_not_found); } if !accounts_with_amount_not_found.is_empty() { - return MigrationCheckResult::AccountAmount(accounts_with_amount_not_found); + return CheckResult::AccountAmount(accounts_with_amount_not_found); } // Check proofs @@ -665,26 +670,26 @@ impl Migration for EthConnectorContract { } } if !proofs_not_found.is_empty() { - return MigrationCheckResult::Proof(proofs_not_found); + return CheckResult::Proof(proofs_not_found); } if let Some(account_storage_usage) = data.account_storage_usage { if self.ft.account_storage_usage != account_storage_usage { - return MigrationCheckResult::StorageUsage(self.ft.account_storage_usage); + return CheckResult::StorageUsage(self.ft.account_storage_usage); } } if let Some(total_supply) = data.total_supply { if self.ft.total_supply != total_supply { - return MigrationCheckResult::TotalSupply(self.ft.total_supply); + return CheckResult::TotalSupply(self.ft.total_supply); } } if let Some(statistics_aurora_accounts_counter) = data.statistics_aurora_accounts_counter { if self.accounts_counter != statistics_aurora_accounts_counter { - return MigrationCheckResult::StatisticsCounter(self.accounts_counter); + return CheckResult::StatisticsCounter(self.accounts_counter); } } - MigrationCheckResult::Success + CheckResult::Success } } @@ -723,7 +728,7 @@ mod tests { fn create_contract() -> EthConnectorContract { let prover_account = "prover.near".parse().unwrap(); - let eth_custodian_address = Address::from_array([0xab; 20]).encode(); + let eth_custodian_address = Address::from_array([0xab; 20]); let metadata = FungibleTokenMetadata { spec: FT_METADATA_SPEC.to_string(), name: "Ether".to_string(), @@ -738,9 +743,9 @@ mod tests { EthConnectorContract::new( prover_account, eth_custodian_address, - metadata, + &metadata, account_with_access_right, - owner_id, + &owner_id, ) } } diff --git a/eth-connector/src/log_entry.rs b/eth-connector/src/log_entry.rs index c8635b0..94233e4 100644 --- a/eth-connector/src/log_entry.rs +++ b/eth-connector/src/log_entry.rs @@ -9,18 +9,19 @@ pub struct LogEntry { impl rlp::Decodable for LogEntry { fn decode(rlp: &rlp::Rlp) -> Result { - let result = LogEntry { - address: rlp.val_at(0usize)?, - topics: rlp.list_at(1usize)?, - data: rlp.val_at(2usize)?, + let result = Self { + address: rlp.val_at(0)?, + topics: rlp.list_at(1)?, + data: rlp.val_at(2)?, }; + Ok(result) } } impl rlp::Encodable for LogEntry { fn rlp_append(&self, stream: &mut rlp::RlpStream) { - stream.begin_list(3usize); + stream.begin_list(3); stream.append(&self.address); stream.append_list::(&self.topics); stream.append(&self.data); diff --git a/eth-connector/src/migration.rs b/eth-connector/src/migration.rs index fc42a5b..124b57f 100644 --- a/eth-connector/src/migration.rs +++ b/eth-connector/src/migration.rs @@ -3,7 +3,7 @@ use near_sdk::{ext_contract, AccountId, Balance, StorageUsage}; use std::collections::HashMap; #[derive(BorshDeserialize, BorshSerialize)] -pub struct MigrationInputData { +pub struct InputData { pub accounts: HashMap, pub total_supply: Option, pub account_storage_usage: Option, @@ -12,7 +12,7 @@ pub struct MigrationInputData { } #[derive(Debug, BorshSerialize, BorshDeserialize, Eq, PartialEq)] -pub enum MigrationCheckResult { +pub enum CheckResult { Success, AccountNotExist(Vec), AccountAmount(HashMap), @@ -24,11 +24,8 @@ pub enum MigrationCheckResult { #[ext_contract(ext_deposit)] pub trait Migration { - fn migrate(&mut self, #[serializer(borsh)] data: MigrationInputData); + fn migrate(&mut self, #[serializer(borsh)] data: InputData); #[result_serializer(borsh)] - fn check_migration_correctness( - &self, - #[serializer(borsh)] data: MigrationInputData, - ) -> MigrationCheckResult; + fn check_migration_correctness(&self, #[serializer(borsh)] data: InputData) -> CheckResult; } diff --git a/eth-connector/src/proof.rs b/eth-connector/src/proof.rs index e05682b..da80b1a 100644 --- a/eth-connector/src/proof.rs +++ b/eth-connector/src/proof.rs @@ -13,6 +13,7 @@ pub struct Proof { } impl Proof { + #[must_use] pub fn get_key(&self) -> String { let mut data = self .log_index @@ -28,7 +29,7 @@ impl Proof { data.extend_from_slice(&self.header_data); near_sdk::env::sha256(&data) .iter() - .map(|n| n.to_string()) + .map(ToString::to_string) .collect() } } @@ -40,7 +41,7 @@ mod tests { #[test] fn test_proof_key() { check_proof_key( - Proof { + &Proof { log_index: 1, receipt_index: 1, ..Default::default() @@ -48,7 +49,7 @@ mod tests { "1297721518512077871939115641114233180253108247225100248224214775219368216419218177247", ); check_proof_key( - Proof { + &Proof { log_index: 1, receipt_index: 1, header_data: vec![17, 99, 173, 233, 9, 0, 68, 10, 7, 20, 71, 10], @@ -59,7 +60,7 @@ mod tests { } #[track_caller] - fn check_proof_key(proof: Proof, expected_key: &str) { + fn check_proof_key(proof: &Proof, expected_key: &str) { let actual_key = proof.get_key(); assert_eq!(expected_key, actual_key); } diff --git a/eth-connector/src/types.rs b/eth-connector/src/types.rs index 4fb6eef..5ff3bd1 100644 --- a/eth-connector/src/types.rs +++ b/eth-connector/src/types.rs @@ -8,9 +8,9 @@ macro_rules! log { }; } -/// Panic with error dat argument +/// Panic with the message from the error argument. pub fn panic_err>(err: E) -> ! { - panic_str(&String::from_utf8(err.as_ref().to_vec()).unwrap()) + panic_str(&String::from_utf8_lossy(err.as_ref())) } pub trait SdkExpect { @@ -19,19 +19,13 @@ pub trait SdkExpect { impl SdkExpect for Option { fn sdk_expect(self, msg: &str) -> T { - match self { - Some(t) => t, - None => panic_str(msg), - } + self.unwrap_or_else(|| panic_str(msg)) } } -impl SdkExpect for core::result::Result { +impl SdkExpect for Result { fn sdk_expect(self, msg: &str) -> T { - match self { - Ok(t) => t, - Err(_) => panic_str(msg), - } + self.unwrap_or_else(|_| panic_str(msg)) } } @@ -41,18 +35,12 @@ pub trait SdkUnwrap { impl SdkUnwrap for Option { fn sdk_unwrap(self) -> T { - match self { - Some(t) => t, - None => panic_str("ERR_UNWRAP"), - } + self.unwrap_or_else(|| panic_str("ERR_UNWRAP")) } } -impl> SdkUnwrap for core::result::Result { +impl> SdkUnwrap for Result { fn sdk_unwrap(self) -> T { - match self { - Ok(t) => t, - Err(e) => panic_str(&String::from_utf8(e.as_ref().to_vec()).unwrap()), - } + self.unwrap_or_else(|e| panic_str(&String::from_utf8_lossy(e.as_ref()))) } }