From 6594d1636e8a4fe6df8dbd8326f7d2d19772a5af Mon Sep 17 00:00:00 2001 From: James Wilson Date: Wed, 1 Nov 2023 09:30:47 +0000 Subject: [PATCH] Update dependencies and get things compiling/passing CI again. (#115) * update deps and cargo check --all-targets working * Get compiling with scale-value and scale-decode * fix desub-current tests * clippy and fmt * workspace-ify all library deps. clap instead of structopt * fmt * doc --- Cargo.lock | 3961 +++++++++++------- Cargo.toml | 47 + bin/tx-decoder/Cargo.toml | 24 +- bin/tx-decoder/src/app.rs | 11 +- bin/v14-test/Cargo.toml | 20 +- bin/v14-test/src/main.rs | 7 +- desub-common/Cargo.toml | 22 +- desub-current/Cargo.toml | 46 +- desub-current/src/decoder/decode_storage.rs | 19 +- desub-current/src/decoder/decode_value.rs | 461 -- desub-current/src/decoder/extrinsic_bytes.rs | 4 +- desub-current/src/decoder/mod.rs | 44 +- desub-current/src/lib.rs | 8 +- desub-current/src/metadata/mod.rs | 12 +- desub-current/src/metadata/version_14.rs | 11 +- desub-current/src/type_id.rs | 51 - desub-current/src/value/deserialize.rs | 669 --- desub-current/src/value/deserializer.rs | 1361 ------ desub-current/src/value/mod.rs | 298 -- desub-current/src/value/serialize.rs | 190 - desub-current/tests/decode_extrinsics.rs | 66 +- desub-current/tests/decode_storage.rs | 30 +- desub-json-resolver/Cargo.toml | 32 +- desub-json-resolver/src/extrinsics.rs | 2 +- desub-json-resolver/src/modules.rs | 6 +- desub-legacy/Cargo.toml | 49 +- desub-legacy/src/decoder.rs | 8 +- desub-legacy/src/decoder/extrinsics.rs | 2 +- desub-legacy/src/decoder/metadata.rs | 8 +- desub-legacy/src/decoder/storage.rs | 2 +- desub-legacy/src/error.rs | 2 +- desub-legacy/src/regex.rs | 22 +- desub-legacy/src/substrate_types.rs | 21 +- desub-legacy/src/substrate_types/data.rs | 10 +- desub-legacy/src/test_suite.rs | 3 +- desub-legacy/src/util.rs | 2 +- desub/Cargo.toml | 37 +- desub/src/error.rs | 2 +- desub/src/lib.rs | 4 +- integration-tests/Cargo.toml | 44 +- integration-tests/tests/storage.rs | 2 +- 41 files changed, 2802 insertions(+), 4818 deletions(-) delete mode 100644 desub-current/src/decoder/decode_value.rs delete mode 100644 desub-current/src/type_id.rs delete mode 100644 desub-current/src/value/deserialize.rs delete mode 100644 desub-current/src/value/deserializer.rs delete mode 100644 desub-current/src/value/mod.rs delete mode 100644 desub-current/src/value/serialize.rs diff --git a/Cargo.lock b/Cargo.lock index 7a6692b8..caba5e70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,11 +14,20 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli", + "gimli 0.27.3", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli 0.28.0", ] [[package]] @@ -29,31 +38,50 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +dependencies = [ + "getrandom 0.2.10", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ - "getrandom 0.2.3", + "cfg-if", + "getrandom 0.2.10", "once_cell", "version_check", + "zerocopy", ] [[package]] name = "aho-corasick" -version = "0.7.18" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] [[package]] -name = "ansi_term" -version = "0.11.0" +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ - "winapi", + "libc", ] [[package]] @@ -65,26 +93,88 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +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 = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" -version = "1.0.45" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "approx" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072df7202e63b127ab55acfe16ce97013d5b97bf160489336d3f1840fd78e99e" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" dependencies = [ "num-traits", ] +[[package]] +name = "aquamarine" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df752953c49ce90719c7bf1fc587bc8227aed04732ea0c0f85e5397d7fdbd1a1" +dependencies = [ + "include_dir", + "itertools", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "argh" -version = "0.1.6" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f023c76cd7975f9969f8e29f0e461decbdc7f51048ce43427107a3d192f1c9bf" +checksum = "7af5ba06967ff7214ce4c7419c7d185be7ecd6cc4965a8f6e1d8ce0398aad219" dependencies = [ "argh_derive", "argh_shared", @@ -92,37 +182,36 @@ dependencies = [ [[package]] name = "argh_derive" -version = "0.1.6" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ad219abc0c06ca788aface2e3a1970587e3413ab70acd20e54b6ec524c1f8f" +checksum = "56df0aeedf6b7a2fc67d06db35b09684c3e8da0c95f8f27685cb17e08413d87a" dependencies = [ "argh_shared", - "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "argh_shared" -version = "0.1.6" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38de00daab4eac7d753e97697066238d67ce9d7e2d823ab4f72fe14af29f3f33" +checksum = "5693f39141bda5760ecc4111ab08da40565d1771038c4a0250f03457ec707531" +dependencies = [ + "serde", +] [[package]] -name = "arrayref" -version = "0.3.6" +name = "array-bytes" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "d9b1c5a481ec30a5abd8dfbd94ab5cf1bb4e9a66be7f1b3b322f2f1170c200fd" [[package]] -name = "arrayvec" -version = "0.4.12" +name = "arrayref" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" @@ -132,9 +221,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "async-attributes" @@ -143,102 +232,113 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "async-channel" -version = "1.6.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] [[package]] name = "async-executor" -version = "1.4.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" dependencies = [ + "async-lock", "async-task", "concurrent-queue", - "fastrand", + "fastrand 2.0.1", "futures-lite", - "once_cell", "slab", ] [[package]] name = "async-global-executor" -version = "2.0.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" dependencies = [ "async-channel", "async-executor", - "async-io", - "async-mutex", + "async-io 1.13.0", + "async-lock", "blocking", "futures-lite", - "num_cpus", "once_cell", ] [[package]] name = "async-io" -version = "1.6.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ + "async-lock", + "autocfg", + "cfg-if", "concurrent-queue", "futures-lite", - "libc", "log", - "once_cell", "parking", - "polling", + "polling 2.8.0", + "rustix 0.37.27", "slab", "socket2", "waker-fn", - "winapi", ] [[package]] -name = "async-lock" -version = "2.4.0" +name = "async-io" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" +checksum = "10da8f3146014722c89e7859e1d7bb97873125d7346d10ca642ffab794355828" dependencies = [ - "event-listener", + "async-lock", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling 3.3.0", + "rustix 0.38.21", + "slab", + "tracing", + "waker-fn", + "windows-sys 0.48.0", ] [[package]] -name = "async-mutex" -version = "1.4.0" +name = "async-lock" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ - "event-listener", + "event-listener 2.5.3", ] [[package]] name = "async-process" -version = "1.3.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6" +checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" dependencies = [ - "async-io", + "async-io 1.13.0", + "async-lock", + "async-signal", "blocking", "cfg-if", - "event-listener", + "event-listener 3.0.1", "futures-lite", - "libc", - "once_cell", - "signal-hook", - "winapi", + "rustix 0.38.21", + "windows-sys 0.48.0", ] [[package]] @@ -252,16 +352,34 @@ dependencies = [ "webpki", ] +[[package]] +name = "async-signal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" +dependencies = [ + "async-io 2.1.0", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 0.38.21", + "signal-hook-registry", + "slab", + "windows-sys 0.48.0", +] + [[package]] name = "async-std" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8056f1455169ab86dd47b47391e4ab0cbd25410a70e9fe675544f49bafaf952" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ "async-attributes", "async-channel", "async-global-executor", - "async-io", + "async-io 1.13.0", "async-lock", "async-process", "crossbeam-utils", @@ -273,7 +391,6 @@ dependencies = [ "kv-log-macro", "log", "memchr", - "num_cpus", "once_cell", "pin-project-lite", "pin-utils", @@ -283,40 +400,41 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" dependencies = [ "async-stream-impl", "futures-core", + "pin-project-lite", ] [[package]] name = "async-stream-impl" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "async-task" -version = "4.0.3" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" +checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" [[package]] name = "async-trait" -version = "0.1.51" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] @@ -330,9 +448,9 @@ dependencies = [ [[package]] name = "atomic-waker" -version = "1.0.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "atty" @@ -340,32 +458,38 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.63" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line", + "addr2line 0.21.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.32.1", "rustc-demangle", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base58" version = "0.2.0" @@ -374,31 +498,23 @@ checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] -name = "bindgen" -version = "0.56.0" +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bincode" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "clap", - "env_logger 0.8.4", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "which", + "serde", ] [[package]] @@ -407,11 +523,17 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "bitvec" -version = "0.20.4" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", @@ -421,12 +543,22 @@ dependencies = [ ] [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "blake2b_simd" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" dependencies = [ - "arrayvec 0.4.12", + "arrayref", + "arrayvec 0.7.4", "constant_time_eq", ] @@ -448,7 +580,16 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.7", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array 0.14.7", ] [[package]] @@ -462,29 +603,52 @@ dependencies = [ [[package]] name = "blocking" -version = "1.1.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046e47d4b2d391b1f6f8b407b1deb8dee56c1852ccd868becf2710f601b5f427" +checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" dependencies = [ "async-channel", + "async-lock", "async-task", - "atomic-waker", - "fastrand", + "fastrand 2.0.1", + "futures-io", "futures-lite", - "once_cell", + "piper", + "tracing", +] + +[[package]] +name = "bounded-collections" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca548b6163b872067dc5eb82fd130c56881435e30367d2073594a3d9744120dd" +dependencies = [ + "log", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "tinyvec", ] [[package]] name = "bumpalo" -version = "3.8.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byte-slice-cast" -version = "1.2.0" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d30c751592b77c499e7bce34d99d67c2c11bdc0574e9a488ddade14150a4698" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-tools" @@ -493,36 +657,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] -name = "byteorder" -version = "1.4.3" +name = "bytemuck" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] -name = "bytes" -version = "1.1.0" +name = "byteorder" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] -name = "cache-padded" -version = "1.1.1" +name = "bytes" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.72" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] -name = "cexpr" -version = "0.4.0" +name = "cfg-expr" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" +checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" dependencies = [ - "nom 5.1.2", + "smallvec", ] [[package]] @@ -533,91 +700,142 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ - "libc", - "num-integer", + "android-tzdata", + "iana-time-zone", "num-traits", - "winapi", + "windows-targets 0.48.5", ] [[package]] -name = "clang-sys" -version = "1.3.0" +name = "clap" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa66045b9cb23c2e9c1520732030608b02ee07e5cfaa5a521ec15ded7fa24c90" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ - "glob", - "libc", - "libloading", + "clap_builder", + "clap_derive", ] [[package]] -name = "clap" -version = "2.33.3" +name = "clap_builder" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ - "ansi_term 0.11.0", - "atty", - "bitflags", + "anstream", + "anstyle", + "clap_lex", "strsim", - "textwrap", - "unicode-width", - "vec_map", ] +[[package]] +name = "clap_derive" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "clap_lex" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "colored" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" +checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" dependencies = [ - "atty", + "is-terminal", "lazy_static", "winapi", ] [[package]] name = "colored" -version = "2.0.0" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" dependencies = [ - "atty", + "is-terminal", "lazy_static", - "winapi", + "windows-sys 0.48.0", ] +[[package]] +name = "common-path" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" + [[package]] name = "concurrent-queue" -version = "1.2.2" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" dependencies = [ - "cache-padded", + "crossbeam-utils", ] [[package]] name = "console" -version = "0.15.0" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28b32d32ca44b70c3e4acd7db1babf555fa026e385fb95f18028f88848b3c31" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" dependencies = [ "encode_unicode", + "lazy_static", "libc", - "once_cell", - "terminal_size", - "winapi", + "windows-sys 0.45.0", ] [[package]] -name = "constant_time_eq" -version = "0.1.5" +name = "const-oid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" + +[[package]] +name = "const-random" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11df32a13d7892ec42d51d3d175faba5211ffe13ed25d4fb348ac9e9ce835593" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.10", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "constant_time_eq" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "convert_case" @@ -625,15 +843,39 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] +[[package]] +name = "cranelift-entity" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" +dependencies = [ + "serde", +] + [[package]] name = "crc" version = "2.1.0" @@ -650,20 +892,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" [[package]] -name = "crossbeam-channel" -version = "0.5.1" +name = "crc32fast" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if", - "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -672,22 +913,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ + "autocfg", "cfg-if", "crossbeam-utils", - "lazy_static", - "memoffset", + "memoffset 0.9.0", "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.2" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b10ddc024425c88c2ad148c1b0fd53f4c6d38db9697c9f1588381212fa657c9" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ "cfg-if", "crossbeam-utils", @@ -695,12 +936,11 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.5" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", - "lazy_static", ] [[package]] @@ -710,33 +950,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-mac" -version = "0.8.0" +name = "crypto-bigint" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.7", + "rand_core 0.6.4", "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.7", + "typenum", ] [[package]] name = "crypto-mac" -version = "0.11.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.7", "subtle", ] [[package]] -name = "ctor" -version = "0.1.21" +name = "crypto-mac" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "quote", - "syn", + "generic-array 0.14.7", + "subtle", ] [[package]] @@ -765,17 +1017,100 @@ dependencies = [ "zeroize", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_more" -version = "0.99.16" +version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version", - "syn", + "syn 1.0.109", ] [[package]] @@ -786,7 +1121,7 @@ dependencies = [ "desub-current", "desub-json-resolver", "desub-legacy", - "frame-metadata", + "frame-metadata 16.0.0", "parity-scale-codec", "serde_json", "thiserror", @@ -797,8 +1132,8 @@ name = "desub-common" version = "0.1.0" dependencies = [ "serde", - "sp-core 4.0.0", - "sp-runtime 4.0.0", + "sp-core", + "sp-runtime", ] [[package]] @@ -808,22 +1143,24 @@ dependencies = [ "bitvec", "derive_more", "desub-common", - "frame-metadata", + "frame-metadata 16.0.0", "hex", "log", "parity-scale-codec", + "scale-decode", "scale-info", + "scale-value", "serde", "serde_json", - "sp-core 4.0.0", + "sp-core", "sp-keyring", - "sp-runtime 4.0.0", + "sp-runtime", "thiserror", ] [[package]] name = "desub-json-resolver" -version = "0.0.1" +version = "0.1.0" dependencies = [ "desub-legacy", "log", @@ -831,7 +1168,7 @@ dependencies = [ "phf", "serde", "serde_json", - "syn", + "syn 2.0.38", "thiserror", ] @@ -843,7 +1180,7 @@ dependencies = [ "derive_more", "desub-common", "dyn-clone", - "frame-metadata", + "frame-metadata 16.0.0", "hex", "log", "onig", @@ -851,9 +1188,9 @@ dependencies = [ "pretty_env_logger", "serde", "serde_json", - "sp-core 4.0.0", - "sp-runtime 4.0.0", - "sp-version 4.0.0", + "sp-core", + "sp-runtime", + "sp-version", "thiserror", ] @@ -872,23 +1209,35 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.7", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "const-oid", + "crypto-common", + "subtle", ] [[package]] name = "dirs" -version = "3.0.2" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", @@ -896,16 +1245,37 @@ dependencies = [ ] [[package]] -name = "dotenv" -version = "0.15.0" +name = "docify" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" +checksum = "4235e9b248e2ba4b92007fe9c646f3adf0ffde16dc74713eacc92b8bc58d8d2f" +dependencies = [ + "docify_macros", +] [[package]] -name = "downcast-rs" -version = "1.2.0" +name = "docify_macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47020e12d7c7505670d1363dd53d6c23724f71a90a3ae32ff8eba40de8404626" +dependencies = [ + "common-path", + "derive-syn-parse", + "once_cell", + "proc-macro2", + "quote", + "regex", + "syn 2.0.38", + "termcolor", + "toml", + "walkdir", +] + +[[package]] +name = "dotenv" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "dyn-clonable" @@ -925,47 +1295,91 @@ checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "dyn-clone" -version = "1.0.4" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" + +[[package]] +name = "ecdsa" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] [[package]] name = "ed25519" -version = "1.2.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4620d40f6d2601794401d6dd95a5cf69b6c157852539470eeda433a99b3c0efc" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "signature", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek 4.1.1", "ed25519", - "rand 0.7.3", - "serde", - "sha2 0.9.8", + "sha2 0.10.8", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", "zeroize", ] [[package]] name = "either" -version = "1.6.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" dependencies = [ "serde", ] +[[package]] +name = "elliptic-curve" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array 0.14.7", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "encode_unicode" version = "0.3.6" @@ -979,36 +1393,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", - "humantime 1.3.0", + "humantime", "log", "regex", "termcolor", ] [[package]] -name = "env_logger" -version = "0.8.4" +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "atty", - "humantime 2.1.0", - "log", - "regex", - "termcolor", + "libc", + "windows-sys 0.48.0", ] [[package]] -name = "environmental" -version = "1.1.3" +name = "event-listener" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "2.5.1" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cec0252c2afff729ee6f00e903d479fba81784c8e2bd77447673471fdfaea1" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "expander" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" +checksum = "5f86a749cf851891866c10515ef6c299b5c69661465e9c3bbe7e07a2b77fb0f7" +dependencies = [ + "blake2", + "fs-err", + "proc-macro2", + "quote", + "syn 2.0.38", +] [[package]] name = "fake-simd" @@ -1016,170 +1457,256 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + [[package]] name = "fastrand" -version = "1.5.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + [[package]] name = "fern" -version = "0.6.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9a4820f0ccc8a7afd67c39a0f1a0f4b07ca1725164271a64939d7aeb9af065" +checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee" dependencies = [ - "colored 1.9.3", + "colored 1.9.4", "log", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a481586acf778f1b1455424c343f71124b048ffa5f4fc3f8f6ae9dc432dcb3c7" + +[[package]] +name = "finl_unicode" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" + [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand 0.8.4", + "rand 0.8.5", "rustc-hex", "static_assertions", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ - "matches", "percent-encoding", ] [[package]] name = "frame-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01af5751a0e4492dc979c57586976403e7ab63641add1a9fd804cad4169f4f6" dependencies = [ "frame-support", + "frame-support-procedural", "frame-system", "linregress", "log", "parity-scale-codec", "paste", "scale-info", + "serde", "sp-api", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-storage 4.0.0-dev", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-runtime-interface", + "sp-std", + "sp-storage", + "static_assertions", ] [[package]] name = "frame-metadata" -version = "14.2.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ed5e5c346de62ca5c184b4325a6600d1eaca210666e4606fe4e449574978d0" +checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" dependencies = [ "cfg-if", "parity-scale-codec", "scale-info", - "serde", ] [[package]] -name = "frame-support" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +name = "frame-metadata" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" dependencies = [ - "bitflags", - "frame-metadata", + "cfg-if", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "frame-support" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0dc5640279221fbd316a3a652963c1cb9d51630ea3f62a08a5ad7fa402f23a4" +dependencies = [ + "aquamarine", + "bitflags 1.3.2", + "docify", + "environmental", + "frame-metadata 16.0.0", "frame-support-procedural", "impl-trait-for-tuples", + "k256", "log", - "once_cell", + "macro_magic", "parity-scale-codec", "paste", "scale-info", "serde", + "serde_json", "smallvec", - "sp-arithmetic 4.0.0-dev", - "sp-core 4.0.0-dev", + "sp-api", + "sp-arithmetic", + "sp-core", "sp-core-hashing-proc-macro", + "sp-debug-derive", + "sp-genesis-builder", "sp-inherents", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-io", + "sp-metadata-ir", + "sp-runtime", "sp-staking", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", - "sp-tracing 4.0.0-dev", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-weights", + "static_assertions", "tt-call", ] [[package]] name = "frame-support-procedural" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "19.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f22719c65353a0010a084cb2040e2e6569aff34562e59119cb66ddd7ecfa588c" dependencies = [ "Inflector", + "cfg-expr", + "derive-syn-parse", + "expander", "frame-support-procedural-tools", + "itertools", + "macro_magic", + "proc-macro-warning", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "frame-support-procedural-tools" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e046ecdc04dd66f17d760525631f553ddcbea6f09423f78fcf52b47c97656cd0" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "frame-support-procedural-tools-derive" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4034ebf9ca7497fa3893191fe3e81adcd3d7cd1c232e60ef41ef58ea0c445ae9" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "frame-system" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc19d4d4037b695805385d56983da173bbb969f68e0e4e6a1240bb30118e87d7" dependencies = [ + "cfg-if", "frame-support", "log", "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-version 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-version", + "sp-weights", ] +[[package]] +name = "fs-err" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541" + [[package]] name = "funty" -version = "1.1.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.17" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -1192,9 +1719,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.17" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -1202,15 +1729,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.17" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.17" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -1220,28 +1747,28 @@ dependencies = [ [[package]] name = "futures-intrusive" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62007592ac46aa7c2b6416f7deb9a8a8f63a01e0f1d6e1787d5630170db2b63e" +checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" dependencies = [ "futures-core", "lock_api", - "parking_lot", + "parking_lot 0.11.2", ] [[package]] name = "futures-io" -version = "0.3.17" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-lite" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", @@ -1252,36 +1779,33 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.17" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ - "autocfg", - "proc-macro-hack", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "futures-sink" -version = "0.3.17" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.17" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.17" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ - "autocfg", "futures-channel", "futures-core", "futures-io", @@ -1291,8 +1815,6 @@ dependencies = [ "memchr", "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] @@ -1307,12 +1829,13 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.4" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1322,53 +1845,66 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] name = "gimli" -version = "0.26.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +dependencies = [ + "fallible-iterator", + "indexmap 1.9.3", + "stable_deref_trait", +] [[package]] -name = "glob" -version = "0.3.0" +name = "gimli" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "gloo-timers" -version = "0.2.1" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" dependencies = [ "futures-channel", "futures-core", "js-sys", "wasm-bindgen", - "web-sys", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] name = "hash-db" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" +checksum = "8e7d7786361d7425ae2fe4f9e407eb0efaa0840f5212d109cc018c40c35c6ab4" [[package]] name = "hash256-std-hasher" @@ -1385,23 +1921,47 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash", + "ahash 0.7.7", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.7", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.6", ] +[[package]] +name = "hashbrown" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" + [[package]] name = "hashlink" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" dependencies = [ - "hashbrown", + "hashbrown 0.11.2", ] [[package]] name = "heck" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" dependencies = [ "unicode-segmentation", ] @@ -1415,12 +1975,27 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hkdf" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac 0.12.1", +] + [[package]] name = "hmac" version = "0.8.1" @@ -1441,6 +2016,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -1448,7 +2032,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", - "generic-array 0.14.4", + "generic-array 0.14.7", "hmac 0.8.1", ] @@ -1462,59 +2046,111 @@ dependencies = [ ] [[package]] -name = "humantime" -version = "2.1.0" +name = "iana-time-zone" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.2.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ - "matches", "unicode-bidi", "unicode-normalization", ] [[package]] name = "impl-codec" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" dependencies = [ "parity-scale-codec", ] [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] [[package]] name = "impl-trait-for-tuples" -version = "0.2.1" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "include_dir" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" +dependencies = [ + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5dacb10c5b3bb92d46ba347505a9041e676bb20ad220101326bffb0c93031ee" +checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" dependencies = [ "proc-macro2", "quote", - "syn", ] [[package]] name = "indexmap" -version = "1.7.0" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +dependencies = [ + "equivalent", + "hashbrown 0.14.2", ] [[package]] @@ -1564,38 +2200,76 @@ dependencies = [ "pretty_env_logger", "serde", "serde_json", - "sp-core 4.0.0", + "sp-core", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.3", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi 0.3.3", + "rustix 0.38.21", + "windows-sys 0.48.0", ] [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" -version = "0.4.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2 0.10.8", +] + [[package]] name = "keccak" -version = "0.1.0" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] [[package]] name = "kv-log-macro" @@ -1612,39 +2286,17 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" -version = "0.2.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219" - -[[package]] -name = "libloading" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cf036d15402bea3c5d4de17b3fce76b3e4a56ebc1f577be0e7a72f7c607cf0" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "libm" -version = "0.2.1" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libsecp256k1" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", "base64", @@ -1653,9 +2305,9 @@ dependencies = [ "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", - "rand 0.8.4", + "rand 0.8.5", "serde", - "sha2 0.9.8", + "sha2 0.9.9", "typenum", ] @@ -1690,231 +2342,282 @@ dependencies = [ [[package]] name = "linregress" -version = "0.4.4" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c601a85f5ecd1aba625247bca0031585fb1c446461b142878a16f8245ddeb8" +checksum = "4de04dcecc58d366391f9920245b85ffa684558a5ef6e7736e754347c3aea9c2" dependencies = [ "nalgebra", - "statrs", ] +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + [[package]] name = "lock_api" -version = "0.4.5" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ + "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" dependencies = [ - "cfg-if", "value-bag", ] [[package]] -name = "matchers" -version = "0.0.1" +name = "mach" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" dependencies = [ - "regex-automata", + "libc", ] [[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - -[[package]] -name = "matrixmultiply" -version = "0.3.1" +name = "macro_magic" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a8a15b776d9dfaecd44b03c5828c2199cddff5247215858aac14624f8d6b741" +checksum = "aee866bfee30d2d7e83835a4574aad5b45adba4cc807f2a3bbba974e5d4383c9" dependencies = [ - "rawpointer", + "macro_magic_core", + "macro_magic_macros", + "quote", + "syn 2.0.38", ] [[package]] -name = "md-5" -version = "0.9.1" +name = "macro_magic_core" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" +checksum = "7e766a20fd9c72bab3e1e64ed63f36bd08410e75803813df210d1ce297d7ad00" dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", + "const-random", + "derive-syn-parse", + "macro_magic_core_macros", + "proc-macro2", + "quote", + "syn 2.0.38", ] [[package]] -name = "memchr" -version = "2.4.1" +name = "macro_magic_core_macros" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] [[package]] -name = "memoffset" -version = "0.6.4" +name = "macro_magic_macros" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" dependencies = [ - "autocfg", + "macro_magic_core", + "quote", + "syn 2.0.38", ] [[package]] -name = "memory-db" -version = "0.27.0" +name = "matchers" +version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de006e09d04fc301a5f7e817b75aa49801c4479a8af753764416b085337ddcc5" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "hash-db", - "hashbrown", - "parity-util-mem", + "regex-automata 0.1.10", ] [[package]] -name = "memory_units" -version = "0.3.0" +name = "matrixmultiply" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" +dependencies = [ + "autocfg", + "rawpointer", +] [[package]] -name = "merlin" -version = "2.0.1" +name = "md-5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", + "cfg-if", + "digest 0.10.7", ] [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "memchr" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] -name = "miniz_oxide" -version = "0.4.4" +name = "memfd" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "adler", - "autocfg", + "rustix 0.38.21", ] [[package]] -name = "nalgebra" -version = "0.27.1" +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memory-db" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" +dependencies = [ + "hash-db", +] + +[[package]] +name = "merlin" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "nalgebra" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" +checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" dependencies = [ "approx", "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.0", + "num-rational", "num-traits", - "rand 0.8.4", - "rand_distr", "simba", "typenum", ] [[package]] name = "nalgebra-macros" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" +checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - -[[package]] -name = "nom" -version = "5.1.2" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" -dependencies = [ - "memchr", - "version_check", -] +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.0" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", - "version_check", -] - -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", ] [[package]] name = "num-complex" -version = "0.4.0" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", ] [[package]] -name = "num-integer" -version = "0.1.44" +name = "num-format" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "autocfg", - "num-traits", + "arrayvec 0.7.4", + "itoa", ] [[package]] -name = "num-rational" -version = "0.2.4" +name = "num-integer" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", - "num-bigint", - "num-integer", "num-traits", ] [[package]] name = "num-rational" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-integer", @@ -1923,21 +2626,20 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", - "libm", ] [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.3", "libc", ] @@ -1949,38 +2651,49 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.27.1" +version = "0.30.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" +dependencies = [ + "crc32fast", + "hashbrown 0.13.2", + "indexmap 1.9.3", + "memchr", +] + +[[package]] +name = "object" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.8.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "onig" -version = "5.0.0" +version = "6.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e723fc996fff1aeab8f62205f3e8528bf498bdd5eadb2784d2d31f30077947" +checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" dependencies = [ - "bitflags", - "lazy_static", + "bitflags 1.3.2", "libc", + "once_cell", "onig_sys", ] [[package]] name = "onig_sys" -version = "69.7.1" +version = "69.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e" +checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7" dependencies = [ - "bindgen", "cc", "pkg-config", ] @@ -1999,8 +2712,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "pallet-balances" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c17ec19ad23b26866ad7d60cdf8b613f653db7f44232aa25009811441908e2b" dependencies = [ "frame-benchmarking", "frame-support", @@ -2008,19 +2722,20 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-runtime", + "sp-std", ] [[package]] name = "parity-scale-codec" -version = "2.3.1" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bitvec", "byte-slice-cast", + "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2028,53 +2743,27 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "2.3.1" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "parity-util-mem" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f4cb4e169446179cbc6b8b6320cc9fca49bd2e94e8db25f25f200a8ea774770" -dependencies = [ - "cfg-if", - "hashbrown", - "impl-trait-for-tuples", - "parity-util-mem-derive", - "parking_lot", - "primitive-types", - "winapi", -] - -[[package]] -name = "parity-util-mem-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" -dependencies = [ - "proc-macro2", - "syn", - "synstructure", + "syn 1.0.109", ] [[package]] name = "parity-wasm" -version = "0.42.2" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" [[package]] name = "parking" -version = "2.0.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" @@ -2084,37 +2773,51 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.9", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "winapi", ] [[package]] -name = "paste" -version = "1.0.6" +name = "parking_lot_core" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.4.1", + "smallvec", + "windows-targets 0.48.5", +] [[package]] -name = "pbkdf2" -version = "0.4.0" +name = "paste" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" -dependencies = [ - "crypto-mac 0.8.0", -] +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pbkdf2" @@ -2126,75 +2829,67 @@ dependencies = [ ] [[package]] -name = "peeking_take_while" -version = "0.1.2" +name = "pbkdf2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", +] [[package]] name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "pest" -version = "2.1.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "phf" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fc3db1018c4b59d7d582a739436478b6035138b6aecbce989fc91c3e98409f" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ "phf_macros", "phf_shared", - "proc-macro-hack", ] [[package]] name = "phf_generator" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ "phf_shared", - "rand 0.8.4", + "rand 0.8.5", ] [[package]] name = "phf_macros" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ "phf_generator", "phf_shared", - "proc-macro-hack", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "phf_shared" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ "siphasher", ] [[package]] name = "pin-project-lite" -version = "0.2.7" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2202,30 +2897,74 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.1", + "futures-io", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" -version = "0.3.22" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "platforms" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" [[package]] name = "polling" -version = "2.2.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ + "autocfg", + "bitflags 1.3.2", "cfg-if", + "concurrent-queue", "libc", "log", - "wepoll-ffi", - "winapi", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "polling" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e53b6af1f60f36f8c2ac2aad5459d75a5a9b4be1e8cdd40264f315d78193e531" +dependencies = [ + "cfg-if", + "concurrent-queue", + "pin-project-lite", + "rustix 0.38.21", + "tracing", + "windows-sys 0.48.0", ] [[package]] name = "ppv-lite86" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "pretty_env_logger" @@ -2233,15 +2972,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" dependencies = [ - "env_logger 0.7.1", + "env_logger", "log", ] [[package]] name = "primitive-types" -version = "0.10.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", @@ -2252,12 +2991,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.1.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ - "thiserror", - "toml", + "once_cell", + "toml_edit", ] [[package]] @@ -2269,7 +3008,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "version_check", ] @@ -2285,24 +3024,32 @@ dependencies = [ ] [[package]] -name = "proc-macro-hack" -version = "0.5.19" +name = "proc-macro-warning" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] [[package]] -name = "proc-macro-nested" -version = "0.1.7" +name = "proc-macro2" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] [[package]] -name = "proc-macro2" -version = "1.0.32" +name = "psm" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" dependencies = [ - "unicode-xid", + "cc", ] [[package]] @@ -2313,18 +3060,18 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.10" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "radium" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] name = "rand" @@ -2336,20 +3083,18 @@ dependencies = [ "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", - "rand_hc 0.2.0", - "rand_pcg", + "rand_hc", ] [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", - "rand_core 0.6.3", - "rand_hc 0.3.1", + "rand_core 0.6.4", ] [[package]] @@ -2369,7 +3114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -2383,21 +3128,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom 0.2.3", -] - -[[package]] -name = "rand_distr" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "964d548f8e7d12e102ef183a0de7e98180c9f8729f555897a857b96e48122d2f" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "num-traits", - "rand 0.8.4", + "getrandom 0.2.10", ] [[package]] @@ -2409,24 +3144,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core 0.6.3", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - [[package]] name = "rawpointer" version = "0.2.1" @@ -2435,77 +3152,83 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", - "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] -name = "redox_users" -version = "0.4.0" +name = "redox_syscall" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "getrandom 0.2.3", - "redox_syscall", + "bitflags 1.3.2", ] [[package]] -name = "ref-cast" -version = "1.0.6" +name = "redox_users" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "ref-cast-impl", + "getrandom 0.2.10", + "redox_syscall 0.2.16", + "thiserror", +] + +[[package]] +name = "ref-cast" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" +dependencies = [ + "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.6" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" +checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -2514,14 +3237,41 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax", + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", ] [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle", +] [[package]] name = "ring" @@ -2540,9 +3290,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-hash" @@ -2558,13 +3308,54 @@ checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] name = "rustc_version" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.36.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustix" +version = "0.37.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys 0.4.10", + "windows-sys 0.48.0", +] + [[package]] name = "rustls" version = "0.19.1" @@ -2578,17 +3369,93 @@ dependencies = [ "webpki", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "safe_arch" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scale-bits" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "036575c29af9b6e4866ffb7fa055dbf623fe7a9cc159b33786de6013a6969d89" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "scale-decode" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7789f5728e4e954aaa20cadcc370b99096fb8645fca3c9333ace44bb18f30095" +dependencies = [ + "derive_more", + "parity-scale-codec", + "primitive-types", + "scale-bits", + "scale-decode-derive", + "scale-info", + "smallvec", +] + +[[package]] +name = "scale-decode-derive" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "27873eb6005868f8cc72dcfe109fae664cf51223d35387bc2f28be4c28d94c47" +dependencies = [ + "darling", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scale-encode" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d70cb4b29360105483fac1ed567ff95d65224a14dd275b6303ed0a654c78de5" +dependencies = [ + "derive_more", + "parity-scale-codec", + "scale-bits", + "scale-info", + "smallvec", +] [[package]] name = "scale-info" -version = "1.0.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c55b744399c25532d63a0d2789b109df8d46fc93752d46b0782991a931a782f" +checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" dependencies = [ "bitvec", "cfg-if", @@ -2600,14 +3467,45 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "1.0.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baeb2780690380592f86205aa4ee49815feb2acad8c2f59e6dd207148c3f1fcd" +checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 1.0.109", +] + +[[package]] +name = "scale-value" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6538d1cc1af9c0baf401c57da8a6d4730ef582db0d330d2efa56ec946b5b0283" +dependencies = [ + "base58", + "blake2", + "derive_more", + "either", + "frame-metadata 15.1.0", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-encode", + "scale-info", + "serde", + "yap", +] + +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.6", + "cfg-if", + "hashbrown 0.13.2", ] [[package]] @@ -2630,9 +3528,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" @@ -2645,75 +3543,102 @@ dependencies = [ ] [[package]] -name = "secrecy" -version = "0.8.0" +name = "sec1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ + "base16ct", + "der", + "generic-array 0.14.7", + "pkcs8", + "subtle", "zeroize", ] [[package]] -name = "semver" -version = "0.11.0" +name = "secp256k1" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ - "semver-parser", + "secp256k1-sys", ] [[package]] -name = "semver-parser" -version = "0.10.2" +name = "secp256k1-sys" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ - "pest", + "cc", ] +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" + [[package]] name = "serde" -version = "1.0.130" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.130" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "serde_json" -version = "1.0.70" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e277c495ac6cd1a01a58d0a0c574568b4d1ddf14f59965c6a58b8d96400b54f3" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ - "indexmap", + "indexmap 2.0.2", "itoa", "ryu", "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +dependencies = [ + "serde", +] + [[package]] name = "sha-1" -version = "0.9.8" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" dependencies = [ - "block-buffer 0.9.0", "cfg-if", "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest 0.10.7", ] [[package]] @@ -2730,9 +3655,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if", @@ -2742,80 +3667,93 @@ dependencies = [ ] [[package]] -name = "sharded-slab" -version = "0.1.4" +name = "sha2" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "lazy_static", + "cfg-if", + "cpufeatures", + "digest 0.10.7", ] [[package]] -name = "shlex" -version = "0.1.1" +name = "sha3" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] [[package]] -name = "signal-hook" -version = "0.3.10" +name = "sharded-slab" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c98891d737e271a2954825ef19e46bd16bdb98e2746f2eec4f7a4ef7946efd1" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ - "libc", - "signal-hook-registry", + "lazy_static", ] [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] [[package]] name = "signature" -version = "1.4.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] [[package]] name = "simba" -version = "0.5.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" dependencies = [ "approx", "num-complex", "num-traits", "paste", + "wide", ] [[package]] name = "siphasher" -version = "0.3.7" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] [[package]] name = "smallvec" -version = "1.7.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" -version = "0.4.2" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -2823,392 +3761,258 @@ dependencies = [ [[package]] name = "sp-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc5213210472ba2becdc094fbb9d30c4455753b1a608962797e1e971c3e5ec4" dependencies = [ "hash-db", "log", "parity-scale-codec", + "scale-info", "sp-api-proc-macro", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", - "sp-version 4.0.0-dev", + "sp-core", + "sp-externalities", + "sp-metadata-ir", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "sp-version", "thiserror", ] [[package]] name = "sp-api-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "11.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e7f093302d30b9d35436db024376459bdc9da7530abcacf5d87c32a67d94fd" dependencies = [ - "blake2-rfc", + "Inflector", + "blake2", + "expander", "proc-macro-crate", "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "sp-application-crypto" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-std 4.0.0-dev", + "syn 2.0.38", ] [[package]] name = "sp-application-crypto" -version = "4.0.0" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a11468fbf1d08502f95a69388b16e927a872df556085b5be7e5c55cdd3022c" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 4.0.0", - "sp-io 4.0.0", - "sp-std 4.0.0", -] - -[[package]] -name = "sp-arithmetic" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +checksum = "b74454c936a45ac55c8de95b9fd8b5e38f8b43d97df8f4274dd6777b20d95569" dependencies = [ - "integer-sqrt", - "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0-dev", - "sp-std 4.0.0-dev", - "static_assertions", + "sp-core", + "sp-io", + "sp-std", ] [[package]] name = "sp-arithmetic" -version = "4.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa92b9707afdaa807bcb985fcc70645ebbe6fbb2442620d61dc47e7f3553a7ae" +checksum = "e41f710a77e9debd1c9b80f862709dce648e50f0904cde4117488e7d11d4796d" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 4.0.0", - "sp-std 4.0.0", + "sp-std", "static_assertions", ] [[package]] name = "sp-core" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "base58", - "bitflags", - "blake2-rfc", - "byteorder", - "dyn-clonable", - "ed25519-dalek", - "futures", - "hash-db", - "hash256-std-hasher", - "hex", - "impl-serde", - "lazy_static", - "libsecp256k1", - "log", - "merlin", - "num-traits", - "parity-scale-codec", - "parity-util-mem", - "parking_lot", - "primitive-types", - "rand 0.7.3", - "regex", - "scale-info", - "schnorrkel", - "secrecy", - "serde", - "sha2 0.9.8", - "sp-core-hashing 4.0.0-dev", - "sp-debug-derive 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-storage 4.0.0-dev", - "ss58-registry", - "substrate-bip39", - "thiserror", - "tiny-bip39", - "tiny-keccak", - "twox-hash", - "wasmi", - "zeroize", -] - -[[package]] -name = "sp-core" -version = "4.0.0" +version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8295f7e800feaa16453768efb63c3063401ec765590f8f6ac9fac808a790435e" +checksum = "7921d278ed2aebbb21a644c96e09663dc49a6139d1e2e063c059dc9f866e149b" dependencies = [ - "base58", - "bitflags", - "blake2-rfc", - "byteorder", + "array-bytes", + "bitflags 1.3.2", + "blake2", + "bounded-collections", + "bs58", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", "log", "merlin", - "num-traits", "parity-scale-codec", - "parity-util-mem", - "parking_lot", + "parking_lot 0.12.1", + "paste", "primitive-types", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", + "secp256k1", "secrecy", "serde", - "sha2 0.9.8", - "sp-core-hashing 4.0.0", - "sp-debug-derive 4.0.0", - "sp-externalities 0.10.0", - "sp-runtime-interface 4.0.0", - "sp-std 4.0.0", - "sp-storage 4.0.0", + "sp-core-hashing", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-std", + "sp-storage", "ss58-registry", "substrate-bip39", "thiserror", "tiny-bip39", - "tiny-keccak", - "twox-hash", - "wasmi", + "tracing", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "blake2-rfc", - "byteorder", - "sha2 0.9.8", - "sp-std 4.0.0-dev", - "tiny-keccak", - "twox-hash", -] - -[[package]] -name = "sp-core-hashing" -version = "4.0.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec864a6a67249f0c8dd3d5acab43623a61677e85ff4f2f9b04b802d2fe780e83" +checksum = "a7cb5c31aa385d6997a5b73fdc9837c1c0145559205198555c3000739a474767" dependencies = [ - "blake2-rfc", + "blake2b_simd", "byteorder", - "sha2 0.9.8", - "sp-std 4.0.0", - "tiny-keccak", + "digest 0.10.7", + "sha2 0.10.8", + "sha3", "twox-hash", ] [[package]] name = "sp-core-hashing-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "proc-macro2", - "quote", - "sp-core-hashing 4.0.0-dev", - "syn", -] - -[[package]] -name = "sp-debug-derive" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a4327a220777a8d492ed3d0bcd4c769cbb030301e7d4a2d9e09513d690c313b" dependencies = [ - "proc-macro2", "quote", - "syn", + "sp-core-hashing", + "syn 2.0.38", ] [[package]] name = "sp-debug-derive" -version = "4.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d676664972e22a0796176e81e7bec41df461d1edf52090955cdab55f2c956ff2" +checksum = "16f7d375610590566e11882bf5b5a4b8d0666a96ba86808b2650bbbd9be50bf8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "sp-externalities" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede074871514ca7c5d2eca9563515d858c6220b47ae815714ed4393a4e99db4a" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0-dev", - "sp-storage 4.0.0-dev", + "sp-std", + "sp-storage", ] [[package]] -name = "sp-externalities" -version = "0.10.0" +name = "sp-genesis-builder" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54226438dbff5ced9718b51eb44b7f38fe139c40a923a088275914519bf451d3" +checksum = "10b9f0251a09b578393f3297abe54a29abdb7e93c17e89a88dc1cabb8e2d5a2d" dependencies = [ - "environmental", - "parity-scale-codec", - "sp-std 4.0.0", - "sp-storage 4.0.0", + "serde_json", + "sp-api", + "sp-runtime", + "sp-std", ] [[package]] name = "sp-inherents" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439882da80e9bcfd1ba53df7ec5070d4d7f2a9a93f988aa3598f99ee5bfc76eb" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "scale-info", + "sp-runtime", + "sp-std", "thiserror", ] [[package]] name = "sp-io" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "futures", - "hash-db", - "libsecp256k1", - "log", - "parity-scale-codec", - "parking_lot", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-trie 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", - "tracing", - "tracing-core", -] - -[[package]] -name = "sp-io" -version = "4.0.0" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe902ca84673ea25897b04f1bae4db2955a0e01105fc115df3cfd5447f78848" +checksum = "88fb6e281de5054565f07a9f79504d21133e115db549993c99f1b21236c677a5" dependencies = [ - "futures", - "hash-db", + "bytes", + "ed25519-dalek", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot", - "sp-core 4.0.0", - "sp-externalities 0.10.0", - "sp-keystore 0.10.0", - "sp-runtime-interface 4.0.0", - "sp-state-machine 0.10.0", - "sp-std 4.0.0", - "sp-tracing 4.0.0", - "sp-trie 4.0.0", - "sp-wasm-interface 4.0.0", + "rustversion", + "secp256k1", + "sp-core", + "sp-externalities", + "sp-keystore", + "sp-runtime-interface", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-trie", "tracing", "tracing-core", ] [[package]] name = "sp-keyring" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f09927534d2233e135e4b4a0c758554d0ff66178f6e9cfba2e151dfeac97b3" dependencies = [ "lazy_static", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-core", + "sp-runtime", "strum", ] [[package]] name = "sp-keystore" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9f19e773319d96223ce8dba960267e6cb977907537a8f738746ceb86592413" dependencies = [ - "async-trait", - "derive_more", - "futures", - "merlin", "parity-scale-codec", - "parking_lot", - "schnorrkel", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", + "parking_lot 0.12.1", + "sp-core", + "sp-externalities", + "thiserror", ] [[package]] -name = "sp-keystore" -version = "0.10.0" +name = "sp-metadata-ir" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37621e7224fff35ca9eb235e3edfe0a4a556408a23901f5f4a23f7b435c0c66" +checksum = "eb0dec8af38c68358600da59cf14424e1230fe9ae1d4b4f64a098288145c0775" dependencies = [ - "async-trait", - "derive_more", - "futures", - "merlin", + "frame-metadata 16.0.0", "parity-scale-codec", - "parking_lot", - "schnorrkel", - "sp-core 4.0.0", - "sp-externalities 0.10.0", -] - -[[package]] -name = "sp-panic-handler" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "backtrace", - "lazy_static", - "regex", + "scale-info", + "sp-std", ] [[package]] name = "sp-panic-handler" -version = "4.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2101f3c555fceafcfcfb0e61c55ea9ed80dc60bd77d54d9f25b369edb029e9a4" +checksum = "cd099ba2d6c1bfe5d0c79aa56e440fa3c9257eadfc0c782c09cdc2122b1e60ed" dependencies = [ "backtrace", "lazy_static", @@ -3217,225 +4021,124 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "either", - "hash256-std-hasher", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "parity-util-mem", - "paste", - "rand 0.7.3", - "scale-info", - "serde", - "sp-application-crypto 4.0.0-dev", - "sp-arithmetic 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "sp-runtime" -version = "4.0.0" +version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c31cd604c0fc105f764ef77eb38a9d0bf71e7bd289f28fd09f32f7132c3c46f" +checksum = "46c0641e1a9d340960b562bcceea1457680fd0e109fc1040f8f5364fd7bc2506" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "parity-util-mem", "paste", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "serde", - "sp-application-crypto 4.0.0", - "sp-arithmetic 4.0.0", - "sp-core 4.0.0", - "sp-io 4.0.0", - "sp-std 4.0.0", -] - -[[package]] -name = "sp-runtime-interface" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "primitive-types", - "sp-externalities 0.10.0-dev", - "sp-runtime-interface-proc-macro 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-storage 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", - "static_assertions", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-std", + "sp-weights", ] [[package]] name = "sp-runtime-interface" -version = "4.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0176151f1195b386ddb4e07d716713e1e29f36b65c0e6e91fe354fc2cec84d" +checksum = "17a4030ad93f05c93f2cc294c74bc5fea227f90fb3d1426d4a6f165e017fb7ea" dependencies = [ + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.10.0", - "sp-runtime-interface-proc-macro 4.0.0", - "sp-std 4.0.0", - "sp-storage 4.0.0", - "sp-tracing 4.0.0", - "sp-wasm-interface 4.0.0", + "sp-externalities", + "sp-runtime-interface-proc-macro", + "sp-std", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "Inflector", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-runtime-interface-proc-macro" -version = "4.0.0" +version = "14.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b58cc6060b2d2f35061db5b4172f4a47353c3f01a89f281699a6c3f05d1267a" +checksum = "b232943ee7ca83a6d56face33b8af12e9fb470a15a53835f4e12a6e452a41c1c" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "sp-staking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d3b2a4a7aa67a9adb2a8f49ed516f6694b5fa70792ab9b0125934b1c8cdc2e3" dependencies = [ + "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "sp-state-machine" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "hash-db", - "log", - "num-traits", - "parity-scale-codec", - "parking_lot", - "rand 0.7.3", - "smallvec", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-panic-handler 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-trie 4.0.0-dev", - "thiserror", - "tracing", - "trie-db", - "trie-root", + "serde", + "sp-core", + "sp-runtime", + "sp-std", ] [[package]] name = "sp-state-machine" -version = "0.10.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e3d9e8443f9d92348d779b06029603fbe536a59a05a0d8593ea2d3711c2330" +checksum = "2bf4c76bea1a9e4a2e79afe70f42f1d368a8a45308e58f19bfd755c5ddb2b4a3" dependencies = [ "hash-db", "log", - "num-traits", "parity-scale-codec", - "parking_lot", - "rand 0.7.3", + "parking_lot 0.12.1", + "rand 0.8.5", "smallvec", - "sp-core 4.0.0", - "sp-externalities 0.10.0", - "sp-panic-handler 4.0.0", - "sp-std 4.0.0", - "sp-trie 4.0.0", + "sp-core", + "sp-externalities", + "sp-panic-handler", + "sp-std", + "sp-trie", "thiserror", "tracing", "trie-db", - "trie-root", ] [[package]] name = "sp-std" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" - -[[package]] -name = "sp-std" -version = "4.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14804d6069ee7a388240b665f17908d98386ffb0b5d39f89a4099fc7a2a4c03f" - -[[package]] -name = "sp-storage" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive 4.0.0-dev", - "sp-std 4.0.0-dev", -] +checksum = "8c91d32e165d08a14098ce5ec923eaec59d1d0583758a18a770beec1b780b0d0" [[package]] name = "sp-storage" -version = "4.0.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "851e1315a935cd5a0ce1bb6e41b0d611ac2370ede860d551f9f133007487043a" +checksum = "ac9660ecd48314443e73ad0f44d58b76426666a1343d72f6f65664e174da9244" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 4.0.0", - "sp-std 4.0.0", -] - -[[package]] -name = "sp-tracing" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "parity-scale-codec", - "sp-std 4.0.0-dev", - "tracing", - "tracing-core", - "tracing-subscriber", + "sp-debug-derive", + "sp-std", ] [[package]] name = "sp-tracing" -version = "4.0.0" +version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4688fceac497cee7e9b72c387fef20fa517e2bf6a3bf52a4a45dcc9391d6201" +checksum = "69a61948986d2a9f8d67d60884ff0277d910df09ebe08d0e1f309da777516453" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0", + "sp-std", "tracing", "tracing-core", "tracing-subscriber", @@ -3443,112 +4146,86 @@ dependencies = [ [[package]] name = "sp-trie" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "hash-db", - "memory-db", - "parity-scale-codec", - "scale-info", - "sp-core 4.0.0-dev", - "sp-std 4.0.0-dev", - "trie-db", - "trie-root", -] - -[[package]] -name = "sp-trie" -version = "4.0.0" +version = "25.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb344969de755877440fccb691860acedd565061774d289886ff9c690206cc0" +checksum = "4bb2d292eb90452dcb0909fb44e74bf04395e3ffa37a66c0f1635a00600382a4" dependencies = [ + "ahash 0.8.6", "hash-db", + "hashbrown 0.13.2", + "lazy_static", "memory-db", + "nohash-hasher", "parity-scale-codec", + "parking_lot 0.12.1", "scale-info", - "sp-core 4.0.0", - "sp-std 4.0.0", + "schnellru", + "sp-core", + "sp-std", + "thiserror", + "tracing", "trie-db", "trie-root", ] [[package]] name = "sp-version" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "parity-wasm", - "scale-info", - "serde", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-version-proc-macro 4.0.0-dev", - "thiserror", -] - -[[package]] -name = "sp-version" -version = "4.0.0" +version = "25.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b57388721427e65bdfadf636eebf444a6f84f7a05b56af2e7c6928cf554c618" +checksum = "125da59ea46ecb23860e7d895f6f2882f596b71ffca0ae4887558aac541f4342" dependencies = [ "impl-serde", "parity-scale-codec", "parity-wasm", "scale-info", "serde", - "sp-runtime 4.0.0", - "sp-std 4.0.0", - "sp-version-proc-macro 4.0.0", + "sp-core-hashing-proc-macro", + "sp-runtime", + "sp-std", + "sp-version-proc-macro", "thiserror", ] [[package]] name = "sp-version-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" -dependencies = [ - "parity-scale-codec", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-version-proc-macro" -version = "4.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fcafba97053cfa9fa366e6b30fd0d0e9d15530c4a738efaa117a4d5707d147" +checksum = "92897ffa04436cbd100c49ea1f8b637cb68e2a9fe144115f4b545b5ace2f47e2" dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "sp-wasm-interface" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2021-12#b6c1c1bcfa5d831bfd1f278064d7af757f9b38f5" +version = "17.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf43bb0c8eb76dc41057ce0fb6b744b94c9aec28b31dff53a1efc4f04ef25384" dependencies = [ + "anyhow", "impl-trait-for-tuples", + "log", "parity-scale-codec", - "sp-std 4.0.0-dev", - "wasmi", + "sp-std", + "wasmtime", ] [[package]] -name = "sp-wasm-interface" -version = "4.0.0" +name = "sp-weights" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89a5b0fe5b5bd3259e914edc35b33b6f7b4b0c803981290256e8ed75eecf1b27" +checksum = "4e1cef0aad13ed8a8522a6e86ace16fb97ab220c16d2357e628352b528582693" dependencies = [ - "impl-trait-for-tuples", "parity-scale-codec", - "sp-std 4.0.0", - "wasmi", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-debug-derive", + "sp-std", ] [[package]] @@ -3557,6 +4234,16 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "sqlformat" version = "0.1.8" @@ -3564,15 +4251,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4" dependencies = [ "itertools", - "nom 7.1.0", + "nom", "unicode_categories", ] [[package]] name = "sqlx" -version = "0.5.9" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7911b0031a0247af40095838002999c7a52fba29d9739e93326e71a5a1bc9d43" +checksum = "551873805652ba0d912fec5bbb0f8b4cdd96baf8e2ebf5970e5671092966019b" dependencies = [ "sqlx-core", "sqlx-macros", @@ -3580,44 +4267,44 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.5.9" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aec89bfaca8f7737439bad16d52b07f1ccd0730520d3bf6ae9d069fe4b641fb1" +checksum = "e48c61941ccf5ddcada342cd59e3e5173b007c509e1e8e990dafc830294d9dc5" dependencies = [ - "ahash", + "ahash 0.7.7", "atoi", "base64", - "bitflags", + "bitflags 1.3.2", "byteorder", "bytes", "crc", - "crossbeam-channel", "crossbeam-queue", - "crossbeam-utils", "dirs", "either", + "event-listener 2.5.3", "futures-channel", "futures-core", "futures-intrusive", "futures-util", "hashlink", "hex", - "hmac 0.11.0", - "indexmap", + "hkdf", + "hmac 0.12.1", + "indexmap 1.9.3", "itoa", "libc", "log", "md-5", "memchr", "once_cell", - "parking_lot", + "paste", "percent-encoding", - "rand 0.8.4", + "rand 0.8.5", "rustls", "serde", "serde_json", "sha-1", - "sha2 0.9.8", + "sha2 0.10.8", "smallvec", "sqlformat", "sqlx-rt", @@ -3631,9 +4318,9 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.5.9" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "584866c833511b1a152e87a7ee20dee2739746f60c858b3c5209150bc4b466f5" +checksum = "bc0fba2b0cae21fc00fe6046f8baa4c7fcb49e379f0f592b04696607f69ed2e1" dependencies = [ "dotenv", "either", @@ -3644,18 +4331,18 @@ dependencies = [ "quote", "serde", "serde_json", - "sha2 0.9.8", + "sha2 0.10.8", "sqlx-core", "sqlx-rt", - "syn", + "syn 1.0.109", "url", ] [[package]] name = "sqlx-rt" -version = "0.5.9" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d1bd069de53442e7a320f525a6d4deb8bb0621ac7a55f7eccbc2b58b57f43d0" +checksum = "4db708cd3e459078f85f39f96a00960bd841f66ee2a669e90bf36907f5a79aae" dependencies = [ "async-rustls", "async-std", @@ -3663,11 +4350,12 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.6.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd3280d191d0d8f29c426b85cf6a3778bea71aef8ccd94034c6effac809b8b9b" +checksum = "5e6915280e2d0db8911e5032a5c275571af6bdded2916abd691a659be25d3439" dependencies = [ "Inflector", + "num-format", "proc-macro2", "quote", "serde", @@ -3676,83 +4364,54 @@ dependencies = [ ] [[package]] -name = "static_assertions" -version = "1.1.0" +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] -name = "statrs" -version = "0.15.0" +name = "static_assertions" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" -dependencies = [ - "approx", - "lazy_static", - "nalgebra", - "num-traits", - "rand 0.8.4", -] +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stringprep" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" dependencies = [ + "finl_unicode", "unicode-bidi", "unicode-normalization", ] [[package]] name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "structopt" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.22.0" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "rustversion", + "syn 1.0.109", ] [[package]] @@ -3764,7 +4423,7 @@ dependencies = [ "hmac 0.11.0", "pbkdf2 0.8.0", "schnorrkel", - "sha2 0.9.8", + "sha2 0.9.9", "zeroize", ] @@ -3776,25 +4435,24 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.81" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] -name = "synstructure" -version = "0.12.6" +name = "syn" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", - "syn", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -3804,75 +4462,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] -name = "termcolor" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "terminal_size" -version = "0.1.17" +name = "target-lexicon" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi", -] +checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" [[package]] -name = "textwrap" -version = "0.11.0" +name = "termcolor" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ - "unicode-width", + "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "thread_local" -version = "1.1.3" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] [[package]] name = "tiny-bip39" -version = "0.8.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" dependencies = [ "anyhow", - "hmac 0.8.1", + "hmac 0.12.1", "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", + "pbkdf2 0.11.0", + "rand 0.8.5", "rustc-hash", - "sha2 0.9.8", + "sha2 0.10.8", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -3889,36 +4535,60 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.5.1" +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "toml" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ - "tinyvec_macros", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", ] [[package]] -name = "tinyvec_macros" -version = "0.1.0" +name = "toml_datetime" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] [[package]] -name = "toml" -version = "0.5.8" +name = "toml_edit" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ + "indexmap 2.0.2", "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] [[package]] name = "tracing" -version = "0.1.29" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3926,40 +4596,41 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.18" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", ] [[package]] name = "tracing-core" -version = "0.1.21" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ - "lazy_static", + "once_cell", + "valuable", ] [[package]] name = "tracing-log" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] [[package]] name = "tracing-serde" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" dependencies = [ "serde", "tracing-core", @@ -3971,7 +4642,7 @@ version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" dependencies = [ - "ansi_term 0.12.1", + "ansi_term", "chrono", "lazy_static", "matchers", @@ -3989,12 +4660,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.22.6" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eac131e334e81b6b3be07399482042838adcd7957aa0010231d0813e39e02fa" +checksum = "ff28e0f815c2fea41ebddf148e008b077d2faddb026c9555b29696114d602642" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.13.2", "log", "rustc-hex", "smallvec", @@ -4002,27 +4673,28 @@ dependencies = [ [[package]] name = "trie-root" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "652931506d2c1244d7217a70b99f56718a7b4161b37f04e7cd868072a99f68cd" +checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" dependencies = [ "hash-db", ] [[package]] name = "tt-call" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" [[package]] name = "twox-hash" -version = "1.6.1" +version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f559b464de2e2bdabcac6a210d12e9b5a5973c251e102c44c585c71d51bd78e" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "rand 0.8.4", + "digest 0.10.7", + "rand 0.8.5", "static_assertions", ] @@ -4034,14 +4706,14 @@ dependencies = [ "argh", "async-std", "async-stream", - "colored 2.0.0", + "colored 2.0.4", "desub", "fern", "futures", "indicatif", "log", "num_cpus", - "parking_lot", + "parking_lot 0.11.2", "rayon", "serde", "serde_json", @@ -4050,21 +4722,15 @@ dependencies = [ [[package]] name = "typenum" -version = "1.14.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" - -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uint" -version = "0.9.1" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6470ab50f482bde894a037a57064480a246dbfdd5960bd65a44824693f08da5f" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -4074,36 +4740,36 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" - -[[package]] -name = "unicode-width" -version = "0.1.9" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-xid" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unicode_categories" @@ -4119,54 +4785,65 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.2.2" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", - "matches", "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "v14-test" version = "0.1.0" dependencies = [ "anyhow", + "clap", "desub-current", "hex", "pretty_env_logger", - "structopt", ] [[package]] -name = "value-bag" -version = "1.0.0-alpha.8" +name = "valuable" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" -dependencies = [ - "ctor", - "version_check", -] +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] -name = "vec_map" -version = "0.8.2" +name = "value-bag" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +checksum = "4a72e1902dde2bd6441347de2b70b7f5d59bf157c6c62f0c44572607a1d55bbe" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "waker-fn" -version = "1.1.0" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" + +[[package]] +name = "walkdir" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] [[package]] name = "wasi" @@ -4176,15 +4853,15 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.78" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4192,24 +4869,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.38", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.28" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -4219,9 +4896,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4229,52 +4906,170 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] -name = "wasmi" -version = "0.9.1" +name = "wasmparser" +version = "0.102.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" +dependencies = [ + "indexmap 1.9.3", + "url", +] + +[[package]] +name = "wasmtime" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" dependencies = [ - "downcast-rs", + "anyhow", + "bincode", + "cfg-if", + "indexmap 1.9.3", "libc", - "memory_units", - "num-rational 0.2.4", - "num-traits", - "parity-wasm", - "wasmi-validation", + "log", + "object 0.30.4", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.45.0", ] [[package]] -name = "wasmi-validation" -version = "0.4.1" +name = "wasmtime-asm-macros" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" dependencies = [ - "parity-wasm", + "cfg-if", +] + +[[package]] +name = "wasmtime-environ" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.27.3", + "indexmap 1.9.3", + "log", + "object 0.30.4", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" +dependencies = [ + "addr2line 0.19.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.27.3", + "log", + "object 0.30.4", + "rustc-demangle", + "serde", + "target-lexicon", + "wasmtime-environ", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-runtime" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap 1.9.3", + "libc", + "log", + "mach", + "memfd", + "memoffset 0.8.0", + "paste", + "rand 0.8.5", + "rustix 0.36.17", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-types" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", ] [[package]] name = "web-sys" -version = "0.3.55" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -4300,31 +5095,23 @@ dependencies = [ ] [[package]] -name = "wepoll-ffi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" -dependencies = [ - "cc", -] - -[[package]] -name = "which" -version = "3.1.1" +name = "whoami" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" dependencies = [ - "libc", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "whoami" -version = "1.2.0" +name = "wide" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c33ac5ee236a4efbf2c98967e12c6cc0c51d93a744159a52957ba206ae6ef5f7" +checksum = "c68938b57b33da363195412cfc5fc37c9ed49aa9cfe2156fde64b8d2c9498242" dependencies = [ - "wasm-bindgen", - "web-sys", + "bytemuck", + "safe_arch", ] [[package]] @@ -4345,9 +5132,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -4358,29 +5145,207 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "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.5", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winnow" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +dependencies = [ + "memchr", +] + [[package]] name = "wyz" -version = "0.2.0" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4524214bc4629eba08d78ceb1d6507070cc0bcbbed23af74e19e6e924a24cf" + +[[package]] +name = "zerocopy" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd66a62464e3ffd4e37bd09950c2b9dd6c4f8767380fabba0d523f9a775bc85a" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" +checksum = "255c4596d41e6916ced49cfafea18727b24d67878fa180ddfd69b9df34fd1726" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] [[package]] name = "zeroize" -version = "1.4.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.2.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65f1a51723ec88c66d5d1fe80c841f17f63587d6691901d66be9bec6c3b51f73" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn", - "synstructure", + "syn 2.0.38", ] diff --git a/Cargo.toml b/Cargo.toml index 264cfc80..3a7eba37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,3 +9,50 @@ members = [ "desub-common", "integration-tests", ] + +resolver = "2" + +[workspace.package] +version = "0.1.0" +authors = ["Parity Technologies "] +license = "Apache-2.0" +repository = "https://github.com/paritytech/desub" +homepage = "https://github.com/paritytech/desub" +description = "Decode Substrate with Backwards-Compatible Metadata" +rust-version = "1.70.0" +edition = "2021" + +[workspace.dependencies] +anyhow = "1" +parity-scale-codec = "3.6.5" +scale-info = "2.10.0" +scale-value = "0.12.0" +scale-decode = "0.9" +frame-metadata = "16" +bitvec = "1" +serde = "1" +serde_json = "1" +derive_more = "0.99" +thiserror = "1" +hex = "0.4" +log = "0.4" +pretty_env_logger = "0.4" +paste = "1.0.3" +dyn-clone = "1.0" +onig = { version = "6", default-features = false } +phf = "0.11" +syn = "2" +clap = "4.4.7" + +sp-core = "24.0.0" +sp-runtime = "27.0.0" +sp-version = "25.0.0" +sp-keyring = "27.0.0" +pallet-balances = "24.0.0" +frame-system = "24.0.0" + +desub = { version = "0.1.0", default-features = false, path = "./desub" } +desub-common = { version = "0.1.0", default-features = false, path = "./desub-common" } +desub-current = { version = "0.1.0", default-features = false, path = "./desub-current" } +desub-json-resolver = { version = "0.1.0", default-features = false, path = "./desub-json-resolver" } +desub-legacy = { version = "0.1.0", default-features = false, path = "./desub-legacy" } diff --git a/bin/tx-decoder/Cargo.toml b/bin/tx-decoder/Cargo.toml index 69e4dc77..03920016 100644 --- a/bin/tx-decoder/Cargo.toml +++ b/bin/tx-decoder/Cargo.toml @@ -1,22 +1,30 @@ [package] name = "tx-decoder" -version = "0.1.0" -edition = "2021" +version.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +description.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -desub = { path = "../../desub", features = [ "polkadot-js" ] } +desub = { workspace = true, features = [ "polkadot-js" ] } +anyhow = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +log = { workspace = true } + +# These are only used here, so aren't part of the workspace deps (this binary might go away): async-std = { version = "1.10.0", features = [ "attributes" ] } async-stream = "0.3.2" sqlx = { version = "0.5", features = [ "runtime-async-std-rustls", "postgres", "offline" ]} -anyhow = "1.0.43" futures = "0.3.17" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -log = "0.4.14" argh = "0.1.6" -fern = {version = "0.6.0", features = [ "colored" ] } +fern = { version = "0.6.0", features = [ "colored" ] } colored = "2.0.0" indicatif = { version = "0.16.2", features = [ "rayon" ] } rayon = "1.5.1" diff --git a/bin/tx-decoder/src/app.rs b/bin/tx-decoder/src/app.rs index 1036fce5..efa228cb 100644 --- a/bin/tx-decoder/src/app.rs +++ b/bin/tx-decoder/src/app.rs @@ -105,13 +105,13 @@ impl<'a> AppState<'a> { let upgrade_block = get_upgrade_block(&self.app.network, version.try_into()?); let mut len = 0; let mut error_count = 0; - let decoder = self.decoder.read(); while let Some(Ok(block)) = blocks.next().await { let version = if upgrade_block == Some(block.block_num.try_into()?) && upgrade_block != Some(0) { previous.expect("Upgrade block must have previous version; qed") } else { version }; + let decoder = self.decoder.read(); if Self::decode(&decoder, block, version.try_into()?, errors).is_err() { error_count += 1; } @@ -142,16 +142,15 @@ impl<'a> AppState<'a> { /// returns the previous spec version. async fn register_metadata(&self, conn: &mut PgConnection, version: SpecVersion) -> Result, Error> { let (past, present) = past_and_present_version(conn, version.try_into()?).await?; - let mut decoder = self.decoder.write(); - if !decoder.has_version(&present) { + if !self.decoder.read().has_version(&present) { let meta = metadata(conn, present.try_into()?).await?; - decoder.register_version(present, &meta)?; + self.decoder.write().register_version(present, &meta)?; } if let Some(p) = past { - if !decoder.has_version(&p) { + if !self.decoder.read().has_version(&p) { let meta = metadata(conn, p.try_into()?).await?; - decoder.register_version(p, &meta)?; + self.decoder.write().register_version(p, &meta)?; } } Ok(past) diff --git a/bin/v14-test/Cargo.toml b/bin/v14-test/Cargo.toml index 81f0e5e9..30d6119a 100644 --- a/bin/v14-test/Cargo.toml +++ b/bin/v14-test/Cargo.toml @@ -1,13 +1,19 @@ [package] name = "v14-test" -version = "0.1.0" -edition = "2021" +version.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +description.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -structopt = "0.3.23" -desub-current = { path = "../../desub-current" } -anyhow = "1.0.44" -hex = "0.4.3" -pretty_env_logger = "0.4.0" +clap = { workspace = true, features = ["derive"] } +desub-current = { workspace = true } +anyhow = { workspace = true } +hex = { workspace = true } +pretty_env_logger = { workspace = true } diff --git a/bin/v14-test/src/main.rs b/bin/v14-test/src/main.rs index 09beefb3..813a223b 100644 --- a/bin/v14-test/src/main.rs +++ b/bin/v14-test/src/main.rs @@ -1,18 +1,17 @@ +use clap::Parser; use desub_current::{decoder, Metadata}; use std::path::PathBuf; -use structopt::StructOpt; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] struct Opts { /// SCALE encoded V14 metadata blob - #[structopt(parse(from_os_str))] metadata: PathBuf, /// Extrinsic hash in the form 0x1a2b3c extrinsic: String, } fn main() -> Result<(), anyhow::Error> { - let opts = Opts::from_args(); + let opts = Opts::parse(); pretty_env_logger::init(); let metadata_bytes = std::fs::read(opts.metadata)?; diff --git a/desub-common/Cargo.toml b/desub-common/Cargo.toml index fb7478ac..0a68d2b9 100644 --- a/desub-common/Cargo.toml +++ b/desub-common/Cargo.toml @@ -1,18 +1,18 @@ [package] name = "desub-common" -version = "0.1.0" -authors = ["Parity Technologies "] -license = "GPL-3.0" -homepage = "https://substrate.dev" -repository = "https://github.com/paritytech/desub/" -description = "Decode Substrate with Backwards-Compatible Metadata" -readme = "README.md" -edition = "2021" +version.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +description.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde = { version = "1", features = [ "derive" ] } +serde = { workspace = true, features = [ "derive" ] } -sp-runtime = "4.0.0" -sp-core = "4.0.0" +sp-runtime = { workspace = true } +sp-core = { workspace = true } diff --git a/desub-current/Cargo.toml b/desub-current/Cargo.toml index a171fdd4..4deb0904 100644 --- a/desub-current/Cargo.toml +++ b/desub-current/Cargo.toml @@ -1,31 +1,33 @@ [package] name = "desub-current" -version = "0.1.0" -authors = ["Parity Technologies "] -license = "GPL-3.0" -homepage = "https://substrate.dev" -repository = "https://github.com/paritytech/desub/" -description = "Decode Substrate with Backwards-Compatible Metadata" -edition = "2021" +version.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +description.workspace = true +edition.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4" -thiserror = "1.0.30" -frame-metadata = { version = "14.2", features = ["v14", "std", "scale-info"] } -serde = { version = "1", features = ["derive"] } -serde_json = { version = "1", features = ["preserve_order"] } -codec = { version = "2", package = "parity-scale-codec", features = ["bit-vec"] } -hex = "0.4.3" -derive_more = "0.99.16" -scale-info = { version = "1.0.0", features = ["bit-vec", "derive"] } -bitvec = { version = "0.20.2", features = ["serde", "alloc"] } -desub-common = { version = "0.1.0", path = "../desub-common" } +log = { workspace = true } +thiserror = { workspace = true } +frame-metadata = { workspace = true, features = ["std", "scale-info"] } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true, features = ["preserve_order"] } +parity-scale-codec = { workspace = true, features = ["bit-vec"] } +hex = { workspace = true } +derive_more = { workspace = true } +scale-info = { workspace = true, features = ["bit-vec", "derive"] } +bitvec = { workspace = true, features = ["serde", "alloc"] } +desub-common = { workspace = true } +scale-value = { workspace = true } +scale-decode = { workspace = true } -sp-core = "4.0.0" -sp-runtime = "4.0.0" +sp-core = { workspace = true } +sp-runtime = { workspace = true } [dev-dependencies] -serde_json = "1" -sp_keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", tag = "monthly-2021-12" } +sp-keyring = { workspace = true } diff --git a/desub-current/src/decoder/decode_storage.rs b/desub-current/src/decoder/decode_storage.rs index 79213e33..f3f5ada4 100644 --- a/desub-current/src/decoder/decode_storage.rs +++ b/desub-current/src/decoder/decode_storage.rs @@ -23,7 +23,7 @@ struct StorageEntries { entry_by_hashed_name: HashMap<[u8; 16], usize>, } -#[derive(thiserror::Error, Debug, Clone, PartialEq)] +#[derive(thiserror::Error, Debug)] pub enum StorageDecodeError { #[error("Not enough bytes in the input data to decode the storage prefix and name; got {0} bytes but expected 32")] NotEnoughBytesForPrefixAndName(usize), @@ -87,7 +87,7 @@ impl StorageDecoder { Ok(StorageEntry { prefix: prefix_str.into(), name: name_str.into(), - ty: ty.into(), + ty: ty.id, details: StorageEntryType::Plain, }) } @@ -155,7 +155,7 @@ impl StorageDecoder { Ok(StorageEntry { prefix: prefix_str.into(), name: name_str.into(), - ty: value.into(), + ty: value.id, details: StorageEntryType::Map(storage_keys), }) } @@ -190,16 +190,17 @@ impl StorageDecoder { // See https://github.com/paritytech/subxt/blob/793c945fbd2de022f523c39a84ee02609ba423a9/codegen/src/api/storage.rs#L105 // for another example of this being handled in code. fn storage_map_key_to_type_id_vec(metadata: &Metadata, key: &ScaleInfoTypeId) -> Vec { - let ty = match metadata.resolve(key) { + let ty_id = key.id; + let ty = match metadata.resolve(ty_id) { Some(ty) => ty, - None => panic!("Metadata inconsistency: type #{} not found", key.id()), + None => panic!("Metadata inconsistency: type #{} not found", ty_id), }; - match ty.type_def() { + match &ty.type_def { // Multiple keys: - scale_info::TypeDef::Tuple(vals) => vals.fields().iter().map(|f| TypeId::from_u32(f.id())).collect(), + scale_info::TypeDef::Tuple(vals) => vals.fields.iter().map(|f| f.id).collect(), // Single key: - _ => vec![key.into()], + _ => vec![ty_id], } } @@ -267,7 +268,7 @@ pub struct StorageMapKey<'b> { pub hasher: StorageHasher, } -impl<'m, 'b> StorageMapKey<'b> { +impl<'b> StorageMapKey<'b> { pub fn into_owned(self) -> StorageMapKey<'static> { StorageMapKey { bytes: Cow::Owned(self.bytes.into_owned()), ty: self.ty, hasher: self.hasher } } diff --git a/desub-current/src/decoder/decode_value.rs b/desub-current/src/decoder/decode_value.rs deleted file mode 100644 index 19118ac0..00000000 --- a/desub-current/src/decoder/decode_value.rs +++ /dev/null @@ -1,461 +0,0 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. -// This file is part of substrate-desub. -// -// substrate-desub is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// substrate-desub is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with substrate-desub. If not, see . - -use crate::value::{BitSequence, Composite, Primitive, Value, ValueDef, Variant}; -use crate::{Type, TypeId}; -use codec::{Compact, Decode}; -use scale_info::{ - form::PortableForm, Field, PortableRegistry, TypeDefArray, TypeDefBitSequence, TypeDefCompact, TypeDefComposite, - TypeDefPrimitive, TypeDefSequence, TypeDefTuple, TypeDefVariant, -}; - -// This is used in several places below. -type TypeDef = scale_info::TypeDef; - -#[derive(Debug, Clone, thiserror::Error, PartialEq)] -pub enum DecodeValueError { - #[error("{0}")] - CodecError(#[from] codec::Error), - #[error("{0} is expected to be a valid char, but is not")] - InvalidChar(u32), - #[error("Cannot find type with ID {0}")] - TypeIdNotFound(u32), - #[error("Ran out of data during decoding")] - Eof, - #[error("Could not find variant with index {0} in {1:?}")] - VariantNotFound(u8, scale_info::TypeDefVariant), - #[error("Could not decode compact encoded type into {0:?}")] - CannotDecodeCompactIntoType(Type), -} - -/// Decode data according to the [`TypeId`] provided. -/// The provided pointer to the data slice will be moved forwards as needed -/// depending on what was decoded. -pub fn decode_value_by_id>( - data: &mut &[u8], - ty_id: Id, - types: &PortableRegistry, -) -> Result, DecodeValueError> { - let ty_id = ty_id.into(); - let ty = types.resolve(ty_id.id()).ok_or_else(|| DecodeValueError::TypeIdNotFound(ty_id.id()))?; - - let value = match ty.type_def() { - TypeDef::Composite(inner) => decode_composite_value(data, inner, types).map(ValueDef::Composite), - TypeDef::Sequence(inner) => decode_sequence_value(data, inner, types).map(ValueDef::Composite), - TypeDef::Array(inner) => decode_array_value(data, inner, types).map(ValueDef::Composite), - TypeDef::Tuple(inner) => decode_tuple_value(data, inner, types).map(ValueDef::Composite), - TypeDef::Variant(inner) => decode_variant_value(data, inner, types).map(ValueDef::Variant), - TypeDef::Primitive(inner) => decode_primitive_value(data, inner).map(ValueDef::Primitive), - TypeDef::Compact(inner) => decode_compact_value(data, inner, types), - TypeDef::BitSequence(inner) => decode_bit_sequence_value(data, inner, types).map(ValueDef::BitSequence), - }?; - - Ok(Value { value, context: ty_id }) -} - -fn decode_composite_value( - data: &mut &[u8], - ty: &TypeDefComposite, - types: &PortableRegistry, -) -> Result, DecodeValueError> { - decode_fields(data, ty.fields(), types) -} - -fn decode_variant_value( - data: &mut &[u8], - ty: &TypeDefVariant, - types: &PortableRegistry, -) -> Result, DecodeValueError> { - let index = *data.get(0).ok_or(DecodeValueError::Eof)?; - *data = &data[1..]; - - // Does a variant exist with the index we're looking for? - let variant = ty - .variants() - .iter() - .find(|v| v.index() == index) - .ok_or_else(|| DecodeValueError::VariantNotFound(index, ty.clone()))?; - - let fields = decode_fields(data, variant.fields(), types)?; - Ok(Variant { name: variant.name().clone(), values: fields }) -} - -/// Variant and Composite types both have fields; this will decode them into values. -fn decode_fields( - data: &mut &[u8], - fields: &[Field], - types: &PortableRegistry, -) -> Result, DecodeValueError> { - let are_named = fields.iter().any(|f| f.name().is_some()); - let named_field_vals = fields.iter().map(|f| { - let name = f.name().cloned().unwrap_or_default(); - decode_value_by_id(data, f.ty(), types).map(|val| (name, val)) - }); - - if are_named { - let vals = named_field_vals.collect::>()?; - Ok(Composite::Named(vals)) - } else { - let vals = named_field_vals.map(|r| r.map(|(_, v)| v)).collect::>()?; - Ok(Composite::Unnamed(vals)) - } -} - -fn decode_sequence_value( - data: &mut &[u8], - ty: &TypeDefSequence, - types: &PortableRegistry, -) -> Result, DecodeValueError> { - // We assume that the sequence is preceeded by a compact encoded length, so that - // we know how many values to try pulling out of the data. - let len = Compact::::decode(data)?; - let values: Vec<_> = - (0..len.0).map(|_| decode_value_by_id(data, ty.type_param(), types)).collect::>()?; - - Ok(Composite::Unnamed(values)) -} - -fn decode_array_value( - data: &mut &[u8], - ty: &TypeDefArray, - types: &PortableRegistry, -) -> Result, DecodeValueError> { - // The length is known based on the type we want to decode into, so we pull out the number of items according - // to that, and don't need a length to exist in the SCALE encoded bytes - let values: Vec<_> = - (0..ty.len()).map(|_| decode_value_by_id(data, ty.type_param(), types)).collect::>()?; - - Ok(Composite::Unnamed(values)) -} - -fn decode_tuple_value( - data: &mut &[u8], - ty: &TypeDefTuple, - types: &PortableRegistry, -) -> Result, DecodeValueError> { - let values: Vec<_> = ty.fields().iter().map(|f| decode_value_by_id(data, f, types)).collect::>()?; - - Ok(Composite::Unnamed(values)) -} - -fn decode_primitive_value(data: &mut &[u8], ty: &TypeDefPrimitive) -> Result { - let val = match ty { - TypeDefPrimitive::Bool => Primitive::Bool(bool::decode(data)?), - TypeDefPrimitive::Char => { - // [jsdw] TODO: There isn't a `char::decode`. Why? Is it wrong to use u32 or is there a more "proper" way? - let val = u32::decode(data)?; - Primitive::Char(char::from_u32(val).ok_or(DecodeValueError::InvalidChar(val))?) - } - TypeDefPrimitive::Str => Primitive::Str(String::decode(data)?), - TypeDefPrimitive::U8 => Primitive::U8(u8::decode(data)?), - TypeDefPrimitive::U16 => Primitive::U16(u16::decode(data)?), - TypeDefPrimitive::U32 => Primitive::U32(u32::decode(data)?), - TypeDefPrimitive::U64 => Primitive::U64(u64::decode(data)?), - TypeDefPrimitive::U128 => Primitive::U128(u128::decode(data)?), - TypeDefPrimitive::U256 => Primitive::U256(<[u8; 32]>::decode(data)?), - TypeDefPrimitive::I8 => Primitive::I8(i8::decode(data)?), - TypeDefPrimitive::I16 => Primitive::I16(i16::decode(data)?), - TypeDefPrimitive::I32 => Primitive::I32(i32::decode(data)?), - TypeDefPrimitive::I64 => Primitive::I64(i64::decode(data)?), - TypeDefPrimitive::I128 => Primitive::I128(i128::decode(data)?), - TypeDefPrimitive::I256 => Primitive::I256(<[u8; 32]>::decode(data)?), - }; - Ok(val) -} - -fn decode_compact_value( - data: &mut &[u8], - ty: &TypeDefCompact, - types: &PortableRegistry, -) -> Result, DecodeValueError> { - fn decode_compact( - data: &mut &[u8], - inner: &Type, - types: &PortableRegistry, - ) -> Result, DecodeValueError> { - use TypeDefPrimitive::*; - let val = match inner.type_def() { - // It's obvious how to decode basic primitive unsigned types, since we have impls for them. - TypeDef::Primitive(U8) => ValueDef::Primitive(Primitive::U8(Compact::::decode(data)?.0)), - TypeDef::Primitive(U16) => ValueDef::Primitive(Primitive::U16(Compact::::decode(data)?.0)), - TypeDef::Primitive(U32) => ValueDef::Primitive(Primitive::U32(Compact::::decode(data)?.0)), - TypeDef::Primitive(U64) => ValueDef::Primitive(Primitive::U64(Compact::::decode(data)?.0)), - TypeDef::Primitive(U128) => ValueDef::Primitive(Primitive::U128(Compact::::decode(data)?.0)), - // A struct with exactly 1 field containing one of the above types can be sensibly compact encoded/decoded. - TypeDef::Composite(composite) => { - if composite.fields().len() != 1 { - return Err(DecodeValueError::CannotDecodeCompactIntoType(inner.clone())); - } - - // What type is the 1 field that we are able to decode? - let field = &composite.fields()[0]; - let field_type_id = field.ty().id(); - let inner_ty = types.resolve(field_type_id).ok_or(DecodeValueError::TypeIdNotFound(field_type_id))?; - - // Decode this inner type via compact decoding. This can recurse, in case - // the inner type is also a 1-field composite type. - let inner_value = Value { value: decode_compact(data, inner_ty, types)?, context: field.ty().into() }; - - // Wrap the inner type in a representation of this outer composite type. - let composite = match field.name() { - Some(name) => Composite::Named(vec![(name.clone(), inner_value)]), - None => Composite::Unnamed(vec![inner_value]), - }; - - ValueDef::Composite(composite) - } - // For now, we give up if we have been asked for any other type: - _cannot_decode_from => return Err(DecodeValueError::CannotDecodeCompactIntoType(inner.clone())), - }; - - Ok(val) - } - - // Pluck the inner type out and run it through our compact decoding logic. - let inner = - types.resolve(ty.type_param().id()).ok_or_else(|| DecodeValueError::TypeIdNotFound(ty.type_param().id()))?; - decode_compact(data, inner, types) -} - -fn decode_bit_sequence_value( - data: &mut &[u8], - _ty: &TypeDefBitSequence, - _types: &PortableRegistry, -) -> Result { - // [jsdw] TODO: might be worth checking the bit_store and bit_order types - // and trying to work out whether they look like Lsb0 and u8, which is what - // we assume here. - let bit_vec: BitSequence = Decode::decode(data)?; - Ok(bit_vec) -} - -#[cfg(test)] -mod test { - - use super::*; - use codec::Encode; - - /// Given a type definition, return the PortableType and PortableRegistry - /// that our decode functions expect. - fn make_type() -> (TypeId, PortableRegistry) { - let m = scale_info::MetaType::new::(); - let mut types = scale_info::Registry::new(); - let id = types.register_type(&m); - let portable_registry: PortableRegistry = types.into(); - - (id.into(), portable_registry) - } - - /// Given a value to encode, and a representation of the decoded value, check that our decode functions - /// successfully decodes the type to the expected value, based on the implicit SCALE type info that the type - /// carries - fn encode_decode_check(val: T, exp: Value<()>) { - encode_decode_check_explicit_info::(val, exp) - } - - /// Given a value to encode, a type to decode it back into, and a representation of - /// the decoded value, check that our decode functions successfully decodes as expected. - fn encode_decode_check_explicit_info(val: T, ex: Value<()>) { - let encoded = val.encode(); - let encoded = &mut &*encoded; - - let (id, portable_registry) = make_type::(); - - // Can we decode? - let val = decode_value_by_id(encoded, id, &portable_registry).expect("decoding failed"); - // Is the decoded value what we expected? - assert_eq!(val.without_context(), ex, "decoded value does not look like what we expected"); - // Did decoding consume all of the encoded bytes, as expected? - assert_eq!(encoded.len(), 0, "decoding did not consume all of the encoded bytes"); - } - - #[test] - fn decode_primitives() { - encode_decode_check(true, Value::bool(true)); - encode_decode_check(false, Value::bool(false)); - encode_decode_check_explicit_info::('a' as u32, Value::char('a')); - encode_decode_check("hello", Value::str("hello".into())); - encode_decode_check( - "hello".to_string(), // String or &str (above) decode OK - Value::str("hello".into()), - ); - encode_decode_check(123u8, Value::u8(123)); - encode_decode_check(123u16, Value::u16(123)); - encode_decode_check(123u32, Value::u32(123)); - encode_decode_check(123u64, Value::u64(123)); - //// Todo [jsdw]: Can we test this if we need a TypeInfo param?: - // encode_decode_check_explicit_info( - // [123u8; 32], // Anything 32 bytes long will do here - // Value::u256([123u8; 32]), - // ); - encode_decode_check(123i8, Value::i8(123)); - encode_decode_check(123i16, Value::i16(123)); - encode_decode_check(123i32, Value::i32(123)); - encode_decode_check(123i64, Value::i64(123)); - //// Todo [jsdw]: Can we test this if we need a TypeInfo param?: - // encode_decode_check_explicit_info( - // [123u8; 32], // Anything 32 bytes long will do here - // Value::i256([123u8; 32]), - // ); - } - - #[test] - fn decode_compact_primitives() { - encode_decode_check(Compact(123u8), Value::u8(123)); - encode_decode_check(Compact(123u16), Value::u16(123)); - encode_decode_check(Compact(123u32), Value::u32(123)); - encode_decode_check(Compact(123u64), Value::u64(123)); - encode_decode_check(Compact(123u128), Value::u128(123)); - } - - #[test] - fn decode_compact_named_wrapper_struct() { - // A struct that can be compact encoded: - #[derive(Encode, scale_info::TypeInfo)] - struct MyWrapper { - inner: u32, - } - impl From> for MyWrapper { - fn from(val: Compact) -> MyWrapper { - val.0 - } - } - impl codec::CompactAs for MyWrapper { - type As = u32; - - fn encode_as(&self) -> &Self::As { - &self.inner - } - fn decode_from(inner: Self::As) -> Result { - Ok(MyWrapper { inner }) - } - } - - encode_decode_check( - Compact(MyWrapper { inner: 123 }), - Value::named_composite(vec![("inner".to_string(), Value::u32(123))]), - ); - } - - #[test] - fn decode_compact_unnamed_wrapper_struct() { - // A struct that can be compact encoded: - #[derive(Encode, scale_info::TypeInfo)] - struct MyWrapper(u32); - impl From> for MyWrapper { - fn from(val: Compact) -> MyWrapper { - val.0 - } - } - impl codec::CompactAs for MyWrapper { - type As = u32; - - // Node the requirement to return something with a lifetime tied - // to self here. This means that we can't implement this for things - // more complex than wrapper structs (eg `Foo(u32,u32,u32,u32)`) without - // shenanigans, meaning that (hopefully) supporting wrapper struct - // decoding and nothing fancier is sufficient. - fn encode_as(&self) -> &Self::As { - &self.0 - } - fn decode_from(inner: Self::As) -> Result { - Ok(MyWrapper(inner)) - } - } - - encode_decode_check(Compact(MyWrapper(123)), Value::unnamed_composite(vec![Value::u32(123)])); - } - - #[test] - fn decode_sequence_array_tuple_types() { - encode_decode_check( - vec![1i32, 2, 3], - Value::unnamed_composite(vec![Value::i32(1), Value::i32(2), Value::i32(3)]), - ); - encode_decode_check( - [1i32, 2, 3], //compile-time length known - Value::unnamed_composite(vec![Value::i32(1), Value::i32(2), Value::i32(3)]), - ); - encode_decode_check( - (1i32, true, 123456u128), - Value::unnamed_composite(vec![Value::i32(1), Value::bool(true), Value::u128(123456)]), - ); - } - - #[test] - fn decode_variant_types() { - #[derive(Encode, scale_info::TypeInfo)] - enum MyEnum { - Foo(bool), - Bar { hi: String, other: u128 }, - } - - encode_decode_check( - MyEnum::Foo(true), - Value::variant("Foo".to_string(), Composite::Unnamed(vec![Value::bool(true)])), - ); - encode_decode_check( - MyEnum::Bar { hi: "hello".to_string(), other: 123 }, - Value::variant( - "Bar".to_string(), - Composite::Named(vec![ - ("hi".to_string(), Value::str("hello".to_string())), - ("other".to_string(), Value::u128(123)), - ]), - ), - ); - } - - #[test] - fn decode_composite_types() { - #[derive(Encode, scale_info::TypeInfo)] - struct Unnamed(bool, String, Vec); - - #[derive(Encode, scale_info::TypeInfo)] - struct Named { - is_valid: bool, - name: String, - bytes: Vec, - } - - encode_decode_check( - Unnamed(true, "James".into(), vec![1, 2, 3]), - Value::unnamed_composite(vec![ - Value::bool(true), - Value::str("James".to_string()), - Value::unnamed_composite(vec![Value::u8(1), Value::u8(2), Value::u8(3)]), - ]), - ); - encode_decode_check( - Named { is_valid: true, name: "James".into(), bytes: vec![1, 2, 3] }, - Value::named_composite(vec![ - ("is_valid".into(), Value::bool(true)), - ("name".into(), Value::str("James".to_string())), - ("bytes".into(), Value::unnamed_composite(vec![Value::u8(1), Value::u8(2), Value::u8(3)])), - ]), - ); - } - - #[test] - fn decode_bit_sequence() { - use bitvec::{bitvec, order::Lsb0}; - - encode_decode_check( - bitvec![Lsb0, u8; 0, 1, 1, 0, 1, 0], - Value::bit_sequence(bitvec![Lsb0, u8; 0, 1, 1, 0, 1, 0]), - ); - } -} diff --git a/desub-current/src/decoder/extrinsic_bytes.rs b/desub-current/src/decoder/extrinsic_bytes.rs index 3ab801bc..627a05ce 100644 --- a/desub-current/src/decoder/extrinsic_bytes.rs +++ b/desub-current/src/decoder/extrinsic_bytes.rs @@ -130,7 +130,7 @@ pub struct ExtrinsicBytesError { /// return a tuple of the length of the vector, and the number of input bytes used to represent /// this length. fn decode_compact_u32(mut data: &[u8]) -> Option<(usize, usize)> { - use codec::{Compact, CompactLen, Decode}; + use parity_scale_codec::{Compact, CompactLen, Decode}; let length = u32::from(Compact::::decode(&mut data).ok()?); let prefix = Compact::::compact_len(&length); @@ -142,7 +142,7 @@ fn decode_compact_u32(mut data: &[u8]) -> Option<(usize, usize)> { mod test { use super::*; - use codec::{Compact, Encode}; + use parity_scale_codec::{Compact, Encode}; fn iter_result_to_bytes(res: Option, E>>) -> Option> { res.map(|r| r.map(|e| e.bytes())) diff --git a/desub-current/src/decoder/mod.rs b/desub-current/src/decoder/mod.rs index ccb914b2..43efafb1 100644 --- a/desub-current/src/decoder/mod.rs +++ b/desub-current/src/decoder/mod.rs @@ -23,20 +23,20 @@ //! See [`decode_storage()`] and then the documentation on [`StorageDecoder`] to decode storage lookups. mod decode_storage; -mod decode_value; mod extrinsic_bytes; use crate::metadata::Metadata; -use crate::value::Value; use crate::TypeId; -use codec::{Compact, Decode}; use extrinsic_bytes::{AllExtrinsicBytes, ExtrinsicBytesError}; +use parity_scale_codec::{Compact, Decode}; +use scale_decode::DecodeAsType; +use scale_value::Value; use serde::Serialize; use sp_runtime::{AccountId32, MultiAddress, MultiSignature}; use std::borrow::Cow; // Re-export the DecodeValueError here, which we expose in our global `DecodeError` enum. -pub use decode_value::DecodeValueError; +pub use scale_decode::Error as DecodeValueError; // Re-export storage related types that are part of our public interface. pub use decode_storage::{ @@ -45,12 +45,12 @@ pub use decode_storage::{ /// An enum of the possible errors that can be returned from attempting to decode bytes /// using the functions in this module. -#[derive(Clone, Debug, thiserror::Error)] +#[derive(Debug, thiserror::Error)] pub enum DecodeError { #[error("Failed to parse the provided vector of extrinsics: {0}")] UnexpectedExtrinsicsShape(#[from] ExtrinsicBytesError), #[error("Failed to decode: {0}")] - CodecError(#[from] codec::Error), + CodecError(#[from] parity_scale_codec::Error), #[error("Failed to decode type: {0}")] DecodeValueError(#[from] DecodeValueError), #[error("Failed to decode: expected more data")] @@ -67,12 +67,12 @@ pub enum DecodeError { /// Decode a single [`Value`] from a piece of scale encoded data, given some metadata and the ID of the type that we /// are expecting it to decode into. -pub fn decode_value_by_id<'a, Id: Into>( - metadata: &'a Metadata, +pub fn decode_value_by_id>( + metadata: &Metadata, ty: Id, data: &mut &[u8], ) -> Result, DecodeValueError> { - decode_value::decode_value_by_id(data, ty, metadata.types()) + Value::decode_as_type(data, ty.into(), metadata.types()) } /// Generate a [`StorageDecoder`] struct which is capable of decoding SCALE encoded storage keys. It's advisable @@ -85,9 +85,9 @@ pub fn decode_value_by_id<'a, Id: Into>( /// use desub_current::{ /// Metadata, /// decoder::{ self, StorageHasher }, -/// value::{ Value, ValueDef, Composite, Primitive }, /// }; -/// use codec::Encode; +/// use scale_value::{ Value, ValueDef, Composite, Primitive }; +/// use parity_scale_codec::Encode; /// /// // Get hold of the metadata (normally by making an RPC call /// // to the node you want to interact with): @@ -114,18 +114,16 @@ pub fn decode_value_by_id<'a, Id: Into>( /// // Because the hasher is Twox64Concat, we can see the decoded original map key: /// assert_eq!(keys.len(), 1); /// if let StorageHasher::Twox64Concat(val) = keys[0].hasher.clone() { -/// assert_eq!(val.without_context(), Value::u32(1000)) +/// assert_eq!(val.remove_context(), Value::u128(1000)) /// } /// /// // We can also decode values at this storage location using the type info we get back: /// let bytes = [1u8; 32].encode(); -/// let val = decoder::decode_value_by_id(&metadata, &entry.ty, &mut &*bytes).unwrap(); +/// let val = decoder::decode_value_by_id(&metadata, entry.ty, &mut &*bytes).unwrap(); /// # assert_eq!( -/// # val.without_context(), +/// # val.remove_context(), /// # // The Type in this case is something like a newtype-wrapped [u8; 32]: -/// # Value::unnamed_composite(vec![ -/// # Value::unnamed_composite(vec![Value::u8(1); 32]) -/// # ]) +/// # Value::unnamed_composite(vec![Value::from_bytes(vec![1u8; 32])]) /// # ); /// ``` pub fn decode_storage(metadata: &Metadata) -> StorageDecoder { @@ -160,7 +158,7 @@ pub fn decode_extrinsics<'a>( metadata: &'a Metadata, data: &mut &[u8], ) -> Result>, (Vec>, DecodeError)> { - let extrinsic_bytes = AllExtrinsicBytes::new(*data).map_err(|e| (Vec::new(), e.into()))?; + let extrinsic_bytes = AllExtrinsicBytes::new(data).map_err(|e| (Vec::new(), e.into()))?; log::trace!("Decoding {} Total Extrinsics.", extrinsic_bytes.len()); @@ -344,11 +342,11 @@ pub fn decode_call_data<'a>(metadata: &'a Metadata, data: &mut &[u8]) -> Result< // Decode each of the argument values in the extrinsic: let arguments = variant - .fields() + .fields .iter() .map(|field| { - let id = field.ty().id(); - decode_value_by_id(metadata, TypeId::from_u32(id), data).map_err(DecodeError::DecodeValueError) + let id = field.ty.id; + decode_value_by_id(metadata, id, data).map_err(DecodeError::DecodeValueError) }) .collect::, _>>()?; @@ -394,7 +392,7 @@ pub fn decode_signed_extensions<'a>( .signed_extensions() .iter() .map(|ext| { - let val = decode_value_by_id(metadata, &ext.ty, data)?; + let val = decode_value_by_id(metadata, ext.ty.id, data)?; let name = Cow::Borrowed(&*ext.identifier); Ok((name, val)) }) @@ -414,7 +412,7 @@ pub fn decode_additional_signed<'a>( .signed_extensions() .iter() .map(|ext| { - let val = decode_value_by_id(metadata, &ext.additional_signed, data)?; + let val = decode_value_by_id(metadata, ext.additional_signed.id, data)?; let name = Cow::Borrowed(&*ext.identifier); Ok((name, val)) }) diff --git a/desub-current/src/lib.rs b/desub-current/src/lib.rs index 6ce9bd6a..2df435f8 100644 --- a/desub-current/src/lib.rs +++ b/desub-current/src/lib.rs @@ -17,16 +17,14 @@ //! A crate to decode extrinsics, signer payloads and storage keys for substrate nodes using V14+ metadata. //! See [`decoder`] for more information. -mod type_id; - pub mod decoder; pub mod metadata; -pub mod value; pub use metadata::Metadata; -pub use value::{Value, ValueDef}; +pub use scale_value::{Value, ValueDef}; -pub use type_id::TypeId; +/// An ID that represents a type in a [`scale_info::PortableRegistry`]. +pub type TypeId = u32; /// A re-export of the [`scale_info`] crate, since we delegate much of the type inspection to it. pub use scale_info; diff --git a/desub-current/src/metadata/mod.rs b/desub-current/src/metadata/mod.rs index a93d6a96..85756235 100644 --- a/desub-current/src/metadata/mod.rs +++ b/desub-current/src/metadata/mod.rs @@ -22,8 +22,8 @@ mod u8_map; mod version_14; use crate::{ScaleInfoTypeId, Type, TypeId}; -use codec::Decode; use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed}; +use parity_scale_codec::Decode; use readonly_array::ReadonlyArray; use scale_info::{form::PortableForm, PortableRegistry}; use u8_map::U8Map; @@ -32,7 +32,7 @@ use u8_map::U8Map; // so to avoid confusion we only publicly export all scale-info types from that // one place. type TypeDefVariant = scale_info::TypeDefVariant; -type SignedExtensionMetadata = frame_metadata::SignedExtensionMetadata; +type SignedExtensionMetadata = frame_metadata::v14::SignedExtensionMetadata; type StorageEntryMetadata = frame_metadata::v14::StorageEntryMetadata; /// An enum of the possible errors that can be returned from attempting to construct @@ -42,7 +42,7 @@ pub enum MetadataError { #[error("metadata version {0} is not supported")] UnsupportedVersion(u32), #[error("{0}")] - CodecError(#[from] codec::Error), + CodecError(#[from] parity_scale_codec::Error), #[error("unexpected type; expecting a Variant type, but got {got}")] ExpectedVariantType { got: String }, #[error("could not find type with ID {0}")] @@ -106,7 +106,7 @@ impl Metadata { /// Given a [`crate::TypeId`], return the corresponding type from the type registry, if possible. pub fn resolve>(&self, id: Id) -> Option<&Type> { - self.types.resolve(id.into().id()) + self.types.resolve(id.into()) } /// Return a reference to the [`scale_info`] type registry. @@ -145,7 +145,7 @@ impl Metadata { p.calls.as_ref().and_then(|calls| { let type_def_variant = self.get_variant(calls.calls_type_id)?; let index = *calls.call_variant_indexes.get(call)?; - let variant = type_def_variant.variants().get(index)?; + let variant = type_def_variant.variants.get(index)?; Some((&*p.name, variant)) }) }) @@ -153,7 +153,7 @@ impl Metadata { /// A helper function to get hold of a Variant given a type ID, or None if it's not found. fn get_variant(&self, ty: ScaleInfoTypeId) -> Option<&TypeDefVariant> { - self.types.resolve(ty.id()).and_then(|ty| match ty.type_def() { + self.types.resolve(ty.id).and_then(|ty| match &ty.type_def { scale_info::TypeDef::Variant(variant) => Some(variant), _ => None, }) diff --git a/desub-current/src/metadata/version_14.rs b/desub-current/src/metadata/version_14.rs index 926b39bd..56e0e57f 100644 --- a/desub-current/src/metadata/version_14.rs +++ b/desub-current/src/metadata/version_14.rs @@ -16,7 +16,7 @@ use super::u8_map::U8Map; use super::{Metadata, MetadataCalls, MetadataError, MetadataExtrinsic, MetadataPalletCalls, MetadataPalletStorage}; -use frame_metadata::RuntimeMetadataV14; +use frame_metadata::v14::RuntimeMetadataV14; /// Decode V14 metadata into our general Metadata struct pub fn decode(meta: RuntimeMetadataV14) -> Result { @@ -36,12 +36,11 @@ pub fn decode(meta: RuntimeMetadataV14) -> Result { .map(|call_md| { // Get the type representing the variant of available calls: let calls_type_id = call_md.ty; - let calls_type = registry - .resolve(calls_type_id.id()) - .ok_or_else(|| MetadataError::TypeNotFound(calls_type_id.id()))?; + let calls_type = + registry.resolve(calls_type_id.id).ok_or_else(|| MetadataError::TypeNotFound(calls_type_id.id))?; // Expect that type to be a variant: - let calls_type_def = calls_type.type_def(); + let calls_type_def = &calls_type.type_def; let calls_variant = match calls_type_def { scale_info::TypeDef::Variant(variant) => variant, _ => { @@ -51,7 +50,7 @@ pub fn decode(meta: RuntimeMetadataV14) -> Result { // Store the mapping from u8 index to variant slice index for quicker decode lookup: let call_variant_indexes = - calls_variant.variants().iter().enumerate().map(|(idx, v)| (v.index(), idx)).collect(); + calls_variant.variants.iter().enumerate().map(|(idx, v)| (v.index, idx)).collect(); Ok(MetadataCalls { calls_type_id, call_variant_indexes }) }) diff --git a/desub-current/src/type_id.rs b/desub-current/src/type_id.rs deleted file mode 100644 index 161b25b6..00000000 --- a/desub-current/src/type_id.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. -// This file is part of substrate-desub. -// -// substrate-desub is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// substrate-desub is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with substrate-desub. If not, see . - -use crate::ScaleInfoTypeId; - -/// This represents the ID of a type found in the metadata. A scale info type representation can -/// be converted into this, and we get this back directly when decoding types into Values. -#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize)] -pub struct TypeId(u32); - -impl TypeId { - /// Create a new `TypeId` from a `u32`. - pub(crate) fn from_u32(id: u32) -> TypeId { - TypeId(id) - } - /// Return the u32 ID expected by a PortableRegistry. - pub(crate) fn id(self) -> u32 { - self.0 - } -} - -impl From for TypeId { - fn from(id: ScaleInfoTypeId) -> Self { - TypeId(id.id()) - } -} - -impl From<&ScaleInfoTypeId> for TypeId { - fn from(id: &ScaleInfoTypeId) -> Self { - TypeId(id.id()) - } -} - -impl From<&TypeId> for TypeId { - fn from(id: &TypeId) -> Self { - *id - } -} diff --git a/desub-current/src/value/deserialize.rs b/desub-current/src/value/deserialize.rs deleted file mode 100644 index 9b9743fd..00000000 --- a/desub-current/src/value/deserialize.rs +++ /dev/null @@ -1,669 +0,0 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. -// This file is part of substrate-desub. -// -// substrate-desub is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// substrate-desub is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with substrate-desub. If not, see . - -use super::{Composite, Primitive, Value, ValueDef, Variant}; -use serde::{ - self, - de::{Error, Visitor}, - Deserialize, Deserializer, -}; -use std::convert::TryInto; - -/* -This module implements the [`Deserialize`] (no R!) trait on our [`Value`] enum. -====================================================================== - -See deserializer.rs for more of a description. - -The Deserialize trait is responsible for describing how some other value (or at least, -the repreentastion of it in terms of the serde data model) can be turned into our `Value` -enum. - -One thing we aim for is to be able to losslessly deserialize a [`Value`] into a -[`Value`]. This would allow for partial type deserialization, for instance we might want to turn -only part of our input into a struct, say, and leave the rest as [`Value`] types until we know what -to do with them. -*/ - -impl<'de> Deserialize<'de> for Value<()> { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let value = deserializer.deserialize_any(ValueDefVisitor)?; - Ok(Value { value, context: () }) - } -} - -impl<'de> Deserialize<'de> for ValueDef<()> { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - deserializer.deserialize_any(ValueDefVisitor) - } -} - -impl<'de> Deserialize<'de> for Primitive { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - deserializer.deserialize_any(PrimitiveVisitor) - } -} - -impl<'de> Deserialize<'de> for Composite<()> { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - deserializer.deserialize_any(CompositeVisitor) - } -} - -impl<'de> Deserialize<'de> for Variant<()> { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - deserializer.deserialize_any(VariantVisitor) - } -} - -struct PrimitiveVisitor; - -macro_rules! visit_prim { - ($name:ident $ty:ident $variant:ident) => { - fn $name(self, v: $ty) -> Result - where - E: serde::de::Error, - { - Ok(Primitive::$variant(v)) - } - } -} - -impl<'de> Visitor<'de> for PrimitiveVisitor { - type Value = Primitive; - - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { - formatter.write_str("a type that can be decoded into a Primitive value") - } - - visit_prim!(visit_bool bool Bool); - visit_prim!(visit_i8 i8 I8); - visit_prim!(visit_i16 i16 I16); - visit_prim!(visit_i32 i32 I32); - visit_prim!(visit_i64 i64 I64); - visit_prim!(visit_i128 i128 I128); - visit_prim!(visit_u8 u8 U8); - visit_prim!(visit_u16 u16 U16); - visit_prim!(visit_u32 u32 U32); - visit_prim!(visit_u64 u64 U64); - visit_prim!(visit_u128 u128 U128); - visit_prim!(visit_char char Char); - - fn visit_str(self, v: &str) -> Result - where - E: serde::de::Error, - { - Ok(Primitive::Str(v.into())) - } - - fn visit_string(self, v: String) -> Result - where - E: serde::de::Error, - { - Ok(Primitive::Str(v)) - } - - fn visit_bytes(self, v: &[u8]) -> Result - where - E: serde::de::Error, - { - let val = v.try_into().map_err(|_| serde::de::Error::invalid_type(serde::de::Unexpected::Bytes(v), &self))?; - Ok(Primitive::U256(val)) - } - - fn visit_seq(self, mut seq: A) -> Result - where - A: serde::de::SeqAccess<'de>, - { - let mut vals = Vec::new(); - while let Some(el) = seq.next_element()? { - vals.push(el) - } - let len = vals.len(); - let arr = vals.try_into().map_err(|_| serde::de::Error::invalid_length(len, &"exactly 32 bytes"))?; - Ok(Primitive::U256(arr)) - } - - fn visit_some(self, deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - Primitive::deserialize(deserializer) - } -} - -struct CompositeVisitor; - -impl<'de> Visitor<'de> for CompositeVisitor { - type Value = Composite<()>; - - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { - formatter.write_str("a type that can be decoded into a Composite value") - } - - fn visit_bytes(self, v: &[u8]) -> Result - where - E: serde::de::Error, - { - let byte_values = v.iter().map(|&b| Value::u8(b)).collect(); - Ok(Composite::Unnamed(byte_values)) - } - - fn visit_none(self) -> Result - where - E: serde::de::Error, - { - Ok(Composite::Unnamed(Vec::new())) - } - - fn visit_some(self, deserializer: D) -> Result - where - D: Deserializer<'de>, - { - Composite::deserialize(deserializer) - } - - fn visit_unit(self) -> Result - where - E: serde::de::Error, - { - Ok(Composite::Unnamed(Vec::new())) - } - - fn visit_newtype_struct(self, deserializer: D) -> Result - where - D: Deserializer<'de>, - { - Composite::deserialize(deserializer) - } - - fn visit_seq(self, mut seq: A) -> Result - where - A: serde::de::SeqAccess<'de>, - { - let mut values = Vec::with_capacity(seq.size_hint().unwrap_or(0)); - while let Some(value) = seq.next_element()? { - values.push(value); - } - Ok(Composite::Unnamed(values)) - } - - fn visit_map(self, mut map: A) -> Result - where - A: serde::de::MapAccess<'de>, - { - let mut values = Vec::with_capacity(map.size_hint().unwrap_or(0)); - while let Some(key_val) = map.next_entry()? { - values.push(key_val); - } - Ok(Composite::Named(values)) - } -} - -struct VariantVisitor; - -impl<'de> Visitor<'de> for VariantVisitor { - type Value = Variant<()>; - - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { - formatter.write_str("a type that can be decoded into an enum Variant") - } - - fn visit_enum(self, data: A) -> Result - where - A: serde::de::EnumAccess<'de>, - { - data.variant().and_then(|(name, variant_access)| { - use serde::de::VariantAccess; - // We have to ask for a particular enum type, but we don't know what type - // of enum to expect (we support anything!). So, we just call the visitor method - // that doesn't require any extra fields, and we know that this will just give back - // whatever it can based on our impl (who knows about other impls though). - let values = variant_access.newtype_variant()?; - Ok(Variant { name, values }) - }) - } - - fn visit_map(self, mut map: A) -> Result - where - A: serde::de::MapAccess<'de>, - { - // We support deserializing from a map that looks like - // { name: "VariantName", values: [1,2,3] } into Variant + Composite::Unnamed, or - // { name: "VariantName", values: { "a": 1, "b": 2 }} into Variant + Composite::Named - // to line up with our Serialize impl for the Value types. - let mut name = None; - let mut values = None; - - while let Some(k) = map.next_key::()? { - match &*k { - "name" => { - name = Some(map.next_value()?); - } - "values" => { - values = Some(map.next_value()?); - } - other => return Err(A::Error::unknown_field(other, &["name", "values"])), - } - } - - if let (Some(name), Some(values)) = (name, values) { - Ok(Variant { name, values }) - } else { - Err(A::Error::custom("map must contain 'name' and 'values' to deserialize to a Variant")) - } - } -} - -struct ValueDefVisitor; - -// It gets repetitive writing out the visitor impls to delegate to the Value subtypes; -// this helper makes that a little easier: -macro_rules! delegate_visitor_fn { - ( - $visitor:ident $mapping:path, - $( $name:ident($($ty:ty)?) )+ - ) => { - $( - fn $name(self, $(v: $ty)?) -> Result - where E: serde::de::Error { - $visitor.$name($(v as $ty)?).map($mapping) - } - )+ - } -} - -impl<'de> Visitor<'de> for ValueDefVisitor { - type Value = ValueDef<()>; - - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { - formatter.write_str("a type that can be decoded into a Value") - } - - delegate_visitor_fn!( - PrimitiveVisitor ValueDef::Primitive, - visit_bool(bool) - visit_i8(i8) - visit_i16(i16) - visit_i32(i32) - visit_i64(i64) - visit_i128(i128) - visit_u8(u8) - visit_u16(u16) - visit_u32(u32) - visit_u64(u64) - visit_u128(u128) - visit_char(char) - visit_str(&str) - visit_string(String) - ); - - delegate_visitor_fn!( - CompositeVisitor ValueDef::Composite, - visit_none() - visit_unit() - visit_bytes(&[u8]) - ); - - fn visit_some(self, deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - ValueDef::deserialize(deserializer) - } - - fn visit_newtype_struct(self, deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - ValueDef::deserialize(deserializer) - } - - fn visit_seq(self, seq: A) -> Result - where - A: serde::de::SeqAccess<'de>, - { - CompositeVisitor.visit_seq(seq).map(ValueDef::Composite) - } - - fn visit_map(self, map: A) -> Result - where - A: serde::de::MapAccess<'de>, - { - CompositeVisitor.visit_map(map).map(ValueDef::Composite) - } - - fn visit_enum(self, data: A) -> Result - where - A: serde::de::EnumAccess<'de>, - { - VariantVisitor.visit_enum(data).map(ValueDef::Variant) - } -} - -#[cfg(test)] -mod test { - - use super::*; - use crate::value::DeserializeError; - - /// Does a value deserialize to itself? - fn assert_value_isomorphic<'de, V: Deserializer<'de> + Deserialize<'de> + PartialEq + std::fmt::Debug + Clone>( - val: V, - ) { - assert_value_to_value(val.clone(), val) - } - - /// Does a value `a` deserialize to the expected value `b`? - fn assert_value_to_value<'de, V1, V2>(a: V1, b: V2) - where - V1: Deserializer<'de>, - V2: Deserialize<'de> + PartialEq + std::fmt::Debug + Clone, - { - let new_val = V2::deserialize(a).expect("Can deserialize"); - assert_eq!(b, new_val); - } - - #[test] - fn deserialize_primitives_isomorphic() { - assert_value_isomorphic(Value::u8(123)); - assert_value_isomorphic(Value::u16(123)); - assert_value_isomorphic(Value::u32(123)); - assert_value_isomorphic(Value::u64(123)); - assert_value_isomorphic(Value::u128(123)); - assert_value_isomorphic(Value::i8(123)); - assert_value_isomorphic(Value::i16(123)); - assert_value_isomorphic(Value::i32(123)); - assert_value_isomorphic(Value::i64(123)); - assert_value_isomorphic(Value::i128(123)); - assert_value_isomorphic(Value::bool(true)); - assert_value_isomorphic(Value::char('a')); - assert_value_isomorphic(Value::str("Hello!".into())); - - // Alas, I256 and U256 are both a sequence of bytes, which could equally be represented - // by a composite sequence (as other sequences-of-things are). We could have a special case where - // precisely 32 u8's is deserialized to one of U256 or I256, but for now we use our more general - // composite type as the sequence catch-all: - assert_value_to_value( - ValueDef::<()>::Primitive(Primitive::I256([1; 32])), - Value::unnamed_composite(vec![1; 32].into_iter().map(|b| Value::u8(b)).collect()), - ); - assert_value_to_value( - ValueDef::<()>::Primitive(Primitive::U256([1; 32])), - Value::unnamed_composite(vec![1; 32].into_iter().map(|b| Value::u8(b)).collect()), - ); - - // .. that said; if you want a primitive value back, you can use that type directly to get it - // (as long as we are given exactly 32 bytes): - - assert_value_to_value(ValueDef::<()>::Primitive(Primitive::I256([1; 32])), Primitive::U256([1; 32])); - assert_value_to_value(ValueDef::<()>::Primitive(Primitive::U256([1; 32])), Primitive::U256([1; 32])); - - // Unwrapped versions also work: - - assert_value_isomorphic(Primitive::U8(123)); - assert_value_isomorphic(Primitive::U16(123)); - assert_value_isomorphic(Primitive::U32(123)); - assert_value_isomorphic(Primitive::U64(123)); - assert_value_isomorphic(Primitive::U128(123)); - assert_value_isomorphic(Primitive::U256([1; 32])); - assert_value_isomorphic(Primitive::I8(123)); - assert_value_isomorphic(Primitive::I16(123)); - assert_value_isomorphic(Primitive::I32(123)); - assert_value_isomorphic(Primitive::I64(123)); - assert_value_isomorphic(Primitive::I128(123)); - assert_value_isomorphic(Primitive::Bool(true)); - assert_value_isomorphic(Primitive::Char('a')); - assert_value_isomorphic(Primitive::Str("Hello!".into())); - assert_value_to_value(Primitive::I256([1; 32]), Primitive::U256([1; 32])); - - // We can also go from wrapped to unwrapped: - - assert_value_to_value(Value::u8(123), Primitive::U8(123)); - assert_value_to_value(Value::u16(123), Primitive::U16(123)); - assert_value_to_value(Value::u32(123), Primitive::U32(123)); - assert_value_to_value(Value::u64(123), Primitive::U64(123)); - - // Or vice versa: - - assert_value_to_value(Primitive::U8(123), Value::u8(123)); - assert_value_to_value(Primitive::U16(123), Value::u16(123)); - assert_value_to_value(Primitive::U32(123), Value::u32(123)); - assert_value_to_value(Primitive::U64(123), Value::u64(123)); - } - - #[test] - fn deserialize_composites_isomorphic() { - assert_value_isomorphic(Value::unnamed_composite(vec![Value::u64(123), Value::bool(true)])); - assert_value_isomorphic(Value::named_composite(vec![])); - assert_value_isomorphic(Value::named_composite(vec![ - ("a".into(), Value::u64(123)), - ("b".into(), Value::bool(true)), - ])); - assert_value_isomorphic(Value::named_composite(vec![ - ("a".into(), Value::u64(123)), - ( - "b".into(), - Value::named_composite(vec![("c".into(), Value::u128(123)), ("d".into(), Value::str("hello".into()))]), - ), - ])); - - // unwrapped: - - assert_value_isomorphic(Composite::Unnamed(vec![Value::u64(123), Value::bool(true)])); - assert_value_isomorphic(Composite::Unnamed(vec![])); - assert_value_isomorphic(Composite::Named(vec![("a".into(), Value::u64(123)), ("b".into(), Value::bool(true))])); - assert_value_isomorphic(Composite::Named(vec![ - ("a".into(), Value::u64(123)), - ( - "b".into(), - Value::named_composite(vec![("c".into(), Value::u128(123)), ("d".into(), Value::str("hello".into()))]), - ), - ])); - } - - #[test] - fn deserialize_variants_isomorphic() { - assert_value_isomorphic(ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Unnamed(vec![Value::u64(123), Value::bool(true)]), - })); - assert_value_isomorphic(ValueDef::Variant(Variant { name: "Foo".into(), values: Composite::Unnamed(vec![]) })); - assert_value_isomorphic(ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Named(vec![("a".into(), Value::u64(123)), ("b".into(), Value::bool(true))]), - })); - - // unwrapped work as well: - - assert_value_isomorphic(Variant { - name: "Foo".into(), - values: Composite::Unnamed(vec![Value::u64(123), Value::bool(true)]), - }); - assert_value_isomorphic(Variant { name: "Foo".into(), values: Composite::Unnamed(vec![]) }); - assert_value_isomorphic(Variant { - name: "Foo".into(), - values: Composite::Named(vec![("a".into(), Value::u64(123)), ("b".into(), Value::bool(true))]), - }); - } - - #[test] - fn sequence_to_value() { - use serde::de::{value::SeqDeserializer, IntoDeserializer}; - - let de: SeqDeserializer<_, DeserializeError> = vec![1u8, 2, 3, 4].into_deserializer(); - - assert_value_to_value( - de.clone(), - Value::unnamed_composite(vec![Value::u8(1), Value::u8(2), Value::u8(3), Value::u8(4)]), - ); - assert_value_to_value(de, Composite::Unnamed(vec![Value::u8(1), Value::u8(2), Value::u8(3), Value::u8(4)])); - } - - #[test] - fn sequence_to_primitive() { - use serde::de::{value::SeqDeserializer, IntoDeserializer}; - - let de: SeqDeserializer<_, DeserializeError> = vec![1u8; 32].into_deserializer(); - - assert_value_to_value(de, Primitive::U256([1; 32])); - } - - #[test] - fn map_to_value() { - use serde::de::{value::MapDeserializer, IntoDeserializer}; - use std::collections::HashMap; - - let map = { - let mut map = HashMap::<&'static str, i32>::new(); - map.insert("a", 1i32); - map.insert("b", 2i32); - map.insert("c", 3i32); - map - }; - - let de: MapDeserializer<_, DeserializeError> = map.into_deserializer(); - - let value = ValueDef::deserialize(de).expect("should deserialize OK"); - if let ValueDef::Composite(Composite::Named(vals)) = value { - // These could come back in any order so we need to search for them: - assert!(vals.contains(&("a".into(), Value::i32(1)))); - assert!(vals.contains(&("b".into(), Value::i32(2)))); - assert!(vals.contains(&("c".into(), Value::i32(3)))); - } else { - panic!("Map should deserialize into Composite::Named value but we have {:?}", value); - } - } - - #[test] - fn partially_deserialize_value() { - let value = Value::named_composite(vec![ - ("a".into(), Value::u64(123)), - ( - "b".into(), - Value::named_composite(vec![ - ("c".into(), Value::u128(123)), - ("d".into(), Value::str("hello".into())), - ("e".into(), Value::named_composite(vec![])), - ]), - ), - ]); - - #[derive(Deserialize, Debug, PartialEq)] - struct Partial { - a: Value<()>, - b: PartialB, - } - - #[derive(Deserialize, Debug, PartialEq)] - struct PartialB { - c: u128, - d: String, - e: Value<()>, - } - - let partial: Partial = crate::value::from_value(value).expect("should work"); - - assert_eq!( - partial, - Partial { - a: Value::u64(123), - b: PartialB { c: 123, d: "hello".into(), e: Value::named_composite(vec![]) } - } - ) - } - - #[test] - fn deserialize_well_formed_map_to_unnamed_variant() { - let v: Variant<()> = Variant::deserialize(serde_json::json!({ - "name": "Hello", - "values": [1, 2, true] - })) - .unwrap(); - - assert_eq!(v.name, "Hello".to_string()); - assert_eq!( - v.values, - Composite::Unnamed(vec![ - // All JSON numbers deserialize to U64 or I64 or F64 as necessary: - Value::u64(1), - Value::u64(2), - Value::bool(true), - ]) - ) - } - - #[test] - fn deserialize_well_formed_map_to_named_variant() { - let v: Variant<()> = Variant::deserialize(serde_json::json!({ - "name": "Hello", - "values": { "a": 1, "b": 2, "c": true } - })) - .unwrap(); - - assert_eq!(v.name, "Hello".to_string()); - assert_eq!( - v.values, - Composite::Named(vec![ - // All JSON numbers deserialize to U64 or I64 or F64 as necessary: - ("a".into(), Value::u64(1)), - ("b".into(), Value::u64(2)), - ("c".into(), Value::bool(true)), - ]) - ) - } - - #[test] - fn cannot_deserialize_malformed_map_to_variant() { - assert!(matches!( - Variant::deserialize(serde_json::json!({ - "names": "Hello", // "names", not "name". - "values": [1, 2, true] - })), - Err(..) - )); - assert!(matches!( - Variant::deserialize(serde_json::json!({ - "name": "Hello", - "values": [1, 2, true], - "other": true // unexpected third prop. - })), - Err(..) - )); - assert!(matches!( - Variant::deserialize(serde_json::json!({ - "names": "Hello", - "values": 1 // incorrect type of values - })), - Err(..) - )); - } -} diff --git a/desub-current/src/value/deserializer.rs b/desub-current/src/value/deserializer.rs deleted file mode 100644 index c74deb27..00000000 --- a/desub-current/src/value/deserializer.rs +++ /dev/null @@ -1,1361 +0,0 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. -// This file is part of substrate-desub. -// -// substrate-desub is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// substrate-desub is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with substrate-desub. If not, see . - -use super::{BitSequence, Composite, Primitive, Value, ValueDef, Variant}; -use serde::{ - de::{self, EnumAccess, IntoDeserializer, SeqAccess, VariantAccess}, - forward_to_deserialize_any, ser, Deserialize, Deserializer, Serialize, Serializer, -}; -use std::borrow::Cow; -use std::fmt::Display; - -/* -This module implements the Deserializer trait on our Value enum -=============================================================== - -Deserializing using Serde is a bit weird to wrap your head around at first (at least, it was for me). -I'd def recommend checking out the serde book, and inparticular https://serde.rs/impl-deserializer.html, -but here's a very quick explainer on how things work: - -We have a `Deserialize` trait (commonly automatically implemented via `#[derive(Deserialize)]`). This trait -(and the `Visitor` trait which I'll talk about in a moment) is concerned with getting the right values needed to -create an instance of the data type (struct, enum, whatever it is) in question. - -We also have a `Deserializer` trait (note the R at the end). this guy is responsible for plucking values out of some -format (could be JSON or TOML or, as we have here, another rust data type!) and handing them to a Deserialize impl. -That way, the Deserialize impl doesn't have to care about any particular format; only what it wants to be given back). - -So, how it works is that the `Deserialize` impl asks this guy for data of a certain type by calling methods like -`deserializer.deserialize_bool` or `deserializer.deserialize_i32` or whatever. (the actual methods available define -the "serde data model"; that is; the known types that can be passed between a Deserialize and Deserializer). - -But! Calling methods like `deserialize_bool` or `deserialize_i32` is really just the Deserialize impls way of -hinting to the Deserializer what it wants to be given back. In reality, the Deserializer might want to give -back something different (maybe it is being asked for a u8 but it knows it only has a u16 to give back, say). - -How? Well, the Deserialize impl calls something like `deserializer.deserialize_i32(visitor)`; it says "I want an i32, but -here's this visitor thing where you can give me back whatever you have, and I'll try and handle it if I can". So maybe -when the Deserialize impl calls `deserializer.deserialize_i32(visitor)`, the Deserializer impl for `deserialize_i32` -actually calls `visitor.visit_i64`. Who knows! - -It's basically a negotiation. The Deserialize impl asks for a value of a certain type, and it provides a visitor that will -try to accept as many types as it can. The Deserializer impl then does it's best to give back what it's asked for. If -the visitor can't handle the type given back, we are given back an error trying to deserialize; we can't convert a map -into an i32 for instance, or whatever. - -Here, we want to allow people to deserialize a `Value` type into some arbitrary struct or enum. So we implement the -Deserializer trait, and do our best to hand the visitor we're given back the data it's asking for. Since we know exactly -what data we actually have, we can often just give it back whatever we have and hgope the visitor will accept it! We have -various "special cases" though (like newtype wrapper structs) where we try to be more accomodating. -*/ - -/// An opaque error to describe in human terms what went wrong. -/// Many internal serialization/deserialization errors are relayed -/// to this in string form, and so we use basic strings for custom -/// errors as well for simplicity. -#[derive(thiserror::Error, Debug, Clone, PartialEq)] -#[error("{0}")] -pub struct Error(Cow<'static, str>); - -impl Error { - fn from_string>(s: S) -> Error { - Error(Cow::Owned(s.into())) - } - fn from_str(s: &'static str) -> Error { - Error(Cow::Borrowed(s)) - } -} - -impl de::Error for Error { - fn custom(msg: T) -> Self { - Error::from_string(msg.to_string()) - } -} -impl ser::Error for Error { - fn custom(msg: T) -> Self { - Error::from_string(msg.to_string()) - } -} - -/// Spit out the simple deserialize methods to avoid loads of repetition. -macro_rules! deserialize_x { - ($fn_name:ident) => { - fn $fn_name(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.value.$fn_name(visitor) - } - } -} - -// Our Value type has some context, which we ignore, and some definition, whose deserializer -// impl we forward to. -impl<'de, T> Deserializer<'de> for Value { - type Error = Error; - - deserialize_x!(deserialize_any); - deserialize_x!(deserialize_bool); - deserialize_x!(deserialize_i8); - deserialize_x!(deserialize_i16); - deserialize_x!(deserialize_i32); - deserialize_x!(deserialize_i64); - deserialize_x!(deserialize_i128); - deserialize_x!(deserialize_u8); - deserialize_x!(deserialize_u16); - deserialize_x!(deserialize_u32); - deserialize_x!(deserialize_u64); - deserialize_x!(deserialize_u128); - deserialize_x!(deserialize_f32); - deserialize_x!(deserialize_f64); - deserialize_x!(deserialize_char); - deserialize_x!(deserialize_str); - deserialize_x!(deserialize_string); - deserialize_x!(deserialize_bytes); - deserialize_x!(deserialize_byte_buf); - deserialize_x!(deserialize_option); - deserialize_x!(deserialize_unit); - deserialize_x!(deserialize_seq); - deserialize_x!(deserialize_map); - deserialize_x!(deserialize_identifier); - deserialize_x!(deserialize_ignored_any); - - fn deserialize_unit_struct(self, name: &'static str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.value.deserialize_unit_struct(name, visitor) - } - - fn deserialize_newtype_struct(self, name: &'static str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.value.deserialize_newtype_struct(name, visitor) - } - - fn deserialize_tuple(self, len: usize, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.value.deserialize_tuple(len, visitor) - } - - fn deserialize_tuple_struct(self, name: &'static str, len: usize, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.value.deserialize_tuple_struct(name, len, visitor) - } - - fn deserialize_struct( - self, - name: &'static str, - fields: &'static [&'static str], - visitor: V, - ) -> Result - where - V: de::Visitor<'de>, - { - self.value.deserialize_struct(name, fields, visitor) - } - - fn deserialize_enum( - self, - name: &'static str, - variants: &'static [&'static str], - visitor: V, - ) -> Result - where - V: de::Visitor<'de>, - { - self.value.deserialize_enum(name, variants, visitor) - } -} - -// Our ValueDef deserializer needs to handle BitSeq itself, but otherwise delegates to -// the inner implementations of things to handle. This macro makes that less repetitive -// to write by only requiring a bitseq impl. -macro_rules! delegate_except_bitseq { - ( - $name:ident ( $self:ident, $($arg:ident),* ), - $seq:pat => $expr:expr - ) => { - match $self { - ValueDef::BitSequence($seq) => { - $expr - }, - ValueDef::Composite(composite) => { - composite.$name( $($arg),* ) - }, - ValueDef::Variant(variant) => { - variant.$name( $($arg),* ) - }, - ValueDef::Primitive(prim) => { - prim.$name( $($arg),* ) - }, - } - } -} - -// The goal here is simply to forward deserialization methods of interest to -// the relevant subtype. The exception is our BitSequence type, which doesn't -// have a sub type to forward to and so is handled here. -impl<'de, T> Deserializer<'de> for ValueDef { - type Error = Error; - - fn deserialize_any(self, visitor: V) -> Result - where - V: serde::de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_any(self, visitor), - seq => { - BitVecPieces::new(seq)?.deserialize_any(visitor) - } - } - } - - fn deserialize_newtype_struct(self, name: &'static str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_newtype_struct(self, name, visitor), - _ => { - Err(Error::from_str("Cannot deserialize BitSequence into a newtype struct")) - } - } - } - - fn deserialize_tuple(self, len: usize, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_tuple(self, len, visitor), - _ => { - Err(Error::from_str("Cannot deserialize BitSequence into a tuple")) - } - } - } - - fn deserialize_tuple_struct(self, name: &'static str, len: usize, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_tuple_struct(self, name, len, visitor), - _ => { - Err(Error::from_str("Cannot deserialize BitSequence into a tuple struct")) - } - } - } - - fn deserialize_unit(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_unit(self, visitor), - _ => { - Err(Error::from_str("Cannot deserialize BitSequence into a ()")) - } - } - } - - fn deserialize_unit_struct(self, name: &'static str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_unit_struct(self, name, visitor), - _ => { - Err(Error::from_string(format!("Cannot deserialize BitSequence into the unit struct {}", name))) - } - } - } - - fn deserialize_enum( - self, - name: &'static str, - variants: &'static [&'static str], - visitor: V, - ) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_enum(self, name, variants, visitor), - _ => { - Err(Error::from_string(format!("Cannot deserialize BitSequence into the enum {}", name))) - } - } - } - - fn deserialize_bytes(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_bytes(self, visitor), - _ => { - Err(Error::from_str("Cannot deserialize BitSequence into raw bytes")) - } - } - } - - fn deserialize_byte_buf(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_byte_buf(self, visitor), - _ => { - Err(Error::from_str("Cannot deserialize BitSequence into raw bytes")) - } - } - } - - fn deserialize_seq(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_seq(self, visitor), - _ => { - Err(Error::from_str("Cannot deserialize BitSequence into a sequence")) - } - } - } - - fn deserialize_map(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - delegate_except_bitseq! { deserialize_map(self, visitor), - _ => { - Err(Error::from_str("Cannot deserialize BitSequence into a map")) - } - } - } - - // None of the sub types particularly care about these, so we just allow them to forward to - // deserialize_any and go from there. - forward_to_deserialize_any! { - bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string - option struct identifier ignored_any - } -} - -impl<'de, T> IntoDeserializer<'de, Error> for Value { - type Deserializer = Value; - fn into_deserializer(self) -> Self::Deserializer { - self - } -} - -impl<'de, T> Deserializer<'de> for Composite { - type Error = Error; - - fn deserialize_any(self, visitor: V) -> Result - where - V: serde::de::Visitor<'de>, - { - match self { - Composite::Named(values) => visitor.visit_map(de::value::MapDeserializer::new(values.into_iter())), - Composite::Unnamed(values) => visitor.visit_seq(de::value::SeqDeserializer::new(values.into_iter())), - } - } - - fn deserialize_seq(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - match self { - Composite::Named(values) => { - visitor.visit_seq(de::value::SeqDeserializer::new(values.into_iter().map(|(_, v)| v))) - } - Composite::Unnamed(values) => visitor.visit_seq(de::value::SeqDeserializer::new(values.into_iter())), - } - } - - fn deserialize_tuple(self, len: usize, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - match self { - // A sequence of named values? just ignores the names: - Composite::Named(values) => { - if values.len() != len { - return Err(Error::from_string(format!( - "Cannot deserialize composite of length {} into tuple of length {}", - values.len(), - len - ))); - } - visitor.visit_seq(de::value::SeqDeserializer::new(values.into_iter().map(|(_, v)| v))) - } - // A sequence of unnamed values is ideal: - Composite::Unnamed(values) => { - if values.len() != len { - return Err(Error::from_string(format!( - "Cannot deserialize composite of length {} into tuple of length {}", - values.len(), - len - ))); - } - visitor.visit_seq(de::value::SeqDeserializer::new(values.into_iter())) - } - } - } - - fn deserialize_tuple_struct(self, _name: &'static str, len: usize, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.deserialize_tuple(len, visitor) - } - - fn deserialize_unit(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - // 0 length composite types can be treated as the unit type: - if self.is_empty() { - visitor.visit_unit() - } else { - Err(Error::from_str("Cannot deserialize non-empty Composite into a unit value")) - } - } - - fn deserialize_unit_struct(self, _name: &'static str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.deserialize_unit(visitor) - } - - fn deserialize_newtype_struct(self, _name: &'static str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - visitor.visit_seq(de::value::SeqDeserializer::new(Some(self).into_iter())) - } - - fn deserialize_byte_buf(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - match self { - Composite::Named(values) => { - let bytes = values - .into_iter() - .map(|(_n, v)| { - if let ValueDef::Primitive(Primitive::U8(byte)) = v.value { - Ok(byte) - } else { - Err(Error::from_str("Cannot deserialize composite that is not entirely U8's into bytes")) - } - }) - .collect::>()?; - visitor.visit_byte_buf(bytes) - } - Composite::Unnamed(values) => { - let bytes = values - .into_iter() - .map(|v| { - if let ValueDef::Primitive(Primitive::U8(byte)) = v.value { - Ok(byte) - } else { - Err(Error::from_str("Cannot deserialize composite that is not entirely U8's into bytes")) - } - }) - .collect::>()?; - visitor.visit_byte_buf(bytes) - } - } - } - - fn deserialize_bytes(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.deserialize_byte_buf(visitor) - } - - forward_to_deserialize_any! { - bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string - option struct map - enum identifier ignored_any - } -} - -impl<'de, T> IntoDeserializer<'de, Error> for Composite { - type Deserializer = Composite; - fn into_deserializer(self) -> Self::Deserializer { - self - } -} - -// Because composite types are used to represent variant fields, we allow -// variant accesses to be called on it, which just delegate to methods defined above. -impl<'de, T> VariantAccess<'de> for Composite { - type Error = Error; - - fn unit_variant(self) -> Result<(), Self::Error> { - Deserialize::deserialize(self) - } - - fn newtype_variant_seed(self, seed: S) -> Result - where - S: de::DeserializeSeed<'de>, - { - seed.deserialize(self) - } - - fn tuple_variant(self, len: usize, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.deserialize_tuple(len, visitor) - } - - fn struct_variant(self, _fields: &'static [&'static str], visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.deserialize_any(visitor) - } -} - -impl<'de, T> Deserializer<'de> for Variant { - type Error = Error; - - fn deserialize_any(self, visitor: V) -> Result - where - V: serde::de::Visitor<'de>, - { - visitor.visit_enum(self) - } - - fn deserialize_enum( - self, - _name: &'static str, - _variants: &'static [&'static str], - visitor: V, - ) -> Result - where - V: de::Visitor<'de>, - { - visitor.visit_enum(self) - } - - fn deserialize_newtype_struct(self, _name: &'static str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - visitor.visit_seq(de::value::SeqDeserializer::new(Some(self).into_iter())) - } - - // All of the below functions delegate to the Composite deserializing methods using the enum values. - - fn deserialize_tuple(self, len: usize, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.values.deserialize_tuple(len, visitor) - } - - fn deserialize_tuple_struct(self, name: &'static str, len: usize, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.values.deserialize_tuple_struct(name, len, visitor) - } - - fn deserialize_unit_struct(self, name: &'static str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.values.deserialize_unit_struct(name, visitor) - } - - fn deserialize_unit(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.values.deserialize_unit(visitor) - } - - fn deserialize_struct( - self, - name: &'static str, - fields: &'static [&'static str], - visitor: V, - ) -> Result - where - V: de::Visitor<'de>, - { - self.values.deserialize_struct(name, fields, visitor) - } - - fn deserialize_map(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.values.deserialize_map(visitor) - } - - fn deserialize_seq(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - self.values.deserialize_seq(visitor) - } - - forward_to_deserialize_any! { - bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string - bytes byte_buf option identifier ignored_any - } -} - -impl<'de, T> IntoDeserializer<'de, Error> for Variant { - type Deserializer = Variant; - fn into_deserializer(self) -> Self::Deserializer { - self - } -} - -// Variant types can be treated as serde enums. Here we just hand back -// the pair of name and values, where values is a composite type that impls -// VariantAccess to actually allow deserializing of those values. -impl<'de, T> EnumAccess<'de> for Variant { - type Error = Error; - - type Variant = Composite; - - fn variant_seed(self, seed: V) -> Result<(V::Value, Self::Variant), Self::Error> - where - V: de::DeserializeSeed<'de>, - { - let name = self.name.into_deserializer(); - let values = self.values; - seed.deserialize(name).map(|name| (name, values)) - } -} - -impl<'de> Deserializer<'de> for Primitive { - type Error = Error; - - fn deserialize_any(self, visitor: V) -> Result - where - V: serde::de::Visitor<'de>, - { - match self { - Primitive::Bool(v) => visitor.visit_bool(v), - Primitive::Char(v) => visitor.visit_char(v), - Primitive::Str(v) => visitor.visit_string(v), - Primitive::U8(v) => visitor.visit_u8(v), - Primitive::U16(v) => visitor.visit_u16(v), - Primitive::U32(v) => visitor.visit_u32(v), - Primitive::U64(v) => visitor.visit_u64(v), - Primitive::U128(v) => visitor.visit_u128(v), - Primitive::U256(v) => visitor.visit_bytes(&v), - Primitive::I8(v) => visitor.visit_i8(v), - Primitive::I16(v) => visitor.visit_i16(v), - Primitive::I32(v) => visitor.visit_i32(v), - Primitive::I64(v) => visitor.visit_i64(v), - Primitive::I128(v) => visitor.visit_i128(v), - Primitive::I256(v) => visitor.visit_bytes(&v), - } - } - - fn deserialize_newtype_struct(self, _name: &'static str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - visitor.visit_seq(de::value::SeqDeserializer::new(Some(self).into_iter())) - } - - forward_to_deserialize_any! { - bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string - bytes byte_buf option unit unit_struct seq tuple - tuple_struct map struct enum identifier ignored_any - } -} - -impl<'de> IntoDeserializer<'de, Error> for Primitive { - type Deserializer = Primitive; - fn into_deserializer(self) -> Self::Deserializer { - self - } -} - -/// This is a somewhat insane approach to extracting the data that we need from a -/// BitVec and allowing it to be deserialized from as part of the [`Value`] enum. -/// First, we serialize the BitVec, which grabs the relevant data out of it (that isn't -/// otherwise publically accessible), and then we implement a Deserializer that aligns -/// with what the Deserialize impl for BitVec expects. -/// -/// See for the Serialize/Deserialize -/// impls we are aligning with. -struct BitVecPieces { - head: u8, - bits: u64, - data: Vec, - // Track which field we're currently deserializing: - current_field: Option, -} - -#[derive(PartialEq, Copy, Clone)] -enum Field { - Head, - Bits, - Data, -} - -impl<'de> Deserializer<'de> for BitVecPieces { - type Error = Error; - - fn deserialize_any(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - // We hand back each field in order as part of a sequence, just because - // it's the least verbose approach: - visitor.visit_seq(self) - } - - forward_to_deserialize_any! { - bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string - bytes byte_buf option unit unit_struct newtype_struct seq tuple - tuple_struct map struct enum identifier ignored_any - } -} - -impl<'de> SeqAccess<'de> for BitVecPieces { - type Error = Error; - - fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> - where - T: de::DeserializeSeed<'de>, - { - match self.current_field { - Some(Field::Head) => { - let res = seed.deserialize(self.head.into_deserializer()).map(Some); - self.current_field = Some(Field::Bits); - res - } - Some(Field::Bits) => { - let res = seed.deserialize(self.bits.into_deserializer()).map(Some); - self.current_field = Some(Field::Data); - res - } - Some(Field::Data) => { - let bytes = std::mem::take(&mut self.data); - let res = seed.deserialize(bytes.into_deserializer()).map(Some); - self.current_field = None; - res - } - None => Ok(None), - } - } -} - -impl BitVecPieces { - fn new(bit_vec: BitSequence) -> Result { - // Step 1. "Serialize" the bitvec into this struct. Essentially, - // we are just writing out the values we need for deserializing, - // but with a silly amount of boilerplate/indirection.. - struct BitVecSerializer { - head: Option, - bits: Option, - data: Vec, - current_field: Option, - } - - // Make note of what field we're trying to serialize and - // delegate back to the main impl to actually do the work. - impl ser::SerializeStruct for &mut BitVecSerializer { - type Ok = (); - type Error = Error; - - fn serialize_field( - &mut self, - key: &'static str, - value: &T, - ) -> Result<(), Self::Error> { - match key { - "head" => { - self.current_field = Some(Field::Head); - } - "bits" => { - self.current_field = Some(Field::Bits); - } - "data" => { - self.current_field = Some(Field::Data); - } - _ => { - return Err(Error::from_string(format!( - "BitVec serialization encountered unexpected field '{}'", - key - ))) - } - } - value.serialize(&mut **self) - } - fn end(self) -> Result { - self.current_field = None; - Ok(()) - } - } - - // This is only expected to be called for serializing the data. We delegate - // straight back to our main impl which should know what to do already, since - // we know what struct field we're trying to serialize. - impl ser::SerializeSeq for &mut BitVecSerializer { - type Ok = (); - type Error = Error; - - fn serialize_element(&mut self, value: &T) -> Result<(), Self::Error> { - value.serialize(&mut **self) - } - fn end(self) -> Result { - Ok(()) - } - } - - // A slightly insane serializer impl whose only purpose is to be called by - // the BitVec serialize impl, which itself only calls `serialize_struct` and - // passes relevant data to that (so we only implement that method..) - impl Serializer for &mut BitVecSerializer { - type Ok = (); - type Error = Error; - - type SerializeStruct = Self; - type SerializeSeq = Self; - - type SerializeTuple = serde::ser::Impossible<(), Error>; - type SerializeTupleStruct = serde::ser::Impossible<(), Error>; - type SerializeTupleVariant = serde::ser::Impossible<(), Error>; - type SerializeMap = serde::ser::Impossible<(), Error>; - type SerializeStructVariant = serde::ser::Impossible<(), Error>; - - fn serialize_struct(self, _: &'static str, _: usize) -> Result { - Ok(self) - } - fn serialize_seq(self, _: Option) -> Result { - match self.current_field { - Some(Field::Data) => Ok(self), - _ => Err(Error::from_str( - "BitVec serialization only expects serialize_seq to be called for 'data' prop", - )), - } - } - fn serialize_u8(self, v: u8) -> Result { - match self.current_field { - Some(Field::Head) => { - self.head = Some(v); - Ok(()) - } - Some(Field::Data) => { - self.data.push(v); - Ok(()) - } - _ => Err(Error::from_str( - "BitVec serialization only expects serialize_u8 to be called for 'head' prop", - )), - } - } - fn serialize_u64(self, v: u64) -> Result { - match self.current_field { - Some(Field::Bits) => { - self.bits = Some(v); - Ok(()) - } - _ => Err(Error::from_str( - "BitVec serialization only expects serialize_u64 to be called for 'len' prop", - )), - } - } - - // All of the below are never expected to be called when serializing a BitVec, - // so we just return an error since we'd have no idea what to do! - fn serialize_bool(self, _v: bool) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_i8(self, _v: i8) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_i16(self, _v: i16) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_i32(self, _v: i32) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_i64(self, _v: i64) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_u16(self, _v: u16) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_u32(self, _v: u32) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_f32(self, _v: f32) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_f64(self, _v: f64) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_char(self, _v: char) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_str(self, _v: &str) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_bytes(self, _v: &[u8]) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_none(self) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_some(self, _: &T) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_unit(self) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_unit_struct(self, _: &'static str) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_unit_variant(self, _: &'static str, _: u32, _: &'static str) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_newtype_struct( - self, - _: &'static str, - _: &T, - ) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_newtype_variant( - self, - _: &'static str, - _: u32, - _: &'static str, - _: &T, - ) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_tuple(self, _: usize) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_tuple_struct( - self, - _: &'static str, - _: usize, - ) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_tuple_variant( - self, - _: &'static str, - _: u32, - _: &'static str, - _: usize, - ) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_map(self, _: Option) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - fn serialize_struct_variant( - self, - _: &'static str, - _: u32, - _: &'static str, - _: usize, - ) -> Result { - Err(Error::from_str("Unsupported BitVec serialization method")) - } - } - - // Serialize the BitVec based on our above serializer: this basically - // extracts the data out of it that we'll need for deserialization. - let mut se = BitVecSerializer { head: None, bits: None, data: Vec::new(), current_field: None }; - bit_vec.serialize(&mut se)?; - - match se { - BitVecSerializer { data, bits: Some(bits), head: Some(head), .. } => { - Ok(BitVecPieces { data, bits, head, current_field: Some(Field::Head) }) - } - _ => Err(Error::from_str("Could not gather together the BitVec pieces required during serialization")), - } - } -} - -// We want to make sure that we can transform our various Value types into the sorts of output we'd expect. -#[cfg(test)] -mod test { - - use crate::value::BitSequence; - use serde::Deserialize; - - use super::*; - - #[test] - fn de_into_struct() { - #[derive(Deserialize, Debug, PartialEq)] - struct Foo { - a: u8, - b: bool, - } - - let val = ValueDef::Composite(Composite::Named(vec![ - // Order shouldn't matter; match on names: - ("b".into(), Value::bool(true)), - ("a".into(), Value::u8(123)), - ])); - - assert_eq!(Foo::deserialize(val), Ok(Foo { a: 123, b: true })) - } - - #[test] - fn de_unwrapped_into_struct() { - #[derive(Deserialize, Debug, PartialEq)] - struct Foo { - a: u8, - b: bool, - } - - let val = Composite::Named(vec![ - // Order shouldn't matter; match on names: - ("b".into(), Value::bool(true)), - ("a".into(), Value::u8(123)), - ]); - - assert_eq!(Foo::deserialize(val), Ok(Foo { a: 123, b: true })) - } - - #[test] - fn de_into_tuple_struct() { - #[derive(Deserialize, Debug, PartialEq)] - struct Foo(u8, bool, String); - - let val = ValueDef::Composite(Composite::Unnamed(vec![ - Value::u8(123), - Value::bool(true), - Value::str("hello".into()), - ])); - - assert_eq!(Foo::deserialize(val), Ok(Foo(123, true, "hello".into()))) - } - - #[test] - fn de_unwrapped_into_tuple_struct() { - #[derive(Deserialize, Debug, PartialEq)] - struct Foo(u8, bool, String); - - let val = Composite::Unnamed(vec![Value::u8(123), Value::bool(true), Value::str("hello".into())]); - - assert_eq!(Foo::deserialize(val), Ok(Foo(123, true, "hello".into()))) - } - - #[test] - fn de_into_newtype_struct() { - #[derive(Deserialize, Debug, PartialEq)] - struct FooStr(String); - let val = ValueDef::<()>::Primitive(Primitive::Str("hello".into())); - assert_eq!(FooStr::deserialize(val), Ok(FooStr("hello".into()))); - let val = Value::str("hello".into()); - assert_eq!(FooStr::deserialize(val), Ok(FooStr("hello".into()))); - - #[derive(Deserialize, Debug, PartialEq)] - struct FooVecU8(Vec); - let val = ValueDef::Composite(Composite::Unnamed(vec![Value::u8(1), Value::u8(2), Value::u8(3)])); - assert_eq!(FooVecU8::deserialize(val), Ok(FooVecU8(vec![1, 2, 3]))); - - #[derive(Deserialize, Debug, PartialEq)] - enum MyEnum { - Foo(u8, u8, u8), - } - #[derive(Deserialize, Debug, PartialEq)] - struct FooVar(MyEnum); - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Unnamed(vec![Value::u8(1), Value::u8(2), Value::u8(3)]), - }); - assert_eq!(FooVar::deserialize(val), Ok(FooVar(MyEnum::Foo(1, 2, 3)))); - } - - #[test] - fn de_unwrapped_into_newtype_struct() { - #[derive(Deserialize, Debug, PartialEq)] - struct FooStr(String); - let val = Primitive::Str("hello".into()); - assert_eq!(FooStr::deserialize(val), Ok(FooStr("hello".into()))); - - #[derive(Deserialize, Debug, PartialEq)] - struct FooVecU8(Vec); - let val = Composite::Unnamed(vec![Value::u8(1), Value::u8(2), Value::u8(3)]); - assert_eq!(FooVecU8::deserialize(val), Ok(FooVecU8(vec![1, 2, 3]))); - - #[derive(Deserialize, Debug, PartialEq)] - enum MyEnum { - Foo(u8, u8, u8), - } - #[derive(Deserialize, Debug, PartialEq)] - struct FooVar(MyEnum); - let val = - Variant { name: "Foo".into(), values: Composite::Unnamed(vec![Value::u8(1), Value::u8(2), Value::u8(3)]) }; - assert_eq!(FooVar::deserialize(val), Ok(FooVar(MyEnum::Foo(1, 2, 3)))); - } - - #[test] - fn de_into_vec() { - let val = ValueDef::Composite(Composite::Unnamed(vec![Value::u8(1), Value::u8(2), Value::u8(3)])); - assert_eq!(>::deserialize(val), Ok(vec![1, 2, 3])); - - let val = ValueDef::Composite(Composite::Unnamed(vec![ - Value::str("a".into()), - Value::str("b".into()), - Value::str("c".into()), - ])); - assert_eq!(>::deserialize(val), Ok(vec!["a".into(), "b".into(), "c".into()])); - } - - #[test] - fn de_unwrapped_into_vec() { - let val = Composite::Unnamed(vec![Value::u8(1), Value::u8(2), Value::u8(3)]); - assert_eq!(>::deserialize(val), Ok(vec![1, 2, 3])); - - let val = - Composite::Named(vec![("a".into(), Value::u8(1)), ("b".into(), Value::u8(2)), ("c".into(), Value::u8(3))]); - assert_eq!(>::deserialize(val), Ok(vec![1, 2, 3])); - - let val = Composite::Unnamed(vec![Value::str("a".into()), Value::str("b".into()), Value::str("c".into())]); - assert_eq!(>::deserialize(val), Ok(vec!["a".into(), "b".into(), "c".into()])); - } - - #[test] - fn de_into_map() { - use std::collections::HashMap; - - let val = ValueDef::Composite(Composite::Named(vec![ - ("a".into(), Value::u8(1)), - ("b".into(), Value::u8(2)), - ("c".into(), Value::u8(3)), - ])); - assert_eq!( - >::deserialize(val), - Ok(vec![("a".into(), 1), ("b".into(), 2), ("c".into(), 3)].into_iter().collect()) - ); - - let val = ValueDef::Composite(Composite::Unnamed(vec![Value::u8(1), Value::u8(2), Value::u8(3)])); - >::deserialize(val).expect_err("no names; can't be map"); - } - - #[test] - fn de_into_tuple() { - let val = ValueDef::Composite(Composite::Unnamed(vec![Value::str("hello".into()), Value::bool(true)])); - assert_eq!(<(String, bool)>::deserialize(val), Ok(("hello".into(), true))); - - // names will just be ignored: - let val = ValueDef::Composite(Composite::Named(vec![ - ("a".into(), Value::str("hello".into())), - ("b".into(), Value::bool(true)), - ])); - assert_eq!(<(String, bool)>::deserialize(val), Ok(("hello".into(), true))); - - // Enum variants are allowed! The variant name will be ignored: - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Unnamed(vec![Value::str("hello".into()), Value::bool(true)]), - }); - assert_eq!(<(String, bool)>::deserialize(val), Ok(("hello".into(), true))); - - // Enum variants with names values are allowed! The variant name will be ignored: - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Named(vec![("a".into(), Value::str("hello".into())), ("b".into(), Value::bool(true))]), - }); - assert_eq!(<(String, bool)>::deserialize(val), Ok(("hello".into(), true))); - - // Wrong number of values should fail: - let val = ValueDef::Composite(Composite::Unnamed(vec![ - Value::str("hello".into()), - Value::bool(true), - Value::u8(123), - ])); - <(String, bool)>::deserialize(val).expect_err("Wrong length, should err"); - } - - #[test] - fn de_unwrapped_into_tuple() { - let val = Composite::Unnamed(vec![Value::str("hello".into()), Value::bool(true)]); - assert_eq!(<(String, bool)>::deserialize(val), Ok(("hello".into(), true))); - - // names will just be ignored: - let val = Composite::Named(vec![("a".into(), Value::str("hello".into())), ("b".into(), Value::bool(true))]); - assert_eq!(<(String, bool)>::deserialize(val), Ok(("hello".into(), true))); - - // Wrong number of values should fail: - let val = Composite::Unnamed(vec![Value::str("hello".into()), Value::bool(true), Value::u8(123)]); - <(String, bool)>::deserialize(val).expect_err("Wrong length, should err"); - } - - #[test] - fn de_bitvec() { - use bitvec::{bitvec, order::Lsb0}; - - let val = Value::bit_sequence(bitvec![Lsb0, u8; 0, 1, 1, 0, 1, 0, 1, 0]); - assert_eq!(BitSequence::deserialize(val), Ok(bitvec![Lsb0, u8; 0, 1, 1, 0, 1, 0, 1, 0])); - - let val = Value::bit_sequence(bitvec![Lsb0, u8; 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0]); - assert_eq!( - BitSequence::deserialize(val), - Ok(bitvec![Lsb0, u8; 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0]) - ); - } - - #[test] - fn de_into_tuple_variant() { - #[derive(Deserialize, Debug, PartialEq)] - enum MyEnum { - Foo(String, bool, u8), - } - - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Unnamed(vec![Value::str("hello".into()), Value::bool(true), Value::u8(123)]), - }); - assert_eq!(MyEnum::deserialize(val), Ok(MyEnum::Foo("hello".into(), true, 123))); - - // it's fine to name the fields; we'll just ignore the names - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Named(vec![ - ("a".into(), Value::str("hello".into())), - ("b".into(), Value::bool(true)), - ("c".into(), Value::u8(123)), - ]), - }); - assert_eq!(MyEnum::deserialize(val), Ok(MyEnum::Foo("hello".into(), true, 123))); - } - - #[test] - fn de_unwrapped_into_tuple_variant() { - #[derive(Deserialize, Debug, PartialEq)] - enum MyEnum { - Foo(String, bool, u8), - } - - let val = Variant { - name: "Foo".into(), - values: Composite::Unnamed(vec![Value::str("hello".into()), Value::bool(true), Value::u8(123)]), - }; - assert_eq!(MyEnum::deserialize(val), Ok(MyEnum::Foo("hello".into(), true, 123))); - - // it's fine to name the fields; we'll just ignore the names - let val = Variant { - name: "Foo".into(), - values: Composite::Named(vec![ - ("a".into(), Value::str("hello".into())), - ("b".into(), Value::bool(true)), - ("c".into(), Value::u8(123)), - ]), - }; - assert_eq!(MyEnum::deserialize(val), Ok(MyEnum::Foo("hello".into(), true, 123))); - } - - #[test] - fn de_into_struct_variant() { - #[derive(Deserialize, Debug, PartialEq)] - enum MyEnum { - Foo { hi: String, a: bool, b: u8 }, - } - - // If names given, order doesn't matter: - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Named(vec![ - // Deliberately out of order: names should ensure alignment: - ("b".into(), Value::u8(123)), - ("a".into(), Value::bool(true)), - ("hi".into(), Value::str("hello".into())), - ]), - }); - assert_eq!(MyEnum::deserialize(val), Ok(MyEnum::Foo { hi: "hello".into(), a: true, b: 123 })); - - // No names needed if order is OK: - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Unnamed(vec![Value::str("hello".into()), Value::bool(true), Value::u8(123)]), - }); - assert_eq!(MyEnum::deserialize(val), Ok(MyEnum::Foo { hi: "hello".into(), a: true, b: 123 })); - - // Wrong order won't work if no names: - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Unnamed(vec![Value::bool(true), Value::u8(123), Value::str("hello".into())]), - }); - MyEnum::deserialize(val).expect_err("Wrong order shouldn't work"); - - // Wrong names won't work: - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Named(vec![ - ("b".into(), Value::u8(123)), - // Whoops; wrong name: - ("c".into(), Value::bool(true)), - ("hi".into(), Value::str("hello".into())), - ]), - }); - MyEnum::deserialize(val).expect_err("Wrong names shouldn't work"); - - // Too many names is OK; we can ignore fields we don't care about: - let val = ValueDef::Variant(Variant { - name: "Foo".into(), - values: Composite::Named(vec![ - ("foo".into(), Value::u8(40)), - ("b".into(), Value::u8(123)), - ("a".into(), Value::bool(true)), - ("bar".into(), Value::bool(false)), - ("hi".into(), Value::str("hello".into())), - ]), - }); - assert_eq!(MyEnum::deserialize(val), Ok(MyEnum::Foo { hi: "hello".into(), a: true, b: 123 })); - } - - #[test] - fn de_into_unit_variants() { - let val = Value::variant("Foo".into(), Composite::Named(vec![])); - let unwrapped_val = Variant::<()> { name: "Foo".into(), values: Composite::Named(vec![]) }; - - #[derive(Deserialize, Debug, PartialEq)] - enum MyEnum { - Foo, - } - assert_eq!(MyEnum::deserialize(val.clone()), Ok(MyEnum::Foo)); - assert_eq!(MyEnum::deserialize(unwrapped_val.clone()), Ok(MyEnum::Foo)); - - #[derive(Deserialize, Debug, PartialEq)] - enum MyEnum2 { - Foo(), - } - assert_eq!(MyEnum2::deserialize(val.clone()), Ok(MyEnum2::Foo())); - assert_eq!(MyEnum2::deserialize(unwrapped_val.clone()), Ok(MyEnum2::Foo())); - - #[derive(Deserialize, Debug, PartialEq)] - enum MyEnum3 { - Foo {}, - } - assert_eq!(MyEnum3::deserialize(val), Ok(MyEnum3::Foo {})); - assert_eq!(MyEnum3::deserialize(unwrapped_val), Ok(MyEnum3::Foo {})); - } -} diff --git a/desub-current/src/value/mod.rs b/desub-current/src/value/mod.rs deleted file mode 100644 index ac4d8cc5..00000000 --- a/desub-current/src/value/mod.rs +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. -// This file is part of substrate-desub. -// -// substrate-desub is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// substrate-desub is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with substrate-desub. If not, see . - -/*! -This module exposes the [`Value`] type and related subtypes, which are used as the runtime -representations of SCALE encoded data (much like `serde_json::Value` is a runtime representation -of JSON data). -*/ - -mod deserialize; -mod deserializer; -mod serialize; - -use bitvec::{order::Lsb0, vec::BitVec}; -use serde::Deserialize; -use std::convert::From; -use std::fmt::Debug; - -/// [`Value`] holds a representation of some value that has been decoded, as well as some arbitrary context. -/// -/// Not all SCALE encoded types have an similar-named value; for instance, the values corresponding to -/// sequence, array and composite types can all be represented with [`Composite`]. Only enough information -/// is preserved here to construct a valid value for any type that we know about, and be able to verify -/// that a given value is compatible with some type (see the [`scale_info`] crate), if we have both. -#[derive(Debug, Clone, PartialEq)] -pub struct Value { - /// The shape and associated values for this Value - pub value: ValueDef, - /// Some additional arbitrary context that can be associated with a value. - pub context: T, -} - -macro_rules! value_prim_method { - ($name:ident $variant:ident) => { - #[doc = concat!("Create a new `", stringify!($name), "` value without additional context")] - pub fn $name(val: $name) -> Value<()> { - Value { value: ValueDef::Primitive(Primitive::$variant(val)), context: () } - } - } -} - -impl Value<()> { - /// Create a new named composite value without additional context. - pub fn named_composite(values: Vec<(String, Value<()>)>) -> Value<()> { - Value { value: ValueDef::Composite(Composite::Named(values)), context: () } - } - /// Create a new unnamed composite value without additional context. - pub fn unnamed_composite(values: Vec>) -> Value<()> { - Value { value: ValueDef::Composite(Composite::Unnamed(values)), context: () } - } - /// Create a new variant value without additional context. - pub fn variant(name: String, values: Composite<()>) -> Value<()> { - Value { value: ValueDef::Variant(Variant { name, values }), context: () } - } - /// Create a new bit sequence value without additional context. - pub fn bit_sequence(bitseq: BitSequence) -> Value<()> { - Value { value: ValueDef::BitSequence(bitseq), context: () } - } - /// Create a new primitive value without additional context. - pub fn primitive(primitive: Primitive) -> Value<()> { - Value { value: ValueDef::Primitive(primitive), context: () } - } - /// Create a new string value without additional context. - pub fn str(val: String) -> Value<()> { - Value { value: ValueDef::Primitive(Primitive::Str(val)), context: () } - } - - value_prim_method!(bool Bool); - value_prim_method!(char Char); - value_prim_method!(u8 U8); - value_prim_method!(u16 U16); - value_prim_method!(u32 U32); - value_prim_method!(u64 U64); - value_prim_method!(u128 U128); - value_prim_method!(i8 I8); - value_prim_method!(i16 I16); - value_prim_method!(i32 I32); - value_prim_method!(i64 I64); - value_prim_method!(i128 I128); -} - -impl Value { - /// Create a new value with some associated context. - pub fn with_context(value: ValueDef, context: T) -> Value { - Value { value, context } - } - /// Remove the context. - pub fn without_context(self) -> Value<()> { - self.map_context(|_| ()) - } - /// Map the context to some different type. - pub fn map_context(self, mut f: F) -> Value - where - F: Clone + FnMut(T) -> U, - { - Value { context: f(self.context), value: self.value.map_context(f) } - } -} - -/// The underlying shape of a given value. -#[derive(Clone, PartialEq)] -pub enum ValueDef { - /// A named or unnamed struct-like, array-like or tuple-like set of values. - Composite(Composite), - /// An enum variant. - Variant(Variant), - /// A sequence of bits (which is more compactly encoded using [`bitvec`]) - BitSequence(BitSequence), - /// Any of the primitive values we can have. - Primitive(Primitive), -} - -impl ValueDef { - /// Map the context to some different type. - pub fn map_context(self, f: F) -> ValueDef - where - F: Clone + FnMut(T) -> U, - { - match self { - ValueDef::Composite(val) => ValueDef::Composite(val.map_context(f)), - ValueDef::Variant(val) => ValueDef::Variant(val.map_context(f)), - ValueDef::BitSequence(val) => ValueDef::BitSequence(val), - ValueDef::Primitive(val) => ValueDef::Primitive(val), - } - } -} - -impl Debug for ValueDef { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Composite(val) => Debug::fmt(val, f), - Self::Variant(val) => Debug::fmt(val, f), - Self::Primitive(val) => Debug::fmt(val, f), - Self::BitSequence(val) => Debug::fmt(val, f), - } - } -} - -/// A named or unnamed struct-like, array-like or tuple-like set of values. -/// This is used to represent a range of composite values on their own, or -/// as values for a specific [`Variant`]. -#[derive(Clone, PartialEq)] -pub enum Composite { - /// Eg `{ foo: 2, bar: false }` - Named(Vec<(String, Value)>), - /// Eg `(2, false)` - Unnamed(Vec>), -} - -impl Composite { - /// Return the number of values stored in this composite type. - pub fn len(&self) -> usize { - match self { - Composite::Named(values) => values.len(), - Composite::Unnamed(values) => values.len(), - } - } - - /// Is the composite type empty? - pub fn is_empty(&self) -> bool { - match self { - Composite::Named(values) => values.is_empty(), - Composite::Unnamed(values) => values.is_empty(), - } - } - - /// Map the context to some different type. - pub fn map_context(self, f: F) -> Composite - where - F: Clone + FnMut(T) -> U, - { - match self { - Composite::Named(values) => { - // Note: Optimally I'd pass `&mut f` into each iteration to avoid cloning, - // but this leads to a type recusion error because F becomes `&mut F`, which can - // (at type level) recurse here again and become `&mut &mut F` and so on. Since - // that's no good; just require `Clone` to avoid altering the type. - let vals = values.into_iter().map(move |(k, v)| (k, v.map_context(f.clone()))).collect(); - Composite::Named(vals) - } - Composite::Unnamed(values) => { - let vals = values.into_iter().map(move |v| v.map_context(f.clone())).collect(); - Composite::Unnamed(vals) - } - } - } -} - -impl Debug for Composite { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Composite::Named(fields) => { - let mut struc = f.debug_struct(""); - for (name, val) in fields { - struc.field(name, val); - } - struc.finish() - } - Composite::Unnamed(fields) => { - let mut struc = f.debug_tuple(""); - for val in fields { - struc.field(val); - } - struc.finish() - } - } - } -} - -impl From> for ValueDef { - fn from(val: Composite) -> Self { - ValueDef::Composite(val) - } -} - -/// This represents the value of a specific variant from an enum, and contains -/// the name of the variant, and the named/unnamed values associated with it. -#[derive(Clone, PartialEq)] -pub struct Variant { - /// The name of the variant. - pub name: String, - /// Values for each of the named or unnamed fields associated with this variant. - pub values: Composite, -} - -impl Variant { - /// Map the context to some different type. - pub fn map_context(self, f: F) -> Variant - where - F: Clone + FnMut(T) -> U, - { - Variant { name: self.name, values: self.values.map_context(f) } - } -} - -impl Debug for Variant { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str(&self.name)?; - f.write_str(" ")?; - Debug::fmt(&self.values, f) - } -} - -impl From> for ValueDef { - fn from(val: Variant) -> Self { - ValueDef::Variant(val) - } -} - -/// A "primitive" value (this includes strings). -#[derive(Debug, Clone, PartialEq)] -pub enum Primitive { - Bool(bool), - Char(char), - Str(String), - U8(u8), - U16(u16), - U32(u32), - U64(u64), - U128(u128), - U256([u8; 32]), - I8(i8), - I16(i16), - I32(i32), - I64(i64), - I128(i128), - I256([u8; 32]), -} - -impl From for ValueDef { - fn from(val: Primitive) -> Self { - ValueDef::Primitive(val) - } -} - -/// A sequence of bits. -pub type BitSequence = BitVec; - -/// An opaque error that is returned if we cannot deserialize the [`Value`] type. -pub use deserializer::Error as DeserializeError; - -/// Attempt to deserialize a [`Value`] into some type that has [`serde::Deserialize`] implemented on it. -pub fn from_value<'de, Ctx, T: Deserialize<'de>>(value: Value) -> Result { - T::deserialize(value) -} diff --git a/desub-current/src/value/serialize.rs b/desub-current/src/value/serialize.rs deleted file mode 100644 index 63b02843..00000000 --- a/desub-current/src/value/serialize.rs +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. -// This file is part of substrate-desub. -// -// substrate-desub is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// substrate-desub is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with substrate-desub. If not, see . - -use super::{Composite, Primitive, Value, ValueDef, Variant}; -use serde::{ - ser::{SerializeMap, SerializeSeq}, - Serialize, -}; - -impl Serialize for Value { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - self.value.serialize(serializer) - } -} - -impl Serialize for ValueDef { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - match self { - ValueDef::Composite(val) => val.serialize(serializer), - ValueDef::Variant(val) => val.serialize(serializer), - ValueDef::BitSequence(val) => val.serialize(serializer), - ValueDef::Primitive(val) => val.serialize(serializer), - } - } -} - -impl Serialize for Composite { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - match self { - Composite::Named(vals) => { - let mut map = serializer.serialize_map(Some(vals.len()))?; - for (key, val) in vals { - map.serialize_entry(key, val)?; - } - map.end() - } - Composite::Unnamed(vals) => { - let mut seq = serializer.serialize_seq(Some(vals.len()))?; - for val in vals { - seq.serialize_element(val)?; - } - seq.end() - } - } - } -} - -impl Serialize for Primitive { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - // Delegate to the serialization strategy used by the primitive types. - match self { - Primitive::Bool(v) => v.serialize(serializer), - Primitive::Char(v) => v.serialize(serializer), - Primitive::Str(v) => v.serialize(serializer), - Primitive::U8(v) => v.serialize(serializer), - Primitive::U16(v) => v.serialize(serializer), - Primitive::U32(v) => v.serialize(serializer), - Primitive::U64(v) => v.serialize(serializer), - Primitive::U128(v) => v.serialize(serializer), - Primitive::U256(v) => v.serialize(serializer), - Primitive::I8(v) => v.serialize(serializer), - Primitive::I16(v) => v.serialize(serializer), - Primitive::I32(v) => v.serialize(serializer), - Primitive::I64(v) => v.serialize(serializer), - Primitive::I128(v) => v.serialize(serializer), - Primitive::I256(v) => v.serialize(serializer), - } - } -} - -impl Serialize for Variant { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - // We can't use the enum serializing in the serde data model because that requires static - // strs and enum indexes, which we don't have (since this is a runtime value), so we serialize - // as a map with a type and a value, and make sure that we allow this format when attempting to - // deserialize into a `Variant` type for a bit of symmetry (although note that if you try to deserialize - // this into a `Value` type it'll have no choice but to deserialize straight into a `Composite::Named` map). - let mut map = serializer.serialize_map(Some(2))?; - map.serialize_entry("name", &self.name)?; - map.serialize_entry("values", &self.values)?; - map.end() - } -} - -#[cfg(test)] -mod test { - - use super::*; - use serde_json::json; - - fn assert_value(value: Value<()>, expected: serde_json::Value) { - let val = serde_json::to_value(&value).expect("can serialize to serde_json::Value"); - assert_eq!(val, expected); - } - - #[test] - fn serialize_primitives() { - // a subset of the primitives to sanity check that they are unwrapped: - assert_value(Value::u8(1), json!(1)); - assert_value(Value::u16(1), json!(1)); - assert_value(Value::u32(1), json!(1)); - assert_value(Value::u64(1), json!(1)); - assert_value(Value::bool(true), json!(true)); - assert_value(Value::bool(false), json!(false)); - } - - #[test] - fn serialize_composites() { - assert_value( - Value::named_composite(vec![ - ("a".into(), Value::bool(true)), - ("b".into(), Value::str("hello".into())), - ("c".into(), Value::char('c')), - ]), - json!({ - "a": true, - "b": "hello", - "c": 'c' - }), - ); - assert_value( - Value::unnamed_composite(vec![Value::bool(true), Value::str("hello".into()), Value::char('c')]), - json!([true, "hello", 'c']), - ) - } - - #[test] - fn serialize_variants() { - assert_value( - Value::variant( - "Foo".into(), - Composite::Named(vec![ - ("a".into(), Value::bool(true)), - ("b".into(), Value::str("hello".into())), - ("c".into(), Value::char('c')), - ]), - ), - json!({ - "name": "Foo", - "values": { - "a": true, - "b": "hello", - "c": 'c' - } - }), - ); - assert_value( - Value::variant( - "Bar".into(), - Composite::Unnamed(vec![Value::bool(true), Value::str("hello".into()), Value::char('c')]), - ), - json!({ - "name": "Bar", - "values": [ - true, - "hello", - 'c' - ] - }), - ) - } -} diff --git a/desub-current/tests/decode_extrinsics.rs b/desub-current/tests/decode_extrinsics.rs index dbfb4248..d2c42749 100644 --- a/desub-current/tests/decode_extrinsics.rs +++ b/desub-current/tests/decode_extrinsics.rs @@ -16,8 +16,9 @@ use desub_current::{ decoder::{self, SignedExtensionWithAdditional}, - value, Metadata, Value, ValueDef, + Metadata, Value, ValueDef, }; +use scale_value::{Composite, Variant}; static V14_METADATA_POLKADOT_SCALE: &[u8] = include_bytes!("data/v14_metadata_polkadot.scale"); @@ -39,11 +40,11 @@ fn singleton_value(x: Value<()>) -> Value<()> { } fn hash_value(xs: Vec) -> Value<()> { - singleton_value(Value::unnamed_composite(xs.iter().map(|x| Value::u8(*x)).collect())) + singleton_value(Value::from_bytes(xs)) } fn assert_args_equal(args: &[Value], expected: Vec>) { - let args: Vec<_> = args.into_iter().map(|v| v.clone().without_context()).collect(); + let args: Vec<_> = args.iter().map(|v| v.clone().remove_context()).collect(); assert_eq!(&args, &expected); } @@ -85,9 +86,9 @@ fn balance_transfer_signed() { assert!(ext_bytes.is_empty(), "No more bytes expected"); assert_eq!(ext.call_data.pallet_name, "Balances"); - assert_eq!(&*ext.call_data.ty.name(), "transfer"); + assert_eq!(&*ext.call_data.ty.name, "transfer"); assert_eq!(ext.call_data.arguments.len(), 2); - assert_eq!(ext.call_data.arguments[1].clone().without_context(), Value::u128(12345)); + assert_eq!(ext.call_data.arguments[1].clone().remove_context(), Value::u128(12345)); } #[test] @@ -100,9 +101,9 @@ fn balance_transfer_all_signed() { assert!(ext_bytes.is_empty(), "No more bytes expected"); assert_eq!(ext.call_data.pallet_name, "Balances"); - assert_eq!(&*ext.call_data.ty.name(), "transfer_all"); + assert_eq!(&*ext.call_data.ty.name, "transfer_all"); assert_eq!(ext.call_data.arguments.len(), 2); - assert_eq!(ext.call_data.arguments[1].clone().without_context(), Value::bool(false)); + assert_eq!(ext.call_data.arguments[1].clone().remove_context(), Value::bool(false)); } /// This test is interesting because: @@ -118,12 +119,12 @@ fn auctions_bid_unsigned() { assert!(ext_bytes.is_empty(), "No more bytes expected"); assert_eq!(ext.call_data.pallet_name, "Auctions"); - assert_eq!(&*ext.call_data.ty.name(), "bid"); + assert_eq!(&*ext.call_data.ty.name, "bid"); assert_eq!(ext.call_data.arguments.len(), 5); assert_args_equal( &ext.call_data.arguments, - vec![singleton_value(Value::u32(1)), Value::u32(2), Value::u32(3), Value::u32(4), Value::u128(5)], + vec![singleton_value(Value::u128(1)), Value::u128(2), Value::u128(3), Value::u128(4), Value::u128(5)], ); } @@ -152,10 +153,10 @@ fn system_fill_block_unsigned() { assert!(ext_bytes.is_empty(), "No more bytes expected"); assert_eq!(ext.call_data.pallet_name, "System"); - assert_eq!(&*ext.call_data.ty.name(), "fill_block"); + assert_eq!(&*ext.call_data.ty.name, "fill_block"); assert_eq!(ext.call_data.arguments.len(), 1); - assert_args_equal(&ext.call_data.arguments, vec![singleton_value(Value::u32(1234))]); + assert_args_equal(&ext.call_data.arguments, vec![singleton_value(Value::u128(1234))]); } /// This test is interesting because you provide a nested enum representing a call @@ -171,20 +172,20 @@ fn technical_committee_execute_unsigned() { assert!(ext_bytes.is_empty(), "No more bytes expected"); assert_eq!(ext.call_data.pallet_name, "TechnicalCommittee"); - assert_eq!(&*ext.call_data.ty.name(), "execute"); + assert_eq!(&*ext.call_data.ty.name, "execute"); assert_eq!(ext.call_data.arguments.len(), 2); // It's a bit hard matching the entire thing, so we just verify that the first arg looks like // a variant representing a call to "Balances.transfer". assert!(matches!(&ext.call_data.arguments[0], - Value { value: ValueDef::Variant(value::Variant { + Value { value: ValueDef::Variant(Variant { name, - values: value::Composite::Unnamed(args) + values: Composite::Unnamed(args) }), .. } - if &*name == "Balances" - && matches!(&args[0], Value { value: ValueDef::Variant(value::Variant { name, ..}), .. } if &*name == "transfer") + if name == "Balances" + && matches!(&args[0], Value { value: ValueDef::Variant(Variant { name, ..}), .. } if name == "transfer") )); - assert_eq!(ext.call_data.arguments[1].clone().without_context(), Value::u32(500)); + assert_eq!(ext.call_data.arguments[1].clone().remove_context(), Value::u128(500)); } #[test] @@ -197,13 +198,10 @@ fn tips_report_awesome_unsigned() { assert!(ext_bytes.is_empty(), "No more bytes expected"); assert_eq!(ext.call_data.pallet_name, "Tips"); - assert_eq!(&*ext.call_data.ty.name(), "report_awesome"); + assert_eq!(&*ext.call_data.ty.name, "report_awesome"); assert_eq!(ext.call_data.arguments.len(), 2); - assert_eq!( - ext.call_data.arguments[0].clone().without_context(), - Value::unnamed_composite("This person rocks!".bytes().map(Value::u8).collect()) - ); + assert_eq!(ext.call_data.arguments[0].clone().remove_context(), Value::from_bytes("This person rocks!")); } // Named structs shouldn't be an issue; this extrinsic contains one. @@ -217,15 +215,15 @@ fn vesting_force_vested_transfer_unsigned() { assert!(ext_bytes.is_empty(), "No more bytes expected"); assert_eq!(ext.call_data.pallet_name, "Vesting"); - assert_eq!(&*ext.call_data.ty.name(), "force_vested_transfer"); + assert_eq!(&*ext.call_data.ty.name, "force_vested_transfer"); assert_eq!(ext.call_data.arguments.len(), 3); assert_eq!( - ext.call_data.arguments[2].clone().without_context(), + ext.call_data.arguments[2].clone().remove_context(), Value::named_composite(vec![ - ("locked".into(), Value::u128(1)), - ("per_block".into(), Value::u128(2)), - ("starting_block".into(), Value::u32(3)), + ("locked", Value::u128(1)), + ("per_block", Value::u128(2)), + ("starting_block", Value::u128(3)), ]) ); } @@ -258,13 +256,13 @@ fn can_decode_signer_payload() { assert_eq!(signer_payload.len(), 0); assert_eq!(r.call_data.pallet_name, "Staking"); - assert_eq!(&*r.call_data.ty.name(), "chill"); + assert_eq!(&*r.call_data.ty.name, "chill"); assert_eq!(r.call_data.arguments, vec![]); // Expected tuples of name, extension, additional. let expected = vec![ - ("CheckSpecVersion", empty_value(), Value::u32(9110)), - ("CheckTxVersion", empty_value(), Value::u32(8)), + ("CheckSpecVersion", empty_value(), Value::u128(9110)), + ("CheckTxVersion", empty_value(), Value::u128(8)), ( "CheckGenesis", empty_value(), @@ -272,10 +270,10 @@ fn can_decode_signer_payload() { ), ( "CheckMortality", - singleton_value(Value::variant("Mortal185".to_string(), value::Composite::Unnamed(vec![Value::u8(52)]))), + singleton_value(Value::variant("Mortal185", Composite::Unnamed(vec![Value::u128(52)]))), hash_value(to_bytes("0x1c81d421f68281950ad2901291603b5e49fc5c872f129e75433f4b55f07ca072")), ), - ("CheckNonce", singleton_value(Value::u32(0)), empty_value()), + ("CheckNonce", singleton_value(Value::u128(0)), empty_value()), ("CheckWeight", empty_value(), empty_value()), ("ChargeTransactionPayment", singleton_value(Value::u128(0)), empty_value()), ("PrevalidateAttests", empty_value(), empty_value()), @@ -286,7 +284,7 @@ fn can_decode_signer_payload() { let (expected_name, expected_extension, expected_additional) = expected; assert_eq!(&*name, expected_name); - assert_eq!(extension.without_context(), expected_extension); - assert_eq!(additional.without_context(), expected_additional); + assert_eq!(extension.remove_context(), expected_extension); + assert_eq!(additional.remove_context(), expected_additional); } } diff --git a/desub-current/tests/decode_storage.rs b/desub-current/tests/decode_storage.rs index 0e526629..004199f3 100644 --- a/desub-current/tests/decode_storage.rs +++ b/desub-current/tests/decode_storage.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU General Public License // along with substrate-desub. If not, see . -use codec::Encode; use desub_current::{ decoder::{self, StorageHasher}, Metadata, Value, }; +use parity_scale_codec::Encode; static V14_METADATA_POLKADOT_SCALE: &[u8] = include_bytes!("data/v14_metadata_polkadot.scale"); @@ -27,13 +27,13 @@ fn metadata() -> Metadata { } fn account_id_to_value>(account_id_bytes: A) -> Value<()> { - Value::unnamed_composite(vec![Value::unnamed_composite(account_id_bytes.as_ref().iter().map(|&b| Value::u8(b)).collect())]) + Value::unnamed_composite(vec![Value::from_bytes(account_id_bytes)]) } macro_rules! assert_hasher_eq { ($actual:expr, $hasher:path, $value:expr) => { if let $hasher(val) = &$actual { - assert_eq!(val.clone().without_context(), $value); + assert_eq!(val.clone().remove_context(), $value); } else { panic!("Passed {:?}, but expected hasher {}", $actual, stringify!($hasher)); } @@ -64,8 +64,8 @@ fn timestamp_now() { // We can decode values at this location, now: let bytes = 123u64.encode(); - let val = decoder::decode_value_by_id(&meta, &entry.ty, &mut &*bytes).unwrap(); - assert_eq!(val.without_context(), Value::u64(123)); + let val = decoder::decode_value_by_id(&meta, entry.ty, &mut &*bytes).unwrap(); + assert_eq!(val.remove_context(), Value::u128(123)); } // A simple map lookup with an Identity hash (ie just the key itself) @@ -89,7 +89,7 @@ fn democracy_blacklist() { assert_hasher_eq!( keys[0].hasher, StorageHasher::Identity, - Value::unnamed_composite(vec![Value::unnamed_composite(vec![Value::u8(1); 32])]) + Value::unnamed_composite(vec![Value::unnamed_composite(vec![Value::u128(1); 32])]) ); assert!(matches!(keys[0].hasher, StorageHasher::Identity(..))); } @@ -112,15 +112,15 @@ fn system_blockhash() { // Because the hasher is Twox64Concat, we can even see the decoded original map key: assert_eq!(keys.len(), 1); - assert_hasher_eq!(keys[0].hasher, StorageHasher::Twox64Concat, Value::u32(1000)); + assert_hasher_eq!(keys[0].hasher, StorageHasher::Twox64Concat, Value::u128(1000)); // We can decode values at this location: let bytes = [1u8; 32].encode(); - let val = decoder::decode_value_by_id(&meta, &entry.ty, &mut &*bytes).unwrap(); + let val = decoder::decode_value_by_id(&meta, entry.ty, &mut &*bytes).unwrap(); assert_eq!( - val.without_context(), + val.remove_context(), // The Type appears to take the form of a newtype-wrapped [u8; 32]: - Value::unnamed_composite(vec![Value::unnamed_composite(vec![Value::u8(1); 32])]) + Value::unnamed_composite(vec![Value::unnamed_composite(vec![Value::u128(1); 32])]) ); } @@ -141,7 +141,7 @@ fn balances_account() { let keys = entry.details.map_keys(); let bobs_accountid = sp_keyring::AccountKeyring::Bob.to_account_id(); - let bobs_value = account_id_to_value(&bobs_accountid); + let bobs_value = account_id_to_value(bobs_accountid); assert_eq!(keys.len(), 1); assert_hasher_eq!(keys[0].hasher, StorageHasher::Blake2_128Concat, bobs_value); @@ -164,15 +164,15 @@ fn imonline_authoredblocks() { let keys = entry.details.map_keys(); let bobs_accountid = sp_keyring::AccountKeyring::Bob.to_account_id(); - let bobs_value = account_id_to_value(&bobs_accountid); + let bobs_value = account_id_to_value(bobs_accountid); // Because the hashers are Twox64Concat, we can check the keys we provided: assert_eq!(keys.len(), 2); - assert_hasher_eq!(keys[0].hasher, StorageHasher::Twox64Concat, Value::u32(1234)); + assert_hasher_eq!(keys[0].hasher, StorageHasher::Twox64Concat, Value::u128(1234)); assert_hasher_eq!(keys[1].hasher, StorageHasher::Twox64Concat, bobs_value); // We can decode values at this location: let bytes = 5678u32.encode(); - let val = decoder::decode_value_by_id(&meta, &entry.ty, &mut &*bytes).unwrap(); - assert_eq!(val.without_context(), Value::u32(5678)); + let val = decoder::decode_value_by_id(&meta, entry.ty, &mut &*bytes).unwrap(); + assert_eq!(val.remove_context(), Value::u128(5678)); } diff --git a/desub-json-resolver/Cargo.toml b/desub-json-resolver/Cargo.toml index 027576b1..860c8e75 100644 --- a/desub-json-resolver/Cargo.toml +++ b/desub-json-resolver/Cargo.toml @@ -1,24 +1,24 @@ [package] name = "desub-json-resolver" -version = "0.0.1" -authors = ["Parity Technologies "] -license = "GPL-3.0" -homepage = "https://substrate.dev" -repository = "https://github.com/paritytech/desub/" -description = "Decode Substrate with Backwards-Compatible Metadata" -readme = "README.md" -edition = "2021" +version.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +description.workspace = true +edition.workspace = true +rust-version.workspace = true [dependencies] -thiserror = "1.0.30" -desub-legacy = { version = "0.1.0", path = "../desub-legacy" } -codec = { version = "2", features = ["derive"], package = "parity-scale-codec" } -log = { version = "0.4" } -serde = { version = "1.0", features = ["derive"] } -serde_json = { version = "1.0", features = ["preserve_order"] } -syn = { version = "1", features = ["parsing", "derive"] } -phf = { version = "0.10.0", features = [ "macros" ] } +thiserror = { workspace = true } +desub-legacy = { workspace = true } +parity-scale-codec = { workspace = true, features = ["derive"] } +log = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true, features = ["preserve_order"] } +syn = { workspace = true, features = ["parsing", "derive"] } +phf = { workspace = true, features = [ "macros" ] } [features] default = ["default_definitions"] diff --git a/desub-json-resolver/src/extrinsics.rs b/desub-json-resolver/src/extrinsics.rs index 68be46f9..6b1b4f20 100644 --- a/desub-json-resolver/src/extrinsics.rs +++ b/desub-json-resolver/src/extrinsics.rs @@ -33,7 +33,7 @@ impl Extrinsics { } pub fn get(&self, ty: &str, spec: u32, chain: &str) -> Option<&desub_legacy::RustTypeMarker> { - if let Some(ty) = self.get_chain_types(chain, spec).map(|c| c.get(ty)).flatten() { + if let Some(ty) = self.get_chain_types(chain, spec).and_then(|c| c.get(ty)) { Some(ty) } else { self.default.get(ty) diff --git a/desub-json-resolver/src/modules.rs b/desub-json-resolver/src/modules.rs index 000b11ff..5f4510bc 100644 --- a/desub-json-resolver/src/modules.rs +++ b/desub-json-resolver/src/modules.rs @@ -49,7 +49,7 @@ impl Modules { /// Iterate over all the types in each module pub fn iter_types(&self) -> impl Iterator { - self.modules.values().map(|v| v.types.iter()).flatten() + self.modules.values().flat_map(|v| v.types.iter()) } } @@ -75,8 +75,8 @@ impl ModuleTypes { pub fn merge(&self, other: &ModuleTypes) -> ModuleTypes { let (mut types, mut fallbacks) = (self.types.clone(), self.fallbacks.clone()); let other = other.clone(); - types.extend(other.types.into_iter()); - fallbacks.extend(other.fallbacks.into_iter()); + types.extend(other.types); + fallbacks.extend(other.fallbacks); ModuleTypes { types, fallbacks } } diff --git a/desub-legacy/Cargo.toml b/desub-legacy/Cargo.toml index ed274395..79fb350b 100644 --- a/desub-legacy/Cargo.toml +++ b/desub-legacy/Cargo.toml @@ -1,32 +1,31 @@ [package] name = "desub-legacy" -version = "0.1.0" -authors = ["Parity Technologies "] -license = "GPL-3.0" -homepage = "https://substrate.dev" -repository = "https://github.com/paritytech/desub/" -description = "Decode Substrate with Backwards-Compatible Metadata" -edition = "2021" +version.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +description.workspace = true +edition.workspace = true +rust-version.workspace = true [dependencies] -log = "0.4" -thiserror = "1.0.30" -codec = { version = "2", package = "parity-scale-codec", features = ["bit-vec"] } -serde = { version = "1", features = ["derive"] } -serde_json = { version = "1", features = ["preserve_order"] } -onig = { version = "5.0", default-features = false } -derive_more = "0.99.3" -dyn-clone = "1.0" -hex = "0.4" -bitvec = { version = "0.20.2", features = ["serde", "alloc"] } -frame-metadata = { version = "14.2", features = ["legacy"] } +log = { workspace = true } +thiserror = { workspace = true } +parity-scale-codec = { workspace = true, features = ["bit-vec"] } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true, features = ["preserve_order"] } +onig = { workspace = true, default-features = false } +derive_more = { workspace = true } +dyn-clone = { workspace = true } +hex = { workspace = true } +bitvec = { workspace = true, features = ["serde", "alloc"] } +frame-metadata = { workspace = true, features = ["legacy"] } +desub-common = { workspace = true } -desub-common = { version = "0.1.0", path = "../desub-common/" } - -sp-core = "4.0.0" -sp-runtime = "4.0.0" +sp-core = { workspace = true } +sp-runtime = { workspace = true } [dev-dependencies] -sp-version = "4.0.0" -pretty_env_logger = "0.4" -hex = "0.4" +sp-version = { workspace = true } +pretty_env_logger = { workspace = true } diff --git a/desub-legacy/src/decoder.rs b/desub-legacy/src/decoder.rs index 03e7fd3f..a1d8c145 100644 --- a/desub-legacy/src/decoder.rs +++ b/desub-legacy/src/decoder.rs @@ -41,12 +41,12 @@ pub use frame_metadata::v14::StorageEntryType; use crate::{ error::Error, - substrate_types::{self, StructField, SubstrateType, pallet_democracy}, + substrate_types::{self, pallet_democracy, StructField, SubstrateType}, CommonTypes, RustTypeMarker, TypeDetective, }; use bitvec::order::Lsb0 as BitOrderLsb0; -use codec::{Compact, CompactLen, Decode, Input}; use desub_common::SpecVersion; +use parity_scale_codec::{Compact, CompactLen, Decode, Input}; use std::{ cell::RefCell, collections::HashMap, @@ -859,7 +859,7 @@ impl Decoder { } "BitVec" => { log::trace!("Decoding BitVec"); - let bit_vec: bitvec::vec::BitVec = state.decode()?; + let bit_vec: bitvec::vec::BitVec = state.decode()?; Ok(Some(SubstrateType::BitVec(bit_vec))) } "Call" | "GenericCall" => { @@ -996,7 +996,7 @@ mod tests { substrate_types::{EnumField, StructField}, test_suite, EnumField as RustEnumField, }; - use codec::Encode; + use parity_scale_codec::Encode; #[derive(Debug, Clone)] struct GenericTypes; diff --git a/desub-legacy/src/decoder/extrinsics.rs b/desub-legacy/src/decoder/extrinsics.rs index 797ad955..f26c5eb5 100644 --- a/desub-legacy/src/decoder/extrinsics.rs +++ b/desub-legacy/src/decoder/extrinsics.rs @@ -62,7 +62,7 @@ impl fmt::Display for GenericExtrinsic { if let Some(v) = &self.signature { s.push_str(&format!("{}", v)); } else { - s.push_str(&"None".to_string()); + s.push_str("None"); } s.push('\n'); s.push_str("CALL"); diff --git a/desub-legacy/src/decoder/metadata.rs b/desub-legacy/src/decoder/metadata.rs index 7ca6cead..d50775e2 100644 --- a/desub-legacy/src/decoder/metadata.rs +++ b/desub-legacy/src/decoder/metadata.rs @@ -39,9 +39,9 @@ pub use frame_metadata::{decode_different::DecodeDifferent, RuntimeMetadata, Run use super::storage::{StorageInfo, StorageLookupTable}; use crate::RustTypeMarker; -use codec::{Decode, Encode, EncodeAsRef, HasCompact}; -use sp_core::{storage::StorageKey, twox_128}; +use parity_scale_codec::{Decode, Encode, EncodeAsRef, HasCompact}; use serde::{Deserialize, Serialize}; +use sp_core::{storage::StorageKey, twox_128}; use std::{ collections::{HashMap, HashSet}, @@ -83,7 +83,7 @@ pub enum Error { #[error("MapValueType Error")] MapValueTypeError, #[error(transparent)] - Decode(#[from] codec::Error), + Decode(#[from] parity_scale_codec::Error), #[error("Metadata Version {0} not supported")] NotSupported(u32), #[error("Expected Decoded")] @@ -229,7 +229,7 @@ impl<'a> Metadata { } fn generate_key>(prefix: S) -> Vec { - prefix.as_ref().split_ascii_whitespace().map(|s| twox_128(s.as_bytes()).to_vec()).flatten().collect() + prefix.as_ref().split_ascii_whitespace().flat_map(|s| twox_128(s.as_bytes()).to_vec()).collect() } /// print out a detailed but human readable description of the module diff --git a/desub-legacy/src/decoder/storage.rs b/desub-legacy/src/decoder/storage.rs index 93c80494..279e3f61 100644 --- a/desub-legacy/src/decoder/storage.rs +++ b/desub-legacy/src/decoder/storage.rs @@ -54,7 +54,7 @@ impl StorageLookupTable { pub fn meta_for_key(&self, key: &[u8]) -> Option<&StorageInfo> { let key = self.table.keys().find(|&k| &key[..k.len()] == k.as_slice()); - key.map(|k| self.lookup(k)).flatten() + key.and_then(|k| self.lookup(k)) } pub fn extra_key_data<'a>(&self, key: &'a [u8]) -> Option<&'a [u8]> { diff --git a/desub-legacy/src/error.rs b/desub-legacy/src/error.rs index c84552c6..cb463b43 100644 --- a/desub-legacy/src/error.rs +++ b/desub-legacy/src/error.rs @@ -1,5 +1,5 @@ use crate::decoder::MetadataError; -use codec::Error as CodecError; +use parity_scale_codec::Error as CodecError; use thiserror::Error; #[derive(Error, Debug)] diff --git a/desub-legacy/src/regex.rs b/desub-legacy/src/regex.rs index 895b17f8..476dd36a 100644 --- a/desub-legacy/src/regex.rs +++ b/desub-legacy/src/regex.rs @@ -186,7 +186,7 @@ pub fn remove_empty_generic>(s: S) -> Option { /// Sanitizes a type and returns parts that might correspond to PolkadotJS types pub fn sanitize_ty(ty: &str) -> Option { log::trace!("sanitizing ty {}", ty); - let ty = if let Some(no_empty_gen) = remove_empty_generic(&ty) { no_empty_gen } else { ty.to_string() }; + let ty = if let Some(no_empty_gen) = remove_empty_generic(ty) { no_empty_gen } else { ty.to_string() }; let ty = if let Some(no_trait) = remove_trait(&ty) { no_trait } else { ty }; let ty = if let Some(no_path) = remove_path(&ty) { no_path } else { ty }; let ty = if let Some(un_prefixed) = remove_prefix(&ty) { un_prefixed } else { ty }; @@ -206,16 +206,16 @@ pub fn sanitize_ty(ty: &str) -> Option { pub fn rust_tuple_decl() -> Regex { Regex::new( [ - r#"^\(([\w\d><:;\[\]()\n ]+)"#, - r#",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*"#, - r#",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*"#, - r#",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*"#, - r#",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*"#, - r#",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*"#, - r#",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*"#, - r#",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*"#, - r#",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*"#, - r#",? *([\w\d><:;\[\]()\n ]+)*\)$"#, + r"^\(([\w\d><:;\[\]()\n ]+)", + r",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*", + r",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*", + r",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*", + r",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*", + r",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*", + r",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*", + r",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*", + r",? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*,? *([\w\d><:;\[\]()\n ]+)*", + r",? *([\w\d><:;\[\]()\n ]+)*\)$", ] .join("") .as_str(), diff --git a/desub-legacy/src/substrate_types.rs b/desub-legacy/src/substrate_types.rs index 7f117380..f5ed1396 100644 --- a/desub-legacy/src/substrate_types.rs +++ b/desub-legacy/src/substrate_types.rs @@ -25,9 +25,9 @@ mod remote; use self::remote::*; use crate::{Error, SetField}; use bitvec::order::Lsb0 as BitOrderLsb0; +use serde::Serialize; use sp_core::crypto::{AccountId32, Ss58Codec}; use sp_runtime::MultiAddress; -use serde::Serialize; use std::{convert::TryFrom, fmt}; pub use self::data::Data; @@ -37,8 +37,8 @@ pub type Address = MultiAddress; /// Stripped down version of https://docs.substrate.io/rustdocs/latest/pallet_democracy /// Remove when/if the real pallet_democracy is published. pub mod pallet_democracy { + use parity_scale_codec::{Decode, Input}; use sp_runtime::RuntimeDebug; - use codec::{Decode, Input}; /// Static copy of https://docs.substrate.io/rustdocs/latest/pallet_democracy/struct.Vote.html #[derive(Copy, Clone, Eq, PartialEq, Default, RuntimeDebug)] pub struct Vote { @@ -47,20 +47,21 @@ pub mod pallet_democracy { } impl Decode for Vote { - fn decode(input: &mut I) -> Result { + fn decode(input: &mut I) -> Result { let b = input.read_byte()?; Ok(Vote { aye: (b & 0b1000_0000) == 0b1000_0000, conviction: Conviction::try_from(b & 0b0111_1111) - .map_err(|_| codec::Error::from("Invalid conviction"))?, + .map_err(|_| parity_scale_codec::Error::from("Invalid conviction"))?, }) } } /// Static copy of https://docs.substrate.io/rustdocs/latest/pallet_democracy/enum.Conviction.html - #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, RuntimeDebug)] + #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, RuntimeDebug, Default)] pub enum Conviction { /// 0.1x votes, unlocked. + #[default] None, /// 1x votes, locked for an enactment period following a successful vote. Locked1x, @@ -76,12 +77,6 @@ pub mod pallet_democracy { Locked6x, } - impl Default for Conviction { - fn default() -> Self { - Conviction::None - } - } - impl Conviction { /// The amount of time (in number of periods) that our conviction implies a successful voter's /// balance should be locked for. @@ -115,8 +110,6 @@ pub mod pallet_democracy { } } - - /// A 'stateful' version of [RustTypeMarker](enum.RustTypeMarker.html). /// 'Std' variant is not here like in RustTypeMarker. /// Instead common types are just apart of the enum @@ -129,7 +122,7 @@ pub enum SubstrateType { H256(sp_core::H256), /// BitVec type - BitVec(bitvec::vec::BitVec), + BitVec(bitvec::vec::BitVec), /// Recursive Call Type Call(Vec<(String, SubstrateType)>), diff --git a/desub-legacy/src/substrate_types/data.rs b/desub-legacy/src/substrate_types/data.rs index 236083b3..e200d434 100644 --- a/desub-legacy/src/substrate_types/data.rs +++ b/desub-legacy/src/substrate_types/data.rs @@ -21,7 +21,7 @@ //! - `Data` has a special way of encoding/decoding //! Data impl is copied over and must be maintaned against substrate master. -use codec::{Decode, Encode}; +use parity_scale_codec::{Decode, Encode}; use serde::{Deserialize, Serialize}; use std::iter::once; @@ -50,7 +50,7 @@ pub enum Data { } impl Decode for Data { - fn decode(input: &mut I) -> Result { + fn decode(input: &mut I) -> Result { let b = input.read_byte()?; Ok(match b { 0 => Data::None, @@ -63,7 +63,7 @@ impl Decode for Data { 35 => Data::Sha256(<[u8; 32]>::decode(input)?), 36 => Data::Keccak256(<[u8; 32]>::decode(input)?), 37 => Data::ShaThree256(<[u8; 32]>::decode(input)?), - _ => return Err(codec::Error::from("invalid leading byte")), + _ => return Err(parity_scale_codec::Error::from("invalid leading byte")), }) } } @@ -75,7 +75,7 @@ impl Encode for Data { Data::Raw(ref x) => { let l = x.len().min(32); let mut r = vec![l as u8 + 1; l + 1]; - r[1..].copy_from_slice(&x[..l as usize]); + r[1..].copy_from_slice(&x[..l]); r } Data::BlakeTwo256(ref h) => once(34u8).chain(h.iter().cloned()).collect(), @@ -85,7 +85,7 @@ impl Encode for Data { } } } -impl codec::EncodeLike for Data {} +impl parity_scale_codec::EncodeLike for Data {} impl Default for Data { fn default() -> Self { diff --git a/desub-legacy/src/test_suite.rs b/desub-legacy/src/test_suite.rs index 4e6e5441..23276364 100644 --- a/desub-legacy/src/test_suite.rs +++ b/desub-legacy/src/test_suite.rs @@ -25,6 +25,7 @@ pub fn mock_runtime(num: u32) -> RuntimeVersion { spec_version: num, impl_version: num, apis: Cow::from(Vec::new()), - transaction_version: 4, + transaction_version: 24, + state_version: 0, } } diff --git a/desub-legacy/src/util.rs b/desub-legacy/src/util.rs index efe2f5d7..1d6f2477 100644 --- a/desub-legacy/src/util.rs +++ b/desub-legacy/src/util.rs @@ -14,11 +14,11 @@ // along with substrate-desub. If not, see . use crate::{Error, SubstrateType}; -use sp_core::crypto::Ss58Codec; use serde::{ ser::{self, SerializeSeq}, Serializer, }; +use sp_core::crypto::Ss58Codec; use std::convert::TryFrom; // Utility function to serialize from slice/vec to hex diff --git a/desub/Cargo.toml b/desub/Cargo.toml index 13ff165c..c84f6621 100644 --- a/desub/Cargo.toml +++ b/desub/Cargo.toml @@ -1,26 +1,27 @@ [package] name = "desub" -version = "0.1.0" -authors = ["Parity Technologies "] -license = "GPL-3.0" -homepage = "https://substrate.dev" -repository = "https://github.com/paritytech/desub/" -description = "Decode Substrate with Backwards-Compatible Metadata" -edition = "2021" +version.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +description.workspace = true +edition.workspace = true +rust-version.workspace = true -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] + +polkadot-js = ["desub-json-resolver", "desub-json-resolver/polkadot", "frame-metadata/legacy" ] [dependencies] -desub-legacy = { version = "0.1.0", path = "../desub-legacy/" } -desub-common = { version = "0.1.0", path = "../desub-common/" } -desub-current = { version = "0.1.0", path = "../desub-current/" } -desub-json-resolver = { version = "0.0.1", path = "../desub-json-resolver/", optional = true } +desub-legacy = { workspace = true } +desub-common = { workspace = true} +desub-current = { workspace = true } +desub-json-resolver = { workspace = true, optional = true } -thiserror = "1.0.30" -frame-metadata = "14.2" -codec = { version = "2.3.1", package = "parity-scale-codec" } -serde_json = { version = "1.0", features = ["preserve_order", "arbitrary_precision"] } +thiserror = { workspace = true } +frame-metadata = { workspace = true } +parity-scale-codec = { workspace = true } +serde_json = { workspace = true, features = ["preserve_order", "arbitrary_precision"] } -[features] -polkadot-js = ["desub-json-resolver", "desub-json-resolver/polkadot", "frame-metadata/legacy" ] diff --git a/desub/src/error.rs b/desub/src/error.rs index 360d64e6..919366d6 100644 --- a/desub/src/error.rs +++ b/desub/src/error.rs @@ -32,7 +32,7 @@ pub enum Error { #[error(transparent)] Legacy(#[from] LegacyError), #[error(transparent)] - Codec(#[from] codec::Error), + Codec(#[from] parity_scale_codec::Error), #[error(transparent)] MetadataError(#[from] MetadataError), #[error(transparent)] diff --git a/desub/src/lib.rs b/desub/src/lib.rs index 839bb01d..46d1fdf6 100644 --- a/desub/src/lib.rs +++ b/desub/src/lib.rs @@ -19,7 +19,6 @@ #[deny(unused)] mod error; -use codec::Decode; use desub_current::{ decoder::{self, Extrinsic}, Metadata as DesubMetadata, @@ -29,6 +28,7 @@ use desub_legacy::{ RustTypeMarker, TypeDetective, }; use frame_metadata::RuntimeMetadataPrefixed; +use parity_scale_codec::Decode; use serde_json::Value; use std::collections::HashMap; @@ -106,7 +106,7 @@ impl Decoder { if self.current_metadata.contains_key(&version) { let metadata = self.current_metadata.get(&version).expect("Checked if key is contained; qed"); match decoder::decode_extrinsics(metadata, &mut data) { - Ok(v) => Ok(serde_json::to_value(&v)?), + Ok(v) => Ok(serde_json::to_value(v)?), Err((ext, e)) => { Err(Error::V14 { source: e, ext: ext.into_iter().map(Extrinsic::into_owned).collect() }) } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 96a75ff8..e5fdde05 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,30 +1,30 @@ [package] name = "integration-tests" -version = "0.1.0" -authors = ["Parity Technologies "] -license = "GPL-3.0" -homepage = "https://substrate.dev" -repository = "https://github.com/paritytech/desub/" -description = "Decode Substrate with Backwards-Compatible Metadata" -readme = "README.md" -edition = "2021" +version.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +description.workspace = true +edition.workspace = true +rust-version.workspace = true autotests = false +publish = false [dev-dependencies] -desub-legacy = { path = "../desub-legacy" } -desub-json-resolver = { path = "../desub-json-resolver" } -serde = { version = "1.0", features = ["derive"] } -serde_json = { version = "1.0", features = ["preserve_order"] } -codec = { version = "2", package = "parity-scale-codec" } -frame-system = { git = "https://github.com/paritytech/substrate", tag = "monthly-2021-12" } -pallet-balances = { git = "https://github.com/paritytech/substrate", tag = "monthly-2021-12" } -pretty_env_logger = "0.4" -log = "0.4" -hex = "0.4" -paste = "1.0.3" -anyhow = "1" - -sp-core = "4.0.0" +desub-legacy = { workspace = true } +desub-json-resolver = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true, features = ["preserve_order"] } +parity-scale-codec = { workspace = true } +pallet-balances = { workspace = true } +pretty_env_logger = { workspace = true } +log = { workspace = true } +hex = { workspace = true } +paste = { workspace = true } +anyhow = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } [[test]] name = "integration-tests" diff --git a/integration-tests/tests/storage.rs b/integration-tests/tests/storage.rs index b9c383e7..637c23cd 100644 --- a/integration-tests/tests/storage.rs +++ b/integration-tests/tests/storage.rs @@ -1,10 +1,10 @@ use crate::runtime_metadata::*; use anyhow::Result; -use codec::Encode; use desub_legacy::{ decoder::{Chain, Decoder, Metadata}, SubstrateType, }; +use parity_scale_codec::Encode; use sp_core::twox_128; /// T::BlockNumber in meta V11 Block 1768321