diff --git a/.github/actions/build-dependencies/action.yml b/.github/actions/build-dependencies/action.yml index 345557b9..bd0dfac2 100644 --- a/.github/actions/build-dependencies/action.yml +++ b/.github/actions/build-dependencies/action.yml @@ -21,7 +21,7 @@ runs: - name: Install solc shell: bash run: | - pip3 install solc-select + pip3 install solc-select==0.2.1 solc-select install 0.8.16 solc-select use 0.8.16 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 63a704f2..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "coins/monero/c/monero"] - path = coins/monero/c/monero - url = https://github.com/monero-project/monero diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f38ea1b2..a8ff9d24 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,6 +17,7 @@ form of code and documentation. - Only use uppercase variable names when relevant to cryptography. +- Use a two-space ident when possible. - Put a space after comment markers. - Don't use multiple newlines between sections of code. - Have a newline before EOF. diff --git a/Cargo.lock b/Cargo.lock index 13ef2895..d596e7b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -285,9 +285,9 @@ dependencies = [ [[package]] name = "async-std-resolver" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2f8a4a203be3325981310ab243a28e6e4ea55b6519bffce05d41ab60e09ad8" +checksum = "6ba50e24d9ee0a8950d3d03fc6d0dd10aa14b5de3b101949b4e160f7fee7c723" dependencies = [ "async-std", "async-trait", @@ -306,9 +306,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" +checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" dependencies = [ "proc-macro2", "quote", @@ -466,12 +466,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bimap" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" - [[package]] name = "bincode" version = "1.3.3" @@ -483,9 +477,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.59.2" +version = "0.60.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" dependencies = [ "bitflags", "cexpr", @@ -603,7 +597,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding 0.1.5", + "block-padding", "byte-tools", "byteorder", "generic-array 0.12.4", @@ -615,7 +609,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "block-padding 0.2.1", "generic-array 0.14.6", ] @@ -637,12 +630,6 @@ dependencies = [ "byte-tools", ] -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - [[package]] name = "blocking" version = "1.2.0" @@ -683,9 +670,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byte-slice-cast" @@ -894,7 +881,7 @@ checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" dependencies = [ "glob", "libc", - "libloading 0.7.3", + "libloading", ] [[package]] @@ -905,8 +892,8 @@ checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" dependencies = [ "atty", "bitflags", - "clap_derive", - "clap_lex", + "clap_derive 3.2.18", + "clap_lex 0.2.4", "indexmap", "once_cell", "strsim", @@ -914,6 +901,21 @@ dependencies = [ "textwrap", ] +[[package]] +name = "clap" +version = "4.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06badb543e734a2d6568e19a40af66ed5364360b9226184926f89d229b4b4267" +dependencies = [ + "atty", + "bitflags", + "clap_derive 4.0.13", + "clap_lex 0.3.0", + "once_cell", + "strsim", + "termcolor", +] + [[package]] name = "clap_derive" version = "3.2.18" @@ -927,6 +929,19 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_derive" +version = "4.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f169caba89a7d512b5418b09864543eeb4d497416c917d7137863bd2076ad" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "clap_lex" version = "0.2.4" @@ -937,12 +952,22 @@ dependencies = [ ] [[package]] -name = "cmake" -version = "0.1.48" +name = "clap_lex" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ - "cc", + "os_str_bytes", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", ] [[package]] @@ -998,7 +1023,7 @@ dependencies = [ "serde", "serde_derive", "sha2 0.10.6", - "sha3 0.10.5", + "sha3", "thiserror", ] @@ -1015,9 +1040,9 @@ dependencies = [ [[package]] name = "comfy-table" -version = "6.1.0" +version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85914173c2f558d61613bfbbf1911f14e630895087a7ed2fafc0f5319e1536e7" +checksum = "7b3d16bb3da60be2f7c7acfc438f2ae6f3496897ce68c291d0509bb67b4e248e" dependencies = [ "strum", "strum_macros", @@ -1280,9 +1305,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f2b443d17d49dad5ef0ede301c3179cc923b8822f3393b4d2c28c269dd4a122" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -1322,9 +1347,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdffe87e1d521a10f9696f833fe502293ea446d7f256c06128293a4119bdf4cb" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ "quote", "syn", @@ -1339,17 +1364,6 @@ dependencies = [ "cipher", ] -[[package]] -name = "cuckoofilter" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" -dependencies = [ - "byteorder", - "fnv", - "rand 0.7.3", -] - [[package]] name = "curve25519-dalek" version = "2.1.3" @@ -1389,6 +1403,50 @@ dependencies = [ "zeroize", ] +[[package]] +name = "cxx" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "dalek-ff-group" version = "0.1.5" @@ -1468,6 +1526,12 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + [[package]] name = "digest" version = "0.8.1" @@ -1576,6 +1640,12 @@ dependencies = [ "quick-error", ] +[[package]] +name = "downcast" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" + [[package]] name = "downcast-rs" version = "1.2.0" @@ -1584,15 +1654,15 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6053ff46b5639ceb91756a85a4c8914668393a03170efd79c8884a529d80656" +checksum = "f8a6eee2d5d0d113f015688310da018bd1d864d86bd567c8fca9c266889e1bfa" [[package]] name = "dunce" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541" +checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" [[package]] name = "dyn-clonable" @@ -1722,9 +1792,9 @@ dependencies = [ [[package]] name = "enum-as-inner" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ "heck", "proc-macro2", @@ -1789,7 +1859,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.6", - "sha3 0.10.5", + "sha3", "thiserror", "uuid", ] @@ -1806,7 +1876,7 @@ dependencies = [ "regex", "serde", "serde_json", - "sha3 0.10.5", + "sha3", "thiserror", "uint", ] @@ -1818,9 +1888,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef" dependencies = [ "crunchy", - "fixed-hash", + "fixed-hash 0.7.0", "impl-rlp", - "impl-serde", + "impl-serde 0.3.2", "tiny-keccak", ] @@ -1838,7 +1908,7 @@ dependencies = [ "rand_core 0.6.4", "serde", "serde_json", - "sha3 0.10.5", + "sha3", "thiserror", "tokio", ] @@ -1850,10 +1920,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6" dependencies = [ "ethbloom", - "fixed-hash", + "fixed-hash 0.7.0", "impl-rlp", - "impl-serde", - "primitive-types", + "impl-serde 0.3.2", + "primitive-types 0.11.1", "uint", ] @@ -2162,9 +2232,9 @@ dependencies = [ [[package]] name = "fastrlp-derive" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fa41ebc231af281098b11ad4a4f6182ec9096902afffe948034a20d4e1385a" +checksum = "d9e9158c1d8f0a7a716c9191562eaabba70268ba64972ef4871ce8d66fd08872" dependencies = [ "bytes", "proc-macro2", @@ -2211,7 +2281,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -2242,6 +2312,18 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + [[package]] name = "fixedbitset" version = "0.4.2" @@ -2268,6 +2350,15 @@ dependencies = [ "merlin 3.0.0", ] +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +dependencies = [ + "num-traits", +] + [[package]] name = "fnv" version = "1.0.7" @@ -2292,7 +2383,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", ] @@ -2306,10 +2397,16 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fragile" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" + [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-support", "frame-system", @@ -2332,12 +2429,12 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "Inflector", "array-bytes", "chrono", - "clap", + "clap 4.0.17", "comfy-table", "frame-benchmarking", "frame-support", @@ -2383,7 +2480,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-support", "frame-system", @@ -2411,7 +2508,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "bitflags", "frame-metadata", @@ -2443,7 +2540,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "Inflector", "cfg-expr", @@ -2457,7 +2554,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2469,7 +2566,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "proc-macro2", "quote", @@ -2479,7 +2576,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-support", "log", @@ -2497,7 +2594,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-benchmarking", "frame-support", @@ -2512,24 +2609,12 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", "sp-api", ] -[[package]] -name = "fs-swap" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d47dad3685eceed8488986cad3d5027165ea5edb164331770e2059555f10a5" -dependencies = [ - "lazy_static", - "libc", - "libloading 0.5.2", - "winapi", -] - [[package]] name = "fs2" version = "0.4.3" @@ -2554,9 +2639,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", @@ -2569,9 +2654,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", "futures-sink", @@ -2579,15 +2664,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-executor" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ "futures-core", "futures-task", @@ -2597,9 +2682,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-lite" @@ -2629,9 +2714,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2", "quote", @@ -2651,15 +2736,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-timer" @@ -2669,9 +2754,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-channel", "futures-core", @@ -2803,11 +2888,10 @@ dependencies = [ [[package]] name = "group" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7391856def869c1c81063a03457c676fbcd419709c3dfb33d8d319de484b154d" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ - "byteorder", "ff", "rand_core 0.6.4", "subtle", @@ -2834,9 +2918,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.3.4" +version = "4.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56b224eaa4987c03c30b251de7ef0c15a6a59f34222905850dbc3026dfb24d5f" +checksum = "433e4ab33f1213cdc25b5fa45c76881240cfe79284cf2b395e8b9e312a30a2fd" dependencies = [ "log", "pest", @@ -2906,12 +2990,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "hex_fmt" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" - [[package]] name = "hmac" version = "0.8.1" @@ -2954,9 +3032,9 @@ dependencies = [ [[package]] name = "home" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" +checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408" dependencies = [ "winapi", ] @@ -2980,7 +3058,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.3", + "itoa", ] [[package]] @@ -3027,7 +3105,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.3", + "itoa", "pin-project-lite 0.2.9", "socket2", "tokio", @@ -3066,17 +3144,28 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.50" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0" +checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" dependencies = [ "android_system_properties", "core-foundation-sys", + "iana-time-zone-haiku", "js-sys", "wasm-bindgen", "winapi", ] +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "idna" version = "0.2.3" @@ -3110,9 +3199,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "1.1.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015a7df1eb6dda30df37f34b63ada9b7b352984b0e84de2a20ed526345000791" +checksum = "065c008e570a43c00de6aed9714035e5ea6a498c255323db9091722af6ee67dd" dependencies = [ "async-io", "core-foundation", @@ -3153,6 +3242,15 @@ dependencies = [ "serde", ] +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -3214,7 +3312,7 @@ dependencies = [ "rand 0.8.5", "secp256k1", "sha2 0.10.6", - "sha3 0.10.5", + "sha3", ] [[package]] @@ -3240,7 +3338,7 @@ dependencies = [ "scale-info", "secp256k1", "sha2 0.10.6", - "sha3 0.10.5", + "sha3", "static_assertions", ] @@ -3269,7 +3367,7 @@ dependencies = [ "derive_more", "either", "heck", - "impl-serde", + "impl-serde 0.3.2", "ink_lang_ir", "itertools", "parity-scale-codec", @@ -3313,7 +3411,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d442f4f5dcbf120aa84cae9e399065ad99d143d5a920b06d3da286e91c03ec70" dependencies = [ "derive_more", - "impl-serde", + "impl-serde 0.3.2", "ink_prelude", "ink_primitives", "scale-info", @@ -3433,15 +3531,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.8" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "jobserver" @@ -3578,7 +3670,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "sha2 0.10.6", - "sha3 0.10.5", + "sha3", ] [[package]] @@ -3598,9 +3690,9 @@ dependencies = [ [[package]] name = "kvdb" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a301d8ecb7989d4a6e2c57a49baca77d353bdbf879909debe3f375fe25d61f86" +checksum = "585089ceadba0197ffe9af6740ab350b325e3c1f5fccfbc3522e0250c750409b" dependencies = [ "parity-util-mem", "smallvec", @@ -3608,9 +3700,9 @@ dependencies = [ [[package]] name = "kvdb-memorydb" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece7e668abd21387aeb6628130a6f4c802787f014fa46bc83221448322250357" +checksum = "40d109c87bfb7759edd2a49b2649c1afe25af785d930ad6a38479b4dc70dd873" dependencies = [ "kvdb", "parity-util-mem", @@ -3619,15 +3711,13 @@ dependencies = [ [[package]] name = "kvdb-rocksdb" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca7fbdfd71cd663dceb0faf3367a99f8cf724514933e9867cec4995b6027cbc1" +checksum = "c076cc2cdbac89b9910c853a36c957d3862a779f31c2661174222cefb49ee597" dependencies = [ - "fs-swap", "kvdb", "log", "num_cpus", - "owning_ref", "parity-util-mem", "parking_lot 0.12.1", "regex", @@ -3681,19 +3771,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.134" +version = "0.2.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" - -[[package]] -name = "libloading" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" -dependencies = [ - "cc", - "winapi", -] +checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" [[package]] name = "libloading" @@ -3713,9 +3793,9 @@ checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" [[package]] name = "libp2p" -version = "0.46.1" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81327106887e42d004fbdab1fef93675be2e2e07c1b95fce45e2cc813485611d" +checksum = "ec878fda12ebec479186b3914ebc48ff180fa4c51847e11a1a68bf65249e02c1" dependencies = [ "bytes", "futures", @@ -3723,12 +3803,8 @@ dependencies = [ "getrandom 0.2.7", "instant", "lazy_static", - "libp2p-autonat", "libp2p-core", - "libp2p-deflate", "libp2p-dns", - "libp2p-floodsub", - "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-mdns", @@ -3736,49 +3812,24 @@ dependencies = [ "libp2p-mplex", "libp2p-noise", "libp2p-ping", - "libp2p-plaintext", - "libp2p-pnet", - "libp2p-relay", - "libp2p-rendezvous", "libp2p-request-response", "libp2p-swarm", "libp2p-swarm-derive", "libp2p-tcp", - "libp2p-uds", "libp2p-wasm-ext", "libp2p-websocket", "libp2p-yamux", "multiaddr", "parking_lot 0.12.1", "pin-project", - "rand 0.7.3", "smallvec", ] -[[package]] -name = "libp2p-autonat" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4decc51f3573653a9f4ecacb31b1b922dd20c25a6322bb15318ec04287ec46f9" -dependencies = [ - "async-trait", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-request-response", - "libp2p-swarm", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.8.5", -] - [[package]] name = "libp2p-core" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf9b94cefab7599b2d3dff2f93bee218c6621d68590b23ede4485813cbcece6" +checksum = "799676bb0807c788065e57551c6527d461ad572162b0519d1958946ff9e0539d" dependencies = [ "asn1_der", "bs58", @@ -3789,17 +3840,15 @@ dependencies = [ "futures-timer", "instant", "lazy_static", - "libsecp256k1", "log", "multiaddr", "multihash", "multistream-select", "parking_lot 0.12.1", "pin-project", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.8.5", - "ring", "rw-stream-sink", "sha2 0.10.6", "smallvec", @@ -3809,22 +3858,11 @@ dependencies = [ "zeroize", ] -[[package]] -name = "libp2p-deflate" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0183dc2a3da1fbbf85e5b6cf51217f55b14f5daea0c455a9536eef646bfec71" -dependencies = [ - "flate2", - "futures", - "libp2p-core", -] - [[package]] name = "libp2p-dns" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cbf54723250fa5d521383be789bf60efdabe6bacfb443f87da261019a49b4b5" +checksum = "2322c9fb40d99101def6a01612ee30500c89abbbecb6297b3cd252903a4c1720" dependencies = [ "async-std-resolver", "futures", @@ -3835,57 +3873,11 @@ dependencies = [ "trust-dns-resolver", ] -[[package]] -name = "libp2p-floodsub" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a4b6ffd53e355775d24b76f583fdda54b3284806f678499b57913adb94f231" -dependencies = [ - "cuckoofilter", - "fnv", - "futures", - "libp2p-core", - "libp2p-swarm", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", - "smallvec", -] - -[[package]] -name = "libp2p-gossipsub" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74b4b888cfbeb1f5551acd3aa1366e01bf88ede26cc3c4645d0d2d004d5ca7b0" -dependencies = [ - "asynchronous-codec", - "base64 0.13.0", - "byteorder", - "bytes", - "fnv", - "futures", - "hex_fmt", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "prometheus-client", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", - "regex", - "sha2 0.10.6", - "smallvec", - "unsigned-varint", - "wasm-timer", -] - [[package]] name = "libp2p-identify" -version = "0.37.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50b585518f8efd06f93ac2f976bd672e17cdac794644b3117edd078e96bda06" +checksum = "dcf9a121f699e8719bda2e6e9e9b6ddafc6cff4602471d6481c1067930ccb29b" dependencies = [ "asynchronous-codec", "futures", @@ -3893,9 +3885,9 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "lru", - "prost 0.10.4", - "prost-build 0.10.4", + "lru 0.8.1", + "prost", + "prost-build", "prost-codec", "smallvec", "thiserror", @@ -3904,9 +3896,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.38.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740862893bb5f06ac24acc9d49bdeadc3a5e52e51818a30a25c1f3519da2c851" +checksum = "6721c200e2021f6c3fab8b6cf0272ead8912d871610ee194ebd628cecf428f22" dependencies = [ "arrayvec 0.7.2", "asynchronous-codec", @@ -3919,9 +3911,9 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", + "prost", + "prost-build", + "rand 0.8.5", "sha2 0.10.6", "smallvec", "thiserror", @@ -3932,16 +3924,15 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.38.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66e5e5919509603281033fd16306c61df7a4428ce274b67af5e14b07de5cdcb2" +checksum = "761704e727f7d68d58d7bc2231eafae5fc1b9814de24290f126df09d4bd37a15" dependencies = [ "async-io", "data-encoding", "dns-parser", "futures", "if-watch", - "lazy_static", "libp2p-core", "libp2p-swarm", "log", @@ -3953,25 +3944,23 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.7.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8aff4a1abef42328fbb30b17c853fff9be986dc39af17ee39f9c5f755c5e0c" +checksum = "9ee31b08e78b7b8bfd1c4204a9dd8a87b4fcdf6dafc57eb51701c1c264a81cb9" dependencies = [ "libp2p-core", - "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-ping", - "libp2p-relay", "libp2p-swarm", "prometheus-client", ] [[package]] name = "libp2p-mplex" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61fd1b20638ec209c5075dfb2e8ce6a7ea4ec3cd3ad7b77f7a477c06d53322e2" +checksum = "692664acfd98652de739a8acbb0a0d670f1d67190a49be6b4395e22c37337d89" dependencies = [ "asynchronous-codec", "bytes", @@ -3980,16 +3969,16 @@ dependencies = [ "log", "nohash-hasher", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "unsigned-varint", ] [[package]] name = "libp2p-noise" -version = "0.37.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "762408cb5d84b49a600422d7f9a42c18012d8da6ebcd570f9a4a4290ba41fb6f" +checksum = "048155686bd81fe6cb5efdef0c6290f25ad32a0a42e8f4f72625cf6a505a206f" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -3997,8 +3986,8 @@ dependencies = [ "lazy_static", "libp2p-core", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.8.5", "sha2 0.10.6", "snow", @@ -4009,9 +3998,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.37.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "100a6934ae1dbf8a693a4e7dd1d730fd60b774dafc45688ed63b554497c6c925" +checksum = "7228b9318d34689521349a86eb39a3c3a802c9efc99a0568062ffb80913e3f91" dependencies = [ "futures", "futures-timer", @@ -4019,95 +4008,15 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "rand 0.7.3", - "void", -] - -[[package]] -name = "libp2p-plaintext" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be27bf0820a6238a4e06365b096d428271cce85a129cf16f2fe9eb1610c4df86" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures", - "libp2p-core", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-pnet" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1a458bbda880107b5b36fcb9b5a1ef0c329685da0e203ed692a8ebe64cc92c" -dependencies = [ - "futures", - "log", - "pin-project", - "rand 0.7.3", - "salsa20", - "sha3 0.9.1", -] - -[[package]] -name = "libp2p-relay" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4931547ee0cce03971ccc1733ff05bb0c4349fd89120a39e9861e2bbe18843c3" -dependencies = [ - "asynchronous-codec", - "bytes", - "either", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "pin-project", - "prost 0.10.4", - "prost-build 0.10.4", - "prost-codec", "rand 0.8.5", - "smallvec", - "static_assertions", - "thiserror", - "void", -] - -[[package]] -name = "libp2p-rendezvous" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9511c9672ba33284838e349623319c8cad2d18cfad243ae46c6b7e8a2982ea4e" -dependencies = [ - "asynchronous-codec", - "bimap", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.8.5", - "sha2 0.10.6", - "thiserror", - "unsigned-varint", "void", ] [[package]] name = "libp2p-request-response" -version = "0.19.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "508a189e2795d892c8f5c1fa1e9e0b1845d32d7b0b249dbf7b05b18811361843" +checksum = "8827af16a017b65311a410bb626205a9ad92ec0473967618425039fa5231adc1" dependencies = [ "async-trait", "bytes", @@ -4116,16 +4025,16 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "unsigned-varint", ] [[package]] name = "libp2p-swarm" -version = "0.37.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ac5be6c2de2d1ff3f7693fda6faf8a827b1f3e808202277783fea9f527d114" +checksum = "46d13df7c37807965d82930c0e4b04a659efcb6cca237373b206043db5398ecf" dependencies = [ "either", "fnv", @@ -4135,7 +4044,7 @@ dependencies = [ "libp2p-core", "log", "pin-project", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "thiserror", "void", @@ -4143,48 +4052,36 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f54a64b6957249e0ce782f8abf41d97f69330d02bf229f0672d864f0650cc76" +checksum = "a0eddc4497a8b5a506013c40e8189864f9c3a00db2b25671f428ae9007f3ba32" dependencies = [ + "heck", "quote", "syn", ] [[package]] name = "libp2p-tcp" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6771dc19aa3c65d6af9a8c65222bfc8fcd446630ddca487acd161fa6096f3b" +checksum = "9839d96761491c6d3e238e70554b856956fca0ab60feb9de2cd08eed4473fa92" dependencies = [ "async-io", "futures", "futures-timer", "if-watch", - "ipnet", "libc", "libp2p-core", "log", "socket2", ] -[[package]] -name = "libp2p-uds" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d125e3e5f0d58f3c6ac21815b20cf4b6a88b8db9dc26368ea821838f4161fd4d" -dependencies = [ - "async-std", - "futures", - "libp2p-core", - "log", -] - [[package]] name = "libp2p-wasm-ext" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec894790eec3c1608f8d1a8a0bdf0dbeb79ed4de2dce964222011c2896dfa05a" +checksum = "a17b5b8e7a73e379e47b1b77f8a82c4721e97eca01abcd18e9cd91a23ca6ce97" dependencies = [ "futures", "js-sys", @@ -4196,9 +4093,9 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.36.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9808e57e81be76ff841c106b4c5974fb4d41a233a7bdd2afbf1687ac6def3818" +checksum = "3758ae6f89b2531a24b6d9f5776bda6a626b60a57600d7185d43dfa75ca5ecc4" dependencies = [ "either", "futures", @@ -4215,12 +4112,13 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.38.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6dea686217a06072033dc025631932810e2f6ad784e4fafa42e27d311c7a81c" +checksum = "30f079097a21ad017fc8139460630286f02488c8c13b26affb46623aa20d8845" dependencies = [ "futures", "libp2p-core", + "log", "parking_lot 0.12.1", "thiserror", "yamux", @@ -4228,9 +4126,9 @@ dependencies = [ [[package]] name = "librocksdb-sys" -version = "0.6.1+6.28.2" +version = "0.8.0+7.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc587013734dadb7cf23468e531aa120788b87243648be42e2d3a072186291" +checksum = "611804e4666a25136fcc5f8cf425ab4d26c7f74ea245ffe92ea23b85b6420b5d" dependencies = [ "bindgen", "bzip2-sys", @@ -4300,6 +4198,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -4360,6 +4267,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "lru" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +dependencies = [ + "hashbrown", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -4472,9 +4388,9 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" dependencies = [ "hash-db", "hashbrown", @@ -4559,12 +4475,39 @@ dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.36.1", +] + +[[package]] +name = "mockall" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e4a1c770583dac7ab5e2f6c139153b783a53a1bbee9729613f193e59828326" +dependencies = [ + "cfg-if", + "downcast", + "fragile", + "lazy_static", + "mockall_derive", + "predicates", + "predicates-tree", +] + +[[package]] +name = "mockall_derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "832663583d5fa284ca8810bf7015e46c9fff9622d3cf34bd1eea5003fec06dd0" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "modular-frost" -version = "0.2.3" +version = "0.2.4" dependencies = [ "dalek-ff-group", "dleq", @@ -4578,8 +4521,10 @@ dependencies = [ "multiexp", "p256", "rand_core 0.6.4", + "serde_json", "sha2 0.10.6", - "sha3 0.10.5", + "sha3", + "subtle", "thiserror", "zeroize", ] @@ -4602,7 +4547,7 @@ dependencies = [ "dalek-ff-group", "group", "lazy_static", - "sha3 0.10.5", + "sha3", "subtle", ] @@ -4631,7 +4576,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "sha3 0.10.5", + "sha3", "subtle", "thiserror", "tokio", @@ -4692,7 +4637,7 @@ dependencies = [ "digest 0.10.5", "multihash-derive", "sha2 0.10.6", - "sha3 0.10.5", + "sha3", "unsigned-varint", ] @@ -4718,9 +4663,9 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" +checksum = "9bc41247ec209813e2fd414d6e16b9d94297dacf3cd613fa6ef09cd4d9755c10" dependencies = [ "bytes", "futures", @@ -4891,6 +4836,12 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + [[package]] name = "num-bigint" version = "0.4.3" @@ -4913,12 +4864,12 @@ dependencies = [ [[package]] name = "num-format" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" +checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" dependencies = [ - "arrayvec 0.4.12", - "itoa 0.4.8", + "arrayvec 0.7.2", + "itoa", ] [[package]] @@ -5059,15 +5010,6 @@ version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" -[[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] - [[package]] name = "p256" version = "0.11.1" @@ -5082,7 +5024,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-benchmarking", "frame-support", @@ -5097,7 +5039,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "bitflags", "frame-benchmarking", @@ -5112,6 +5054,7 @@ dependencies = [ "scale-info", "serde", "smallvec", + "sp-api", "sp-core", "sp-io", "sp-runtime", @@ -5124,62 +5067,29 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "bitflags", "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-rpc", "sp-runtime", "sp-std", + "sp-weights", ] [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "pallet-contracts-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" -dependencies = [ - "jsonrpsee", - "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", - "parity-scale-codec", - "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", -] - -[[package]] -name = "pallet-contracts-rpc-runtime-api" -version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" -dependencies = [ - "pallet-contracts-primitives", - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-support", "frame-system", @@ -5193,7 +5103,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-benchmarking", "frame-support", @@ -5211,7 +5121,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-support", "frame-system", @@ -5227,7 +5137,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5242,7 +5152,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5304,16 +5214,16 @@ checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" [[package]] name = "parity-util-mem" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ "cfg-if", "hashbrown", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot 0.12.1", - "primitive-types", + "primitive-types 0.12.0", "smallvec", "winapi", ] @@ -5368,7 +5278,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.3", + "parking_lot_core 0.9.4", ] [[package]] @@ -5387,15 +5297,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -5485,9 +5395,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb779fcf4bb850fbbb0edc96ff6cf34fd90c4b1a112ce042653280d9a7364048" +checksum = "dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a" dependencies = [ "thiserror", "ucd-trie", @@ -5495,9 +5405,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502b62a6d0245378b04ffe0a7fb4f4419a4815fce813bd8a0ec89a56e07d67b1" +checksum = "60b75706b9642ebcb34dab3bc7750f811609a0eb1dd8b88c2d15bf628c1c65b2" dependencies = [ "pest", "pest_generator", @@ -5505,9 +5415,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451e629bf49b750254da26132f1a5a9d11fd8a95a3df51d15c4abd1ba154cb6c" +checksum = "f4f9272122f5979a6511a749af9db9bfc810393f63119970d7085fed1c4ea0db" dependencies = [ "pest", "pest_meta", @@ -5518,9 +5428,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcec162c71c45e269dfc3fc2916eaeb97feab22993a21bcce4721d08cd7801a6" +checksum = "4c8717927f9b79515e565a64fe46c38b8cd0427e64c40680b14a7365ab09ac8d" dependencies = [ "once_cell", "pest", @@ -5706,16 +5616,58 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "predicates" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c" +dependencies = [ + "difflib", + "float-cmp", + "itertools", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da1c2388b1513e1b605fcec39a95e0a9e8ef088f71443ef37099fa9ae6673fcb" + +[[package]] +name = "predicates-tree" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d86de6de25020a36c6d3643a86d9a6a9f552107c0559c60ea03551b5e16c032" +dependencies = [ + "predicates-core", + "termtree", +] + [[package]] name = "primitive-types" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" dependencies = [ - "fixed-hash", + "fixed-hash 0.7.0", "impl-codec", "impl-rlp", - "impl-serde", + "impl-serde 0.3.2", + "uint", +] + +[[package]] +name = "primitive-types" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cfd65aea0c5fa0bfcc7c9e7ca828c921ef778f43d325325ec84bda371bfa75a" +dependencies = [ + "fixed-hash 0.8.0", + "impl-codec", + "impl-serde 0.4.0", "scale-info", "uint", ] @@ -5763,9 +5715,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.46" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] @@ -5786,37 +5738,27 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.16.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825" +checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" dependencies = [ "dtoa", - "itoa 1.0.3", - "owning_ref", + "itoa", + "parking_lot 0.12.1", "prometheus-client-derive-text-encode", ] [[package]] name = "prometheus-client-derive-text-encode" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652" +checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "prost" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" -dependencies = [ - "bytes", - "prost-derive 0.10.1", -] - [[package]] name = "prost" version = "0.11.0" @@ -5824,29 +5766,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "399c3c31cdec40583bb68f0b18403400d01ec4289c383aa047560439952c4dd7" dependencies = [ "bytes", - "prost-derive 0.11.0", -] - -[[package]] -name = "prost-build" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae5a4388762d5815a9fc0dea33c56b021cdc8dde0c55e0c9ca57197254b0cab" -dependencies = [ - "bytes", - "cfg-if", - "cmake", - "heck", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prost 0.10.4", - "prost-types 0.10.1", - "regex", - "tempfile", - "which", + "prost-derive", ] [[package]] @@ -5862,8 +5782,8 @@ dependencies = [ "log", "multimap", "petgraph", - "prost 0.11.0", - "prost-types 0.11.1", + "prost", + "prost-types", "regex", "tempfile", "which", @@ -5871,30 +5791,17 @@ dependencies = [ [[package]] name = "prost-codec" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00af1e92c33b4813cc79fda3f2dbf56af5169709be0202df730e9ebc3e4cd007" +checksum = "011ae9ff8359df7915f97302d591cdd9e0e27fbd5a4ddc5bd13b71079bb20987" dependencies = [ "asynchronous-codec", "bytes", - "prost 0.10.4", + "prost", "thiserror", "unsigned-varint", ] -[[package]] -name = "prost-derive" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "prost-derive" version = "0.11.0" @@ -5908,16 +5815,6 @@ dependencies = [ "syn", ] -[[package]] -name = "prost-types" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" -dependencies = [ - "bytes", - "prost 0.10.4", -] - [[package]] name = "prost-types" version = "0.11.1" @@ -5925,7 +5822,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dfaa718ad76a44b3415e6c4d53b17c8f99160dcb3a99b10470fce8ad43f6e3e" dependencies = [ "bytes", - "prost 0.11.0", + "prost", ] [[package]] @@ -6127,18 +6024,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13bcd201494ab44900a96490291651d200730904221832b9547d24a87d332b" +checksum = "12a733f1746c929b4913fe48f8697fcf9c55e3304ba251a79ffb41adfeaf49c2" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5234cd6063258a5e32903b53b1b6ac043a0541c8adc1f610f67b0326c7a578fa" +checksum = "5887de4a01acafd221861463be6113e6e87275e79804e56779f4cdc131c60368" dependencies = [ "proc-macro2", "quote", @@ -6308,9 +6205,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620f4129485ff1a7128d184bc687470c21c7951b64779ebc9cfdad3dcd920290" +checksum = "7e9562ea1d70c0cc63a34a22d977753b50cca91cc6b6527750463bd5dd8697bc" dependencies = [ "libc", "librocksdb-sys", @@ -6399,14 +6296,14 @@ dependencies = [ "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "rustls" -version = "0.20.6" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" +checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" dependencies = [ "log", "ring", @@ -6488,7 +6385,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "log", "sp-core", @@ -6499,7 +6396,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "futures", "futures-timer", @@ -6522,7 +6419,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6538,7 +6435,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "impl-trait-for-tuples", "memmap2", @@ -6555,7 +6452,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6566,11 +6463,11 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "array-bytes", "chrono", - "clap", + "clap 4.0.17", "fdlimit", "futures", "libp2p", @@ -6606,7 +6503,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "fnv", "futures", @@ -6634,7 +6531,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "hash-db", "kvdb", @@ -6659,7 +6556,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "async-trait", "futures", @@ -6683,7 +6580,7 @@ dependencies = [ [[package]] name = "sc-consensus-pow" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "async-trait", "futures", @@ -6708,10 +6605,10 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "lazy_static", - "lru", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", @@ -6735,7 +6632,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "environmental", "parity-scale-codec", @@ -6751,7 +6648,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "log", "parity-scale-codec", @@ -6766,7 +6663,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "cfg-if", "libc", @@ -6786,7 +6683,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "ansi_term", "futures", @@ -6803,7 +6700,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "array-bytes", "async-trait", @@ -6818,7 +6715,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "array-bytes", "async-trait", @@ -6836,11 +6733,11 @@ dependencies = [ "linked-hash-map", "linked_hash_set", "log", - "lru", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", - "prost 0.10.4", + "prost", "rand 0.7.3", "sc-block-builder", "sc-client-api", @@ -6865,14 +6762,14 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "cid", "futures", "libp2p", "log", - "prost 0.11.0", - "prost-build 0.11.1", + "prost", + "prost-build", "sc-client-api", "sc-network-common", "sp-blockchain", @@ -6885,7 +6782,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "async-trait", "bitflags", @@ -6895,7 +6792,7 @@ dependencies = [ "libp2p", "linked_hash_set", "parity-scale-codec", - "prost-build 0.10.4", + "prost-build", "sc-consensus", "sc-peerset", "serde", @@ -6911,15 +6808,15 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "array-bytes", "futures", "libp2p", "log", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "sc-client-api", "sc-network-common", "sc-peerset", @@ -6932,21 +6829,23 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "array-bytes", "fork-tree", "futures", "libp2p", "log", - "lru", + "lru 0.7.8", + "mockall", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "sc-client-api", "sc-consensus", "sc-network-common", "sc-peerset", + "sc-utils", "smallvec", "sp-arithmetic", "sp-blockchain", @@ -6960,7 +6859,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "array-bytes", "futures", @@ -6979,7 +6878,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "array-bytes", "bytes", @@ -7009,7 +6908,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "futures", "libp2p", @@ -7022,7 +6921,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -7031,7 +6930,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "futures", "hash-db", @@ -7061,7 +6960,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "futures", "jsonrpsee", @@ -7084,7 +6983,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "futures", "jsonrpsee", @@ -7094,10 +6993,29 @@ dependencies = [ "tokio", ] +[[package]] +name = "sc-rpc-spec-v2" +version = "0.10.0-dev" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" +dependencies = [ + "futures", + "hex", + "jsonrpsee", + "parity-scale-codec", + "sc-chain-spec", + "sc-transaction-pool-api", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-runtime", + "thiserror", +] + [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "async-trait", "directories", @@ -7129,6 +7047,7 @@ dependencies = [ "sc-offchain", "sc-rpc", "sc-rpc-server", + "sc-rpc-spec-v2", "sc-sysinfo", "sc-telemetry", "sc-tracing", @@ -7167,7 +7086,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "log", "parity-scale-codec", @@ -7181,7 +7100,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "futures", "libc", @@ -7200,7 +7119,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "chrono", "futures", @@ -7218,7 +7137,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "ansi_term", "atty", @@ -7249,7 +7168,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7260,8 +7179,9 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ + "async-trait", "futures", "futures-timer", "linked-hash-map", @@ -7286,8 +7206,9 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ + "async-trait", "futures", "log", "serde", @@ -7299,7 +7220,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "futures", "futures-timer", @@ -7342,7 +7263,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -7369,6 +7290,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "scrypt" version = "0.8.1" @@ -7417,9 +7344,9 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7058dc8eaf3f2810d7828680320acda0b25a288f6d288e19278e249bbf74226b" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ "cc", ] @@ -7547,12 +7474,11 @@ dependencies = [ name = "serai-node" version = "0.1.0" dependencies = [ - "clap", + "clap 4.0.17", "frame-benchmarking", "frame-benchmarking-cli", "frame-system", "jsonrpsee", - "pallet-contracts-rpc", "pallet-transaction-payment", "pallet-transaction-payment-rpc", "sc-cli", @@ -7585,20 +7511,17 @@ name = "serai-processor" version = "0.1.0" dependencies = [ "async-trait", - "blake2", "curve25519-dalek 3.2.0", "dalek-ff-group", "flexible-transcript", "futures", "group", "hex", - "k256", "modular-frost", "monero-serai", "rand_core 0.6.4", "serde", "serde_json", - "sha3 0.10.5", "thiserror", "tokio", ] @@ -7617,7 +7540,6 @@ dependencies = [ "pallet-balances", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-randomness-collective-flip", "pallet-timestamp", "pallet-transaction-payment", @@ -7669,11 +7591,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ - "itoa 1.0.3", + "itoa", "ryu", "serde", ] @@ -7694,7 +7616,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.3", + "itoa", "ryu", "serde", ] @@ -7761,21 +7683,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.9.1" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha3" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2904bea16a1ae962b483322a1c7b81d976029203aea1f461e51cd7705db7ba9" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ "digest 0.10.5", "keccak", @@ -7817,9 +7727,9 @@ dependencies = [ [[package]] name = "signature" -version = "1.6.3" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb766570a2825fa972bceff0d195727876a9cdf2460ab2e52d455dc2de47fd9" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ "digest 0.10.5", "rand_core 0.6.4", @@ -7860,9 +7770,9 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "smallvec" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snap" @@ -7929,7 +7839,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "hash-db", "log", @@ -7947,7 +7857,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "blake2", "proc-macro-crate", @@ -7959,7 +7869,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", "scale-info", @@ -7972,7 +7882,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "integer-sqrt", "num-traits", @@ -7987,7 +7897,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", "sp-api", @@ -7999,11 +7909,11 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "futures", "log", - "lru", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "sp-api", @@ -8017,7 +7927,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "async-trait", "futures", @@ -8036,7 +7946,7 @@ dependencies = [ [[package]] name = "sp-consensus-pow" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", "sp-api", @@ -8048,7 +7958,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "array-bytes", "base58 0.2.0", @@ -8060,7 +7970,7 @@ dependencies = [ "futures", "hash-db", "hash256-std-hasher", - "impl-serde", + "impl-serde 0.4.0", "lazy_static", "libsecp256k1", "log", @@ -8069,7 +7979,7 @@ dependencies = [ "parity-scale-codec", "parity-util-mem", "parking_lot 0.12.1", - "primitive-types", + "primitive-types 0.12.0", "rand 0.7.3", "regex", "scale-info", @@ -8094,13 +8004,13 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "blake2", "byteorder", "digest 0.10.5", "sha2 0.10.6", - "sha3 0.10.5", + "sha3", "sp-std", "twox-hash", ] @@ -8108,7 +8018,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "proc-macro2", "quote", @@ -8119,7 +8029,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -8128,7 +8038,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "proc-macro2", "quote", @@ -8138,7 +8048,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "environmental", "parity-scale-codec", @@ -8149,7 +8059,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "finality-grandpa", "log", @@ -8167,7 +8077,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -8181,7 +8091,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "bytes", "futures", @@ -8207,7 +8117,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "lazy_static", "sp-core", @@ -8218,7 +8128,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "async-trait", "futures", @@ -8235,7 +8145,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "thiserror", "zstd", @@ -8244,7 +8154,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "sp-api", "sp-core", @@ -8254,7 +8164,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "backtrace", "lazy_static", @@ -8264,7 +8174,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "rustc-hash", "serde", @@ -8274,7 +8184,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "either", "hash256-std-hasher", @@ -8297,12 +8207,12 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", - "primitive-types", + "primitive-types 0.12.0", "sp-externalities", "sp-runtime-interface-proc-macro", "sp-std", @@ -8315,7 +8225,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "Inflector", "proc-macro-crate", @@ -8327,7 +8237,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "log", "parity-scale-codec", @@ -8341,7 +8251,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", "scale-info", @@ -8355,7 +8265,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", "scale-info", @@ -8366,7 +8276,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "hash-db", "log", @@ -8388,14 +8298,14 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec", "ref-cast", "serde", @@ -8406,7 +8316,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "log", "sp-core", @@ -8419,7 +8329,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "async-trait", "futures-timer", @@ -8435,7 +8345,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", "sp-std", @@ -8447,7 +8357,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "sp-api", "sp-runtime", @@ -8456,7 +8366,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "async-trait", "log", @@ -8472,13 +8382,13 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "ahash", "hash-db", "hashbrown", "lazy_static", - "lru", + "lru 0.7.8", "memory-db", "nohash-hasher", "parity-scale-codec", @@ -8495,9 +8405,9 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec", "parity-wasm 0.45.0", "scale-info", @@ -8512,7 +8422,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8523,7 +8433,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "impl-trait-for-tuples", "log", @@ -8536,7 +8446,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8567,9 +8477,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.29.1" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4f0cb475a8e58d9ed8a963010108768d79e397f7aff79f9a3972ef490f97de" +checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" dependencies = [ "Inflector", "num-format", @@ -8690,7 +8600,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "platforms", ] @@ -8698,7 +8608,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -8719,7 +8629,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "futures-util", "hyper", @@ -8732,7 +8642,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#201ce645a742f02d79bfe6ac7d783b1dfe043ab1" +source = "git+https://github.com/serai-dex/substrate#176b4e8cfc110f339d88ebd414602bc3833da3c3" dependencies = [ "ansi_term", "build-helper", @@ -8760,7 +8670,7 @@ checksum = "4e4cdcf91153dc0e4e0637f26f042ada32a3b552bc8115935c7bf96f80132b0a" dependencies = [ "anyhow", "cfg-if", - "clap", + "clap 3.2.22", "console 0.14.1", "dialoguer", "fs2", @@ -8785,9 +8695,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.101" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2" +checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1" dependencies = [ "proc-macro2", "quote", @@ -8892,6 +8802,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "termtree" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" + [[package]] name = "textwrap" version = "0.15.1" @@ -8944,9 +8860,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.4.3+5.2.1-patched.2" +version = "0.5.2+5.3.0-patched" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49" +checksum = "ec45c14da997d0925c7835883e4d5c181f196fa142f8c19d7643d1e9af2592c3" dependencies = [ "cc", "fs_extra", @@ -8966,11 +8882,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b" +checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c" dependencies = [ - "itoa 1.0.3", + "itoa", "libc", "num_threads", "time-macros", @@ -9079,9 +8995,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6edf2d6bc038a43d31353570e27270603f4648d18f5ed10c0e179abe43255af" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" dependencies = [ "futures-core", "pin-project-lite 0.2.9", @@ -9120,9 +9036,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.36" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "pin-project-lite 0.2.9", @@ -9132,9 +9048,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", @@ -9143,9 +9059,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ "once_cell", "valuable", @@ -9229,9 +9145,9 @@ dependencies = [ [[package]] name = "trust-dns-proto" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" +checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" dependencies = [ "async-trait", "cfg-if", @@ -9243,30 +9159,30 @@ dependencies = [ "idna 0.2.3", "ipnet", "lazy_static", - "log", "rand 0.8.5", "smallvec", "thiserror", "tinyvec", + "tracing", "url", ] [[package]] name = "trust-dns-resolver" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" +checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" dependencies = [ "cfg-if", "futures-util", "ipconfig", "lazy_static", - "log", "lru-cache", "parking_lot 0.12.1", "resolv-conf", "smallvec", "thiserror", + "tracing", "trust-dns-proto", ] @@ -9335,9 +9251,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unicode-normalization" @@ -9656,7 +9572,7 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -9684,7 +9600,7 @@ dependencies = [ "serde", "sha2 0.9.9", "toml", - "windows-sys", + "windows-sys 0.36.1", "zstd", ] @@ -9750,7 +9666,7 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit-debug", "wasmtime-runtime", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -9786,7 +9702,7 @@ dependencies = [ "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -9913,6 +9829,27 @@ dependencies = [ "windows_x86_64_msvc 0.36.1", ] +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" version = "0.34.0" @@ -9925,6 +9862,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + [[package]] name = "windows_i686_gnu" version = "0.34.0" @@ -9937,6 +9880,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + [[package]] name = "windows_i686_msvc" version = "0.34.0" @@ -9949,6 +9898,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + [[package]] name = "windows_x86_64_gnu" version = "0.34.0" @@ -9961,6 +9916,18 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + [[package]] name = "windows_x86_64_msvc" version = "0.34.0" @@ -9973,6 +9940,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "winreg" version = "0.7.0" @@ -10066,8 +10039,9 @@ dependencies = [ [[package]] name = "zip" -version = "0.6.2" -source = "git+https://github.com/zip-rs/zip?rev=bb230ef56adc13436d1fcdfaa489249d119c498f#bb230ef56adc13436d1fcdfaa489249d119c498f" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537ce7411d25e54e8ae21a7ce0b15840e7bfcff15b51d697ec3266cc76bdf080" dependencies = [ "aes", "byteorder", @@ -10079,7 +10053,7 @@ dependencies = [ "hmac 0.12.1", "pbkdf2 0.11.0", "sha1", - "time 0.3.14", + "time 0.3.15", "zstd", ] diff --git a/Cargo.toml b/Cargo.toml index 0f4e16f1..c5721b0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,3 @@ monero-serai = { opt-level = 3 } [profile.release] panic = "unwind" - -[patch.crates-io] -zip = { version = "0.6.2", git = "https://github.com/zip-rs/zip", rev = "bb230ef56adc13436d1fcdfaa489249d119c498f" } diff --git a/coins/ethereum/Cargo.toml b/coins/ethereum/Cargo.toml index 217b9f18..25ca79b0 100644 --- a/coins/ethereum/Cargo.toml +++ b/coins/ethereum/Cargo.toml @@ -3,8 +3,14 @@ name = "ethereum-serai" version = "0.1.0" description = "An Ethereum library supporting Schnorr signing and on-chain verification" license = "AGPL-3.0-only" +repository = "https://github.com/serai-dex/serai/tree/develop/coins/ethereum" authors = ["Luke Parker ", "Elizabeth Binks "] edition = "2021" +publish = false + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] [dependencies] hex-literal = "0.3" @@ -24,8 +30,8 @@ eyre = "0.6" ethers = { version = "0.14", features = ["abigen", "ethers-solc"] } -[dev-dependencies] -tokio = { version = "1", features = ["macros"] } - [build-dependencies] ethers-solc = "0.14" + +[dev-dependencies] +tokio = { version = "1", features = ["macros"] } diff --git a/coins/monero/Cargo.toml b/coins/monero/Cargo.toml index 001de963..ccc1d5de 100644 --- a/coins/monero/Cargo.toml +++ b/coins/monero/Cargo.toml @@ -3,7 +3,7 @@ name = "monero-serai" version = "0.1.1-alpha" description = "A modern Monero transaction library" license = "MIT" -repository = "https://github.com/serai-dex/serai" +repository = "https://github.com/serai-dex/serai/tree/develop/coins/monero" authors = ["Luke Parker "] edition = "2021" @@ -48,12 +48,14 @@ monero-epee-bin-serde = "1.0" reqwest = { version = "0.11", features = ["json"] } -[features] -multisig = ["rand_chacha", "blake2", "transcript", "frost", "dleq"] - [build-dependencies] dalek-ff-group = { path = "../../crypto/dalek-ff-group", version = "0.1" } monero-generators = { path = "generators", version = "0.1" } [dev-dependencies] tokio = { version = "1", features = ["full"] } + +frost = { package = "modular-frost", path = "../../crypto/frost", version = "0.2", features = ["ed25519", "tests"] } + +[features] +multisig = ["rand_chacha", "blake2", "transcript", "frost", "dleq"] diff --git a/coins/monero/generators/Cargo.toml b/coins/monero/generators/Cargo.toml index 9e286dc9..0f626f17 100644 --- a/coins/monero/generators/Cargo.toml +++ b/coins/monero/generators/Cargo.toml @@ -3,7 +3,7 @@ name = "monero-generators" version = "0.1.1" description = "Monero's hash_to_point and generators" license = "MIT" -repository = "https://github.com/serai-dex/serai" +repository = "https://github.com/serai-dex/serai/tree/develop/coins/monero/generators" authors = ["Luke Parker "] edition = "2021" diff --git a/coins/monero/src/rpc.rs b/coins/monero/src/rpc.rs index 21c8488d..af80a581 100644 --- a/coins/monero/src/rpc.rs +++ b/coins/monero/src/rpc.rs @@ -23,12 +23,28 @@ pub struct JsonRpcResponse { result: T, } +#[derive(Deserialize, Debug)] +struct TransactionResponse { + tx_hash: String, + block_height: usize, + as_hex: String, + pruned_as_hex: String, +} +#[derive(Deserialize, Debug)] +struct TransactionsResponse { + #[serde(default)] + missed_tx: Vec, + txs: Vec, +} + #[derive(Clone, Error, Debug)] pub enum RpcError { #[error("internal error ({0})")] InternalError(String), #[error("connection error")] ConnectionError, + #[error("invalid node")] + InvalidNode, #[error("transactions not found")] TransactionsNotFound(Vec<[u8; 32]>), #[error("invalid point ({0})")] @@ -40,7 +56,11 @@ pub enum RpcError { } fn rpc_hex(value: &str) -> Result, RpcError> { - hex::decode(value).map_err(|_| RpcError::InternalError("Monero returned invalid hex".to_string())) + hex::decode(value).map_err(|_| RpcError::InvalidNode) +} + +fn hash_hex(hash: &str) -> Result<[u8; 32], RpcError> { + rpc_hex(hash)?.try_into().map_err(|_| RpcError::InvalidNode) } fn rpc_point(point: &str) -> Result { @@ -149,19 +169,6 @@ impl Rpc { return Ok(vec![]); } - #[derive(Deserialize, Debug)] - struct TransactionResponse { - tx_hash: String, - as_hex: String, - pruned_as_hex: String, - } - #[derive(Deserialize, Debug)] - struct TransactionsResponse { - #[serde(default)] - missed_tx: Vec, - txs: Vec, - } - let txs: TransactionsResponse = self .rpc_call( "get_transactions", @@ -173,7 +180,7 @@ impl Rpc { if !txs.missed_tx.is_empty() { Err(RpcError::TransactionsNotFound( - txs.missed_tx.iter().map(|hash| hex::decode(hash).unwrap().try_into().unwrap()).collect(), + txs.missed_tx.iter().map(|hash| hash_hex(hash)).collect::>()?, ))?; } @@ -181,11 +188,12 @@ impl Rpc { .txs .iter() .map(|res| { - let tx = Transaction::deserialize(&mut std::io::Cursor::new( - rpc_hex(if !res.as_hex.is_empty() { &res.as_hex } else { &res.pruned_as_hex }).unwrap(), - )) - .map_err(|_| { - RpcError::InvalidTransaction(hex::decode(&res.tx_hash).unwrap().try_into().unwrap()) + let tx = Transaction::deserialize(&mut std::io::Cursor::new(rpc_hex( + if !res.as_hex.is_empty() { &res.as_hex } else { &res.pruned_as_hex }, + )?)) + .map_err(|_| match hash_hex(&res.tx_hash) { + Ok(hash) => RpcError::InvalidTransaction(hash), + Err(err) => err, })?; // https://github.com/monero-project/monero/issues/8311 @@ -205,6 +213,19 @@ impl Rpc { self.get_transactions(&[tx]).await.map(|mut txs| txs.swap_remove(0)) } + pub async fn get_transaction_block_number(&self, tx: &[u8]) -> Result { + let txs: TransactionsResponse = + self.rpc_call("get_transactions", Some(json!({ "txs_hashes": [hex::encode(tx)] }))).await?; + + if !txs.missed_tx.is_empty() { + Err(RpcError::TransactionsNotFound( + txs.missed_tx.iter().map(|hash| hash_hex(hash)).collect::>()?, + ))?; + } + + Ok(txs.txs[0].block_height) + } + pub async fn get_block(&self, height: usize) -> Result { #[derive(Deserialize, Debug)] struct BlockResponse { diff --git a/contracts/extension/Cargo.toml b/contracts/extension/Cargo.toml index 4d717cdf..9272659e 100644 --- a/contracts/extension/Cargo.toml +++ b/contracts/extension/Cargo.toml @@ -3,10 +3,15 @@ name = "serai-extension" version = "0.1.0" description = "An ink! extension for exposing Serai to ink" license = "AGPL-3.0-only" +repository = "https://github.com/serai-dex/serai/tree/develop/contracts/extension" authors = ["Luke Parker "] edition = "2021" publish = false +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + [dependencies] scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } diff --git a/contracts/multisig/Cargo.toml b/contracts/multisig/Cargo.toml index 2b2e3565..6fb4d08b 100644 --- a/contracts/multisig/Cargo.toml +++ b/contracts/multisig/Cargo.toml @@ -3,10 +3,20 @@ name = "serai-multisig" version = "0.1.0" description = "An ink! tracker for Serai's current multisig" license = "AGPL-3.0-only" +repository = "https://github.com/serai-dex/serai/tree/develop/contracts/multisig" authors = ["Luke Parker "] edition = "2021" publish = false +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[lib] +name = "serai_multisig" +path = "lib.rs" +crate-type = ["cdylib"] + [dependencies] scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } @@ -22,11 +32,6 @@ serai-extension = { path = "../extension", default-features = false } [dev-dependencies] lazy_static = "1" -[lib] -name = "serai_multisig" -path = "lib.rs" -crate-type = ["cdylib"] - [features] default = ["std"] std = [ diff --git a/crypto/dalek-ff-group/Cargo.toml b/crypto/dalek-ff-group/Cargo.toml index a1dd4720..df22f767 100644 --- a/crypto/dalek-ff-group/Cargo.toml +++ b/crypto/dalek-ff-group/Cargo.toml @@ -3,7 +3,7 @@ name = "dalek-ff-group" version = "0.1.5" description = "ff/group bindings around curve25519-dalek" license = "MIT" -repository = "https://github.com/serai-dex/serai" +repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dalek-ff-group" authors = ["Luke Parker "] keywords = ["curve25519", "ed25519", "ristretto", "dalek", "group"] edition = "2021" diff --git a/crypto/dleq/Cargo.toml b/crypto/dleq/Cargo.toml index 4f66bf2e..99a0fa47 100644 --- a/crypto/dleq/Cargo.toml +++ b/crypto/dleq/Cargo.toml @@ -3,7 +3,7 @@ name = "dleq" version = "0.1.1" description = "Implementation of single and cross-curve Discrete Log Equality proofs" license = "MIT" -repository = "https://github.com/serai-dex/serai" +repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dleq" authors = ["Luke Parker "] edition = "2021" diff --git a/crypto/ed448/Cargo.toml b/crypto/ed448/Cargo.toml index 95b25849..c7be3f75 100644 --- a/crypto/ed448/Cargo.toml +++ b/crypto/ed448/Cargo.toml @@ -3,7 +3,7 @@ name = "minimal-ed448" version = "0.1.1" description = "Unaudited, inefficient implementation of Ed448 in Rust" license = "MIT" -repository = "https://github.com/serai-dex/serai" +repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ed448" authors = ["Luke Parker "] keywords = ["ed448", "ff", "group"] edition = "2021" diff --git a/crypto/frost/Cargo.toml b/crypto/frost/Cargo.toml index 0d816030..452ea429 100644 --- a/crypto/frost/Cargo.toml +++ b/crypto/frost/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "modular-frost" -version = "0.2.3" +version = "0.2.4" description = "Modular implementation of FROST over ff/group" license = "MIT" -repository = "https://github.com/serai-dex/serai" +repository = "https://github.com/serai-dex/serai/tree/develop/crypto/frost" authors = ["Luke Parker "] keywords = ["frost", "multisig", "threshold"] edition = "2021" @@ -18,6 +18,7 @@ thiserror = "1" rand_core = "0.6" zeroize = { version = "1.5", features = ["zeroize_derive"] } +subtle = "2" hex = "0.4" @@ -44,6 +45,7 @@ dleq = { path = "../dleq", version = "0.1", features = ["serialize"] } [dev-dependencies] sha2 = "0.10" dalek-ff-group = { path = "../dalek-ff-group", version = "^0.1.2" } +serde_json = "1" [features] dalek = ["sha2", "dalek-ff-group"] @@ -55,3 +57,5 @@ p256 = ["kp256", "dep:p256"] secp256k1 = ["kp256", "k256"] ed448 = ["sha3", "minimal-ed448"] + +tests = [] diff --git a/crypto/frost/src/curve/dalek.rs b/crypto/frost/src/curve/dalek.rs index f6b94b77..8db03bd0 100644 --- a/crypto/frost/src/curve/dalek.rs +++ b/crypto/frost/src/curve/dalek.rs @@ -74,7 +74,7 @@ dalek_curve!( IetfRistrettoHram, RistrettoPoint, b"ristretto", - b"FROST-RISTRETTO255-SHA512-v10", + b"FROST-RISTRETTO255-SHA512-v11", b"chal", ); @@ -85,6 +85,6 @@ dalek_curve!( IetfEd25519Hram, EdwardsPoint, b"edwards25519", - b"FROST-ED25519-SHA512-v10", + b"FROST-ED25519-SHA512-v11", b"", ); diff --git a/crypto/frost/src/curve/ed448.rs b/crypto/frost/src/curve/ed448.rs index 373c24a3..b3ae8550 100644 --- a/crypto/frost/src/curve/ed448.rs +++ b/crypto/frost/src/curve/ed448.rs @@ -7,7 +7,7 @@ use minimal_ed448::{scalar::Scalar, point::Point}; use crate::{curve::Curve, algorithm::Hram}; -const CONTEXT: &[u8] = b"FROST-ED448-SHAKE256-v10"; +const CONTEXT: &[u8] = b"FROST-ED448-SHAKE256-v11"; #[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)] pub struct Ed448; @@ -53,8 +53,8 @@ impl Ietf8032Ed448Hram { } #[derive(Copy, Clone)] -pub struct NonIetfEd448Hram; -impl Hram for NonIetfEd448Hram { +pub struct IetfEd448Hram; +impl Hram for IetfEd448Hram { #[allow(non_snake_case)] fn hram(R: &Point, A: &Point, m: &[u8]) -> Scalar { Ietf8032Ed448Hram::hram(&[], R, A, m) diff --git a/crypto/frost/src/curve/kp256.rs b/crypto/frost/src/curve/kp256.rs index b9d1a820..a7d65beb 100644 --- a/crypto/frost/src/curve/kp256.rs +++ b/crypto/frost/src/curve/kp256.rs @@ -92,7 +92,7 @@ macro_rules! kp_curve { } #[cfg(feature = "p256")] -kp_curve!("p256", p256, P256, IetfP256Hram, b"P-256", b"FROST-P256-SHA256-v10"); +kp_curve!("p256", p256, P256, IetfP256Hram, b"P-256", b"FROST-P256-SHA256-v11"); #[cfg(feature = "secp256k1")] kp_curve!( @@ -101,5 +101,5 @@ kp_curve!( Secp256k1, IetfSecp256k1Hram, b"secp256k1", - b"FROST-secp256k1-SHA256-v10" + b"FROST-secp256k1-SHA256-v11" ); diff --git a/crypto/frost/src/curve/mod.rs b/crypto/frost/src/curve/mod.rs index a12edea9..b8365d30 100644 --- a/crypto/frost/src/curve/mod.rs +++ b/crypto/frost/src/curve/mod.rs @@ -6,8 +6,9 @@ use thiserror::Error; use rand_core::{RngCore, CryptoRng}; use zeroize::Zeroize; +use subtle::ConstantTimeEq; -use ff::{PrimeField, PrimeFieldBits}; +use ff::{Field, PrimeField, PrimeFieldBits}; use group::{Group, GroupOps, GroupEncoding, prime::PrimeGroup}; #[cfg(any(test, feature = "dalek"))] @@ -27,7 +28,7 @@ pub use kp256::{P256, IetfP256Hram}; #[cfg(feature = "ed448")] mod ed448; #[cfg(feature = "ed448")] -pub use ed448::{Ed448, Ietf8032Ed448Hram, NonIetfEd448Hram}; +pub use ed448::{Ed448, Ietf8032Ed448Hram, IetfEd448Hram}; /// Set of errors for curve-related operations, namely encoding and decoding. #[derive(Clone, Error, Debug)] @@ -49,7 +50,7 @@ pub trait Curve: Clone + Copy + PartialEq + Eq + Debug + Zeroize { // This is available via G::Scalar yet `C::G::Scalar` is ambiguous, forcing horrific accesses type F: PrimeField + PrimeFieldBits + Zeroize; /// Group element type. - type G: Group + GroupOps + PrimeGroup + Zeroize; + type G: Group + GroupOps + PrimeGroup + Zeroize + ConstantTimeEq; /// ID for this curve. const ID: &'static [u8]; @@ -81,6 +82,16 @@ pub trait Curve: Clone + Copy + PartialEq + Eq + Debug + Zeroize { Self::hash_to_F(b"rho", binding) } + #[allow(non_snake_case)] + fn random_F(rng: &mut R) -> Self::F { + let mut res; + while { + res = Self::F::random(&mut *rng); + res.ct_eq(&Self::F::zero()).into() + } {} + res + } + /// Securely generate a random nonce. H3 from the IETF draft. fn random_nonce(mut secret: Self::F, rng: &mut R) -> Self::F { let mut seed = vec![0; 32]; @@ -89,12 +100,18 @@ pub trait Curve: Clone + Copy + PartialEq + Eq + Debug + Zeroize { let mut repr = secret.to_repr(); secret.zeroize(); - seed.extend(repr.as_ref()); + let mut res; + while { + seed.extend(repr.as_ref()); + res = Self::hash_to_F(b"nonce", &seed); + res.ct_eq(&Self::F::zero()).into() + } { + rng.fill_bytes(&mut seed); + } + for i in repr.as_mut() { i.zeroize(); } - - let res = Self::hash_to_F(b"nonce", &seed); seed.zeroize(); res } diff --git a/crypto/frost/src/key_gen.rs b/crypto/frost/src/key_gen.rs index 2cbb00f9..4a9571d7 100644 --- a/crypto/frost/src/key_gen.rs +++ b/crypto/frost/src/key_gen.rs @@ -48,7 +48,7 @@ fn generate_key_r1( for i in 0 .. t { // Step 1: Generate t random values to form a polynomial with - coefficients.push(C::F::random(&mut *rng)); + coefficients.push(C::random_F(&mut *rng)); // Step 3: Generate public commitments commitments.push(C::generator() * coefficients[i]); // Serialize them for publication @@ -56,7 +56,7 @@ fn generate_key_r1( } // Step 2: Provide a proof of knowledge - let mut r = C::F::random(rng); + let mut r = C::random_F(rng); serialized.extend( schnorr::sign::( coefficients[0], diff --git a/crypto/frost/src/lib.rs b/crypto/frost/src/lib.rs index 636f8315..7c6e3753 100644 --- a/crypto/frost/src/lib.rs +++ b/crypto/frost/src/lib.rs @@ -42,6 +42,7 @@ pub mod algorithm; pub mod sign; /// Tests for application-provided curves and algorithms. +#[cfg(any(test, feature = "tests"))] pub mod tests; // Validate a map of serialized values to have the expected included participants @@ -215,6 +216,7 @@ impl FrostCore { self.params } + #[cfg(any(test, feature = "tests"))] pub(crate) fn secret_share(&self) -> C::F { self.secret_share } diff --git a/crypto/frost/src/sign.rs b/crypto/frost/src/sign.rs index e0efc822..a863a76a 100644 --- a/crypto/frost/src/sign.rs +++ b/crypto/frost/src/sign.rs @@ -7,6 +7,7 @@ use std::{ use rand_core::{RngCore, CryptoRng}; use zeroize::{Zeroize, ZeroizeOnDrop}; +use subtle::ConstantTimeEq; use transcript::Transcript; @@ -97,8 +98,6 @@ impl Drop for PreprocessPackage { } impl ZeroizeOnDrop for PreprocessPackage {} -// This library unifies the preprocessing step with signing due to security concerns and to provide -// a simpler UX fn preprocess>( rng: &mut R, params: &mut Params, @@ -202,14 +201,20 @@ fn sign_with_share>( // consistency. While this is suboptimal, it maintains IETF compliance, and Algorithm is // documented accordingly let transcript = |t: &mut A::Transcript, commitments: [C::G; 2]| { + if commitments[0].ct_eq(&C::G::identity()).into() || + commitments[1].ct_eq(&C::G::identity()).into() + { + Err(FrostError::InvalidCommitment(*l))?; + } t.append_message(b"commitment_D", commitments[0].to_bytes().as_ref()); t.append_message(b"commitment_E", commitments[1].to_bytes().as_ref()); + Ok(()) }; if *l == params.keys.params().i { for nonce_commitments in &our_preprocess.commitments { for commitments in nonce_commitments { - transcript(params.algorithm.transcript(), *commitments); + transcript(params.algorithm.transcript(), *commitments).unwrap(); } } @@ -227,7 +232,7 @@ fn sign_with_share>( commitments.push(Vec::with_capacity(nonce_generators.len())); for _ in 0 .. nonce_generators.len() { commitments[n].push(read_D_E::<_, C>(&mut cursor, *l)?); - transcript(params.algorithm.transcript(), commitments[n][commitments[n].len() - 1]); + transcript(params.algorithm.transcript(), commitments[n][commitments[n].len() - 1])?; } if nonce_generators.len() >= 2 { @@ -426,6 +431,7 @@ impl> AlgorithmMachine { Ok(AlgorithmMachine { params: Params::new(algorithm, keys, included)? }) } + #[cfg(any(test, feature = "tests"))] pub(crate) fn unsafe_override_preprocess( self, preprocess: PreprocessPackage, diff --git a/crypto/frost/src/tests/curve.rs b/crypto/frost/src/tests/curve.rs index 078df28e..56265f85 100644 --- a/crypto/frost/src/tests/curve.rs +++ b/crypto/frost/src/tests/curve.rs @@ -2,7 +2,7 @@ use std::io::Cursor; use rand_core::{RngCore, CryptoRng}; -use group::{ff::Field, Group}; +use group::Group; use crate::{Curve, FrostCore, tests::core_gen}; @@ -27,7 +27,7 @@ pub fn test_multiexp(rng: &mut R) { let mut sum = C::G::identity(); for _ in 0 .. 10 { for _ in 0 .. 100 { - pairs.push((C::F::random(&mut *rng), C::generator() * C::F::random(&mut *rng))); + pairs.push((C::random_F(&mut *rng), C::generator() * C::random_F(&mut *rng))); sum += pairs[pairs.len() - 1].1 * pairs[pairs.len() - 1].0; } assert_eq!(multiexp::multiexp(&pairs), sum); diff --git a/crypto/frost/src/tests/literal/dalek.rs b/crypto/frost/src/tests/literal/dalek.rs index b35e54e4..02cddec2 100644 --- a/crypto/frost/src/tests/literal/dalek.rs +++ b/crypto/frost/src/tests/literal/dalek.rs @@ -10,35 +10,12 @@ use crate::{ fn ristretto_vectors() { test_with_vectors::<_, curve::Ristretto, curve::IetfRistrettoHram>( &mut OsRng, - Vectors { - threshold: 2, - shares: &[ - "5c3430d391552f6e60ecdc093ff9f6f4488756aa6cebdbad75a768010b8f830e", - "b06fc5eac20b4f6e1b271d9df2343d843e1e1fb03c4cbb673f2872d459ce6f01", - "f17e505f0e2581c6acfe54d3846a622834b5e7b50cad9a2109a97ba7a80d5c04", - ], - group_secret: "1b25a55e463cfd15cf14a5d3acc3d15053f08da49c8afcf3ab265f2ebc4f970b", - group_key: "e2a62f39eede11269e3bd5a7d97554f5ca384f9f6d3dd9c3c0d05083c7254f57", - - msg: "74657374", - included: &[1, 3], - nonces: &[ - [ - "de3e8f526dcb51a1b9b48cc284aeca27c385aa3ba1a92a0c8440d51e1a1d2f00", - "fa8dca5ec7a05d5a7b782be847ba3dde1509de1dbcf0569fc980cff795db5404", - ], - [ - "e07061a9ab6735de9a75b0c64f086c5b999894611d0cdc03f85c4e87c8aae602", - "38b17578e8e6ad4077071ce6b0bf9cb85ac35fee7868dcb6d9bfa97f0e153e0e", - ], - ], - sig_shares: &[ - "a5f046916a6a111672111e47f9825586e1188da8a0f3b7c61f2b6b432c636e07", - "4c175c7e43bd197980c2021774036eb288f54179f079fbf21b7d2f9f52846401", - ], - sig: "94b11def3f919503c3544452ad2a59f198f64cc323bd758bb1c65b42032a7473".to_owned() + - "f107a30fae272b8ff2d3205e6d86c3386a0ecf21916db3b93ba89ae27ee7d208", - }, + Vectors::from( + serde_json::from_str::(include_str!( + "vectors/frost-ristretto255-sha512.json" + )) + .unwrap(), + ), ); } @@ -47,34 +24,9 @@ fn ristretto_vectors() { fn ed25519_vectors() { test_with_vectors::<_, curve::Ed25519, curve::IetfEd25519Hram>( &mut OsRng, - Vectors { - threshold: 2, - shares: &[ - "929dcc590407aae7d388761cddb0c0db6f5627aea8e217f4a033f2ec83d93509", - "a91e66e012e4364ac9aaa405fcafd370402d9859f7b6685c07eed76bf409e80d", - "d3cb090a075eb154e82fdb4b3cb507f110040905468bb9c46da8bdea643a9a02", - ], - group_secret: "7b1c33d3f5291d85de664833beb1ad469f7fb6025a0ec78b3a790c6e13a98304", - group_key: "15d21ccd7ee42959562fc8aa63224c8851fb3ec85a3faf66040d380fb9738673", - - msg: "74657374", - included: &[1, 3], - nonces: &[ - [ - "4e64f59e90a3b9cdce346fae68eb0e459532c8ca1ad59a566c3ee2c67bf0100b", - "470c660895c6db164ee6564120eec71023fa5297f09c663bb8171646c5632d00", - ], - [ - "6fc516495dbb364b807cdd0c2e5e3f58aa4914a53fed33cc340033979bb07304", - "0837e770a88147d41ff39138ca23b35d6cf303a4f148294755ede4b7e760d701", - ], - ], - sig_shares: &[ - "3f2eb12735e5b39da97e884a6caadf6bb83f1efcec709d6f66333d0d67ebe707", - "79e572b8632fbb928519dd2eff793de8784a56d582ae48c807d39b0dc5b93509", - ], - sig: "e31e69a4e10d5ca2307c4a0d12cd86e3fceee550e55cb5b3f47c7ad6dbb38884".to_owned() + - "cb3f2e837eb15cd858fb6dd68c2a3e3f318a74d16f1fe6376e06d91a2ca51d01", - }, + Vectors::from( + serde_json::from_str::(include_str!("vectors/frost-ed25519-sha512.json")) + .unwrap(), + ), ); } diff --git a/crypto/frost/src/tests/literal/ed448.rs b/crypto/frost/src/tests/literal/ed448.rs index 82e762b6..df0c9ee7 100644 --- a/crypto/frost/src/tests/literal/ed448.rs +++ b/crypto/frost/src/tests/literal/ed448.rs @@ -3,7 +3,7 @@ use std::io::Cursor; use rand_core::OsRng; use crate::{ - curve::{Curve, Ed448, Ietf8032Ed448Hram, NonIetfEd448Hram}, + curve::{Curve, Ed448, Ietf8032Ed448Hram, IetfEd448Hram}, schnorr::{SchnorrSignature, verify}, tests::vectors::{Vectors, test_with_vectors}, }; @@ -48,88 +48,12 @@ fn ed448_8032_vector() { } #[test] -fn ed448_non_ietf() { - test_with_vectors::<_, Ed448, NonIetfEd448Hram>( +fn ed448_vectors() { + test_with_vectors::<_, Ed448, IetfEd448Hram>( &mut OsRng, - Vectors { - threshold: 2, - shares: &[ - concat!( - "4a2b2f5858a932ad3d3b18bd16e76ced3070d72fd79ae4402df201f5", - "25e754716a1bc1b87a502297f2a99d89ea054e0018eb55d39562fd01", - "00" - ), - concat!( - "2503d56c4f516444a45b080182b8a2ebbe4d9b2ab509f25308c88c0e", - "a7ccdc44e2ef4fc4f63403a11b116372438a1e287265cadeff1fcb07", - "00" - ), - concat!( - "00db7a8146f995db0a7cf844ed89d8e94c2b5f259378ff66e39d1728", - "28b264185ac4decf7219e4aa4478285b9c0eef4fccdf3eea69dd980d", - "00" - ), - ], - group_secret: concat!( - "6298e1eef3c379392caaed061ed8a31033c9e9e3420726f23b404158", - "a401cd9df24632adfe6b418dc942d8a091817dd8bd70e1c72ba52f3c", - "00" - ), - group_key: concat!( - "3832f82fda00ff5365b0376df705675b63d2a93c24c6e81d40801ba2", - "65632be10f443f95968fadb70d10786827f30dc001c8d0f9b7c1d1b0", - "00" - ), - - msg: "74657374", - included: &[1, 3], - nonces: &[ - [ - concat!( - "06f2e15b05d29a50f0686a890259f4dcf66147a80809ed9e50926f5f", - "173fe23a0627561efa003724dc270effc47a30bc4d80aba30725401d", - "00" - ), - concat!( - "e0482e611c34f191d1c13a09bc8bbf4bda68db4de32aa7908849b02b", - "a912cfba46c805e2d8560ab9437e343e1dde6b481a2bae527e111b2c", - "00" - ), - ], - [ - concat!( - "295c56447c070157e6bc3c83ed2afca194569e07d0ad27d28a40dec2", - "c4107c07d507db20da1be62ea6976b8e53ab5d26e225c663f2e71511", - "00" - ), - concat!( - "b97303a6c5ab12b6ad310834361033a19d99dfdf93109da721da35c3", - "abbc5f29df33b3402692bef9f005bb8ea00af5ba20cc688360fd8831", - "00" - ), - ], - ], - sig_shares: &[ - concat!( - "5b65641e27007ec71509c6af5cf8527eb01fee5b2b07d8beecf6646e", - "b7e7e27d85119b74f895b56ba7561834a1b0c42639b122160a0b6208", - "00" - ), - concat!( - "821b7ac04d7c01d970b0b3ba4ae8f737a5bac934aed1600b1cad7601", - "1c240629bce6a4671a1b6f572cec708ec161a72a5ca04e50eabdfc25", - "00" - ), - ], - sig: concat!( - "c7ad7ad9fcfeef9d1492361ba641400bd3a3c8335a83cdffbdd8867d", - "2849bb4419dcc3e594baa731081a1a00cd3dea9219a81ecba4646e95", - "00", - "dd80dede747c7fa086b9796aa7e04ab655dab790d9d838ca08a4db6f", - "d30be9a641f83fdc12b124c3d34289c262126c5195517166f4c85e2e", - "00" - ) - .to_string(), - }, + Vectors::from( + serde_json::from_str::(include_str!("vectors/frost-ed448-shake256.json")) + .unwrap(), + ), ); } diff --git a/crypto/frost/src/tests/literal/kp256.rs b/crypto/frost/src/tests/literal/kp256.rs index b0b581d2..175039e4 100644 --- a/crypto/frost/src/tests/literal/kp256.rs +++ b/crypto/frost/src/tests/literal/kp256.rs @@ -13,35 +13,12 @@ use crate::curve::{P256, IetfP256Hram}; fn secp256k1_vectors() { test_with_vectors::<_, Secp256k1, IetfSecp256k1Hram>( &mut OsRng, - Vectors { - threshold: 2, - shares: &[ - "08f89ffe80ac94dcb920c26f3f46140bfc7f95b493f8310f5fc1ea2b01f4254c", - "04f0feac2edcedc6ce1253b7fab8c86b856a797f44d83d82a385554e6e401984", - "00e95d59dd0d46b0e303e500b62b7ccb0e555d49f5b849f5e748c071da8c0dbc", - ], - group_secret: "0d004150d27c3bf2a42f312683d35fac7394b1e9e318249c1bfe7f0795a83114", - group_key: "02f37c34b66ced1fb51c34a90bdae006901f10625cc06c4f64663b0eae87d87b4f", - - msg: "74657374", - included: &[1, 3], - nonces: &[ - [ - "36d5c4185c40b02b5e4673e2531a10e6ff9883840a68ec08dbeb896467e21355", - "7b3f573ca0a28f9f94522be4748df0ed04de8a83085aff4be7b01aa53fb6ac1b", - ], - [ - "ba4f8b8e587b2c9fc61a6156885f0bc67654b5e068c9e7749f75c09a98f17c13", - "316de06639051ac7869e5ac4458eda1fef90ce93fa3c490556c4192e4fa550d0", - ], - ], - sig_shares: &[ - "f9ee00d5ac0c746b751dde99f71d86f8f0300a81bd0336ca6649ef597239e13f", - "61048ca334ac6a6cb59d6b3ea2b25b7098e204adc09e2f88b024531b081d1d6f", - ], - sig: "023cf76388f92d403aa937af2e3cb3e7a2350e40400c16a282e330af2c60eeb85a".to_owned() + - "5af28d78e0b8ded82abb49d899cfe26ace633248ce58c617569be3e7aa20bd6d", - }, + Vectors::from( + serde_json::from_str::(include_str!( + "vectors/frost-secp256k1-sha256.json" + )) + .unwrap(), + ), ); } @@ -50,34 +27,9 @@ fn secp256k1_vectors() { fn p256_vectors() { test_with_vectors::<_, P256, IetfP256Hram>( &mut OsRng, - Vectors { - threshold: 2, - shares: &[ - "0c9c1a0fe806c184add50bbdcac913dda73e482daf95dcb9f35dbb0d8a9f7731", - "8d8e787bef0ff6c2f494ca45f4dad198c6bee01212d6c84067159c52e1863ad5", - "0e80d6e8f6192c003b5488ce1eec8f5429587d48cf001541e713b2d53c09d928", - ], - group_secret: "8ba9bba2e0fd8c4767154d35a0b7562244a4aaf6f36c8fb8735fa48b301bd8de", - group_key: "023a309ad94e9fe8a7ba45dfc58f38bf091959d3c99cfbd02b4dc00585ec45ab70", - - msg: "74657374", - included: &[1, 3], - nonces: &[ - [ - "9aa66350b0f72b27ce4668323b4280cd49709177ed8373977c22a75546c9995d", - "bd8b05d7fd0ff5a5ed65b1f105478f7718a981741fa8fa9b55ac6d3c8fc59a05", - ], - [ - "4c1aec8e84c496b80af98415fada2e6a4b1f902d4bc6c9682699b8aeffd97419", - "eeaf5ef7af01e55050fb8acafc9c9306ef1cc13214677ba33e7bc51e8677e892", - ], - ], - sig_shares: &[ - "ec5b8ab47d55903698492a07bb322ab6e7d3cf32581dcedf43c4fa18b46f3e10", - "c97da3580560e88725a8e393d46fee18ecd2e00148e5e303d4a510fae9c11da5", - ], - sig: "036b3eba585ff5d40df29893fb6f60572803aef97800cfaaaa5cf0f0f19d8237f7".to_owned() + - "b5d92e0d82b678bcbdf20d9b8fa218d017bfb485f9ec135e24b04050a1cd3664", - }, + Vectors::from( + serde_json::from_str::(include_str!("vectors/frost-p256-sha256.json")) + .unwrap(), + ), ); } diff --git a/crypto/frost/src/tests/literal/vectors/frost-ed25519-sha512.json b/crypto/frost/src/tests/literal/vectors/frost-ed25519-sha512.json new file mode 100644 index 00000000..b0ebb1dc --- /dev/null +++ b/crypto/frost/src/tests/literal/vectors/frost-ed25519-sha512.json @@ -0,0 +1,68 @@ +{ + "config": { + "MAX_PARTICIPANTS": "3", + "NUM_PARTICIPANTS": "2", + "MIN_PARTICIPANTS": "2", + "name": "FROST(Ed25519, SHA-512)", + "group": "ed25519", + "hash": "SHA-512" + }, + "inputs": { + "group_secret_key": "7b1c33d3f5291d85de664833beb1ad469f7fb6025a0ec78b3a790c6e13a98304", + "group_public_key": "15d21ccd7ee42959562fc8aa63224c8851fb3ec85a3faf66040d380fb9738673", + "message": "74657374", + "share_polynomial_coefficients": [ + "178199860edd8c62f5212ee91eff1295d0d670ab4ed4506866bae57e7030b204" + ], + "participants": { + "1": { + "participant_share": "929dcc590407aae7d388761cddb0c0db6f5627aea8e217f4a033f2ec83d93509" + }, + "2": { + "participant_share": "a91e66e012e4364ac9aaa405fcafd370402d9859f7b6685c07eed76bf409e80d" + }, + "3": { + "participant_share": "d3cb090a075eb154e82fdb4b3cb507f110040905468bb9c46da8bdea643a9a02" + } + } + }, + "round_one_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "hiding_nonce_randomness": "9d06a6381c7a4493929761a73692776772b274236fb5cfcc7d1b48ac3a9c249f", + "binding_nonce_randomness": "db184d7bc01a3417fe1f2eb3cf5479bb027145e6369a5f879f32d334ab256b23", + "hiding_nonce": "70652da3e8d7533a0e4b9e9104f01b48c396b5b553717784ed8d05c6a36b9609", + "binding_nonce": "4f9e1ad260b5c0e4fe0e0719c6324f89fecd053758f77c957f56967e634a710e", + "hiding_nonce_commitment": "44105304351ceddc58e15ddea35b2cb48e60ced54ceb22c3b0e5d42d098aa1d8", + "binding_nonce_commitment": "b8274b18a12f2cef74ae42f876cec1e31daab5cb162f95a56cd2487409c9d1dd", + "binding_factor_input": "c5b95020cba31a9035835f074f718d0c3af02a318d6b4723bbd1c088f4889dd7b9ff8e79f9a67a9d27605144259a7af18b7cca2539ffa5c4f1366a98645da8f4e077d604fff64f20e2377a37e5a10ce152194d62fe856ef4cd935d4f1cb0088c2083a2722ad3f5a84d778e257da0df2a7cadb004b1f5528352af778b94ee1c2a0100000000000000000000000000000000000000000000000000000000000000", + "binding_factor": "2d5630c36d33258b1208c4205fa759b762d09bfa06b29cf792cf98758c0b3305" + }, + "3": { + "hiding_nonce_randomness": "31ca9b07936d6b342a43d97f23b7bec5a5f5a09575a075393868dd8df5c05a54", + "binding_nonce_randomness": "c1db96a85d8b593e14fdb869c0955625478afa6a987ad217e7f2261dcab26819", + "hiding_nonce": "233adcb0ec0eddba5f1cc5268f3f4e6fc1dd97fb1e4a1754e6ddc92ed834ca0b", + "binding_nonce": "b59fc8a32fe02ec0a44c4671f3d1f82ea3924b7c7c0179398fc9137e82757803", + "hiding_nonce_commitment": "d31bd81ce216b1c83912803a574a0285796275cb8b14f6dc92c8b09a6951f0a2", + "binding_nonce_commitment": "e1c863cfd08df775b6747ef2456e9bf9a03cc281a479a95261dc39137fcf0967", + "binding_factor_input": "c5b95020cba31a9035835f074f718d0c3af02a318d6b4723bbd1c088f4889dd7b9ff8e79f9a67a9d27605144259a7af18b7cca2539ffa5c4f1366a98645da8f4e077d604fff64f20e2377a37e5a10ce152194d62fe856ef4cd935d4f1cb0088c2083a2722ad3f5a84d778e257da0df2a7cadb004b1f5528352af778b94ee1c2a0300000000000000000000000000000000000000000000000000000000000000", + "binding_factor": "1137be5cdf3d18e44367acee8485e9a66c3164077af80619b6291e3943bbef04" + } + } + }, + "round_two_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "sig_share": "c4b26af1e91fbc8440a0dad253e72620da624553c5b625fd51e6ea179fc09f05" + }, + "3": { + "sig_share": "9369640967d0cb98f4dedfde58a845e0e18e0a7164396358439060ed282b4e08" + } + } + }, + "final_output": { + "sig": "ae11c539fdc709b78fef5ee1f5a2250297e3e1b62a86a86c26d93c389934ba0e571ccffa50f0871d357fbab1ac8f6c00bcf14fc429f0885595764b05c8ebed0d" + } +} \ No newline at end of file diff --git a/crypto/frost/src/tests/literal/vectors/frost-ed448-shake256.json b/crypto/frost/src/tests/literal/vectors/frost-ed448-shake256.json new file mode 100644 index 00000000..b8b20418 --- /dev/null +++ b/crypto/frost/src/tests/literal/vectors/frost-ed448-shake256.json @@ -0,0 +1,68 @@ +{ + "config": { + "MAX_PARTICIPANTS": "3", + "NUM_PARTICIPANTS": "2", + "MIN_PARTICIPANTS": "2", + "name": "FROST(Ed448, SHAKE256)", + "group": "ed448", + "hash": "SHAKE256" + }, + "inputs": { + "group_secret_key": "6298e1eef3c379392caaed061ed8a31033c9e9e3420726f23b404158a401cd9df24632adfe6b418dc942d8a091817dd8bd70e1c72ba52f3c00", + "group_public_key": "3832f82fda00ff5365b0376df705675b63d2a93c24c6e81d40801ba265632be10f443f95968fadb70d10786827f30dc001c8d0f9b7c1d1b000", + "message": "74657374", + "share_polynomial_coefficients": [ + "dbd7a514f7a731976620f0436bd135fe8dddc3fadd6e0d13dbd58a1981e587d377d48e0b7ce4e0092967c5e85884d0275a7a740b6abdcd0500" + ], + "participants": { + "1": { + "participant_share": "4a2b2f5858a932ad3d3b18bd16e76ced3070d72fd79ae4402df201f525e754716a1bc1b87a502297f2a99d89ea054e0018eb55d39562fd0100" + }, + "2": { + "participant_share": "2503d56c4f516444a45b080182b8a2ebbe4d9b2ab509f25308c88c0ea7ccdc44e2ef4fc4f63403a11b116372438a1e287265cadeff1fcb0700" + }, + "3": { + "participant_share": "00db7a8146f995db0a7cf844ed89d8e94c2b5f259378ff66e39d172828b264185ac4decf7219e4aa4478285b9c0eef4fccdf3eea69dd980d00" + } + } + }, + "round_one_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "hiding_nonce_randomness": "89bf16040081ff2990336b200613787937ebe1f024b8cdff90eb6f1c741d91c1", + "binding_nonce_randomness": "cd646348bb98fd2a4b2f27fb7d6da18201c161847352576b4bf125190e965483", + "hiding_nonce": "67a6f023e77361707c6e894c625e809e80f33fdb310810053ae29e28e7011f3193b9020e73c183a98cc3a519160ed759376dd92c9483162200", + "binding_nonce": "4812e8d7c8b7a50ced80b507902d074ef8647bc1146979683da8d0fecd93fa3c8230cade2fb4344600aa04bd4b7a21d046c5b63ee865b12a00", + "hiding_nonce_commitment": "649c6a53b109897d962d033f23d01fd4e1053dddf3746d2ddce9bd66aea38ccfc3df061df03ca399eb806312ab3037c0c31523142956ada780", + "binding_nonce_commitment": "0064cc729a8e2fcf417e43788ecec37b10e9e1dcb3ae90854efbfaad00a0ef3cdd52e18d56f073c8ff0947cb71ff0bb17c3d45d096409ddb00", + "binding_factor_input": "106dadce87ca867018702d69a02effd165e1ac1a511c957cff1897ceff2e34ca212fe798d84f0bde6054bf0fa77fd4cd4bc4853d6dc8dbd19d340923f0ebbbb35172df4ab865a45d55af31fa0e6606ea97cf8513022b2b133d0f9f6b8d3be184221fc4592bf12bd7fb4127bb67e51a6dc9e5f1ed5243362fb46a6da552418ca967d43d9bc811a21917a3018de58f11c25f6b9ad8bec3699e06b87dd3ab67a7326c30878c7c55ec1a45802af65da193ce99634158539e38c232a627895c5f14e2e20d487382ccc9c99cd0a0df266a292f283bb9b6854e344ecc32d5e1852fdde5fde77798010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "binding_factor": "3412ac894a91a6bc0e3e7c790f3e8ef5d1288e54de780aba384cbb3081b602dd188010e5b0c9ac2b5dca0aae54cfd0f5c391cece8092131d00" + }, + "3": { + "hiding_nonce_randomness": "3718dabb4fd3d7dd9adad4878c6de8b33c8841cfe7cc95a85592952a2c9c554d", + "binding_nonce_randomness": "3becbc90798211a0f52543dd1f24869a143fdf743409581af4db30f045773d64", + "hiding_nonce": "4f2666770317d14ec9f7fd6690c075c34b4cde7f6d9bceda9e9433ec8c0f2dc983ff1622c3a54916ce7c161381d263fad62539cddab2101600", + "binding_nonce": "88f66df8bb66389932721a40de4aa5754f632cac114abc1052688104d19f3b1a010880ebcd0c4c0f8cf567d887e5b0c3c0dc78821166550f00", + "hiding_nonce_commitment": "8dcf049167e28d5f53fa7ebbbd136abcaf2be9f2c02448c8979002f92577b22027640def7ddd5b98f9540c2280f36a92d4747bbade0b0c4280", + "binding_nonce_commitment": "12e837b89a2c085481fcf0ca640a17a24b6fc96b032d40e4301c78e7232a9f49ffdcad2c21acbc992e79dfc3c6c07cb94e4680b3dcc9935580", + "binding_factor_input": "106dadce87ca867018702d69a02effd165e1ac1a511c957cff1897ceff2e34ca212fe798d84f0bde6054bf0fa77fd4cd4bc4853d6dc8dbd19d340923f0ebbbb35172df4ab865a45d55af31fa0e6606ea97cf8513022b2b133d0f9f6b8d3be184221fc4592bf12bd7fb4127bb67e51a6dc9e5f1ed5243362fb46a6da552418ca967d43d9bc811a21917a3018de58f11c25f6b9ad8bec3699e06b87dd3ab67a7326c30878c7c55ec1a45802af65da193ce99634158539e38c232a627895c5f14e2e20d487382ccc9c99cd0a0df266a292f283bb9b6854e344ecc32d5e1852fdde5fde77798030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "binding_factor": "6aa48a3635d7b962489283ee1ccda8ea66e5677b1e17f2f475eb565e3ae8ea73360f24c04e3775dadd1f2923adcda3d105536ad28c3c561100" + } + } + }, + "round_two_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "sig_share": "c5057c80d13e565545dac6f3aa333065c809a14a94fea3c8e4e87e386a9cb89602de7355c5d19ebb09d553b100ef1858104fc7c43992d83400" + }, + "3": { + "sig_share": "2b490ea08411f78c620c668fff8ba70b25b7c89436f20cc45419213de70f93fb6c9094c79293697d72e741b68d2e493446005145d0b7fc3500" + } + } + }, + "final_output": { + "sig": "83ac141d289a5171bc894b058aee2890316280719a870fc5c1608b77403023155d7a9dc15a2b7920bb5826dd540bf76336be99536cebe36280fd093275c38dd4be525767f537fd6a4f5d8a9330811562c84fded5f851ac4b926f6e081d586508397cbc95678e1d628c564f180a0a4ad52a00" + } +} \ No newline at end of file diff --git a/crypto/frost/src/tests/literal/vectors/frost-p256-sha256.json b/crypto/frost/src/tests/literal/vectors/frost-p256-sha256.json new file mode 100644 index 00000000..db6be1f8 --- /dev/null +++ b/crypto/frost/src/tests/literal/vectors/frost-p256-sha256.json @@ -0,0 +1,68 @@ +{ + "config": { + "MAX_PARTICIPANTS": "3", + "NUM_PARTICIPANTS": "2", + "MIN_PARTICIPANTS": "2", + "name": "FROST(P-256, SHA-256)", + "group": "P-256", + "hash": "SHA-256" + }, + "inputs": { + "group_secret_key": "8ba9bba2e0fd8c4767154d35a0b7562244a4aaf6f36c8fb8735fa48b301bd8de", + "group_public_key": "023a309ad94e9fe8a7ba45dfc58f38bf091959d3c99cfbd02b4dc00585ec45ab70", + "message": "74657374", + "share_polynomial_coefficients": [ + "80f25e6c0709353e46bfbe882a11bdbb1f8097e46340eb8673b7e14556e6c3a4" + ], + "participants": { + "1": { + "participant_share": "0c9c1a0fe806c184add50bbdcac913dda73e482daf95dcb9f35dbb0d8a9f7731" + }, + "2": { + "participant_share": "8d8e787bef0ff6c2f494ca45f4dad198c6bee01212d6c84067159c52e1863ad5" + }, + "3": { + "participant_share": "0e80d6e8f6192c003b5488ce1eec8f5429587d48cf001541e713b2d53c09d928" + } + } + }, + "round_one_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "hiding_nonce_randomness": "f4e8cf80aec3f888d997900ac7e3e349944b5a6b47649fc32186d2f1238103c6", + "binding_nonce_randomness": "a7f220770b6f10ff54ec6afa55f99bd08cc92fa1a488c86e9bf493e9cb894cdf", + "hiding_nonce": "f871dfcf6bcd199342651adc361b92c941cb6a0d8c8c1a3b91d79e2c1bf3722d", + "binding_nonce": "bd3ece3634a1b303dea0586ed67a91fe68510f11ebe66e8868309b1551ef2388", + "hiding_nonce_commitment": "03987febbc67a8ed735affdff4d3a5adf22c05c80f97f311ab7437a3027372deb3", + "binding_nonce_commitment": "02a1960477d139035b986d6adcb06491378beb92ccd097ad94e76291c52343849d", + "binding_factor_input": "350c8b523feea9bb35720e9fbe0405ed48d78caa4fb60869f34367e144c68bb0fc77bf512409ad8b91e2ace4909229891a446c45683f5eb2f843dbec224527dc0000000000000000000000000000000000000000000000000000000000000001", + "binding_factor": "cb415dd1d866493ee7d2db7cb33929d7e430e84d80c58070e2bbb1fdbf76a9c8" + }, + "3": { + "hiding_nonce_randomness": "1b6149d252a0a0a6618b8d22a1c49897f9b0d23a48f19598e191e05dc7b7ae33", + "binding_nonce_randomness": "e13994bb75aafe337c32afdbfd08ae60dd108fc768845edaa871992044cabf1b", + "hiding_nonce": "802e9321f9f63688c6c1a9681a4a4661f71770e0cef92b8a5997155d18fb82ef", + "binding_nonce": "8b6b692ae634a24536f45dda95b2398af71cd605fb7a0bbdd9408d211ab99eba", + "hiding_nonce_commitment": "0212cac45ebd4100c97506939391f9be4ffc3ca2960e2ef95aeaa38abdede204ca", + "binding_nonce_commitment": "03017ce754d310eabda0f5681e61ce3d713cdd337070faa6a68471af49694a4e7e", + "binding_factor_input": "350c8b523feea9bb35720e9fbe0405ed48d78caa4fb60869f34367e144c68bb0fc77bf512409ad8b91e2ace4909229891a446c45683f5eb2f843dbec224527dc0000000000000000000000000000000000000000000000000000000000000003", + "binding_factor": "dfd82467569334e952edecb10d92adf85b8e299db0b40be3131a12efdfa3e796" + } + } + }, + "round_two_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "sig_share": "c5acd980310aaf87cb7a9a90428698ef3e6b1e5860f7fb06329bc0efe3f14ca5" + }, + "3": { + "sig_share": "1e064fbd35467377eb3fe161ff975e9ec3ed8e2e0d4c73f3a6b0a023777e1264" + } + } + }, + "final_output": { + "sig": "029e07d4171dbf9a730ed95e9d95bda06fa4db76c88c519f7f3ca5483019f46cb0e3b3293d665122ffb6ba7bf2421df78e0258ac866e446ef9d94c61135b6f5f09" + } +} \ No newline at end of file diff --git a/crypto/frost/src/tests/literal/vectors/frost-ristretto255-sha512.json b/crypto/frost/src/tests/literal/vectors/frost-ristretto255-sha512.json new file mode 100644 index 00000000..72a518b6 --- /dev/null +++ b/crypto/frost/src/tests/literal/vectors/frost-ristretto255-sha512.json @@ -0,0 +1,68 @@ +{ + "config": { + "MAX_PARTICIPANTS": "3", + "NUM_PARTICIPANTS": "2", + "MIN_PARTICIPANTS": "2", + "name": "FROST(ristretto255, SHA-512)", + "group": "ristretto255", + "hash": "SHA-512" + }, + "inputs": { + "group_secret_key": "1b25a55e463cfd15cf14a5d3acc3d15053f08da49c8afcf3ab265f2ebc4f970b", + "group_public_key": "e2a62f39eede11269e3bd5a7d97554f5ca384f9f6d3dd9c3c0d05083c7254f57", + "message": "74657374", + "share_polynomial_coefficients": [ + "410f8b744b19325891d73736923525a4f596c805d060dfb9c98009d34e3fec02" + ], + "participants": { + "1": { + "participant_share": "5c3430d391552f6e60ecdc093ff9f6f4488756aa6cebdbad75a768010b8f830e" + }, + "2": { + "participant_share": "b06fc5eac20b4f6e1b271d9df2343d843e1e1fb03c4cbb673f2872d459ce6f01" + }, + "3": { + "participant_share": "f17e505f0e2581c6acfe54d3846a622834b5e7b50cad9a2109a97ba7a80d5c04" + } + } + }, + "round_one_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "hiding_nonce_randomness": "81800157bb554f299fe0b6bd658e4c4591d74168b5177bf55e8dceed59dc80c7", + "binding_nonce_randomness": "e9b37de02fde28f601f09051ed9a277b02ac81c803a5c72492d58635001fe355", + "hiding_nonce": "40f58e8df202b21c94f826e76e4647efdb0ea3ca7ae7e3689bc0cbe2e2f6660c", + "binding_nonce": "373dd42b5fe80e88edddf82e03744b6a12d59256f546de612d4bbd91a6b1df06", + "hiding_nonce_commitment": "b8c7319a56b296537436e5a6f509a871a3c74eff1534ec1e2f539ccd8b322411", + "binding_nonce_commitment": "7af5d4bece8763ce3630370adbd978699402f624fd3a7d2c71ea5839efc3cf54", + "binding_factor_input": "9c245d5fc2e451c5c5a617cc6f2a20629fb317d9b1c1915ab4bfa319d4ebf922c54dd1a5b3b754550c72734ac9255db8107a2b01f361754d9f13f428c2f6de9e4f609ae0dbe8bd1f95bee9f9ea219154d567ef174390bac737bb67ee1787c8a34279728d4aa99a6de2d5ce6deb86afe6bc68178f01223bb5eb934c8a23b6354e0100000000000000000000000000000000000000000000000000000000000000", + "binding_factor": "607df5e2e3a8b5e2704716693e18f548100a32b86a5685d3932a774c3f107e06" + }, + "3": { + "hiding_nonce_randomness": "daeb223c4a913943cff2fb0b0e638dfcc281e1e8936ee6c3fef4d49ad9cbfaa0", + "binding_nonce_randomness": "c425768d952ab8f18b9720c54b93e612ba2cca170bb7518cac080896efa7429b", + "hiding_nonce": "491477c9dbe8717c77c6c1e2c5f4cec636c7c154313a44c91fea63e309f3e100", + "binding_nonce": "3ae1bba7d6f2076f81596912dd916efae5b3c2ef896956321194fdd2e52ebc0f", + "hiding_nonce_commitment": "e4466b7670ac4f9d9b7b67655860dd1ab341be18a654bb1966df53c76c85d511", + "binding_nonce_commitment": "ce47cd595d25d7effc3c095efa2a687a1728a5ecab402b39e0c0ad9a525ea54f", + "binding_factor_input": "9c245d5fc2e451c5c5a617cc6f2a20629fb317d9b1c1915ab4bfa319d4ebf922c54dd1a5b3b754550c72734ac9255db8107a2b01f361754d9f13f428c2f6de9e4f609ae0dbe8bd1f95bee9f9ea219154d567ef174390bac737bb67ee1787c8a34279728d4aa99a6de2d5ce6deb86afe6bc68178f01223bb5eb934c8a23b6354e0300000000000000000000000000000000000000000000000000000000000000", + "binding_factor": "2bd27271c28746eb93e2114d6778c12b44c9287d84b85dc780eb08da6f689900" + } + } + }, + "round_two_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "sig_share": "c38f438c325ce6bfa4272b37e7707caaeb57fa8c7ddcc05e0725acb8a7d9cd0c" + }, + "3": { + "sig_share": "4cb9917be3bd53f1d60f1c3d1a3ff563565fa15a391133e7f980e55d3aeb7904" + } + } + }, + "final_output": { + "sig": "204d5d93aa486192ecf2f64ce7dbc1db76948fb1077d1a719ae1ecca6143501e2275dfaafbb62759a59a4fd122b692f941b79be7b6edf34501a69116e2c44701" + } +} \ No newline at end of file diff --git a/crypto/frost/src/tests/literal/vectors/frost-secp256k1-sha256.json b/crypto/frost/src/tests/literal/vectors/frost-secp256k1-sha256.json new file mode 100644 index 00000000..e7f8e317 --- /dev/null +++ b/crypto/frost/src/tests/literal/vectors/frost-secp256k1-sha256.json @@ -0,0 +1,68 @@ +{ + "config": { + "MAX_PARTICIPANTS": "3", + "NUM_PARTICIPANTS": "2", + "MIN_PARTICIPANTS": "2", + "name": "FROST(secp256k1, SHA-256)", + "group": "secp256k1", + "hash": "SHA-256" + }, + "inputs": { + "group_secret_key": "0d004150d27c3bf2a42f312683d35fac7394b1e9e318249c1bfe7f0795a83114", + "group_public_key": "02f37c34b66ced1fb51c34a90bdae006901f10625cc06c4f64663b0eae87d87b4f", + "message": "74657374", + "share_polynomial_coefficients": [ + "fbf85eadae3058ea14f19148bb72b45e4399c0b16028acaf0395c9b03c823579" + ], + "participants": { + "1": { + "participant_share": "08f89ffe80ac94dcb920c26f3f46140bfc7f95b493f8310f5fc1ea2b01f4254c" + }, + "2": { + "participant_share": "04f0feac2edcedc6ce1253b7fab8c86b856a797f44d83d82a385554e6e401984" + }, + "3": { + "participant_share": "00e95d59dd0d46b0e303e500b62b7ccb0e555d49f5b849f5e748c071da8c0dbc" + } + } + }, + "round_one_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "hiding_nonce_randomness": "80cbea5e405d169999d8c4b30b755fedb26ab07ec8198cda4873ed8ce5e16773", + "binding_nonce_randomness": "f6d5b38197843046b68903048c1feba433e3500145281fa8bb1e26fdfeef5e7f", + "hiding_nonce": "acc83278035223c1ba464e2d11bfacfc872b2b23e1041cf5f6130da21e4d8068", + "binding_nonce": "c3ef169995bc3d2c2d48f30b83d0c63751e67ceb057695bcb2a6aa40ed5d926b", + "hiding_nonce_commitment": "036673d68a928793c33ae07776908eae8ea15dd947ed81284e939aaba118573a5e", + "binding_nonce_commitment": "03d2a96dd4ec1ee29dc22067109d1290dabd8016cb41856ee8ff9281c3fa1baffd", + "binding_factor_input": "a645d8249457bbcac34fa7b740f66bcce08fc39506b8bbf1a1c81092f6272eda82ae39234d714f87a7b91dd67d124a06561a36817c1ecaa255c3527d694fc4f10000000000000000000000000000000000000000000000000000000000000001", + "binding_factor": "d7bcbd29408dedc9e138262d99b09d8b5705d76eb5de2369d9103e4423f8ac79" + }, + "3": { + "hiding_nonce_randomness": "b9794047604beda0c5c0529ac9dfd83c0a80399a7bdf4c3e23cef2faf69cdcc3", + "binding_nonce_randomness": "c28ce6252631620b84c2702b34774fab365e286ebc77030a112ebccccbffa78b", + "hiding_nonce": "cb3387defef07fc9010c0564ba6495ed41876626ed86b886ca26cbbd3566ffbc", + "binding_nonce": "4559459735eb68e8c16319a9fd9a14016053957cb8cea273a24b7c7bc1ee26f6", + "hiding_nonce_commitment": "030278e6e6055fb963b40e0c3c37099f803f3f38930fc89092517f8ce1b47e8d6b", + "binding_nonce_commitment": "028eb6d238c6c0fc6216906706ad0ff9943c6c1d6079cdf74f674481ebb2485db3", + "binding_factor_input": "a645d8249457bbcac34fa7b740f66bcce08fc39506b8bbf1a1c81092f6272eda82ae39234d714f87a7b91dd67d124a06561a36817c1ecaa255c3527d694fc4f10000000000000000000000000000000000000000000000000000000000000003", + "binding_factor": "ecc057259f3c8b195308c9b73aaaf840660a37eb264ebce342412c58102ee437" + } + } + }, + "round_two_outputs": { + "participant_list": "1,3", + "participants": { + "1": { + "sig_share": "1750b2a314a81b66fd81366583617aaafcffa68f14495204795aa0434b907aa3" + }, + "3": { + "sig_share": "e4dbbbbbcb035eb3512918b0368c4ab2c836a92dccff3251efa7a4aacc7d3790" + } + } + }, + "final_output": { + "sig": "0259696aac722558e8638485d252bb2556f6241a7adfdf284c8c87a3428d46448dfc2c6e5edfab7a1a4eaa4f15b9edc55dc5364fbce1488456690244ee180db233" + } +} \ No newline at end of file diff --git a/crypto/frost/src/tests/schnorr.rs b/crypto/frost/src/tests/schnorr.rs index 8c12b07d..d25d066d 100644 --- a/crypto/frost/src/tests/schnorr.rs +++ b/crypto/frost/src/tests/schnorr.rs @@ -12,9 +12,9 @@ use crate::{ }; pub(crate) fn core_sign(rng: &mut R) { - let private_key = C::F::random(&mut *rng); - let nonce = C::F::random(&mut *rng); - let challenge = C::F::random(rng); // Doesn't bother to craft an HRAM + let private_key = C::random_F(&mut *rng); + let nonce = C::random_F(&mut *rng); + let challenge = C::random_F(rng); // Doesn't bother to craft an HRAm assert!(schnorr::verify::( C::generator() * private_key, challenge, @@ -27,8 +27,8 @@ pub(crate) fn core_sign(rng: &mut R) { // random pub(crate) fn core_verify(rng: &mut R) { assert!(!schnorr::verify::( - C::generator() * C::F::random(&mut *rng), - C::F::random(rng), + C::generator() * C::random_F(&mut *rng), + C::random_F(rng), &SchnorrSignature { R: C::G::identity(), s: C::F::zero() } )); } @@ -39,9 +39,9 @@ pub(crate) fn core_batch_verify(rng: &mut R) { let mut challenges = vec![]; let mut sigs = vec![]; for i in 0 .. 5 { - keys.push(C::F::random(&mut *rng)); - challenges.push(C::F::random(&mut *rng)); - sigs.push(schnorr::sign::(keys[i], C::F::random(&mut *rng), challenges[i])); + keys.push(C::random_F(&mut *rng)); + challenges.push(C::random_F(&mut *rng)); + sigs.push(schnorr::sign::(keys[i], C::random_F(&mut *rng), challenges[i])); } // Batch verify @@ -66,7 +66,7 @@ pub(crate) fn core_batch_verify(rng: &mut R) { // Make sure a completely invalid signature fails when included for i in 0 .. 5 { let mut triplets = triplets.clone(); - triplets[i].3.s = C::F::random(&mut *rng); + triplets[i].3.s = C::random_F(&mut *rng); if let Err(blame) = schnorr::batch_verify(rng, &triplets) { assert_eq!(blame, u16::try_from(i + 1).unwrap()); } else { diff --git a/crypto/frost/src/tests/vectors.rs b/crypto/frost/src/tests/vectors.rs index ca2cf278..747df6a1 100644 --- a/crypto/frost/src/tests/vectors.rs +++ b/crypto/frost/src/tests/vectors.rs @@ -1,4 +1,6 @@ use std::{io::Cursor, collections::HashMap}; +#[cfg(test)] +use std::str::FromStr; use rand_core::{RngCore, CryptoRng}; @@ -16,17 +18,61 @@ use crate::{ pub struct Vectors { pub threshold: u16, - pub shares: &'static [&'static str], - pub group_secret: &'static str, - pub group_key: &'static str, - pub msg: &'static str, - pub included: &'static [u16], - pub nonces: &'static [[&'static str; 2]], - pub sig_shares: &'static [&'static str], + pub group_secret: String, + pub group_key: String, + pub shares: Vec, + + pub msg: String, + pub included: Vec, + pub nonces: Vec<[String; 2]>, + + pub sig_shares: Vec, + pub sig: String, } +#[cfg(test)] +impl From for Vectors { + fn from(value: serde_json::Value) -> Vectors { + let to_str = |value: &serde_json::Value| value.as_str().unwrap().to_string(); + Vectors { + threshold: u16::from_str(value["config"]["NUM_PARTICIPANTS"].as_str().unwrap()).unwrap(), + + group_secret: to_str(&value["inputs"]["group_secret_key"]), + group_key: to_str(&value["inputs"]["group_public_key"]), + shares: value["inputs"]["participants"] + .as_object() + .unwrap() + .values() + .map(|share| to_str(&share["participant_share"])) + .collect(), + + msg: to_str(&value["inputs"]["message"]), + included: to_str(&value["round_one_outputs"]["participant_list"]) + .split(",") + .map(u16::from_str) + .collect::>() + .unwrap(), + nonces: value["round_one_outputs"]["participants"] + .as_object() + .unwrap() + .values() + .map(|value| [to_str(&value["hiding_nonce"]), to_str(&value["binding_nonce"])]) + .collect(), + + sig_shares: value["round_two_outputs"]["participants"] + .as_object() + .unwrap() + .values() + .map(|value| to_str(&value["sig_share"])) + .collect(), + + sig: to_str(&value["final_output"]["sig"]), + } + } +} + // Load these vectors into FrostKeys using a custom serialization it'll deserialize fn vectors_to_multisig_keys(vectors: &Vectors) -> HashMap> { let shares = vectors @@ -54,7 +100,7 @@ fn vectors_to_multisig_keys(vectors: &Vectors) -> HashMap>( ) { // Do basic tests before trying the vectors test_curve::<_, C>(&mut *rng); - test_schnorr::<_, C>(rng); + test_schnorr::<_, C>(&mut *rng); test_promotion::<_, C>(rng); // Test against the vectors let keys = vectors_to_multisig_keys::(&vectors); - let group_key = C::read_G(&mut Cursor::new(hex::decode(vectors.group_key).unwrap())).unwrap(); - assert_eq!( - C::generator() * - C::read_F(&mut Cursor::new(hex::decode(vectors.group_secret).unwrap())).unwrap(), - group_key - ); - assert_eq!( - recover(&keys), - C::read_F(&mut Cursor::new(hex::decode(vectors.group_secret).unwrap())).unwrap() - ); + let group_key = C::read_G(&mut Cursor::new(hex::decode(&vectors.group_key).unwrap())).unwrap(); + let secret = C::read_F(&mut Cursor::new(hex::decode(&vectors.group_secret).unwrap())).unwrap(); + assert_eq!(C::generator() * secret, group_key); + assert_eq!(recover(&keys), secret); let mut machines = vec![]; - for i in vectors.included { + for i in &vectors.included { machines.push(( - *i, + i, AlgorithmMachine::new( Schnorr::::new(), keys[i].clone(), @@ -102,8 +142,8 @@ pub fn test_with_vectors>( .drain(..) .map(|(i, machine)| { let nonces = [ - C::read_F(&mut Cursor::new(hex::decode(vectors.nonces[c][0]).unwrap())).unwrap(), - C::read_F(&mut Cursor::new(hex::decode(vectors.nonces[c][1]).unwrap())).unwrap(), + C::read_F(&mut Cursor::new(hex::decode(&vectors.nonces[c][0]).unwrap())).unwrap(), + C::read_F(&mut Cursor::new(hex::decode(&vectors.nonces[c][1]).unwrap())).unwrap(), ]; c += 1; let these_commitments = vec![[C::generator() * nonces[0], C::generator() * nonces[1]]]; @@ -114,7 +154,7 @@ pub fn test_with_vectors>( }); commitments.insert( - i, + *i, Cursor::new( [ these_commitments[0][0].to_bytes().as_ref(), @@ -134,18 +174,18 @@ pub fn test_with_vectors>( .drain(..) .map(|(i, machine)| { let (machine, share) = - machine.sign(clone_without(&commitments, &i), &hex::decode(vectors.msg).unwrap()).unwrap(); + machine.sign(clone_without(&commitments, i), &hex::decode(&vectors.msg).unwrap()).unwrap(); - assert_eq!(share, hex::decode(vectors.sig_shares[c]).unwrap()); + assert_eq!(share, hex::decode(&vectors.sig_shares[c]).unwrap()); c += 1; - shares.insert(i, Cursor::new(share)); + shares.insert(*i, Cursor::new(share)); (i, machine) }) .collect::>(); for (i, machine) in machines.drain() { - let sig = machine.complete(clone_without(&shares, &i)).unwrap(); + let sig = machine.complete(clone_without(&shares, i)).unwrap(); let mut serialized = sig.R.to_bytes().as_ref().to_vec(); serialized.extend(sig.s.to_repr().as_ref()); assert_eq!(hex::encode(serialized), vectors.sig); diff --git a/crypto/multiexp/Cargo.toml b/crypto/multiexp/Cargo.toml index 1ef12d86..eb107626 100644 --- a/crypto/multiexp/Cargo.toml +++ b/crypto/multiexp/Cargo.toml @@ -3,7 +3,7 @@ name = "multiexp" version = "0.2.1" description = "Multiexponentation algorithms for ff/group" license = "MIT" -repository = "https://github.com/serai-dex/serai" +repository = "https://github.com/serai-dex/serai/tree/develop/crypto/multiexp" authors = ["Luke Parker "] keywords = ["multiexp", "ff", "group"] edition = "2021" diff --git a/crypto/transcript/Cargo.toml b/crypto/transcript/Cargo.toml index a31588a5..6cffcd94 100644 --- a/crypto/transcript/Cargo.toml +++ b/crypto/transcript/Cargo.toml @@ -3,7 +3,7 @@ name = "flexible-transcript" version = "0.1.3" description = "A simple transcript trait definition, along with viable options" license = "MIT" -repository = "https://github.com/serai-dex/serai" +repository = "https://github.com/serai-dex/serai/tree/develop/crypto/transcript" authors = ["Luke Parker "] keywords = ["transcript"] edition = "2021" diff --git a/deploy/coins/bitcoin/scripts/entry-dev.sh b/deploy/coins/bitcoin/scripts/entry-dev.sh index 1ae37017..ad7583f5 100644 --- a/deploy/coins/bitcoin/scripts/entry-dev.sh +++ b/deploy/coins/bitcoin/scripts/entry-dev.sh @@ -13,8 +13,8 @@ bitcoind -regtest -txindex -fallbackfee=0.000001 -rpcuser=$RPC_USER -rpcpassword # give time to bitcoind to start while true do - bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS generatetoaddress 100 $MINER && break - sleep 5 + bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS generatetoaddress 100 $MINER && break + sleep 5 done bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS createwallet "miner" false false $RPC_PASS false false true && @@ -24,6 +24,6 @@ bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS importprivkey $PR # mine a new block every BLOCK_TIME while true do - bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS generatetoaddress 1 $MINER - sleep $BLOCK_TIME + bitcoin-cli -regtest -rpcuser=$RPC_USER -rpcpassword=$RPC_PASS generatetoaddress 1 $MINER + sleep $BLOCK_TIME done diff --git a/deploy/coins/monero/scripts/entry-dev.sh b/deploy/coins/monero/scripts/entry-dev.sh index ac650bae..2625e26d 100644 --- a/deploy/coins/monero/scripts/entry-dev.sh +++ b/deploy/coins/monero/scripts/entry-dev.sh @@ -2,15 +2,13 @@ # Setup Environment RPC_USER="${RPC_USER:=serai}" RPC_PASS="${RPC_PASS:=seraidex}" -MINER="${MINER:=xmraddr}" BLOCK_TIME=${BLOCK_TIME:=5} - # Run Monero monerod --regtest --rpc-login ${RPC_USER}:${RPC_PASS} \ ---rpc-access-control-origins * --rpc-bind-ip=0.0.0.0 --offline \ ---fixed-difficulty=1 --non-interactive --start-mining ${MINER} \ ---mining-threads 1 --bg-mining-enable --detach +--rpc-access-control-origins * --confirm-external-bind \ +--rpc-bind-ip=0.0.0.0 --offline --fixed-difficulty=1 \ +--non-interactive --mining-threads 1 --bg-mining-enable --detach # give time to monerod to start while true; do diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 5e3f2b4c..ff371db3 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -8,7 +8,7 @@ name: serai-dev # coins - node clients for coins only (BTC, ETH, XMR) # cluster-sm - Alice, Bob, Charlie # cluster-coins-sm - cluster-sm with coins - # cluter-lg - Alice, Bob, Charlie, Dave, Eve, Ferdie + # cluster-lg - Alice, Bob, Charlie, Dave, Eve, Ferdie # cluster-coins-lg - cluster-lg with coins # monero - full node monero only # bitcoin - full node bitcoin only @@ -42,7 +42,6 @@ services: - "./serai/scripts:/scripts" serai-base: - &serai <<: *serai_defaults hostname: serai-base profiles: @@ -52,7 +51,6 @@ services: NAME: base serai-alice: - &serai <<: *serai_defaults hostname: serai-alice profiles: @@ -67,7 +65,6 @@ services: VALIDATOR: true serai-bob: - &serai <<: *serai_defaults hostname: serai-bob profiles: @@ -81,7 +78,6 @@ services: NAME: Bob serai-charlie: - &serai <<: *serai_defaults hostname: serai-charlie profiles: @@ -95,7 +91,6 @@ services: NAME: Charlie serai-dave: - &serai <<: *serai_defaults hostname: serai-dave profiles: @@ -107,7 +102,6 @@ services: NAME: Dave serai-eve: - &serai <<: *serai_defaults hostname: serai-eve profiles: @@ -119,7 +113,6 @@ services: NAME: Eve serai-ferdie: - &serai <<: *serai_defaults hostname: serai-ferdie profiles: @@ -171,6 +164,5 @@ services: context: ./coins/monero/ restart: unless-stopped volumes: - - "./coins/monero/temp:/temp" - "./coins/monero/scripts:/scripts" entrypoint: /scripts/entry-dev.sh diff --git a/deploy/kubernetes/Makefile b/deploy/kubernetes/Makefile new file mode 100644 index 00000000..9889b071 --- /dev/null +++ b/deploy/kubernetes/Makefile @@ -0,0 +1,103 @@ +SHELL := /bin/bash + +check-helm: + @helm version || $(MAKE) install-helm + +check-kubectl: + @kubectl version || $(MAKE) install-kubectl + +install-helm: + @curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 + @chmod 700 get_helm.sh + @./get_helm.sh + @rm get_helm.sh + +install-kubectl: + @curl -LO 'https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl' + @sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl + @rm kubectl + +deploy-base: + @docker compose -f ../docker-compose.yml --profile base build --quiet + @(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-base charts/serai/\ + --values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-base,nameOverride=serai-base,\ + image.envVariables[1].value=base,configMapFile=% + +deploy-bitcoin: + @docker compose -f ../docker-compose.yml --profile bitcoin build --quiet + @(cat ../coins/bitcoin/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install bitcoin-daemon\ + charts/bitcoin/ --values charts/bitcoin/values.yaml --set configMapFile=% + +deploy-ethereum: + @docker compose -f ../docker-compose.yml --profile ethereum build --quiet + @(cat ../coins/ethereum/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install ethereum-daemon\ + charts/ethereum/ --values charts/ethereum/values.yaml --set configMapFile=% + +deploy-monero: + @docker compose -f ../docker-compose.yml --profile monero build --quiet + @(cat ../coins/monero/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install monero-daemon\ + charts/monero/ --values charts/monero/values.yaml --set configMapFile=% + +deploy-cluster-sm: + @docker compose -f ../docker-compose.yml --profile cluster-sm build --quiet + @(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-alice charts/serai/\ + --values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-alice,nameOverride=serai-alice,\ + image.envVariables[1].value=Alice,image.envVariables[2].value="'1'",configMapFile=% + @(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-charlie charts/serai/\ + --values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-charlie,nameOverride=serai-charlie,\ + image.envVariables[1].value=Charlie,configMapFile=% + @(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-bob charts/serai/\ + --values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-bob,nameOverride=serai-bob,\ + image.envVariables[1].value=Bob,configMapFile=% + +deploy-cluster-lg: deploy-cluster-sm + @docker compose -f ../docker-compose.yml --profile cluster-lg build --quiet + @(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-dave charts/serai/\ + --values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-dave,nameOverride=serai-dave,\ + image.envVariables[1].value=Dave,configMapFile=% + @(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-eve charts/serai/\ + --values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-eve,nameOverride=serai-eve,\ + image.envVariables[1].value=Eve,configMapFile=% + @(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-ferdie charts/serai/\ + --values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-ferdie,nameOverride=serai-ferdie,\ + image.envVariables[1].value=Ferdie,configMapFile=% + +deploy-coins: deploy-bitcoin deploy-ethereum deploy-monero + +deploy-cluster-coins-sm: deploy-cluster-sm deploy-coins + +deploy-cluster-coins-lg: deploy-cluster-lg deploy-coins + +deploy-all: deploy-cluster-coins-lg + +delete-base: + @helm delete serai-base + +delete-bitcoin: + @helm delete bitcoin-daemon + +delete-ethereum: + @helm delete ethereum-daemon + +delete-monero: + @helm delete monero-daemon + +delete-cluster-lg: delete-cluster-sm + @helm delete serai-dave + @helm delete serai-eve + @helm delete serai-ferdie + +delete-cluster-sm: + @helm delete serai-alice + @helm delete serai-charlie + @helm delete serai-bob + +delete-coins: delete-bitcoin delete-ethereum delete-monero + +delete-cluster-coins-sm: delete-cluster-sm delete-coins + +delete-cluster-coins-lg: delete-cluster-lg delete-coins + +delete-all: delete-cluster-coins-lg + +check-dependencies: check-helm check-kubectl diff --git a/deploy/kubernetes/README.md b/deploy/kubernetes/README.md new file mode 100644 index 00000000..7bf68d9e --- /dev/null +++ b/deploy/kubernetes/README.md @@ -0,0 +1,41 @@ +# Kubernetes +## Run with Kubernetes +Running the Serai infrastructure is easy with Kubernetes. + +We utilize Makefile to easily orchestrate various pieces of the infrastructure on kubernetes. + +**Example to deploy:** `make deploy-` +```bash +make deploy-cluster-sm +``` +**Example to delete:** `make -i delete-` +```bash +make delete-cluster-sm +``` + +All commands are assumed to be ran from the kubernetes folder, not the serai root folder. + +### Profiles: +* deploy-base - single node, named base +* deploy-coins - node clients for coins only (BTC, ETH, XMR) +* deploy-cluster-sm - Alice (Validator), Bob, Charlie +* deploy-cluster-coins-sm - cluster-sm with coins +* deploy-cluster-lg - Alice (Validator), Bob, Charlie, Dave, Eve, Ferdie +* deploy-cluster-coins-lg - cluster-lg with coins +* deploy-monero - full node monero only +* deploy-bitcoin - full node bitcoin only +* deploy-ethereum - full node ethereum only + +## Requirements for Linux +* Local built images of serai and coins, please follow the Instructions [here](../README.md) +* Running kubernetes cluster (version >= 1.19) +* Curl tool +* Make tool +* Kubectl, check if not installed +```bash +make check-kubectl +``` +* Helm, check if not installed +```bash +make check-helm +``` diff --git a/deploy/kubernetes/charts/bitcoin/Chart.yaml b/deploy/kubernetes/charts/bitcoin/Chart.yaml new file mode 100644 index 00000000..3824b0e4 --- /dev/null +++ b/deploy/kubernetes/charts/bitcoin/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: bitcoin +description: A Helm chart for bitcoin-daemon +type: application +version: 0.1.0 diff --git a/deploy/kubernetes/charts/bitcoin/templates/_helpers.tpl b/deploy/kubernetes/charts/bitcoin/templates/_helpers.tpl new file mode 100644 index 00000000..17b464a4 --- /dev/null +++ b/deploy/kubernetes/charts/bitcoin/templates/_helpers.tpl @@ -0,0 +1,42 @@ +{{- define "bitcoin.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }} +{{- end }} + +{{- define "bitcoin.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 253 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{- define "bitcoin.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }} +{{- end }} + +{{- define "bitcoin.labels" -}} +helm.sh/chart: {{ include "bitcoin.chart" . }} +{{ include "bitcoin.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "bitcoin.selectorLabels" -}} +app.kubernetes.io/name: {{ include "bitcoin.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "bitcoin.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "bitcoin.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/deploy/kubernetes/charts/bitcoin/templates/configmap.yaml b/deploy/kubernetes/charts/bitcoin/templates/configmap.yaml new file mode 100644 index 00000000..bf550200 --- /dev/null +++ b/deploy/kubernetes/charts/bitcoin/templates/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-configmap +data: + entry-dev.sh: | +{{ .Values.configMapFile | b64dec | indent 4}} diff --git a/deploy/kubernetes/charts/bitcoin/templates/deployment.yaml b/deploy/kubernetes/charts/bitcoin/templates/deployment.yaml new file mode 100644 index 00000000..f852a96e --- /dev/null +++ b/deploy/kubernetes/charts/bitcoin/templates/deployment.yaml @@ -0,0 +1,88 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "bitcoin.fullname" . }} + labels: + {{- include "bitcoin.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "bitcoin.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "bitcoin.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "bitcoin.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if hasKey .Values.image "ports" }} + ports: + {{- range .Values.image.ports }} + - name: {{ .name }} + containerPort: {{ .containerPort }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "command" }} + command: + {{- toYaml .Values.image.command | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "args" }} + args: + {{- toYaml .Values.image.args | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "envVariables" }} + env: + {{- toYaml .Values.image.envVariables | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "volumeMounts" }} + volumeMounts: + {{- range .Values.image.volumeMounts }} + - mountPath: {{ .mountPath }} + name: {{ $.Release.Name}}-{{ .name }} + {{- end }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if hasKey .Values "volumes" }} + volumes: + {{- range .Values.volumes }} + - configMap: + defaultMode: {{ .configMap.defaultMode }} + name: {{ $.Release.Name}}-{{ .configMap.name }} + name: {{ $.Release.Name}}-{{ .name }} + {{- end }} + {{- end }} diff --git a/deploy/kubernetes/charts/bitcoin/templates/ingress.yaml b/deploy/kubernetes/charts/bitcoin/templates/ingress.yaml new file mode 100644 index 00000000..39dff21c --- /dev/null +++ b/deploy/kubernetes/charts/bitcoin/templates/ingress.yaml @@ -0,0 +1,50 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "bitcoin.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "bitcoin.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if .pathType }} + pathType: {{ .pathType }} + {{- end }} + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/deploy/kubernetes/charts/bitcoin/templates/service.yaml b/deploy/kubernetes/charts/bitcoin/templates/service.yaml new file mode 100644 index 00000000..e5fc600f --- /dev/null +++ b/deploy/kubernetes/charts/bitcoin/templates/service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "bitcoin.fullname" . }} + labels: + {{- include "bitcoin.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + {{- if hasKey .Values.service "ports" }} + {{- range .Values.service.ports }} + - port: {{ .port }} + name: {{ .name }} + targetPort: {{ .targetPort }} + protocol: {{ .protocol }} + {{- end }} + {{- else }} + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- end }} + selector: + {{- include "bitcoin.selectorLabels" . | nindent 4 }} diff --git a/deploy/kubernetes/charts/bitcoin/values.yaml b/deploy/kubernetes/charts/bitcoin/values.yaml new file mode 100644 index 00000000..54bb0462 --- /dev/null +++ b/deploy/kubernetes/charts/bitcoin/values.yaml @@ -0,0 +1,74 @@ +replicaCount: 1 + +net: mainnet + +image: + repository: serai-dev-bitcoin + pullPolicy: IfNotPresent + tag: "latest" + ports: + - name: p2p + containerPort: 18444 + protocol: TCP + - name: rpc + containerPort: 18443 + protocol: TCP + volumeMounts: + - mountPath: /scripts + name: configmap-volume + args: + - bash + - /scripts/entry-dev.sh + +volumes: + - configMap: + defaultMode: 420 + name: configmap + name: configmap-volume + +configMapFile: "entry-dev.sh" + +imagePullSecrets: [] + +serviceAccount: + create: false + name: "" + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: {} + +service: + type: ClusterIP + ports: + - name: p2p + port: 18444 + targetPort: p2p + protocol: TCP + - name: rpc + port: 18443 + targetPort: rpc + protocol: TCP + +ingress: + enabled: false + className: "" + annotations: {} + hosts: [] + tls: [] + +resources: {} + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/deploy/kubernetes/charts/ethereum/Chart.yaml b/deploy/kubernetes/charts/ethereum/Chart.yaml new file mode 100644 index 00000000..31594044 --- /dev/null +++ b/deploy/kubernetes/charts/ethereum/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: ethereum +description: A Helm chart for ethereum-daemon +type: application +version: 0.1.0 diff --git a/deploy/kubernetes/charts/ethereum/templates/_helpers.tpl b/deploy/kubernetes/charts/ethereum/templates/_helpers.tpl new file mode 100644 index 00000000..ab9b2fc9 --- /dev/null +++ b/deploy/kubernetes/charts/ethereum/templates/_helpers.tpl @@ -0,0 +1,42 @@ +{{- define "ethereum.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }} +{{- end }} + +{{- define "ethereum.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 253 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{- define "ethereum.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }} +{{- end }} + +{{- define "ethereum.labels" -}} +helm.sh/chart: {{ include "ethereum.chart" . }} +{{ include "ethereum.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "ethereum.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ethereum.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "ethereum.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ethereum.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/deploy/kubernetes/charts/ethereum/templates/configmap.yaml b/deploy/kubernetes/charts/ethereum/templates/configmap.yaml new file mode 100644 index 00000000..bf550200 --- /dev/null +++ b/deploy/kubernetes/charts/ethereum/templates/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-configmap +data: + entry-dev.sh: | +{{ .Values.configMapFile | b64dec | indent 4}} diff --git a/deploy/kubernetes/charts/ethereum/templates/deployment.yaml b/deploy/kubernetes/charts/ethereum/templates/deployment.yaml new file mode 100644 index 00000000..b673ba12 --- /dev/null +++ b/deploy/kubernetes/charts/ethereum/templates/deployment.yaml @@ -0,0 +1,89 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "ethereum.fullname" . }} + labels: + {{- include "ethereum.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "ethereum.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "ethereum.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "ethereum.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if hasKey .Values.image "ports" }} + ports: + {{- range .Values.image.ports }} + - name: {{ .name }} + containerPort: {{ .containerPort }} + protocol: {{ .protocol }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "command" }} + command: + {{- toYaml .Values.image.command | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "args" }} + args: + {{- toYaml .Values.image.args | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "envVariables" }} + env: + {{- toYaml .Values.image.envVariables | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "volumeMounts" }} + volumeMounts: + {{- range .Values.image.volumeMounts }} + - mountPath: {{ .mountPath }} + name: {{ $.Release.Name}}-{{ .name }} + {{- end }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if hasKey .Values "volumes" }} + volumes: + {{- range .Values.volumes }} + - configMap: + defaultMode: {{ .configMap.defaultMode }} + name: {{ $.Release.Name}}-{{ .configMap.name }} + name: {{ $.Release.Name}}-{{ .name }} + {{- end }} + {{- end }} diff --git a/deploy/kubernetes/charts/ethereum/templates/ingress.yaml b/deploy/kubernetes/charts/ethereum/templates/ingress.yaml new file mode 100644 index 00000000..18dcd185 --- /dev/null +++ b/deploy/kubernetes/charts/ethereum/templates/ingress.yaml @@ -0,0 +1,50 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "ethereum.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "ethereum.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if .pathType }} + pathType: {{ .pathType }} + {{- end }} + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/deploy/kubernetes/charts/ethereum/templates/service.yaml b/deploy/kubernetes/charts/ethereum/templates/service.yaml new file mode 100644 index 00000000..df83df17 --- /dev/null +++ b/deploy/kubernetes/charts/ethereum/templates/service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ethereum.fullname" . }} + labels: + {{- include "ethereum.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + {{- if hasKey .Values.service "ports" }} + {{- range .Values.service.ports }} + - port: {{ .port }} + name: {{ .name }} + targetPort: {{ .targetPort }} + protocol: {{ .protocol }} + {{- end }} + {{- else }} + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- end }} + selector: + {{- include "ethereum.selectorLabels" . | nindent 4 }} diff --git a/deploy/kubernetes/charts/ethereum/values.yaml b/deploy/kubernetes/charts/ethereum/values.yaml new file mode 100644 index 00000000..cef45a09 --- /dev/null +++ b/deploy/kubernetes/charts/ethereum/values.yaml @@ -0,0 +1,60 @@ +replicaCount: 1 + +image: + repository: serai-dev-ethereum + pullPolicy: IfNotPresent + tag: "latest" + + ports: + - name: rpc + containerPort: 8545 + protocol: TCP + volumeMounts: + - mountPath: /scripts + name: configmap-volume + args: + - bash + - /scripts/entry-dev.sh + +volumes: + - configMap: + defaultMode: 420 + name: configmap + name: configmap-volume + +configMapFile: "entry-dev.sh" + +imagePullSecrets: [] + +serviceAccount: + create: false + name: "" + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: {} + +service: + type: ClusterIP + port: 8545 + +ingress: + enabled: false + className: "" + annotations: {} + hosts: [] + tls: [] + +resources: {} + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + +nodeSelector: {} +tolerations: [] +affinity: {} diff --git a/deploy/kubernetes/charts/monero/Chart.yaml b/deploy/kubernetes/charts/monero/Chart.yaml new file mode 100644 index 00000000..b9c0d84c --- /dev/null +++ b/deploy/kubernetes/charts/monero/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: monero +description: A Helm chart for monero-daemon +type: application +version: 0.1.0 diff --git a/deploy/kubernetes/charts/monero/templates/_helpers.tpl b/deploy/kubernetes/charts/monero/templates/_helpers.tpl new file mode 100644 index 00000000..2829e603 --- /dev/null +++ b/deploy/kubernetes/charts/monero/templates/_helpers.tpl @@ -0,0 +1,42 @@ +{{- define "monero.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }} +{{- end }} + +{{- define "monero.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 253 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{- define "monero.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }} +{{- end }} + +{{- define "monero.labels" -}} +helm.sh/chart: {{ include "monero.chart" . }} +{{ include "monero.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "monero.selectorLabels" -}} +app.kubernetes.io/name: {{ include "monero.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "monero.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "monero.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/deploy/kubernetes/charts/monero/templates/configmap.yaml b/deploy/kubernetes/charts/monero/templates/configmap.yaml new file mode 100644 index 00000000..bf550200 --- /dev/null +++ b/deploy/kubernetes/charts/monero/templates/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-configmap +data: + entry-dev.sh: | +{{ .Values.configMapFile | b64dec | indent 4}} diff --git a/deploy/kubernetes/charts/monero/templates/deployment.yaml b/deploy/kubernetes/charts/monero/templates/deployment.yaml new file mode 100644 index 00000000..fdd32c05 --- /dev/null +++ b/deploy/kubernetes/charts/monero/templates/deployment.yaml @@ -0,0 +1,88 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "monero.fullname" . }} + labels: + {{- include "monero.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "monero.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "monero.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "monero.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if hasKey .Values.image "ports" }} + ports: + {{- range .Values.image.ports }} + - name: {{ .name }} + containerPort: {{ .containerPort }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "command" }} + command: + {{- toYaml .Values.image.command | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "args" }} + args: + {{- toYaml .Values.image.args | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "envVariables" }} + env: + {{- toYaml .Values.image.envVariables | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "volumeMounts" }} + volumeMounts: + {{- range .Values.image.volumeMounts }} + - mountPath: {{ .mountPath }} + name: {{ $.Release.Name}}-{{ .name }} + {{- end }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if hasKey .Values "volumes" }} + volumes: + {{- range .Values.volumes }} + - configMap: + defaultMode: {{ .configMap.defaultMode }} + name: {{ $.Release.Name}}-{{ .configMap.name }} + name: {{ $.Release.Name}}-{{ .name }} + {{- end }} + {{- end }} diff --git a/deploy/kubernetes/charts/monero/templates/ingress.yaml b/deploy/kubernetes/charts/monero/templates/ingress.yaml new file mode 100644 index 00000000..2ae3d4fa --- /dev/null +++ b/deploy/kubernetes/charts/monero/templates/ingress.yaml @@ -0,0 +1,50 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "monero.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "monero.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if .pathType }} + pathType: {{ .pathType }} + {{- end }} + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/deploy/kubernetes/charts/monero/templates/service.yaml b/deploy/kubernetes/charts/monero/templates/service.yaml new file mode 100644 index 00000000..1a4f90d2 --- /dev/null +++ b/deploy/kubernetes/charts/monero/templates/service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "monero.fullname" . }} + labels: + {{- include "monero.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + {{- if hasKey .Values.service "ports" }} + {{- range .Values.service.ports }} + - port: {{ .port }} + name: {{ .name }} + targetPort: {{ .targetPort }} + protocol: {{ .protocol }} + {{- end }} + {{- else }} + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- end }} + selector: + {{- include "monero.selectorLabels" . | nindent 4 }} diff --git a/deploy/kubernetes/charts/monero/values.yaml b/deploy/kubernetes/charts/monero/values.yaml new file mode 100644 index 00000000..8105e003 --- /dev/null +++ b/deploy/kubernetes/charts/monero/values.yaml @@ -0,0 +1,72 @@ +replicaCount: 1 + +image: + repository: serai-dev-monero + pullPolicy: IfNotPresent + tag: "latest" + ports: + - name: p2p + containerPort: 18080 + protocol: TCP + - name: rpc + containerPort: 18081 + protocol: TCP + volumeMounts: + - mountPath: /scripts + name: configmap-volume + args: + - bash + - /scripts/entry-dev.sh + +volumes: + - configMap: + defaultMode: 420 + name: configmap + name: configmap-volume + +configMapFile: "entry-dev.sh" + +imagePullSecrets: [] + +serviceAccount: + create: false + name: "" + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: {} + +service: + type: ClusterIP + ports: + - name: p2p + port: 18080 + targetPort: p2p + protocol: TCP + - name: rpc + port: 18081 + targetPort: rpc + protocol: TCP + +ingress: + enabled: false + className: "" + annotations: {} + hosts: [] + tls: [] + +resources: {} + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/deploy/kubernetes/charts/serai/Chart.yaml b/deploy/kubernetes/charts/serai/Chart.yaml new file mode 100644 index 00000000..69249e1d --- /dev/null +++ b/deploy/kubernetes/charts/serai/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: serai +description: A Helm chart for serai +type: application +version: 0.1.0 diff --git a/deploy/kubernetes/charts/serai/templates/_helpers.tpl b/deploy/kubernetes/charts/serai/templates/_helpers.tpl new file mode 100644 index 00000000..962c2f80 --- /dev/null +++ b/deploy/kubernetes/charts/serai/templates/_helpers.tpl @@ -0,0 +1,42 @@ +{{- define "serai-base.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }} +{{- end }} + +{{- define "serai-base.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 253 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{- define "serai-base.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }} +{{- end }} + +{{- define "serai-base.labels" -}} +helm.sh/chart: {{ include "serai-base.chart" . }} +{{ include "serai-base.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "serai-base.selectorLabels" -}} +app.kubernetes.io/name: {{ include "serai-base.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "serai-base.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "serai-base.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/deploy/kubernetes/charts/serai/templates/configmap.yaml b/deploy/kubernetes/charts/serai/templates/configmap.yaml new file mode 100644 index 00000000..bf550200 --- /dev/null +++ b/deploy/kubernetes/charts/serai/templates/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-configmap +data: + entry-dev.sh: | +{{ .Values.configMapFile | b64dec | indent 4}} diff --git a/deploy/kubernetes/charts/serai/templates/deployment.yaml b/deploy/kubernetes/charts/serai/templates/deployment.yaml new file mode 100644 index 00000000..35d0d7c0 --- /dev/null +++ b/deploy/kubernetes/charts/serai/templates/deployment.yaml @@ -0,0 +1,88 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "serai-base.fullname" . }} + labels: + {{- include "serai-base.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "serai-base.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "serai-base.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "serai-base.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if hasKey .Values.image "ports" }} + ports: + {{- range .Values.image.ports }} + - name: {{ .name }} + containerPort: {{ .containerPort }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "command" }} + command: + {{- toYaml .Values.image.command | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "args" }} + args: + {{- toYaml .Values.image.args | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "envVariables" }} + env: + {{- toYaml .Values.image.envVariables | nindent 12 }} + {{- end }} + + {{- if hasKey .Values.image "volumeMounts" }} + volumeMounts: + {{- range .Values.image.volumeMounts }} + - mountPath: {{ .mountPath }} + name: {{ $.Release.Name}}-{{ .name }} + {{- end }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if hasKey .Values "volumes" }} + volumes: + {{- range .Values.volumes }} + - configMap: + defaultMode: {{ .configMap.defaultMode }} + name: {{ $.Release.Name}}-{{ .configMap.name }} + name: {{ $.Release.Name}}-{{ .name }} + {{- end }} + {{- end }} diff --git a/deploy/kubernetes/charts/serai/templates/ingress.yaml b/deploy/kubernetes/charts/serai/templates/ingress.yaml new file mode 100644 index 00000000..b020fc02 --- /dev/null +++ b/deploy/kubernetes/charts/serai/templates/ingress.yaml @@ -0,0 +1,50 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "serai-base.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "serai-base.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if .pathType }} + pathType: {{ .pathType }} + {{- end }} + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/deploy/kubernetes/charts/serai/templates/service.yaml b/deploy/kubernetes/charts/serai/templates/service.yaml new file mode 100644 index 00000000..f45d73ef --- /dev/null +++ b/deploy/kubernetes/charts/serai/templates/service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "serai-base.fullname" . }} + labels: + {{- include "serai-base.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + {{- if hasKey .Values.service "ports" }} + {{- range .Values.service.ports }} + - port: {{ .port }} + name: {{ .name }} + targetPort: {{ .targetPort }} + protocol: {{ .protocol }} + {{- end }} + {{- else }} + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- end }} + selector: + {{- include "serai-base.selectorLabels" . | nindent 4 }} diff --git a/deploy/kubernetes/charts/serai/values.yaml b/deploy/kubernetes/charts/serai/values.yaml new file mode 100644 index 00000000..9c702daf --- /dev/null +++ b/deploy/kubernetes/charts/serai/values.yaml @@ -0,0 +1,92 @@ +replicaCount: 1 + +image: + repository: serai + pullPolicy: IfNotPresent + tag: "dev" + ports: + - name: p2p + containerPort: 30333 + protocol: TCP + - name: prometheus + containerPort: 9615 + protocol: TCP + - name: rpc + containerPort: 9933 + protocol: TCP + - name: ws + containerPort: 9944 + protocol: TCP + + volumeMounts: + - mountPath: /scripts + name: configmap-volume + envVariables: + - name: CHAIN + value: dev + - name: NAME + value: base + - name: VALIDATOR + value: + args: + - bash + - /scripts/entry-dev.sh + +volumes: + - configMap: + defaultMode: 420 + name: configmap + name: configmap-volume + +configMapFile: "entry-dev.sh" + +imagePullSecrets: [] + +serviceAccount: + create: false + name: "" + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: {} + +service: + type: ClusterIP + ports: + - name: p2p + port: 30333 + targetPort: p2p + protocol: TCP + - name: prometheus + port: 9615 + targetPort: prometheus + protocol: TCP + - name: rpc + port: 9933 + targetPort: rpc + protocol: TCP + - name: ws + port: 9944 + targetPort: ws + protocol: TCP + +ingress: + enabled: false + className: "" + annotations: {} + hosts: [] + tls: [] + +resources: {} + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + +nodeSelector: {} +tolerations: [] +affinity: {} diff --git a/deploy/serai/Dockerfile b/deploy/serai/Dockerfile index 3c07e172..2e941724 100644 --- a/deploy/serai/Dockerfile +++ b/deploy/serai/Dockerfile @@ -16,7 +16,7 @@ WORKDIR /serai RUN rustup update # Install Solc @ 0.8.16 -RUN pip3 install solc-select +RUN pip3 install solc-select==0.2.1 RUN solc-select install 0.8.16 RUN solc-select use 0.8.16 diff --git a/processor/Cargo.toml b/processor/Cargo.toml index 18942d4b..25eafd5a 100644 --- a/processor/Cargo.toml +++ b/processor/Cargo.toml @@ -3,35 +3,39 @@ name = "serai-processor" version = "0.1.0" description = "Multichain processor premised on canonicity to reach distributed consensus automatically" license = "AGPL-3.0-only" -repository = "https://github.com/serai-dex/processor" +repository = "https://github.com/serai-dex/serai/tree/develop/processor" authors = ["Luke Parker "] keywords = [] edition = "2021" publish = false +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + [dependencies] async-trait = "0.1" rand_core = "0.6" thiserror = "1" -hex = "0.4" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" - -sha3 = "0.10" -blake2 = "0.10" - group = "0.12" -k256 = { version = "0.11", features = ["arithmetic", "keccak256", "ecdsa"] } + curve25519-dalek = { version = "3", features = ["std"] } transcript = { package = "flexible-transcript", path = "../crypto/transcript", features = ["recommended"] } dalek-ff-group = { path = "../crypto/dalek-ff-group" } -frost = { package = "modular-frost", path = "../crypto/frost", features = ["secp256k1", "ed25519"] } +frost = { package = "modular-frost", path = "../crypto/frost", features = ["ed25519"] } monero-serai = { path = "../coins/monero", features = ["multisig"] } [dev-dependencies] -group = "0.12" +rand_core = "0.6" + +hex = "0.4" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" + futures = "0.3" tokio = { version = "1", features = ["full"] } + +frost = { package = "modular-frost", path = "../crypto/frost", features = ["ed25519", "tests"] } diff --git a/processor/src/coin/mod.rs b/processor/src/coin/mod.rs index 88d9d98c..6420faff 100644 --- a/processor/src/coin/mod.rs +++ b/processor/src/coin/mod.rs @@ -47,19 +47,22 @@ pub trait Coin { // Doesn't have to take self, enables some level of caching which is pleasant fn address(&self, key: ::G) -> Self::Address; - async fn get_height(&self) -> Result; - async fn get_block(&self, height: usize) -> Result; + async fn get_latest_block_number(&self) -> Result; + async fn get_block(&self, number: usize) -> Result; async fn get_outputs( &self, block: &Self::Block, key: ::G, ) -> Result, CoinError>; + // TODO: Remove + async fn is_confirmed(&self, tx: &[u8]) -> Result; + async fn prepare_send( &self, keys: FrostKeys, transcript: RecommendedTranscript, - height: usize, + block_number: usize, inputs: Vec, payments: &[(Self::Address, u64)], fee: Self::Fee, @@ -76,6 +79,9 @@ pub trait Coin { tx: &Self::Transaction, ) -> Result<(Vec, Vec<::Id>), CoinError>; + #[cfg(test)] + async fn get_fee(&self) -> Self::Fee; + #[cfg(test)] async fn mine_block(&self); diff --git a/processor/src/coin/monero.rs b/processor/src/coin/monero.rs index 436caa12..6643c466 100644 --- a/processor/src/coin/monero.rs +++ b/processor/src/coin/monero.rs @@ -18,8 +18,8 @@ use monero_serai::{ }; use crate::{ + additional_key, coin::{CoinError, Output as OutputTrait, Coin}, - view_key, }; #[derive(Clone, Debug)] @@ -54,12 +54,13 @@ impl OutputTrait for Output { } #[derive(Debug)] -pub struct SignableTransaction( - FrostKeys, - RecommendedTranscript, - usize, - MSignableTransaction, -); +pub struct SignableTransaction { + keys: FrostKeys, + transcript: RecommendedTranscript, + // Monero height, defined as the length of the chain + height: usize, + actual: MSignableTransaction, +} #[derive(Clone, Debug)] pub struct Monero { @@ -69,7 +70,7 @@ pub struct Monero { impl Monero { pub async fn new(url: String) -> Monero { - Monero { rpc: Rpc::new(url), view: view_key::(0).0 } + Monero { rpc: Rpc::new(url), view: additional_key::(0).0 } } fn scanner(&self, spend: dfg::EdwardsPoint) -> Scanner { @@ -121,12 +122,13 @@ impl Coin for Monero { self.scanner(key).address() } - async fn get_height(&self) -> Result { - self.rpc.get_height().await.map_err(|_| CoinError::ConnectionError) + async fn get_latest_block_number(&self) -> Result { + // Monero defines height as chain length, so subtract 1 for block number + Ok(self.rpc.get_height().await.map_err(|_| CoinError::ConnectionError)? - 1) } - async fn get_block(&self, height: usize) -> Result { - self.rpc.get_block(height).await.map_err(|_| CoinError::ConnectionError) + async fn get_block(&self, number: usize) -> Result { + self.rpc.get_block(number).await.map_err(|_| CoinError::ConnectionError) } async fn get_outputs( @@ -147,21 +149,27 @@ impl Coin for Monero { ) } + async fn is_confirmed(&self, tx: &[u8]) -> Result { + let tx_block_number = + self.rpc.get_transaction_block_number(tx).await.map_err(|_| CoinError::ConnectionError)?; + Ok((self.get_latest_block_number().await?.saturating_sub(tx_block_number) + 1) >= 10) + } + async fn prepare_send( &self, keys: FrostKeys, transcript: RecommendedTranscript, - height: usize, + block_number: usize, mut inputs: Vec, payments: &[(Address, u64)], fee: Fee, ) -> Result { let spend = keys.group_key(); - Ok(SignableTransaction( + Ok(SignableTransaction { keys, transcript, - height, - MSignableTransaction::new( + height: block_number + 1, + actual: MSignableTransaction::new( self.rpc.get_protocol().await.unwrap(), // TODO: Make this deterministic inputs.drain(..).map(|input| input.0).collect(), payments.to_vec(), @@ -170,7 +178,7 @@ impl Coin for Monero { fee, ) .map_err(|_| CoinError::ConnectionError)?, - )) + }) } async fn attempt_send( @@ -179,13 +187,13 @@ impl Coin for Monero { included: &[u16], ) -> Result { transaction - .3 + .actual .clone() .multisig( &self.rpc, - transaction.0.clone(), - transaction.1.clone(), - transaction.2, + transaction.keys.clone(), + transaction.transcript.clone(), + transaction.height, included.to_vec(), ) .await @@ -201,6 +209,11 @@ impl Coin for Monero { Ok((tx.hash().to_vec(), tx.prefix.outputs.iter().map(|output| output.key.to_bytes()).collect())) } + #[cfg(test)] + async fn get_fee(&self) -> Self::Fee { + self.rpc.get_fee().await.unwrap() + } + #[cfg(test)] async fn mine_block(&self) { #[derive(serde::Deserialize, Debug)] @@ -225,7 +238,7 @@ impl Coin for Monero { async fn test_send(&self, address: Self::Address) { use rand_core::OsRng; - let height = self.get_height().await.unwrap(); + let new_block = self.get_latest_block_number().await.unwrap() + 1; self.mine_block().await; for _ in 0 .. 7 { @@ -233,7 +246,7 @@ impl Coin for Monero { } let outputs = Self::empty_scanner() - .scan(&self.rpc, &self.rpc.get_block(height).await.unwrap()) + .scan(&self.rpc, &self.rpc.get_block(new_block).await.unwrap()) .await .unwrap() .swap_remove(0) diff --git a/processor/src/lib.rs b/processor/src/lib.rs index 58346e0e..45583dc2 100644 --- a/processor/src/lib.rs +++ b/processor/src/lib.rs @@ -7,6 +7,7 @@ use frost::{curve::Curve, FrostError}; mod coin; use coin::{CoinError, Coin}; + mod wallet; #[cfg(test)] @@ -30,9 +31,10 @@ pub enum SignError { NetworkError(NetworkError), } -// Generate a static view key for a given chain in a globally consistent manner +// Generate a static additional key for a given chain in a globally consistent manner // Doesn't consider the current group key to increase the simplicity of verifying Serai's status -// Takes an index, k, for more modern privacy protocols which use multiple view keys -pub fn view_key(k: u64) -> ::F { - C::Curve::hash_to_F(b"Serai DEX View Key", &[C::ID, &k.to_le_bytes()].concat()) +// Takes an index, k, to support protocols which use multiple secondary keys +// Presumably a view key +pub(crate) fn additional_key(k: u64) -> ::F { + C::Curve::hash_to_F(b"Serai DEX Additional Key", &[C::ID, &k.to_le_bytes()].concat()) } diff --git a/processor/src/tests/mod.rs b/processor/src/tests/mod.rs index c27c373a..27cd8f31 100644 --- a/processor/src/tests/mod.rs +++ b/processor/src/tests/mod.rs @@ -59,9 +59,9 @@ impl Network for LocalNetwork { } async fn test_send(coin: C, fee: C::Fee) { - // Mine a block so there's a confirmed height + // Mine blocks so there's a confirmed block coin.mine_block().await; - let height = coin.get_height().await.unwrap(); + let latest = coin.get_latest_block_number().await.unwrap(); let mut keys = frost::tests::key_gen::<_, C::Curve>(&mut OsRng); let threshold = keys[&1].params().t(); @@ -70,13 +70,13 @@ async fn test_send(coin: C, fee: C::Fee) { let mut wallets = vec![]; for i in 1 ..= threshold { let mut wallet = Wallet::new(MemCoinDb::new(), coin.clone()); - wallet.acknowledge_height(0, height); + wallet.acknowledge_block(0, latest); wallet.add_keys(&WalletKeys::new(keys.remove(&i).unwrap(), 0)); wallets.push(wallet); } - // Get the chain to a height where blocks have sufficient confirmations - while (height + C::CONFIRMATIONS) > coin.get_height().await.unwrap() { + // Get the chain to a length where blocks have sufficient confirmations + while (latest + (C::CONFIRMATIONS - 1)) > coin.get_latest_block_number().await.unwrap() { coin.mine_block().await; } @@ -91,8 +91,8 @@ async fn test_send(coin: C, fee: C::Fee) { for (network, wallet) in networks.iter_mut().zip(wallets.iter_mut()) { wallet.poll().await.unwrap(); - let height = coin.get_height().await.unwrap(); - wallet.acknowledge_height(1, height - 10); + let latest = coin.get_latest_block_number().await.unwrap(); + wallet.acknowledge_block(1, latest - (C::CONFIRMATIONS - 1)); let signable = wallet .prepare_sends(1, vec![(wallet.address(), 10000000000)], fee) .await @@ -112,6 +112,6 @@ async fn test_send(coin: C, fee: C::Fee) { #[tokio::test] async fn monero() { let monero = Monero::new("http://127.0.0.1:18081".to_string()).await; - let fee = monero.rpc.get_fee().await.unwrap(); + let fee = monero.get_fee().await; test_send(monero, fee).await; } diff --git a/processor/src/wallet.rs b/processor/src/wallet.rs index d12614fa..b2496e8a 100644 --- a/processor/src/wallet.rs +++ b/processor/src/wallet.rs @@ -18,12 +18,12 @@ use crate::{ pub struct WalletKeys { keys: FrostKeys, - creation_height: usize, + creation_block: usize, } impl WalletKeys { - pub fn new(keys: FrostKeys, creation_height: usize) -> WalletKeys { - WalletKeys { keys, creation_height } + pub fn new(keys: FrostKeys, creation_block: usize) -> WalletKeys { + WalletKeys { keys, creation_block } } // Bind this key to a specific network by applying an additive offset @@ -45,42 +45,42 @@ impl WalletKeys { } pub trait CoinDb { - // Set a height as scanned to - fn scanned_to_height(&mut self, height: usize); - // Acknowledge a given coin height for a canonical height - fn acknowledge_height(&mut self, canonical: usize, height: usize); + // Set a block as scanned to + fn scanned_to_block(&mut self, block: usize); + // Acknowledge a specific block number as part of a canonical block + fn acknowledge_block(&mut self, canonical: usize, block: usize); // Adds an output to the DB. Returns false if the output was already added fn add_output(&mut self, output: &O) -> bool; - // Height this coin has been scanned to - fn scanned_height(&self) -> usize; - // Acknowledged height for a given canonical height - fn acknowledged_height(&self, canonical: usize) -> usize; + // Block this coin has been scanned to (inclusive) + fn scanned_block(&self) -> usize; + // Acknowledged block for a given canonical block + fn acknowledged_block(&self, canonical: usize) -> usize; } pub struct MemCoinDb { // Height this coin has been scanned to - scanned_height: usize, - // Acknowledged height for a given canonical height - acknowledged_heights: HashMap, + scanned_block: usize, + // Acknowledged block for a given canonical block + acknowledged_blocks: HashMap, outputs: HashMap, Vec>, } impl MemCoinDb { pub fn new() -> MemCoinDb { - MemCoinDb { scanned_height: 0, acknowledged_heights: HashMap::new(), outputs: HashMap::new() } + MemCoinDb { scanned_block: 0, acknowledged_blocks: HashMap::new(), outputs: HashMap::new() } } } impl CoinDb for MemCoinDb { - fn scanned_to_height(&mut self, height: usize) { - self.scanned_height = height; + fn scanned_to_block(&mut self, block: usize) { + self.scanned_block = block; } - fn acknowledge_height(&mut self, canonical: usize, height: usize) { - debug_assert!(!self.acknowledged_heights.contains_key(&canonical)); - self.acknowledged_heights.insert(canonical, height); + fn acknowledge_block(&mut self, canonical: usize, block: usize) { + debug_assert!(!self.acknowledged_blocks.contains_key(&canonical)); + self.acknowledged_blocks.insert(canonical, block); } fn add_output(&mut self, output: &O) -> bool { @@ -96,12 +96,12 @@ impl CoinDb for MemCoinDb { true } - fn scanned_height(&self) -> usize { - self.scanned_height + fn scanned_block(&self) -> usize { + self.scanned_block } - fn acknowledged_height(&self, canonical: usize) -> usize { - self.acknowledged_heights[&canonical] + fn acknowledged_block(&self, canonical: usize) -> usize { + self.acknowledged_blocks[&canonical] } } @@ -212,36 +212,38 @@ impl Wallet { Wallet { db, coin, keys: vec![], pending: vec![] } } - pub fn scanned_height(&self) -> usize { - self.db.scanned_height() + pub fn scanned_block(&self) -> usize { + self.db.scanned_block() } - pub fn acknowledge_height(&mut self, canonical: usize, height: usize) { - self.db.acknowledge_height(canonical, height); - if height > self.db.scanned_height() { - self.db.scanned_to_height(height); - } + pub fn acknowledge_block(&mut self, canonical: usize, block: usize) { + self.db.acknowledge_block(canonical, block); } - pub fn acknowledged_height(&self, canonical: usize) -> usize { - self.db.acknowledged_height(canonical) + pub fn acknowledged_block(&self, canonical: usize) -> usize { + self.db.acknowledged_block(canonical) } pub fn add_keys(&mut self, keys: &WalletKeys) { - // Doesn't use +1 as this is height, not block index, and poll moves by block index - self.pending.push((self.acknowledged_height(keys.creation_height), keys.bind(C::ID))); + self.pending.push((self.acknowledged_block(keys.creation_block), keys.bind(C::ID))); } pub fn address(&self) -> C::Address { self.coin.address(self.keys[self.keys.len() - 1].0.group_key()) } + // TODO: Remove + pub async fn is_confirmed(&mut self, tx: &[u8]) -> Result { + self.coin.is_confirmed(tx).await + } + pub async fn poll(&mut self) -> Result<(), CoinError> { - if self.coin.get_height().await? < C::CONFIRMATIONS { + if self.coin.get_latest_block_number().await? < (C::CONFIRMATIONS - 1) { return Ok(()); } - let confirmed_block = self.coin.get_height().await? - C::CONFIRMATIONS; + let confirmed_block = self.coin.get_latest_block_number().await? - (C::CONFIRMATIONS - 1); - for b in self.scanned_height() ..= confirmed_block { - // If any keys activated at this height, shift them over + // Will never scan the genesis block, which shouldn't be an issue + for b in (self.scanned_block() + 1) ..= confirmed_block { + // If any keys activated at this block, shift them over { let mut k = 0; while k < self.pending.len() { @@ -269,8 +271,7 @@ impl Wallet { ); } - // Blocks are zero-indexed while heights aren't - self.db.scanned_to_height(b + 1); + self.db.scanned_to_block(b); } Ok(()) @@ -291,7 +292,7 @@ impl Wallet { return Ok((vec![], vec![])); } - let acknowledged_height = self.acknowledged_height(canonical); + let acknowledged_block = self.acknowledged_block(canonical); // TODO: Log schedule outputs when MAX_OUTPUTS is lower than payments.len() // Payments is the first set of TXs in the schedule @@ -313,16 +314,16 @@ impl Wallet { // Create the transcript for this transaction let mut transcript = RecommendedTranscript::new(b"Serai Processor Wallet Send"); transcript - .append_message(b"canonical_height", &u64::try_from(canonical).unwrap().to_le_bytes()); + .append_message(b"canonical_block", &u64::try_from(canonical).unwrap().to_le_bytes()); transcript.append_message( - b"acknowledged_height", - &u64::try_from(acknowledged_height).unwrap().to_le_bytes(), + b"acknowledged_block", + &u64::try_from(acknowledged_block).unwrap().to_le_bytes(), ); transcript.append_message(b"index", &u64::try_from(txs.len()).unwrap().to_le_bytes()); let tx = self .coin - .prepare_send(keys.clone(), transcript, acknowledged_height, inputs, &outputs, fee) + .prepare_send(keys.clone(), transcript, acknowledged_block, inputs, &outputs, fee) .await?; // self.db.save_tx(tx) // TODO txs.push(tx); diff --git a/substrate/consensus/Cargo.toml b/substrate/consensus/Cargo.toml index 5296dcee..892b648e 100644 --- a/substrate/consensus/Cargo.toml +++ b/substrate/consensus/Cargo.toml @@ -3,10 +3,15 @@ name = "serai-consensus" version = "0.1.0" description = "Serai consensus module" license = "AGPL-3.0-only" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/consensus" authors = ["Luke Parker "] edition = "2021" publish = false +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + [dependencies] sp-core = { git = "https://github.com/serai-dex/substrate" } sp-trie = { git = "https://github.com/serai-dex/substrate" } diff --git a/substrate/node/Cargo.toml b/substrate/node/Cargo.toml index cc0d2a09..58c50785 100644 --- a/substrate/node/Cargo.toml +++ b/substrate/node/Cargo.toml @@ -3,6 +3,7 @@ name = "serai-node" version = "0.1.0" description = "Serai network node, built over Substrate" license = "AGPL-3.0-only" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/node" authors = ["Luke Parker "] edition = "2021" publish = false @@ -11,7 +12,7 @@ publish = false name = "serai-node" [dependencies] -clap = { version = "3.1.18", features = ["derive"] } +clap = { version = "4", features = ["derive"] } sc-cli = { git = "https://github.com/serai-dex/substrate", features = ["wasmtime"] } sp-core = { git = "https://github.com/serai-dex/substrate" } @@ -31,7 +32,7 @@ frame-system = { git = "https://github.com/serai-dex/substrate" } pallet-transaction-payment = { git = "https://github.com/serai-dex/substrate", default-features = false } # These dependencies are used for the node template's RPCs -jsonrpsee = { version = "0.15.1", features = ["server"] } +jsonrpsee = { version = "0.15", features = ["server"] } sc-rpc = { git = "https://github.com/serai-dex/substrate" } sp-api = { git = "https://github.com/serai-dex/substrate" } sc-rpc-api = { git = "https://github.com/serai-dex/substrate" } @@ -39,7 +40,6 @@ sp-blockchain = { git = "https://github.com/serai-dex/substrate" } sp-block-builder = { git = "https://github.com/serai-dex/substrate" } substrate-frame-rpc-system = { git = "https://github.com/serai-dex/substrate" } pallet-transaction-payment-rpc = { git = "https://github.com/serai-dex/substrate" } -pallet-contracts-rpc = { git = "https://github.com/serai-dex/substrate", package = "pallet-contracts-rpc" } # These dependencies are used for runtime benchmarking frame-benchmarking = { git = "https://github.com/serai-dex/substrate" } diff --git a/substrate/node/src/rpc.rs b/substrate/node/src/rpc.rs index 814877a4..6c961fc7 100644 --- a/substrate/node/src/rpc.rs +++ b/substrate/node/src/rpc.rs @@ -9,7 +9,7 @@ use sp_api::ProvideRuntimeApi; pub use sc_rpc_api::DenyUnsafe; -use serai_runtime::{BlockNumber, Hash, opaque::Block, AccountId, Balance, Index}; +use serai_runtime::{opaque::Block, AccountId, Balance, Index}; pub struct FullDeps { pub client: Arc, @@ -31,19 +31,16 @@ pub fn create_full< where C::Api: substrate_frame_rpc_system::AccountNonceApi + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi - + pallet_contracts_rpc::ContractsRuntimeApi + BlockBuilder, { use substrate_frame_rpc_system::{System, SystemApiServer}; use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; - use pallet_contracts_rpc::{Contracts, ContractsApiServer}; let mut module = RpcModule::new(()); let FullDeps { client, pool, deny_unsafe } = deps; module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; - module.merge(Contracts::new(client).into_rpc())?; Ok(module) } diff --git a/substrate/runtime/Cargo.toml b/substrate/runtime/Cargo.toml index 1faeb370..048039c8 100644 --- a/substrate/runtime/Cargo.toml +++ b/substrate/runtime/Cargo.toml @@ -3,15 +3,19 @@ name = "serai-runtime" version = "0.1.0" description = "Serai network node runtime, built over Substrate" license = "AGPL-3.0-only" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/runtime" authors = ["Luke Parker "] edition = "2021" -publish = false + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] [dependencies] hex-literal = { version = "0.3.4", optional = true } -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"] } sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false } @@ -35,7 +39,6 @@ pallet-transaction-payment = { git = "https://github.com/serai-dex/substrate", d pallet-contracts-primitives = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-contracts = { git = "https://github.com/serai-dex/substrate", default-features = false } -pallet-contracts-rpc-runtime-api = { git = "https://github.com/serai-dex/substrate", default-features = false } # Used for the node template's RPCs frame-system-rpc-runtime-api = { git = "https://github.com/serai-dex/substrate", default-features = false } @@ -77,7 +80,6 @@ std = [ "pallet-contracts/std", "pallet-contracts-primitives/std", - "pallet-contracts-rpc-runtime-api/std", ] runtime-benchmarks = [ diff --git a/substrate/runtime/src/lib.rs b/substrate/runtime/src/lib.rs index a78dc8a9..bc6de59f 100644 --- a/substrate/runtime/src/lib.rs +++ b/substrate/runtime/src/lib.rs @@ -19,7 +19,7 @@ use sp_version::RuntimeVersion; use frame_support::{ traits::{ConstU8, ConstU32, ConstU64}, weights::{ - constants::{RocksDbWeight, ExtrinsicBaseWeight, BlockExecutionWeight, WEIGHT_PER_SECOND}, + constants::{RocksDbWeight, WEIGHT_PER_SECOND}, IdentityFee, Weight, }, dispatch::DispatchClass, @@ -30,7 +30,6 @@ pub use frame_system::Call as SystemCall; pub use pallet_timestamp::Call as TimestampCall; pub use pallet_balances::Call as BalancesCall; use pallet_transaction_payment::CurrencyAdapter; -use pallet_contracts::DefaultContractAccessWeight; /// An index to a block. pub type BlockNumber = u32; @@ -92,17 +91,6 @@ pub fn native_version() -> NativeVersion { const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); -/// We assume that ~10% of the block weight is consumed by `on_initialize` handlers. -/// This is used to limit the maximal weight of a single extrinsic. -const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); - -/// We allow for 2 seconds of compute with a 6 second average block time. -const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_ref_time(2 * WEIGHT_PER_SECOND.ref_time()); - -// Prints debug output of the `contracts` pallet to stdout if the node is -// started with `-lruntime::contracts=debug`. -const CONTRACTS_DEBUG_OUTPUT: bool = true; - // Unit = the base number of indivisible units for balances const UNIT: Balance = 1_000_000_000_000; const MILLIUNIT: Balance = 1_000_000_000; @@ -121,24 +109,10 @@ parameter_types! { pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength::max_with_normal_ratio(1024 * 1024, NORMAL_DISPATCH_RATIO); pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::builder() - .base_block(BlockExecutionWeight::get()) - .for_class(DispatchClass::all(), |weights| { - weights.base_extrinsic = ExtrinsicBaseWeight::get(); - }) - .for_class(DispatchClass::Normal, |weights| { - weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); - }) - .for_class(DispatchClass::Operational, |weights| { - weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); - // Operational transactions have some extra reserved space, so that they - // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. - weights.reserved = Some( - MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT - ); - }) - .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) - .build_or_panic(); + frame_system::limits::BlockWeights::with_sensible_defaults( + (2u64 * WEIGHT_PER_SECOND).set_proof_size(u64::MAX), + NORMAL_DISPATCH_RATIO, + ); pub const DepositPerItem: Balance = deposit(1, 0); pub const DepositPerByte: Balance = deposit(0, 1); @@ -236,7 +210,6 @@ impl pallet_contracts::Config for Runtime { type DeletionWeightLimit = DeletionWeightLimit; type Schedule = Schedule; type AddressGenerator = pallet_contracts::DefaultAddressGenerator; - type ContractAccessWeight = DefaultContractAccessWeight; type MaxCodeLen = ConstU32<{ 128 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; @@ -388,63 +361,4 @@ sp_api::impl_runtime_apis! { TransactionPayment::query_fee_details(uxt, len) } } - - impl pallet_contracts_rpc_runtime_api::ContractsApi - for Runtime - { - fn call( - origin: AccountId, - dest: AccountId, - value: Balance, - gas_limit: u64, - storage_deposit_limit: Option, - input_data: Vec, - ) -> pallet_contracts_primitives::ContractExecResult { - Contracts::bare_call( - origin, - dest, - value, - Weight::from_ref_time(gas_limit), - storage_deposit_limit, - input_data, - CONTRACTS_DEBUG_OUTPUT - ) - } - - fn instantiate( - origin: AccountId, - value: Balance, - gas_limit: u64, - storage_deposit_limit: Option, - code: pallet_contracts_primitives::Code, - data: Vec, - salt: Vec, - ) -> pallet_contracts_primitives::ContractInstantiateResult { - Contracts::bare_instantiate( - origin, - value, - Weight::from_ref_time(gas_limit), - storage_deposit_limit, - code, - data, - salt, - CONTRACTS_DEBUG_OUTPUT - ) - } - - fn upload_code( - origin: AccountId, - code: Vec, - storage_deposit_limit: Option, - ) -> pallet_contracts_primitives::CodeUploadResult { - Contracts::bare_upload_code(origin, code, storage_deposit_limit) - } - - fn get_storage( - address: AccountId, - key: Vec, - ) -> pallet_contracts_primitives::GetStorageResult { - Contracts::get_storage(address, key) - } - } }