From c507ab9fd610611ce6d06299856b6737c97f2ec5 Mon Sep 17 00:00:00 2001 From: Justin Berman Date: Thu, 11 Jan 2024 02:15:11 -0600 Subject: [PATCH 01/17] monero: match varint decoding (#513) * monero: match varint decoding * Fix build and clippy --- coins/monero/src/serialize.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/coins/monero/src/serialize.rs b/coins/monero/src/serialize.rs index fe7ca28fe..916f306f7 100644 --- a/coins/monero/src/serialize.rs +++ b/coins/monero/src/serialize.rs @@ -12,11 +12,21 @@ use curve25519_dalek::{ const VARINT_CONTINUATION_MASK: u8 = 0b1000_0000; mod sealed { - pub trait VarInt: TryInto + TryFrom + Copy {} - impl VarInt for u8 {} - impl VarInt for u32 {} - impl VarInt for u64 {} - impl VarInt for usize {} + pub trait VarInt: TryInto + TryFrom + Copy { + const BITS: usize; + } + impl VarInt for u8 { + const BITS: usize = 8; + } + impl VarInt for u32 { + const BITS: usize = 32; + } + impl VarInt for u64 { + const BITS: usize = 64; + } + impl VarInt for usize { + const BITS: usize = core::mem::size_of::() * 8; + } } // This will panic if the VarInt exceeds u64::MAX @@ -102,7 +112,7 @@ pub(crate) fn read_varint(r: &mut R) -> io::Result 64) && (b >= (1 << (64 - bits))) { + if ((bits + 7) >= U::BITS) && (b >= (1 << (U::BITS - bits))) { Err(io::Error::other("varint overflow"))?; } From 9c06cbccadde0c08db60c3bd5fddf4d30e7dbee0 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Tue, 16 Jan 2024 12:06:01 -0500 Subject: [PATCH 02/17] Document immunity to https://github.com/paritytech/polkadot-sdk/issues/2947 now that I have permission to disclose it --- substrate/primitives/src/tx.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/substrate/primitives/src/tx.rs b/substrate/primitives/src/tx.rs index 2b1e1e84a..b97ec3a2f 100644 --- a/substrate/primitives/src/tx.rs +++ b/substrate/primitives/src/tx.rs @@ -21,6 +21,8 @@ impl< { } +// We use our own Transaction struct, over UncheckedExtrinsic, for more control, a bit more +// simplicity, and in order to be immune to https://github.com/paritytech/polkadot-sdk/issues/2947 #[allow(private_bounds)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)] pub struct Transaction { From 6691f1629205eb808cd818bf1578b5a948c97b4f Mon Sep 17 00:00:00 2001 From: akildemir Date: Mon, 8 Jan 2024 23:32:13 +0300 Subject: [PATCH 03/17] remove mach patch --- Cargo.lock | 9 +-------- Cargo.toml | 4 ---- patches/mach/Cargo.toml | 17 ----------------- patches/mach/src/lib.rs | 2 -- 4 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 patches/mach/Cargo.toml delete mode 100644 patches/mach/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 144cf0418..42608f5ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4014,15 +4014,8 @@ dependencies = [ [[package]] name = "mach" version = "0.3.2" -dependencies = [ - "mach2", -] - -[[package]] -name = "mach2" -version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" dependencies = [ "libc", ] diff --git a/Cargo.toml b/Cargo.toml index 8bd7bec54..cfdf13ebd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,7 +72,6 @@ members = [ "patches/matches", "patches/option-ext", "patches/directories-next", - "patches/mach", "patches/proc-macro-crate", ] @@ -116,9 +115,6 @@ matches = { path = "patches/matches" } option-ext = { path = "patches/option-ext" } directories-next = { path = "patches/directories-next" } -# mach is unmaintained, so this wraps mach2 as mach -mach = { path = "patches/mach" } - # proc-macro-crate 2 binds to an old version of toml for msrv so we patch to 3 proc-macro-crate = { path = "patches/proc-macro-crate" } diff --git a/patches/mach/Cargo.toml b/patches/mach/Cargo.toml deleted file mode 100644 index bf2da1ff1..000000000 --- a/patches/mach/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "mach" -version = "0.3.2" -description = "Replacement for mach which uses the mach2 implementation" -license = "MIT" -repository = "https://github.com/serai-dex/serai/tree/develop/patches/mach" -authors = ["Luke Parker "] -keywords = [] -edition = "2021" -rust-version = "1.56" - -[package.metadata.docs.rs] -all-features = true -rustdoc-args = ["--cfg", "docsrs"] - -[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies] -mach2 = "0.4" diff --git a/patches/mach/src/lib.rs b/patches/mach/src/lib.rs deleted file mode 100644 index e7e1a5a22..000000000 --- a/patches/mach/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[cfg(any(target_os = "macos", target_os = "ios"))] -pub use mach2::*; From 9d3d47fc9fbdd5402871e611ece219e036d705fb Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Tue, 16 Jan 2024 19:32:30 -0500 Subject: [PATCH 04/17] hyper-rustls 0.26 (#519) * hyper-rustls 0.25 This isn't worth it until our dependencies update to rustls 0.22 as well. * hyper-rustls 0.26 and hyper 1.0 --- Cargo.lock | 737 +++++++++++++++++++-------------- common/request/Cargo.toml | 8 +- common/request/src/lib.rs | 29 +- common/request/src/request.rs | 9 +- common/request/src/response.rs | 5 +- 5 files changed, 455 insertions(+), 333 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 42608f5ab..b5a9e7634 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,9 +125,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba" dependencies = [ "anstyle", "anstyle-parse", @@ -262,9 +262,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.2.2" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7" +checksum = "fb41eb19024a91746eba0773aa5e16036045bbf45733766661099e182ea6a744" dependencies = [ "async-lock", "cfg-if", @@ -281,11 +281,11 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" +checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ - "event-listener 4.0.1", + "event-listener 4.0.3", "event-listener-strategy", "pin-project-lite 0.2.13", ] @@ -298,7 +298,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -309,7 +309,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -342,7 +342,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" dependencies = [ - "http", + "http 0.2.11", "log", "url", ] @@ -410,9 +410,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -462,14 +462,14 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "bitcoin" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5973a027b341b462105675962214dfe3c938ad9afd395d84b28602608bdcec7b" +checksum = "fd00f3c09b5f21fb357abe32d29946eb8bb7a0862bae62c0b5e4a692acbbe73c" dependencies = [ "bech32", "bitcoin-internals", @@ -636,14 +636,14 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f03db470b3c0213c47e978da93200259a1eb4dae2e5512cba9955e2b540a6fc6" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bollard-stubs", "bytes", "futures-core", "futures-util", "hex", - "http", - "hyper", + "http 0.2.11", + "hyper 0.14.28", "hyperlocal", "log", "pin-project-lite 0.2.13", @@ -672,9 +672,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" +checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" dependencies = [ "borsh-derive", "cfg_aliases", @@ -682,15 +682,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" +checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" dependencies = [ "once_cell", - "proc-macro-crate 2.0.1", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", "syn_derive", ] @@ -949,9 +949,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.12" +version = "4.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" +checksum = "80932e03c33999b9235edb8655bc9df3204adc9887c2f95b50cb1deb9fd54253" dependencies = [ "clap_builder", "clap_derive", @@ -959,9 +959,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.12" +version = "4.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +checksum = "d6c0db58c659eef1c73e444d298c27322a1b52f6927d2ad470c0c0f96fa7b8fa" dependencies = [ "anstream", "anstyle", @@ -978,7 +978,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -1101,9 +1101,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -1227,34 +1227,28 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.17" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crunchy" @@ -1321,14 +1315,14 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "cxx" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ed3a27153f220bb42b96005947ca3b87266cfdae5b4b4d703642c3a565e9708" +checksum = "8de00f15a6fa069c99b88c5c78c4541d0e7899a33b86f7480e23df2431fce0bc" dependencies = [ "cc", "cxxbridge-flags", @@ -1338,9 +1332,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "005721caedeb9869792e656d567695281c7e2bf2ac022d4ed95e5240b215f44d" +checksum = "0a71e1e631fa2f2f5f92e8b0d860a00c198c6771623a6cefcc863e3554f0d8d6" dependencies = [ "cc", "codespan-reporting", @@ -1348,24 +1342,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "cxxbridge-flags" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6981d27196cca89f82c8a89fd495cca25066d2933c974e907f7c3699801e112" +checksum = "6f3fed61d56ba497c4efef9144dfdbaa25aa58f2f6b3a7cf441d4591c583745c" [[package]] name = "cxxbridge-macro" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca7e7d41b675af76ee4844e8e4c1cec70b65555dbc4852eae7b11c9cd5525d60" +checksum = "8908e380a8efd42150c017b0cfa31509fc49b6d47f7cb6b33e93ffb8f4e3661e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -1551,7 +1545,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -1597,7 +1591,7 @@ source = "git+https://github.com/kayabaNerve/dockertest-rs?branch=arc#c0ea779970 dependencies = [ "anyhow", "async-trait", - "base64 0.21.5", + "base64 0.21.7", "bollard", "dyn-clone", "futures", @@ -1751,7 +1745,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "hex", "k256", @@ -1784,7 +1778,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -1927,7 +1921,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.47", + "syn 2.0.48", "toml 0.7.8", "walkdir", ] @@ -1945,7 +1939,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -1971,7 +1965,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.47", + "syn 2.0.48", "tempfile", "thiserror", "tiny-keccak", @@ -1986,7 +1980,7 @@ checksum = "6838fa110e57d572336178b7c79e94ff88ef976306852d8cb87d9e5b1fc7c0b5" dependencies = [ "async-trait", "auto_impl", - "base64 0.21.5", + "base64 0.21.7", "bytes", "const-hex", "enr", @@ -1995,7 +1989,7 @@ dependencies = [ "futures-timer", "futures-util", "hashers", - "http", + "http 0.2.11", "instant", "jsonwebtoken", "once_cell", @@ -2022,9 +2016,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "4.0.1" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f2cdcf274580f2d63697192d744727b3198894b1bf02923643bf59e2c26712" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" dependencies = [ "concurrent-queue", "parking", @@ -2037,7 +2031,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" dependencies = [ - "event-listener 4.0.1", + "event-listener 4.0.3", "pin-project-lite 0.2.13", ] @@ -2060,7 +2054,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -2212,7 +2206,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", ] @@ -2235,7 +2229,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-support", "frame-support-procedural", @@ -2260,7 +2254,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-support", "frame-system", @@ -2289,7 +2283,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "bitflags 1.3.2", "environmental", @@ -2322,7 +2316,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "Inflector", "cfg-expr", @@ -2334,35 +2328,35 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "cfg-if", "frame-support", @@ -2381,7 +2375,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "sp-api", @@ -2390,7 +2384,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-support", "parity-scale-codec", @@ -2499,9 +2493,9 @@ checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" +checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" dependencies = [ "futures-core", "pin-project-lite 0.2.13", @@ -2515,7 +2509,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -2525,7 +2519,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35bd3cf68c183738046838e300353e4716c674dc5e56890de4826801a6622a28" dependencies = [ "futures-io", - "rustls", + "rustls 0.21.10", ] [[package]] @@ -2636,9 +2630,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -2716,16 +2710,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.11", "indexmap 2.1.0", "slab", "tokio", @@ -2876,6 +2870,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -2883,7 +2888,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.11", + "pin-project-lite 0.2.13", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.0.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", "pin-project-lite 0.2.13", ] @@ -2922,8 +2950,8 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.11", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -2935,20 +2963,60 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "httparse", + "itoa", + "pin-project-lite 0.2.13", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", - "http", - "hyper", - "log", - "rustls", + "http 1.0.0", + "hyper 1.1.0", + "hyper-util", + "rustls 0.22.2", "rustls-native-certs", + "rustls-pki-types", "tokio", "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "hyper 1.1.0", + "pin-project-lite 0.2.13", + "socket2 0.5.5", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -2959,7 +3027,7 @@ checksum = "0fafdf7b2b2de7c9784f76e02c0935e65a8117ec3b768644379983ab333ac98c" dependencies = [ "futures-util", "hex", - "hyper", + "hyper 0.14.28", "pin-project", "tokio", ] @@ -3039,16 +3107,16 @@ dependencies = [ [[package]] name = "igd-next" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e065e90a518ab5fedf79aa1e4b784e10f8e484a834f6bda85c42633a2cb7af" +checksum = "064d90fec10d541084e7b39ead8875a5a80d9114a2b18791565253bae25f49e4" dependencies = [ "async-trait", "attohttpc", "bytes", "futures", - "http", - "hyper", + "http 0.2.11", + "hyper 0.14.28", "log", "rand", "tokio", @@ -3204,9 +3272,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -3237,7 +3305,7 @@ dependencies = [ "futures-channel", "futures-util", "globset", - "hyper", + "hyper 0.14.28", "jsonrpsee-types", "parking_lot 0.12.1", "rand", @@ -3271,8 +3339,8 @@ checksum = "cf4d945a6008c9b03db3354fb3c83ee02d2faa9f2e755ec1dfb69c3551b8f4ba" dependencies = [ "futures-channel", "futures-util", - "http", - "hyper", + "http 0.2.11", + "hyper 0.14.28", "jsonrpsee-core", "jsonrpsee-types", "serde", @@ -3305,7 +3373,7 @@ version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "pem", "ring 0.16.20", "serde", @@ -3315,9 +3383,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", "ecdsa", @@ -3329,9 +3397,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] @@ -3391,9 +3459,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libloading" @@ -3524,7 +3592,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1f9624e2a843b655f1c1b8262b8d5de6f309413fca4d66f01bb0662429f84dc" dependencies = [ "asynchronous-codec", - "base64 0.21.5", + "base64 0.21.7", "byteorder", "bytes", "either", @@ -3719,7 +3787,7 @@ dependencies = [ "quinn", "rand", "ring 0.16.20", - "rustls", + "rustls 0.21.10", "socket2 0.5.5", "thiserror", "tokio", @@ -3776,7 +3844,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -3808,8 +3876,8 @@ dependencies = [ "libp2p-identity", "rcgen", "ring 0.16.20", - "rustls", - "rustls-webpki", + "rustls 0.21.10", + "rustls-webpki 0.101.7", "thiserror", "x509-parser", "yasna", @@ -3896,9 +3964,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "295c17e837573c8c821dbaeb3cceb3d745ad082f7572191409e69cbc1b3fd050" dependencies = [ "cc", "pkg-config", @@ -4029,7 +4097,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -4043,7 +4111,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -4054,7 +4122,7 @@ checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -4065,7 +4133,7 @@ checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -4688,23 +4756,23 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 2.0.1", + "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -4813,7 +4881,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-support", "frame-system", @@ -4827,7 +4895,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4851,7 +4919,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4874,7 +4942,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-support", "frame-system", @@ -4895,7 +4963,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-benchmarking", "frame-support", @@ -4913,7 +4981,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-support", "frame-system", @@ -4929,7 +4997,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -4945,7 +5013,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -4956,9 +5024,9 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e9ab494af9e6e813c72170f0d3c1de1500990d62c97cc05cc7576f91aa402f" +checksum = "592a28a24b09c9dc20ac8afaa6839abc417c720afe42c12e1e4a9d6aa2508d2e" dependencies = [ "blake2", "crc32fast", @@ -4972,6 +5040,7 @@ dependencies = [ "rand", "siphasher", "snap", + "winapi", ] [[package]] @@ -5178,7 +5247,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -5223,9 +5292,9 @@ checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "polling" -version = "3.3.1" +version = "3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" +checksum = "545c980a3880efd47b2e262f6a4bb6daad6555cf3367aa9c4e52895f69537a41" dependencies = [ "cfg-if", "concurrent-queue", @@ -5317,7 +5386,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -5401,14 +5470,14 @@ checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "proc-macro2" -version = "1.0.75" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] @@ -5447,7 +5516,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -5564,7 +5633,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash", - "rustls", + "rustls 0.21.10", "thiserror", "tokio", "tracing", @@ -5580,7 +5649,7 @@ dependencies = [ "rand", "ring 0.16.20", "rustc-hash", - "rustls", + "rustls 0.21.10", "slab", "thiserror", "tinyvec", @@ -5748,7 +5817,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -5814,15 +5883,15 @@ version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", "h2", - "http", - "http-body", - "hyper", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", "ipnet", "js-sys", "log", @@ -6007,9 +6076,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ "bitflags 2.4.1", "errno", @@ -6026,31 +6095,52 @@ checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring 0.17.7", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +dependencies = [ + "ring 0.17.7", + "rustls-pki-types", + "rustls-webpki 0.102.1", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", "rustls-pemfile", + "rustls-pki-types", "schannel", "security-framework", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", + "rustls-pki-types", ] +[[package]] +name = "rustls-pki-types" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9d979b3ce68192e42760c7810125eb6cf2ea10efae545a156063e61f314e2a" + [[package]] name = "rustls-webpki" version = "0.101.7" @@ -6061,6 +6151,17 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "rustls-webpki" +version = "0.102.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef4ca26037c909dedb327b48c3327d0ba91d3dd3c4e05dad328f210ffb68e95b" +dependencies = [ + "ring 0.17.7", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "rustversion" version = "1.0.14" @@ -6105,7 +6206,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "log", "sp-core", @@ -6116,7 +6217,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "futures", @@ -6144,7 +6245,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "futures", "futures-timer", @@ -6167,7 +6268,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6182,7 +6283,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -6201,18 +6302,18 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "array-bytes", "chrono", @@ -6251,7 +6352,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "fnv", "futures", @@ -6276,7 +6377,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "hash-db", "kvdb", @@ -6302,7 +6403,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "futures", @@ -6327,7 +6428,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "fork-tree", @@ -6363,7 +6464,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6376,7 +6477,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "ahash", "array-bytes", @@ -6417,7 +6518,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "futures", @@ -6440,7 +6541,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", @@ -6462,7 +6563,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -6474,7 +6575,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "anyhow", "cfg-if", @@ -6491,7 +6592,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "anstyle", "futures", @@ -6507,7 +6608,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "array-bytes", "parking_lot 0.12.1", @@ -6521,7 +6622,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "array-bytes", "async-channel", @@ -6563,7 +6664,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-channel", "cid", @@ -6583,7 +6684,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -6600,7 +6701,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "ahash", "futures", @@ -6619,7 +6720,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "array-bytes", "async-channel", @@ -6640,7 +6741,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "array-bytes", "async-channel", @@ -6674,7 +6775,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "array-bytes", "futures", @@ -6692,14 +6793,13 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "bytes", "fnv", "futures", "futures-timer", - "hyper", - "hyper-rustls", + "hyper 0.14.28", "libp2p", "log", "num_cpus", @@ -6724,7 +6824,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6733,7 +6833,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "futures", "jsonrpsee", @@ -6763,7 +6863,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -6782,9 +6882,9 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ - "http", + "http 0.2.11", "jsonrpsee", "log", "serde_json", @@ -6797,7 +6897,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "array-bytes", "futures", @@ -6823,7 +6923,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "directories", @@ -6886,7 +6986,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "log", "parity-scale-codec", @@ -6897,7 +6997,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "futures", "libc", @@ -6916,7 +7016,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "chrono", "futures", @@ -6935,7 +7035,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "anstyle", "chrono", @@ -6963,18 +7063,18 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "futures", @@ -7000,7 +7100,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "futures", @@ -7016,7 +7116,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-channel", "futures", @@ -7773,9 +7873,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] @@ -7791,20 +7891,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.110" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fbd975230bada99c8bb618e0c365c2eefa219158d5c6c29610fd09ff1833257" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -7819,7 +7919,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -7849,7 +7949,7 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", @@ -7956,9 +8056,12 @@ name = "simple-request" version = "0.1.0" dependencies = [ "base64ct", - "hyper", + "http-body-util", + "hyper 1.1.0", "hyper-rustls", + "hyper-util", "tokio", + "tower-service", "zeroize", ] @@ -7997,9 +8100,9 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "1.11.2" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" [[package]] name = "snap" @@ -8053,7 +8156,7 @@ dependencies = [ "base64 0.13.1", "bytes", "futures", - "http", + "http 0.2.11", "httparse", "log", "rand", @@ -8063,7 +8166,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "hash-db", "log", @@ -8084,7 +8187,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "Inflector", "blake2", @@ -8092,13 +8195,13 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "sp-application-crypto" version = "23.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "scale-info", @@ -8111,7 +8214,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "integer-sqrt", "num-traits", @@ -8125,7 +8228,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "scale-info", @@ -8137,7 +8240,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "sp-api", "sp-inherents", @@ -8148,7 +8251,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "futures", "log", @@ -8166,7 +8269,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "futures", @@ -8180,7 +8283,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "parity-scale-codec", @@ -8199,7 +8302,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "finality-grandpa", "log", @@ -8217,7 +8320,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "scale-info", @@ -8229,7 +8332,7 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "array-bytes", "bitflags 1.3.2", @@ -8272,7 +8375,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "9.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "blake2b_simd", "byteorder", @@ -8284,17 +8387,17 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "quote", "sp-core-hashing", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -8303,17 +8406,17 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "environmental", "parity-scale-codec", @@ -8324,7 +8427,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -8338,7 +8441,7 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "bytes", "ed25519", @@ -8360,7 +8463,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "24.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "lazy_static", "sp-core", @@ -8371,7 +8474,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", @@ -8383,7 +8486,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "thiserror", "zstd 0.12.4", @@ -8392,7 +8495,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -8403,7 +8506,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "sp-api", "sp-core", @@ -8413,7 +8516,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "backtrace", "lazy_static", @@ -8423,7 +8526,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "rustc-hash", "serde", @@ -8433,7 +8536,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "either", "hash256-std-hasher", @@ -8455,7 +8558,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8473,19 +8576,19 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "Inflector", "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "scale-info", @@ -8500,7 +8603,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8514,7 +8617,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "hash-db", "log", @@ -8535,12 +8638,12 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8553,7 +8656,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "async-trait", "parity-scale-codec", @@ -8566,7 +8669,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "sp-std", @@ -8578,7 +8681,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "sp-api", "sp-runtime", @@ -8587,7 +8690,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "ahash", "hash-db", @@ -8610,7 +8713,7 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8627,18 +8730,18 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -8651,7 +8754,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "parity-scale-codec", "scale-info", @@ -8693,9 +8796,9 @@ checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" [[package]] name = "ss58-registry" -version = "1.44.0" +version = "1.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35935738370302d5e33963665b77541e4b990a3e919ec904c837a56cfc891de1" +checksum = "3c0c74081753a8ce1c8eb10b9f262ab6f7017e5ad3317c17a54c7ab65fcb3c6e" dependencies = [ "Inflector", "num-format", @@ -8811,7 +8914,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -8829,12 +8932,12 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -8853,9 +8956,9 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ - "hyper", + "hyper 0.14.28", "log", "prometheus", "thiserror", @@ -8865,7 +8968,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#400d5c9d4da49ae96035964da14c7654478b11e5" +source = "git+https://github.com/serai-dex/substrate#6e3f07bf5c98a6a3ec15f2b1a46148aa8c7d737a" dependencies = [ "anstyle", "build-helper", @@ -8899,9 +9002,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.47" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1726efe18f42ae774cc644f330953a5e7b3c3003d3edcecf18850fe9d4dd9afb" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -8917,7 +9020,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -8994,9 +9097,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -9024,7 +9127,7 @@ checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -9155,16 +9258,17 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls", + "rustls 0.22.2", + "rustls-pki-types", "tokio", ] @@ -9255,6 +9359,11 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite 0.2.13", + "tokio", "tower-layer", "tower-service", "tracing", @@ -9270,8 +9379,8 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "http", - "http-body", + "http 0.2.11", + "http-body 0.4.6", "http-range-header", "pin-project-lite 0.2.13", "tower-layer", @@ -9310,7 +9419,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -9696,9 +9805,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -9706,24 +9815,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" dependencies = [ "cfg-if", "js-sys", @@ -9733,9 +9842,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -9743,22 +9852,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-encoder" @@ -9891,7 +10000,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31561fbbaa86d3c042696940bc9601146bf4aaec39ae725c86b5f1358d8d7023" dependencies = [ "anyhow", - "base64 0.21.5", + "base64 0.21.7", "bincode", "directories-next", "file-per-thread-logger", @@ -10058,14 +10167,14 @@ checksum = "ca7af9bb3ee875c4907835e607a275d10b04d15623d3aebe01afe8fbd3f85050" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -10298,9 +10407,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.32" +version = "0.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8434aeec7b290e8da5c3f0d628cb0eac6cabcb31d14bb74f779a08109a5914d6" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ] @@ -10435,7 +10544,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -10455,7 +10564,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] diff --git a/common/request/Cargo.toml b/common/request/Cargo.toml index 054e7f581..0fe9ae5c8 100644 --- a/common/request/Cargo.toml +++ b/common/request/Cargo.toml @@ -17,11 +17,13 @@ rustdoc-args = ["--cfg", "docsrs"] workspace = true [dependencies] -# Deprecated here means to enable deprecated warnings, not to restore deprecated APIs -hyper = { version = "0.14", default-features = false, features = ["http1", "tcp", "client", "runtime", "backports", "deprecated"] } +tower-service = { version = "0.3", default-features = false } +hyper = { version = "1", default-features = false, features = ["http1", "client"] } +hyper-util = { version = "0.1", default-features = false, features = ["http1", "client-legacy", "tokio"] } +http-body-util = { version = "0.1", default-features = false } tokio = { version = "1", default-features = false } -hyper-rustls = { version = "0.24", default-features = false, features = ["http1", "native-tokio"], optional = true } +hyper-rustls = { version = "0.26", default-features = false, features = ["http1", "ring", "rustls-native-certs", "native-tokio"], optional = true } zeroize = { version = "1", optional = true } base64ct = { version = "1", features = ["alloc"], optional = true } diff --git a/common/request/src/lib.rs b/common/request/src/lib.rs index 2c56db945..ad452a0cc 100644 --- a/common/request/src/lib.rs +++ b/common/request/src/lib.rs @@ -5,14 +5,13 @@ use std::sync::Arc; use tokio::sync::Mutex; +use tower_service::Service as TowerService; #[cfg(feature = "tls")] use hyper_rustls::{HttpsConnectorBuilder, HttpsConnector}; -use hyper::{ - Uri, - header::HeaderValue, - body::Body, - service::Service, - client::{HttpConnector, conn::http1::SendRequest}, +use hyper::{Uri, header::HeaderValue, body::Bytes, client::conn::http1::SendRequest}; +use hyper_util::{ + rt::tokio::TokioExecutor, + client::legacy::{Client as HyperClient, connect::HttpConnector}, }; pub use hyper; @@ -29,6 +28,7 @@ pub enum Error { InconsistentHost, ConnectionError(Box), Hyper(hyper::Error), + HyperUtil(hyper_util::client::legacy::Error), } #[cfg(not(feature = "tls"))] @@ -38,8 +38,12 @@ type Connector = HttpsConnector; #[derive(Clone, Debug)] enum Connection { - ConnectionPool(hyper::Client), - Connection { connector: Connector, host: Uri, connection: Arc>>> }, + ConnectionPool(HyperClient>), + Connection { + connector: Connector, + host: Uri, + connection: Arc>>>>, + }, } #[derive(Clone, Debug)] @@ -54,6 +58,7 @@ impl Client { #[cfg(feature = "tls")] let res = HttpsConnectorBuilder::new() .with_native_roots() + .expect("couldn't fetch system's SSL roots") .https_or_http() .enable_http1() .wrap_connector(res); @@ -62,7 +67,9 @@ impl Client { pub fn with_connection_pool() -> Client { Client { - connection: Connection::ConnectionPool(hyper::Client::builder().build(Self::connector())), + connection: Connection::ConnectionPool( + HyperClient::builder(TokioExecutor::new()).build(Self::connector()), + ), } } @@ -115,7 +122,9 @@ impl Client { } let response = match &self.connection { - Connection::ConnectionPool(client) => client.request(request).await.map_err(Error::Hyper)?, + Connection::ConnectionPool(client) => { + client.request(request).await.map_err(Error::HyperUtil)? + } Connection::Connection { connector, host, connection } => { let mut connection_lock = connection.lock().await; diff --git a/common/request/src/request.rs b/common/request/src/request.rs index f6ca6f447..ced0d10b0 100644 --- a/common/request/src/request.rs +++ b/common/request/src/request.rs @@ -1,12 +1,13 @@ -use hyper::body::Body; +use hyper::body::Bytes; #[cfg(feature = "basic-auth")] use hyper::header::HeaderValue; +pub use http_body_util::Full; #[cfg(feature = "basic-auth")] use crate::Error; #[derive(Debug)] -pub struct Request(pub(crate) hyper::Request); +pub struct Request(pub(crate) hyper::Request>); impl Request { #[cfg(feature = "basic-auth")] fn username_password_from_uri(&self) -> Result<(String, String), Error> { @@ -59,8 +60,8 @@ impl Request { let _ = self.basic_auth_from_uri(); } } -impl From> for Request { - fn from(request: hyper::Request) -> Request { +impl From>> for Request { + fn from(request: hyper::Request>) -> Request { Request(request) } } diff --git a/common/request/src/response.rs b/common/request/src/response.rs index 46a4239f1..899d538cd 100644 --- a/common/request/src/response.rs +++ b/common/request/src/response.rs @@ -1,14 +1,15 @@ use hyper::{ StatusCode, header::{HeaderValue, HeaderMap}, - body::{HttpBody, Buf, Body}, + body::{Buf, Incoming}, }; +use http_body_util::BodyExt; use crate::{Client, Error}; // Borrows the client so its async task lives as long as this response exists. #[derive(Debug)] -pub struct Response<'a>(pub(crate) hyper::Response, pub(crate) &'a Client); +pub struct Response<'a>(pub(crate) hyper::Response, pub(crate) &'a Client); impl<'a> Response<'a> { pub fn status(&self) -> StatusCode { self.0.status() From 90df3911708ec8e43ccbe12f28784c2fdcf5864f Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Fri, 19 Jan 2024 11:44:49 -0500 Subject: [PATCH 05/17] cargo update Resolves h2 disclosure (which shouldn't have affected us). --- Cargo.lock | 74 +++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5a9e7634..8a31305b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,9 +125,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.7" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -530,9 +530,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bitvec" @@ -687,7 +687,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" dependencies = [ "once_cell", - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 2.0.48", @@ -949,9 +949,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.17" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80932e03c33999b9235edb8655bc9df3204adc9887c2f95b50cb1deb9fd54253" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -959,9 +959,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.17" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c0db58c659eef1c73e444d298c27322a1b52f6927d2ad470c0c0f96fa7b8fa" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -1783,9 +1783,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -2588,7 +2588,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "debugid", "fxhash", "serde", @@ -2710,9 +2710,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -2784,9 +2784,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "hex" @@ -2956,7 +2956,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite 0.2.13", - "socket2 0.5.5", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -4008,9 +4008,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -4769,7 +4769,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 3.0.0", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 2.0.48", @@ -5280,9 +5280,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platforms" @@ -5426,14 +5426,14 @@ dependencies = [ name = "proc-macro-crate" version = "2.0.1" dependencies = [ - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", ] [[package]] name = "proc-macro-crate" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ "toml_edit 0.21.0", ] @@ -5741,9 +5741,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -5751,9 +5751,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -6080,7 +6080,7 @@ version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", @@ -8100,9 +8100,9 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "1.12.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "snap" @@ -9375,7 +9375,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bytes", "futures-core", "futures-util", @@ -9666,9 +9666,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -9750,9 +9750,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" [[package]] name = "valuable" From 508f7eb23a462ad033c1a1154504eff605699801 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Mon, 22 Jan 2024 22:08:37 -0500 Subject: [PATCH 06/17] cargo update Pseudo-resolves shlex advisory (due to the deprecation of the vulnerable functions, which hopefully should prevent their use). shlex is only used by bindgen, a sufficiently trusted dependency. --- Cargo.lock | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a31305b9..c9406a006 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -876,9 +876,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -886,7 +886,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -2681,7 +2681,7 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "regex-syntax 0.8.2", ] @@ -5475,9 +5475,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -5835,13 +5835,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "regex-syntax 0.8.2", ] @@ -5856,9 +5856,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" dependencies = [ "aho-corasick", "memchr", @@ -7945,9 +7945,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "f58c3a1b3e418f61c25b2aeb43fc6c95eaa252b8cecdda67f401943e9e08d33f" dependencies = [ "base64 0.21.7", "chrono", @@ -8015,9 +8015,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" @@ -8796,9 +8796,9 @@ checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" [[package]] name = "ss58-registry" -version = "1.45.0" +version = "1.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0c74081753a8ce1c8eb10b9f262ab6f7017e5ad3317c17a54c7ab65fcb3c6e" +checksum = "b1114ee5900b8569bbc8b1a014a942f937b752af4b44f4607430b5f86cedaac0" dependencies = [ "Inflector", "num-format", @@ -10200,9 +10200,9 @@ dependencies = [ [[package]] name = "wide" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68938b57b33da363195412cfc5fc37c9ed49aa9cfe2156fde64b8d2c9498242" +checksum = "b31891d644eba1789fb6715f27fbc322e4bdf2ecdc412ede1993246159271613" dependencies = [ "bytemuck", "safe_arch", From 21262d41e6e0f203ba1dbcf3f17d28682e23564c Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Mon, 22 Jan 2024 22:13:37 -0500 Subject: [PATCH 07/17] Resolve latest clippy and a couple no longer needed fmt notes --- common/request/src/response.rs | 1 + crypto/dkg/src/tests/frost.rs | 1 - substrate/primitives/src/balance.rs | 5 +---- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/common/request/src/response.rs b/common/request/src/response.rs index 899d538cd..78295d377 100644 --- a/common/request/src/response.rs +++ b/common/request/src/response.rs @@ -8,6 +8,7 @@ use http_body_util::BodyExt; use crate::{Client, Error}; // Borrows the client so its async task lives as long as this response exists. +#[allow(dead_code)] #[derive(Debug)] pub struct Response<'a>(pub(crate) hyper::Response, pub(crate) &'a Client); impl<'a> Response<'a> { diff --git a/crypto/dkg/src/tests/frost.rs b/crypto/dkg/src/tests/frost.rs index 01af35626..e54f60be4 100644 --- a/crypto/dkg/src/tests/frost.rs +++ b/crypto/dkg/src/tests/frost.rs @@ -11,7 +11,6 @@ use crate::{ tests::{THRESHOLD, PARTICIPANTS, clone_without}, }; -// Needed so rustfmt doesn't fail to format on line length issues type FrostEncryptedMessage = EncryptedMessage::F>>; type FrostSecretShares = HashMap>; diff --git a/substrate/primitives/src/balance.rs b/substrate/primitives/src/balance.rs index 8a0a7c9de..62182d43f 100644 --- a/substrate/primitives/src/balance.rs +++ b/substrate/primitives/src/balance.rs @@ -14,10 +14,7 @@ use scale_info::TypeInfo; use crate::{Coin, Amount}; /// The type used for balances (a Coin and Balance). -#[rustfmt::skip] -#[derive( - Clone, Copy, PartialEq, Eq, Debug, Encode, Decode, MaxEncodedLen, TypeInfo, -)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)] #[cfg_attr(feature = "std", derive(Zeroize))] #[cfg_attr(feature = "borsh", derive(BorshSerialize, BorshDeserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] From 0b8c7ade6ea31bddeb5dc67cde91ebb2a93cb4ca Mon Sep 17 00:00:00 2001 From: rlking Date: Mon, 29 Jan 2024 02:58:23 +0100 Subject: [PATCH 08/17] Add scripts to create monero wallet rpc container (#521) * create Dockerfile for monero wallet rpc with dockerfiles.sh * make monero wallet rpc docker accessible from outside * connect wallet-rpc with monerod * add generated Dockerfile for monero wallet rpc * add monero wallet rpcs to docker profiles * update getting started guide to refer to wallet rpc docker --- docs/Getting Started.md | 2 +- .../coins/monero-wallet-rpc/Dockerfile | 50 +++++++++++++++++++ .../Dockerfile.monero-wallet-rpc.end | 10 ++++ .../monero-wallet-rpc/scripts/entry-dev.sh | 3 ++ orchestration/docker-compose.yml | 14 ++++++ orchestration/dockerfiles.sh | 10 ++++ 6 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 orchestration/coins/monero-wallet-rpc/Dockerfile create mode 100644 orchestration/coins/monero-wallet-rpc/Dockerfile.monero-wallet-rpc.end create mode 100644 orchestration/coins/monero-wallet-rpc/scripts/entry-dev.sh diff --git a/docs/Getting Started.md b/docs/Getting Started.md index 3726392a0..4500efc1e 100644 --- a/docs/Getting Started.md +++ b/docs/Getting Started.md @@ -69,7 +69,7 @@ Running tests requires: - [A rootless Docker setup](https://docs.docker.com/engine/security/rootless/) - A properly configured Bitcoin regtest node (available via Docker) - A properly configured Monero regtest node (available via Docker) -- A properly configured monero-wallet-rpc instance +- A properly configured monero-wallet-rpc instance (available via Docker) - A debug Serai node (`cd substrate/node && cargo build`) ``` diff --git a/orchestration/coins/monero-wallet-rpc/Dockerfile b/orchestration/coins/monero-wallet-rpc/Dockerfile new file mode 100644 index 000000000..98fb760b0 --- /dev/null +++ b/orchestration/coins/monero-wallet-rpc/Dockerfile @@ -0,0 +1,50 @@ +FROM debian:bookworm-slim as mimalloc + +RUN apt update && apt upgrade -y && apt install -y gcc g++ make cmake git +RUN git clone https://github.com/microsoft/mimalloc && \ + cd mimalloc && \ + git checkout 43ce4bd7fd34bcc730c1c7471c99995597415488 && \ + mkdir -p out/secure && \ + cd out/secure && \ + cmake -DMI_SECURE=ON ../.. && \ + make && \ + cp ./libmimalloc-secure.so ../../../libmimalloc.so +FROM alpine:latest as monero + +# https://downloads.getmonero.org/cli/monero-linux-x64-v0.18.3.1.tar.bz2 +# Verification will fail if MONERO_VERSION doesn't match the latest +# due to the way monero publishes releases. They overwrite a single hashes.txt +# file with each release, meaning we can only grab the SHA256 of the latest +# release. +# Most publish a asc file for each release / build architecture ¯\_(ツ)_/¯ +ENV MONERO_VERSION=0.18.3.1 + +RUN apk --no-cache add gnupg + +# Download Monero +RUN wget https://downloads.getmonero.org/cli/monero-linux-x64-v${MONERO_VERSION}.tar.bz2 + +# Verify Binary -- fingerprint from https://github.com/monero-project/monero-site/issues/1949 +ADD ./temp/hashes-v${MONERO_VERSION}.txt . +RUN gpg --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options no-self-sigs-only --receive-keys 81AC591FE9C4B65C5806AFC3F0AF4D462A0BDF92 && \ + gpg --verify hashes-v${MONERO_VERSION}.txt && \ + grep "$(sha256sum monero-linux-x64-v${MONERO_VERSION}.tar.bz2 | cut -c 1-64)" hashes-v${MONERO_VERSION}.txt + +# Extract it +RUN tar -xvjf monero-linux-x64-v${MONERO_VERSION}.tar.bz2 --strip-components=1 +FROM debian:bookworm-slim as image + +COPY --from=mimalloc libmimalloc.so /usr/lib +RUN echo "/usr/lib/libmimalloc.so" >> /etc/ld.so.preload + +RUN apt update && apt upgrade -y && apt autoremove -y && apt clean +# Switch to a non-root user +# System user (not a human), shell of nologin, no password assigned +RUN useradd --system --create-home --shell /sbin/nologin monero +USER monero + +WORKDIR /home/monero +COPY --from=monero --chown=monero monero-wallet-rpc /bin +ADD scripts /scripts + +EXPOSE 6061 diff --git a/orchestration/coins/monero-wallet-rpc/Dockerfile.monero-wallet-rpc.end b/orchestration/coins/monero-wallet-rpc/Dockerfile.monero-wallet-rpc.end new file mode 100644 index 000000000..bf143fb67 --- /dev/null +++ b/orchestration/coins/monero-wallet-rpc/Dockerfile.monero-wallet-rpc.end @@ -0,0 +1,10 @@ +# Switch to a non-root user +# System user (not a human), shell of nologin, no password assigned +RUN useradd --system --create-home --shell /sbin/nologin monero +USER monero + +WORKDIR /home/monero +COPY --from=monero --chown=monero monero-wallet-rpc /bin +ADD scripts /scripts + +EXPOSE 6061 diff --git a/orchestration/coins/monero-wallet-rpc/scripts/entry-dev.sh b/orchestration/coins/monero-wallet-rpc/scripts/entry-dev.sh new file mode 100644 index 000000000..fbf1edb99 --- /dev/null +++ b/orchestration/coins/monero-wallet-rpc/scripts/entry-dev.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +monero-wallet-rpc --disable-rpc-login --rpc-bind-port 6061 --rpc-bind-ip=0.0.0.0 --confirm-external-bind --daemon-address monero:18081 --allow-mismatched-daemon-version --wallet-dir /home/monero diff --git a/orchestration/docker-compose.yml b/orchestration/docker-compose.yml index c77db8cbc..ae8637bb9 100644 --- a/orchestration/docker-compose.yml +++ b/orchestration/docker-compose.yml @@ -52,6 +52,20 @@ services: ports: - "18081:18081" + monero-wallet-rpc: + profiles: + - monero + - coins + build: + context: ./coins/monero-wallet-rpc/ + restart: unless-stopped + volumes: + - "./coins/monero-wallet-rpc/scripts:/scripts" + entrypoint: /scripts/entry-dev.sh + # TODO: Use expose, not ports + ports: + - "6061:6061" + # Infrastructure message-queue: diff --git a/orchestration/dockerfiles.sh b/orchestration/dockerfiles.sh index 38f940e3b..40b8c1119 100755 --- a/orchestration/dockerfiles.sh +++ b/orchestration/dockerfiles.sh @@ -14,6 +14,16 @@ cat \ ./Dockerfile.parts/Dockerfile.alpine.start \ ./coins/monero/Dockerfile.monero.end >> ./coins/monero/Dockerfile +# Monero wallet rpc +rm -f ./coins/monero-wallet-rpc/Dockerfile +mkdir -p ./coins/monero-wallet-rpc/temp/ +cp ./coins/monero/temp/hashes-v* ./coins/monero-wallet-rpc/temp/ +cat \ + ./Dockerfile.parts/mimalloc/Dockerfile.debian \ + ./coins/monero/Dockerfile.monero \ + ./Dockerfile.parts/Dockerfile.debian.start \ + ./coins/monero-wallet-rpc/Dockerfile.monero-wallet-rpc.end >> ./coins/monero-wallet-rpc/Dockerfile + # Message Queue rm ./message-queue/Dockerfile cat \ From 4913873b105fa2cc6525fcb033c4292a556f3d11 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Mon, 29 Jan 2024 03:48:53 -0500 Subject: [PATCH 09/17] Slash reports (#523) * report_slashes plumbing in Substrate Notably delays the SetRetired event until it provides a slash report or the set after it becomes the set to report its slashes. * Add dedicated AcceptedHandover event * Add SlashReport TX to Tributary * Create SlashReport TXs * Handle SlashReport TXs * Add logic to generate a SlashReport to the coordinator * Route SlashReportSigner into the processor * Finish routing the SlashReport signing/TX publication * Add serai feature to processor's serai-client --- coordinator/src/main.rs | 146 ++++++++- coordinator/src/substrate/mod.rs | 39 ++- coordinator/src/tests/tributary/mod.rs | 17 +- coordinator/src/tributary/db.rs | 16 +- coordinator/src/tributary/handle.rs | 33 ++ coordinator/src/tributary/scanner.rs | 108 ++++++- coordinator/src/tributary/transaction.rs | 43 +++ processor/Cargo.toml | 2 +- processor/messages/src/lib.rs | 23 +- processor/src/batch_signer.rs | 4 + processor/src/cosigner.rs | 4 + processor/src/main.rs | 117 ++++--- processor/src/slash_report_signer.rs | 293 ++++++++++++++++++ substrate/abi/src/validator_sets.rs | 16 +- substrate/client/src/serai/validator_sets.rs | 37 +++ substrate/validator-sets/pallet/src/lib.rs | 80 ++++- .../validator-sets/primitives/src/lib.rs | 4 + 17 files changed, 916 insertions(+), 66 deletions(-) create mode 100644 processor/src/slash_report_signer.rs diff --git a/coordinator/src/main.rs b/coordinator/src/main.rs index d0f387411..690fb3426 100644 --- a/coordinator/src/main.rs +++ b/coordinator/src/main.rs @@ -9,7 +9,10 @@ use zeroize::{Zeroize, Zeroizing}; use rand_core::OsRng; use ciphersuite::{ - group::ff::{Field, PrimeField}, + group::{ + ff::{Field, PrimeField}, + GroupEncoding, + }, Ciphersuite, Ristretto, }; use schnorr::SchnorrSignature; @@ -240,7 +243,9 @@ async fn handle_processor_message( coordinator::ProcessorMessage::InvalidParticipant { id, .. } | coordinator::ProcessorMessage::CosignPreprocess { id, .. } | coordinator::ProcessorMessage::BatchPreprocess { id, .. } | + coordinator::ProcessorMessage::SlashReportPreprocess { id, .. } | coordinator::ProcessorMessage::SubstrateShare { id, .. } => Some(id.session), + // This causes an action on our P2P net yet not on any Tributary coordinator::ProcessorMessage::CosignedBlock { block_number, block, signature } => { let cosigned_block = CosignedBlock { network, @@ -258,6 +263,55 @@ async fn handle_processor_message( P2p::broadcast(p2p, P2pMessageKind::CosignedBlock, buf).await; None } + // This causes an action on Substrate yet not on any Tributary + coordinator::ProcessorMessage::SignedSlashReport { session, signature } => { + let set = ValidatorSet { network, session: *session }; + let signature: &[u8] = signature.as_ref(); + let signature = serai_client::Signature(signature.try_into().unwrap()); + + let slashes = crate::tributary::SlashReport::get(&txn, set) + .expect("signed slash report despite not having slash report locally"); + let slashes_pubs = + slashes.iter().map(|(address, points)| (Public(*address), *points)).collect::>(); + + let tx = serai_client::SeraiValidatorSets::report_slashes( + network, + slashes + .into_iter() + .map(|(address, points)| (serai_client::SeraiAddress(address), points)) + .collect::>() + .try_into() + .unwrap(), + signature.clone(), + ); + + loop { + if serai.publish(&tx).await.is_ok() { + break None; + } + + // Check if the slashes shouldn't still be reported. If not, break. + let Ok(serai) = serai.as_of_latest_finalized_block().await else { + tokio::time::sleep(core::time::Duration::from_secs(5)).await; + continue; + }; + let Ok(key) = serai.validator_sets().key_pending_slash_report(network).await else { + tokio::time::sleep(core::time::Duration::from_secs(5)).await; + continue; + }; + let Some(key) = key else { + break None; + }; + // If this is the key for this slash report, then this will verify + use sp_application_crypto::RuntimePublic; + if !key.verify( + &serai_client::validator_sets::primitives::report_slashes_message(&set, &slashes_pubs), + &signature, + ) { + break None; + } + } + } }, // These don't return a relevant Tributary as there's no Tributary with action expected ProcessorMessage::Substrate(inner_msg) => match inner_msg { @@ -550,7 +604,8 @@ async fn handle_processor_message( // slash) and censor transactions (yet don't explicitly ban) vec![] } - coordinator::ProcessorMessage::CosignPreprocess { id, preprocesses } => { + coordinator::ProcessorMessage::CosignPreprocess { id, preprocesses } | + coordinator::ProcessorMessage::SlashReportPreprocess { id, preprocesses } => { vec![Transaction::SubstrateSign(SignData { plan: id.id, attempt: id.attempt, @@ -665,6 +720,8 @@ async fn handle_processor_message( } #[allow(clippy::match_same_arms)] // Allowed to preserve layout coordinator::ProcessorMessage::CosignedBlock { .. } => unreachable!(), + #[allow(clippy::match_same_arms)] + coordinator::ProcessorMessage::SignedSlashReport { .. } => unreachable!(), }, ProcessorMessage::Substrate(inner_msg) => match inner_msg { processor_messages::substrate::ProcessorMessage::Batch { .. } | @@ -963,6 +1020,8 @@ pub async fn run( new_tributary_spec_send.send(spec).unwrap(); } + let (perform_slash_report_send, mut perform_slash_report_recv) = mpsc::unbounded_channel(); + let (tributary_retired_send, mut tributary_retired_recv) = mpsc::unbounded_channel(); // Handle new Substrate blocks @@ -972,6 +1031,7 @@ pub async fn run( processors.clone(), serai.clone(), new_tributary_spec_send, + perform_slash_report_send, tributary_retired_send, )); @@ -1026,10 +1086,12 @@ pub async fn run( let raw_db = raw_db.clone(); let key = key.clone(); + let specs = Arc::new(RwLock::new(HashMap::new())); let tributaries = Arc::new(RwLock::new(HashMap::new())); // Spawn a task to maintain a local view of the tributaries for whenever recognized_id is // called tokio::spawn({ + let specs = specs.clone(); let tributaries = tributaries.clone(); let mut set_to_genesis = HashMap::new(); async move { @@ -1038,9 +1100,11 @@ pub async fn run( Ok(TributaryEvent::NewTributary(tributary)) => { set_to_genesis.insert(tributary.spec.set(), tributary.spec.genesis()); tributaries.write().await.insert(tributary.spec.genesis(), tributary.tributary); + specs.write().await.insert(tributary.spec.set(), tributary.spec); } Ok(TributaryEvent::TributaryRetired(set)) => { if let Some(genesis) = set_to_genesis.remove(&set) { + specs.write().await.remove(&set); tributaries.write().await.remove(&genesis); } } @@ -1053,6 +1117,84 @@ pub async fn run( } }); + // Also spawn a task to handle slash reports, as this needs such a view of tributaries + tokio::spawn({ + let mut raw_db = raw_db.clone(); + let key = key.clone(); + let tributaries = tributaries.clone(); + async move { + 'task_loop: loop { + match perform_slash_report_recv.recv().await { + Some(set) => { + let (genesis, validators) = loop { + let specs = specs.read().await; + let Some(spec) = specs.get(&set) else { + // If we don't have this Tributary because it's retired, break and move on + if RetiredTributaryDb::get(&raw_db, set).is_some() { + continue 'task_loop; + } + + // This may happen if the task above is simply slow + log::warn!("tributary we don't have yet is supposed to perform a slash report"); + continue; + }; + break (spec.genesis(), spec.validators()); + }; + + let mut slashes = vec![]; + for (validator, _) in validators { + if validator == (::generator() * key.deref()) { + continue; + } + let validator = validator.to_bytes(); + + let fatally = tributary::FatallySlashed::get(&raw_db, genesis, validator).is_some(); + // TODO: Properly type this + let points = if fatally { + u32::MAX + } else { + tributary::SlashPoints::get(&raw_db, genesis, validator).unwrap_or(0) + }; + slashes.push(points); + } + + let mut tx = Transaction::SlashReport(slashes, Transaction::empty_signed()); + tx.sign(&mut OsRng, genesis, &key); + + let mut first = true; + loop { + if !first { + sleep(Duration::from_millis(100)).await; + } + first = false; + + let tributaries = tributaries.read().await; + let Some(tributary) = tributaries.get(&genesis) else { + // If we don't have this Tributary because it's retired, break and move on + if RetiredTributaryDb::get(&raw_db, set).is_some() { + break; + } + + // This may happen if the task above is simply slow + log::warn!("tributary we don't have yet is supposed to perform a slash report"); + continue; + }; + // This is safe to perform multiple times and solely needs atomicity with regards + // to itself + // TODO: Should this not take a txn accordingly? It's best practice to take a txn, + // yet taking a txn fails to declare its achieved independence + let mut txn = raw_db.txn(); + tributary::publish_signed_transaction(&mut txn, tributary, tx).await; + txn.commit(); + break; + } + } + None => panic!("perform slash report sender closed"), + } + } + } + }); + move |set: ValidatorSet, genesis, id_type, id: Vec| { log::debug!("recognized ID {:?} {}", id_type, hex::encode(&id)); let mut raw_db = raw_db.clone(); diff --git a/coordinator/src/substrate/mod.rs b/coordinator/src/substrate/mod.rs index 446780f2c..7a76353ce 100644 --- a/coordinator/src/substrate/mod.rs +++ b/coordinator/src/substrate/mod.rs @@ -208,10 +208,12 @@ async fn handle_batch_and_burns( // Handle a specific Substrate block, returning an error when it fails to get data // (not blocking / holding) +#[allow(clippy::too_many_arguments)] async fn handle_block( db: &mut D, key: &Zeroizing<::F>, new_tributary_spec: &mpsc::UnboundedSender, + perform_slash_report: &mpsc::UnboundedSender, tributary_retired: &mpsc::UnboundedSender, processors: &Pro, serai: &Serai, @@ -287,6 +289,27 @@ async fn handle_block( event_id += 1; } + for accepted_handover in serai.as_of(hash).validator_sets().accepted_handover_events().await? { + let ValidatorSetsEvent::AcceptedHandover { set } = accepted_handover else { + panic!("AcceptedHandover event wasn't AcceptedHandover: {accepted_handover:?}"); + }; + + if set.network == NetworkId::Serai { + continue; + } + + if HandledEvent::is_unhandled(db, hash, event_id) { + log::info!("found fresh accepted handover event {:?}", accepted_handover); + // TODO: This isn't atomic with the event handling + // Send a oneshot receiver so we can await the response? + perform_slash_report.send(set).unwrap(); + let mut txn = db.txn(); + HandledEvent::handle_event(&mut txn, hash, event_id); + txn.commit(); + } + event_id += 1; + } + for retired_set in serai.as_of(hash).validator_sets().set_retired_events().await? { let ValidatorSetsEvent::SetRetired { set } = retired_set else { panic!("SetRetired event wasn't SetRetired: {retired_set:?}"); @@ -320,10 +343,12 @@ async fn handle_block( Ok(()) } +#[allow(clippy::too_many_arguments)] async fn handle_new_blocks( db: &mut D, key: &Zeroizing<::F>, new_tributary_spec: &mpsc::UnboundedSender, + perform_slash_report: &mpsc::UnboundedSender, tributary_retired: &mpsc::UnboundedSender, processors: &Pro, serai: &Serai, @@ -349,7 +374,17 @@ async fn handle_new_blocks( .expect("couldn't get block before the latest finalized block"); log::info!("handling substrate block {b}"); - handle_block(db, key, new_tributary_spec, tributary_retired, processors, serai, block).await?; + handle_block( + db, + key, + new_tributary_spec, + perform_slash_report, + tributary_retired, + processors, + serai, + block, + ) + .await?; *next_block += 1; let mut txn = db.txn(); @@ -368,6 +403,7 @@ pub async fn scan_task( processors: Pro, serai: Arc, new_tributary_spec: mpsc::UnboundedSender, + perform_slash_report: mpsc::UnboundedSender, tributary_retired: mpsc::UnboundedSender, ) { log::info!("scanning substrate"); @@ -443,6 +479,7 @@ pub async fn scan_task( &mut db, &key, &new_tributary_spec, + &perform_slash_report, &tributary_retired, &processors, &serai, diff --git a/coordinator/src/tests/tributary/mod.rs b/coordinator/src/tests/tributary/mod.rs index cc6567d68..29472482a 100644 --- a/coordinator/src/tests/tributary/mod.rs +++ b/coordinator/src/tests/tributary/mod.rs @@ -7,7 +7,7 @@ use ciphersuite::{group::Group, Ciphersuite, Ristretto}; use scale::{Encode, Decode}; use serai_client::{ primitives::{SeraiAddress, Signature}, - validator_sets::primitives::{ValidatorSet, KeyPair}, + validator_sets::primitives::{MAX_KEY_SHARES_PER_SET, ValidatorSet, KeyPair}, }; use processor_messages::coordinator::SubstrateSignableId; @@ -79,7 +79,7 @@ fn test_read_write(value: &RW) { #[test] fn tx_size_limit() { - use serai_client::validator_sets::primitives::{MAX_KEY_SHARES_PER_SET, MAX_KEY_LEN}; + use serai_client::validator_sets::primitives::MAX_KEY_LEN; use tributary::TRANSACTION_SIZE_LIMIT; @@ -277,4 +277,17 @@ fn serialize_transaction() { signature: random_signed_with_nonce(&mut OsRng, 2).signature, }); } + + test_read_write(&Transaction::SlashReport( + { + let amount = + usize::try_from(OsRng.next_u64() % u64::from(MAX_KEY_SHARES_PER_SET - 1)).unwrap(); + let mut points = vec![]; + for _ in 0 .. amount { + points.push((OsRng.next_u64() >> 32).try_into().unwrap()); + } + points + }, + random_signed_with_nonce(&mut OsRng, 0), + )); } diff --git a/coordinator/src/tributary/db.rs b/coordinator/src/tributary/db.rs index 27fef1f0e..fda1c47ba 100644 --- a/coordinator/src/tributary/db.rs +++ b/coordinator/src/tributary/db.rs @@ -51,10 +51,13 @@ create_db!( TributaryBlockNumber: (block: [u8; 32]) -> u32, LastHandledBlock: (genesis: [u8; 32]) -> [u8; 32], + // TODO: Revisit the point of this FatalSlashes: (genesis: [u8; 32]) -> Vec<[u8; 32]>, RemovedAsOfDkgAttempt: (genesis: [u8; 32], attempt: u32) -> Vec<[u8; 32]>, OfflineDuringDkg: (genesis: [u8; 32]) -> Vec<[u8; 32]>, + // TODO: Combine these two FatallySlashed: (genesis: [u8; 32], account: [u8; 32]) -> (), + SlashPoints: (genesis: [u8; 32], account: [u8; 32]) -> u32, VotedToRemove: (genesis: [u8; 32], voter: [u8; 32], to_remove: [u8; 32]) -> (), VotesToRemove: (genesis: [u8; 32], to_remove: [u8; 32]) -> u16, @@ -73,6 +76,11 @@ create_db!( PlanIds: (genesis: &[u8], block: u64) -> Vec<[u8; 32]>, SignedTransactionDb: (order: &[u8], nonce: u32) -> Vec, + + SlashReports: (genesis: [u8; 32], signer: [u8; 32]) -> Vec, + SlashReported: (genesis: [u8; 32]) -> u16, + SlashReportCutOff: (genesis: [u8; 32]) -> u64, + SlashReport: (set: ValidatorSet) -> Vec<([u8; 32], u32)>, } ); @@ -116,7 +124,13 @@ impl AttemptDb { pub fn attempt(getter: &impl Get, genesis: [u8; 32], topic: Topic) -> Option { let attempt = Self::get(getter, genesis, &topic); // Don't require explicit recognition of the Dkg topic as it starts when the chain does - if attempt.is_none() && ((topic == Topic::Dkg) || (topic == Topic::DkgConfirmation)) { + // Don't require explicit recognition of the SlashReport topic as it isn't a DoS risk and it + // should always happen (eventually) + if attempt.is_none() && + ((topic == Topic::Dkg) || + (topic == Topic::DkgConfirmation) || + (topic == Topic::SubstrateSign(SubstrateSignableId::SlashReport))) + { return Some(0); } attempt diff --git a/coordinator/src/tributary/handle.rs b/coordinator/src/tributary/handle.rs index f2b62d5f2..fbce7dd9a 100644 --- a/coordinator/src/tributary/handle.rs +++ b/coordinator/src/tributary/handle.rs @@ -738,6 +738,39 @@ impl< }; self.processors.send(self.spec.set().network, msg).await; } + + Transaction::SlashReport(points, signed) => { + // Uses &[] as we only need the length which is independent to who else was removed + let signer_range = self.spec.i(&[], signed.signer).unwrap(); + let signer_len = u16::from(signer_range.end) - u16::from(signer_range.start); + if points.len() != (self.spec.validators().len() - 1) { + self.fatal_slash( + signed.signer.to_bytes(), + "submitted a distinct amount of slash points to participants", + ); + return; + } + + if SlashReports::get(self.txn, genesis, signed.signer.to_bytes()).is_some() { + self.fatal_slash(signed.signer.to_bytes(), "submitted multiple slash points"); + return; + } + SlashReports::set(self.txn, genesis, signed.signer.to_bytes(), &points); + + let prior_reported = SlashReported::get(self.txn, genesis).unwrap_or(0); + let now_reported = prior_reported + signer_len; + SlashReported::set(self.txn, genesis, &now_reported); + + if (prior_reported < self.spec.t()) && (now_reported >= self.spec.t()) { + SlashReportCutOff::set( + self.txn, + genesis, + // 30 minutes into the future + &(u64::from(self.block_number) + + ((30 * 60 * 1000) / u64::from(tributary::tendermint::TARGET_BLOCK_TIME))), + ); + } + } } } } diff --git a/coordinator/src/tributary/scanner.rs b/coordinator/src/tributary/scanner.rs index 9680328e5..369a900af 100644 --- a/coordinator/src/tributary/scanner.rs +++ b/coordinator/src/tributary/scanner.rs @@ -16,7 +16,7 @@ use serai_client::{ use serai_db::DbTxn; -use processor_messages::coordinator::SubstrateSignableId; +use processor_messages::coordinator::{SubstrateSignId, SubstrateSignableId}; use tributary::{ TransactionKind, Transaction as TributaryTransaction, TransactionError, Block, TributaryReader, @@ -520,6 +520,24 @@ impl< .await; } } + SubstrateSignableId::SlashReport => { + // If this Tributary hasn't been retired... + // (published SlashReport/took too long to do so) + if crate::RetiredTributaryDb::get(self.txn, self.spec.set()).is_none() { + let report = SlashReport::get(self.txn, self.spec.set()) + .expect("re-attempting signing a SlashReport we don't have?"); + self + .processors + .send( + self.spec.set().network, + processor_messages::coordinator::CoordinatorMessage::SignSlashReport { + id, + report, + }, + ) + .await; + } + } } } Topic::Sign(id) => { @@ -542,6 +560,94 @@ impl< } } } + + if Some(u64::from(self.block_number)) == SlashReportCutOff::get(self.txn, genesis) { + // Grab every slash report + let mut all_reports = vec![]; + for (i, (validator, _)) in self.spec.validators().into_iter().enumerate() { + let Some(mut report) = SlashReports::get(self.txn, genesis, validator.to_bytes()) else { + continue; + }; + // Assign them 0 points for themselves + report.insert(i, 0); + // Uses &[] as we only need the length which is independent to who else was removed + let signer_i = self.spec.i(&[], validator).unwrap(); + let signer_len = u16::from(signer_i.end) - u16::from(signer_i.start); + // Push `n` copies, one for each of their shares + for _ in 0 .. signer_len { + all_reports.push(report.clone()); + } + } + + // For each participant, grab their median + let mut medians = vec![]; + for p in 0 .. self.spec.validators().len() { + let mut median_calc = vec![]; + for report in &all_reports { + median_calc.push(report[p]); + } + median_calc.sort_unstable(); + medians.push(median_calc[median_calc.len() / 2]); + } + + // Grab the points of the last party within the best-performing threshold + // This is done by first expanding the point values by the amount of shares + let mut sorted_medians = vec![]; + for (i, (_, shares)) in self.spec.validators().into_iter().enumerate() { + for _ in 0 .. shares { + sorted_medians.push(medians[i]); + } + } + // Then performing the sort + sorted_medians.sort_unstable(); + let worst_points_by_party_within_threshold = sorted_medians[usize::from(self.spec.t()) - 1]; + + // Reduce everyone's points by this value + for median in &mut medians { + *median = median.saturating_sub(worst_points_by_party_within_threshold); + } + + // The threshold now has the proper incentive to report this as they no longer suffer + // negative effects + // + // Additionally, if all validators had degraded performance, they don't all get penalized for + // what's likely outside their control (as it occurred universally) + + // Mark everyone fatally slashed with u32::MAX + for (i, (validator, _)) in self.spec.validators().into_iter().enumerate() { + if FatallySlashed::get(self.txn, genesis, validator.to_bytes()).is_some() { + medians[i] = u32::MAX; + } + } + + let mut report = vec![]; + for (i, (validator, _)) in self.spec.validators().into_iter().enumerate() { + if medians[i] != 0 { + report.push((validator.to_bytes(), medians[i])); + } + } + + // This does lock in the report, meaning further slash point accumulations won't be reported + // They still have value to be locally tracked due to local decisions made based off + // accumulated slash reports + SlashReport::set(self.txn, self.spec.set(), &report); + + // Start a signing protocol for this + self + .processors + .send( + self.spec.set().network, + processor_messages::coordinator::CoordinatorMessage::SignSlashReport { + id: SubstrateSignId { + session: self.spec.set().session, + id: SubstrateSignableId::SlashReport, + attempt: 0, + }, + report, + }, + ) + .await; + } } } diff --git a/coordinator/src/tributary/transaction.rs b/coordinator/src/tributary/transaction.rs index 22650154a..8d8bdd4cd 100644 --- a/coordinator/src/tributary/transaction.rs +++ b/coordinator/src/tributary/transaction.rs @@ -190,6 +190,8 @@ pub enum Transaction { first_signer: ::G, signature: SchnorrSignature, }, + + SlashReport(Vec, Signed), } impl Debug for Transaction { @@ -244,6 +246,11 @@ impl Debug for Transaction { .field("plan", &hex::encode(plan)) .field("tx_hash", &hex::encode(tx_hash)) .finish_non_exhaustive(), + Transaction::SlashReport(points, signed) => fmt + .debug_struct("Transaction::SignCompleted") + .field("points", points) + .field("signed", signed) + .finish(), } } } @@ -413,6 +420,25 @@ impl ReadWrite for Transaction { Ok(Transaction::SignCompleted { plan, tx_hash, first_signer, signature }) } + 11 => { + let mut len = [0]; + reader.read_exact(&mut len)?; + let len = len[0]; + // If the set has as many validators as MAX_KEY_SHARES_PER_SET, then the amount of distinct + // validators (the amount of validators reported on) will be at most + // `MAX_KEY_SHARES_PER_SET - 1` + if u32::from(len) > (serai_client::validator_sets::primitives::MAX_KEY_SHARES_PER_SET - 1) { + Err(io::Error::other("more points reported than allowed validator"))?; + } + let mut points = vec![0u32; len.into()]; + for points in &mut points { + let mut these_points = [0; 4]; + reader.read_exact(&mut these_points)?; + *points = u32::from_le_bytes(these_points); + } + Ok(Transaction::SlashReport(points, Signed::read_without_nonce(reader, 0)?)) + } + _ => Err(io::Error::other("invalid transaction type")), } } @@ -529,6 +555,14 @@ impl ReadWrite for Transaction { writer.write_all(&first_signer.to_bytes())?; signature.write(writer) } + Transaction::SlashReport(points, signed) => { + writer.write_all(&[11])?; + writer.write_all(&[u8::try_from(points.len()).unwrap()])?; + for points in points { + writer.write_all(&points.to_le_bytes())?; + } + signed.write_without_nonce(writer) + } } } } @@ -559,6 +593,10 @@ impl TransactionTrait for Transaction { TransactionKind::Signed((b"sign", data.plan, data.attempt).encode(), &data.signed) } Transaction::SignCompleted { .. } => TransactionKind::Unsigned, + + Transaction::SlashReport(_, signed) => { + TransactionKind::Signed(b"slash_report".to_vec(), signed) + } } } @@ -622,10 +660,13 @@ impl Transaction { Transaction::Sign(data) => data.label.nonce(), Transaction::SignCompleted { .. } => panic!("signing SignCompleted"), + + Transaction::SlashReport(_, _) => 0, }; ( nonce, + #[allow(clippy::match_same_arms)] match tx { Transaction::RemoveParticipantDueToDkg { ref mut signed, .. } | Transaction::DkgCommitments { ref mut signed, .. } | @@ -642,6 +683,8 @@ impl Transaction { Transaction::Sign(ref mut data) => &mut data.signed, Transaction::SignCompleted { .. } => panic!("signing SignCompleted"), + + Transaction::SlashReport(_, ref mut signed) => signed, }, ) } diff --git a/processor/Cargo.toml b/processor/Cargo.toml index a213b983c..73a34efea 100644 --- a/processor/Cargo.toml +++ b/processor/Cargo.toml @@ -58,7 +58,7 @@ zalloc = { path = "../common/zalloc" } serai-db = { path = "../common/db", optional = true } serai-env = { path = "../common/env", optional = true } # TODO: Replace with direct usage of primitives -serai-client = { path = "../substrate/client", default-features = false } +serai-client = { path = "../substrate/client", default-features = false, features = ["serai"] } messages = { package = "serai-processor-messages", path = "./messages", optional = true } diff --git a/processor/messages/src/lib.rs b/processor/messages/src/lib.rs index f9f29790d..22360a1a5 100644 --- a/processor/messages/src/lib.rs +++ b/processor/messages/src/lib.rs @@ -169,6 +169,7 @@ pub mod coordinator { pub enum SubstrateSignableId { CosigningSubstrateBlock([u8; 32]), Batch(u32), + SlashReport, } #[derive(Clone, PartialEq, Eq, Hash, Debug, Encode, Decode, BorshSerialize, BorshDeserialize)] @@ -181,6 +182,7 @@ pub mod coordinator { #[derive(Clone, PartialEq, Eq, Debug, BorshSerialize, BorshDeserialize)] pub enum CoordinatorMessage { CosignSubstrateBlock { id: SubstrateSignId, block_number: u64 }, + SignSlashReport { id: SubstrateSignId, report: Vec<([u8; 32], u32)> }, SubstratePreprocesses { id: SubstrateSignId, preprocesses: HashMap }, SubstrateShares { id: SubstrateSignId, shares: HashMap }, // Re-attempt a batch signing protocol. @@ -209,8 +211,11 @@ pub mod coordinator { InvalidParticipant { id: SubstrateSignId, participant: Participant }, CosignPreprocess { id: SubstrateSignId, preprocesses: Vec<[u8; 64]> }, BatchPreprocess { id: SubstrateSignId, block: BlockHash, preprocesses: Vec<[u8; 64]> }, + SlashReportPreprocess { id: SubstrateSignId, preprocesses: Vec<[u8; 64]> }, SubstrateShare { id: SubstrateSignId, shares: Vec<[u8; 32]> }, + // TODO: Make these signatures [u8; 64]? CosignedBlock { block_number: u64, block: [u8; 32], signature: Vec }, + SignedSlashReport { session: Session, signature: Vec }, } } @@ -354,12 +359,15 @@ impl CoordinatorMessage { } CoordinatorMessage::Coordinator(msg) => { let (sub, id) = match msg { - // Unique since this is the entire message + // Unique since this ID contains the hash of the block being cosigned coordinator::CoordinatorMessage::CosignSubstrateBlock { id, .. } => (0, id.encode()), + // Unique since there's only one of these per session/attempt, and ID is inclusive to + // both + coordinator::CoordinatorMessage::SignSlashReport { id, .. } => (1, id.encode()), // Unique since this embeds the batch ID (including its network) and attempt - coordinator::CoordinatorMessage::SubstratePreprocesses { id, .. } => (1, id.encode()), - coordinator::CoordinatorMessage::SubstrateShares { id, .. } => (2, id.encode()), - coordinator::CoordinatorMessage::BatchReattempt { id, .. } => (3, id.encode()), + coordinator::CoordinatorMessage::SubstratePreprocesses { id, .. } => (2, id.encode()), + coordinator::CoordinatorMessage::SubstrateShares { id, .. } => (3, id.encode()), + coordinator::CoordinatorMessage::BatchReattempt { id, .. } => (4, id.encode()), }; let mut res = vec![COORDINATOR_UID, TYPE_COORDINATOR_UID, sub]; @@ -426,8 +434,11 @@ impl ProcessorMessage { coordinator::ProcessorMessage::InvalidParticipant { id, .. } => (1, id.encode()), coordinator::ProcessorMessage::CosignPreprocess { id, .. } => (2, id.encode()), coordinator::ProcessorMessage::BatchPreprocess { id, .. } => (3, id.encode()), - coordinator::ProcessorMessage::SubstrateShare { id, .. } => (4, id.encode()), - coordinator::ProcessorMessage::CosignedBlock { block, .. } => (5, block.encode()), + coordinator::ProcessorMessage::SlashReportPreprocess { id, .. } => (4, id.encode()), + coordinator::ProcessorMessage::SubstrateShare { id, .. } => (5, id.encode()), + // Unique since only one instance of a signature matters + coordinator::ProcessorMessage::CosignedBlock { block, .. } => (6, block.encode()), + coordinator::ProcessorMessage::SignedSlashReport { .. } => (7, vec![]), }; let mut res = vec![PROCESSOR_UID, TYPE_COORDINATOR_UID, sub]; diff --git a/processor/src/batch_signer.rs b/processor/src/batch_signer.rs index 6110b84fe..41f50322c 100644 --- a/processor/src/batch_signer.rs +++ b/processor/src/batch_signer.rs @@ -213,6 +213,10 @@ impl BatchSigner { panic!("BatchSigner passed CosignSubstrateBlock") } + CoordinatorMessage::SignSlashReport { .. } => { + panic!("Cosigner passed SignSlashReport") + } + CoordinatorMessage::SubstratePreprocesses { id, preprocesses } => { let (session, id, attempt) = self.verify_id(&id).ok()?; diff --git a/processor/src/cosigner.rs b/processor/src/cosigner.rs index a324da776..a9fb6cccc 100644 --- a/processor/src/cosigner.rs +++ b/processor/src/cosigner.rs @@ -124,6 +124,10 @@ impl Cosigner { panic!("Cosigner passed CosignSubstrateBlock") } + CoordinatorMessage::SignSlashReport { .. } => { + panic!("Cosigner passed SignSlashReport") + } + CoordinatorMessage::SubstratePreprocesses { id, preprocesses } => { assert_eq!(id.session, self.session); let SubstrateSignableId::CosigningSubstrateBlock(block) = id.id else { diff --git a/processor/src/main.rs b/processor/src/main.rs index 8aa7ef196..a4e9552de 100644 --- a/processor/src/main.rs +++ b/processor/src/main.rs @@ -55,6 +55,9 @@ use cosigner::Cosigner; mod batch_signer; use batch_signer::BatchSigner; +mod slash_report_signer; +use slash_report_signer::SlashReportSigner; + mod multisigs; use multisigs::{MultisigEvent, MultisigManager}; @@ -101,6 +104,7 @@ struct TributaryMutable { // Solely mutated by the tributary. cosigner: Option, + slash_report_signer: Option, } // Items which are mutably borrowed by Substrate. @@ -233,59 +237,86 @@ async fn handle_coordinator_msg( } } - CoordinatorMessage::Coordinator(msg) => { - let is_batch = match msg { - CoordinatorCoordinatorMessage::CosignSubstrateBlock { .. } => false, - CoordinatorCoordinatorMessage::SubstratePreprocesses { ref id, .. } | - CoordinatorCoordinatorMessage::SubstrateShares { ref id, .. } => { - matches!(&id.id, SubstrateSignableId::Batch(_)) + CoordinatorMessage::Coordinator(msg) => match msg { + CoordinatorCoordinatorMessage::CosignSubstrateBlock { id, block_number } => { + let SubstrateSignableId::CosigningSubstrateBlock(block) = id.id else { + panic!("CosignSubstrateBlock id didn't have a CosigningSubstrateBlock") + }; + let Some(keys) = tributary_mutable.key_gen.substrate_keys_by_session(id.session) else { + panic!("didn't have key shares for the key we were told to cosign with"); + }; + if let Some((cosigner, msg)) = + Cosigner::new(txn, id.session, keys, block_number, block, id.attempt) + { + tributary_mutable.cosigner = Some(cosigner); + coordinator.send(msg).await; + } else { + log::warn!("Cosigner::new returned None"); } - CoordinatorCoordinatorMessage::BatchReattempt { .. } => true, - }; - if is_batch { - if let Some(msg) = tributary_mutable - .batch_signer - .as_mut() - .expect( - "coordinator told us to sign a batch when we don't currently have a Substrate signer", - ) - .handle(txn, msg) + } + CoordinatorCoordinatorMessage::SignSlashReport { id, report } => { + assert_eq!(id.id, SubstrateSignableId::SlashReport); + let Some(keys) = tributary_mutable.key_gen.substrate_keys_by_session(id.session) else { + panic!("didn't have key shares for the key we were told to perform a slash report with"); + }; + if let Some((slash_report_signer, msg)) = + SlashReportSigner::new(txn, N::NETWORK, id.session, keys, report, id.attempt) { + tributary_mutable.slash_report_signer = Some(slash_report_signer); coordinator.send(msg).await; + } else { + log::warn!("SlashReportSigner::new returned None"); } - } else { - match msg { - CoordinatorCoordinatorMessage::CosignSubstrateBlock { id, block_number } => { - let SubstrateSignableId::CosigningSubstrateBlock(block) = id.id else { - panic!("CosignSubstrateBlock id didn't have a CosigningSubstrateBlock") - }; - let Some(keys) = tributary_mutable.key_gen.substrate_keys_by_session(id.session) else { - panic!("didn't have key shares for the key we were told to cosign with"); - }; - if let Some((cosigner, msg)) = - Cosigner::new(txn, id.session, keys, block_number, block, id.attempt) - { - tributary_mutable.cosigner = Some(cosigner); + } + _ => { + let (is_cosign, is_batch, is_slash_report) = match msg { + CoordinatorCoordinatorMessage::CosignSubstrateBlock { .. } | + CoordinatorCoordinatorMessage::SignSlashReport { .. } => (false, false, false), + CoordinatorCoordinatorMessage::SubstratePreprocesses { ref id, .. } | + CoordinatorCoordinatorMessage::SubstrateShares { ref id, .. } => ( + matches!(&id.id, SubstrateSignableId::CosigningSubstrateBlock(_)), + matches!(&id.id, SubstrateSignableId::Batch(_)), + matches!(&id.id, SubstrateSignableId::SlashReport), + ), + CoordinatorCoordinatorMessage::BatchReattempt { .. } => (false, true, false), + }; + + if is_cosign { + if let Some(cosigner) = tributary_mutable.cosigner.as_mut() { + if let Some(msg) = cosigner.handle(txn, msg) { coordinator.send(msg).await; - } else { - log::warn!("Cosigner::new returned None"); } + } else { + log::warn!( + "received message for cosigner yet didn't have a cosigner. {}", + "this is an error if we didn't reboot", + ); } - _ => { - if let Some(cosigner) = tributary_mutable.cosigner.as_mut() { - if let Some(msg) = cosigner.handle(txn, msg) { - coordinator.send(msg).await; - } - } else { - log::warn!( - "received message for cosigner yet didn't have a cosigner. {}", - "this is an error if we didn't reboot", - ); + } else if is_batch { + if let Some(msg) = tributary_mutable + .batch_signer + .as_mut() + .expect( + "coordinator told us to sign a batch when we don't currently have a Substrate signer", + ) + .handle(txn, msg) + { + coordinator.send(msg).await; + } + } else if is_slash_report { + if let Some(slash_report_signer) = tributary_mutable.slash_report_signer.as_mut() { + if let Some(msg) = slash_report_signer.handle(txn, msg) { + coordinator.send(msg).await; } + } else { + log::warn!( + "received message for slash report signer yet didn't have {}", + "a slash report signer. this is an error if we didn't reboot", + ); } } } - } + }, CoordinatorMessage::Substrate(msg) => { match msg { @@ -540,7 +571,7 @@ async fn boot( ( raw_db.clone(), - TributaryMutable { key_gen, batch_signer, cosigner: None, signers }, + TributaryMutable { key_gen, batch_signer, cosigner: None, slash_report_signer: None, signers }, multisig_manager, ) } diff --git a/processor/src/slash_report_signer.rs b/processor/src/slash_report_signer.rs new file mode 100644 index 000000000..b7b2d55ce --- /dev/null +++ b/processor/src/slash_report_signer.rs @@ -0,0 +1,293 @@ +use core::fmt; +use std::collections::HashMap; + +use rand_core::OsRng; + +use frost::{ + curve::Ristretto, + ThresholdKeys, FrostError, + algorithm::Algorithm, + sign::{ + Writable, PreprocessMachine, SignMachine, SignatureMachine, AlgorithmMachine, + AlgorithmSignMachine, AlgorithmSignatureMachine, + }, +}; +use frost_schnorrkel::Schnorrkel; + +use log::{info, warn}; + +use serai_client::{ + Public, + primitives::NetworkId, + validator_sets::primitives::{Session, ValidatorSet, report_slashes_message}, +}; + +use messages::coordinator::*; +use crate::{Get, DbTxn, create_db}; + +create_db! { + SlashReportSignerDb { + Completed: (session: Session) -> (), + Attempt: (session: Session, attempt: u32) -> (), + } +} + +type Preprocess = as PreprocessMachine>::Preprocess; +type SignatureShare = as SignMachine< + >::Signature, +>>::SignatureShare; + +pub struct SlashReportSigner { + network: NetworkId, + session: Session, + keys: Vec>, + report: Vec<([u8; 32], u32)>, + + attempt: u32, + #[allow(clippy::type_complexity)] + preprocessing: Option<(Vec>, Vec)>, + #[allow(clippy::type_complexity)] + signing: Option<(AlgorithmSignatureMachine, Vec)>, +} + +impl fmt::Debug for SlashReportSigner { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt + .debug_struct("SlashReportSigner") + .field("session", &self.session) + .field("report", &self.report) + .field("attempt", &self.attempt) + .field("preprocessing", &self.preprocessing.is_some()) + .field("signing", &self.signing.is_some()) + .finish_non_exhaustive() + } +} + +impl SlashReportSigner { + pub fn new( + txn: &mut impl DbTxn, + network: NetworkId, + session: Session, + keys: Vec>, + report: Vec<([u8; 32], u32)>, + attempt: u32, + ) -> Option<(SlashReportSigner, ProcessorMessage)> { + assert!(!keys.is_empty()); + + if Completed::get(txn, session).is_some() { + return None; + } + + if Attempt::get(txn, session, attempt).is_some() { + warn!( + "already attempted signing slash report for session {:?}, attempt #{}. {}", + session, attempt, "this is an error if we didn't reboot", + ); + return None; + } + Attempt::set(txn, session, attempt, &()); + + info!("signing slash report for session {:?} with attempt #{}", session, attempt); + + let mut machines = vec![]; + let mut preprocesses = vec![]; + let mut serialized_preprocesses = vec![]; + for keys in &keys { + // b"substrate" is a literal from sp-core + let machine = AlgorithmMachine::new(Schnorrkel::new(b"substrate"), keys.clone()); + + let (machine, preprocess) = machine.preprocess(&mut OsRng); + machines.push(machine); + serialized_preprocesses.push(preprocess.serialize().try_into().unwrap()); + preprocesses.push(preprocess); + } + let preprocessing = Some((machines, preprocesses)); + + let substrate_sign_id = + SubstrateSignId { session, id: SubstrateSignableId::SlashReport, attempt }; + + Some(( + SlashReportSigner { network, session, keys, report, attempt, preprocessing, signing: None }, + ProcessorMessage::SlashReportPreprocess { + id: substrate_sign_id, + preprocesses: serialized_preprocesses, + }, + )) + } + + #[must_use] + pub fn handle( + &mut self, + txn: &mut impl DbTxn, + msg: CoordinatorMessage, + ) -> Option { + match msg { + CoordinatorMessage::CosignSubstrateBlock { .. } => { + panic!("SlashReportSigner passed CosignSubstrateBlock") + } + + CoordinatorMessage::SignSlashReport { .. } => { + panic!("SlashReportSigner passed SignSlashReport") + } + + CoordinatorMessage::SubstratePreprocesses { id, preprocesses } => { + assert_eq!(id.session, self.session); + assert_eq!(id.id, SubstrateSignableId::SlashReport); + if id.attempt != self.attempt { + panic!("given preprocesses for a distinct attempt than SlashReportSigner is signing") + } + + let (machines, our_preprocesses) = match self.preprocessing.take() { + // Either rebooted or RPC error, or some invariant + None => { + warn!("not preprocessing. this is an error if we didn't reboot"); + return None; + } + Some(preprocess) => preprocess, + }; + + let mut parsed = HashMap::new(); + for l in { + let mut keys = preprocesses.keys().copied().collect::>(); + keys.sort(); + keys + } { + let mut preprocess_ref = preprocesses.get(&l).unwrap().as_slice(); + let Ok(res) = machines[0].read_preprocess(&mut preprocess_ref) else { + return Some(ProcessorMessage::InvalidParticipant { id, participant: l }); + }; + if !preprocess_ref.is_empty() { + return Some(ProcessorMessage::InvalidParticipant { id, participant: l }); + } + parsed.insert(l, res); + } + let preprocesses = parsed; + + // Only keep a single machine as we only need one to get the signature + let mut signature_machine = None; + let mut shares = vec![]; + let mut serialized_shares = vec![]; + for (m, machine) in machines.into_iter().enumerate() { + let mut preprocesses = preprocesses.clone(); + for (i, our_preprocess) in our_preprocesses.clone().into_iter().enumerate() { + if i != m { + assert!(preprocesses.insert(self.keys[i].params().i(), our_preprocess).is_none()); + } + } + + let (machine, share) = match machine.sign( + preprocesses, + &report_slashes_message( + &ValidatorSet { network: self.network, session: self.session }, + &self + .report + .clone() + .into_iter() + .map(|(validator, points)| (Public(validator), points)) + .collect::>(), + ), + ) { + Ok(res) => res, + Err(e) => match e { + FrostError::InternalError(_) | + FrostError::InvalidParticipant(_, _) | + FrostError::InvalidSigningSet(_) | + FrostError::InvalidParticipantQuantity(_, _) | + FrostError::DuplicatedParticipant(_) | + FrostError::MissingParticipant(_) => unreachable!(), + + FrostError::InvalidPreprocess(l) | FrostError::InvalidShare(l) => { + return Some(ProcessorMessage::InvalidParticipant { id, participant: l }) + } + }, + }; + if m == 0 { + signature_machine = Some(machine); + } + + let mut share_bytes = [0; 32]; + share_bytes.copy_from_slice(&share.serialize()); + serialized_shares.push(share_bytes); + + shares.push(share); + } + self.signing = Some((signature_machine.unwrap(), shares)); + + // Broadcast our shares + Some(ProcessorMessage::SubstrateShare { id, shares: serialized_shares }) + } + + CoordinatorMessage::SubstrateShares { id, shares } => { + assert_eq!(id.session, self.session); + assert_eq!(id.id, SubstrateSignableId::SlashReport); + if id.attempt != self.attempt { + panic!("given preprocesses for a distinct attempt than SlashReportSigner is signing") + } + + let (machine, our_shares) = match self.signing.take() { + // Rebooted, RPC error, or some invariant + None => { + // If preprocessing has this ID, it means we were never sent the preprocess by the + // coordinator + if self.preprocessing.is_some() { + panic!("never preprocessed yet signing?"); + } + + warn!("not preprocessing. this is an error if we didn't reboot"); + return None; + } + Some(signing) => signing, + }; + + let mut parsed = HashMap::new(); + for l in { + let mut keys = shares.keys().copied().collect::>(); + keys.sort(); + keys + } { + let mut share_ref = shares.get(&l).unwrap().as_slice(); + let Ok(res) = machine.read_share(&mut share_ref) else { + return Some(ProcessorMessage::InvalidParticipant { id, participant: l }); + }; + if !share_ref.is_empty() { + return Some(ProcessorMessage::InvalidParticipant { id, participant: l }); + } + parsed.insert(l, res); + } + let mut shares = parsed; + + for (i, our_share) in our_shares.into_iter().enumerate().skip(1) { + assert!(shares.insert(self.keys[i].params().i(), our_share).is_none()); + } + + let sig = match machine.complete(shares) { + Ok(res) => res, + Err(e) => match e { + FrostError::InternalError(_) | + FrostError::InvalidParticipant(_, _) | + FrostError::InvalidSigningSet(_) | + FrostError::InvalidParticipantQuantity(_, _) | + FrostError::DuplicatedParticipant(_) | + FrostError::MissingParticipant(_) => unreachable!(), + + FrostError::InvalidPreprocess(l) | FrostError::InvalidShare(l) => { + return Some(ProcessorMessage::InvalidParticipant { id, participant: l }) + } + }, + }; + + info!("signed slash report for session {:?} with attempt #{}", self.session, id.attempt); + + Completed::set(txn, self.session, &()); + + Some(ProcessorMessage::SignedSlashReport { + session: self.session, + signature: sig.to_bytes().to_vec(), + }) + } + CoordinatorMessage::BatchReattempt { .. } => { + panic!("BatchReattempt passed to SlashReportSigner") + } + } + } +} diff --git a/substrate/abi/src/validator_sets.rs b/substrate/abi/src/validator_sets.rs index 64eb8b4a6..1630f8aca 100644 --- a/substrate/abi/src/validator_sets.rs +++ b/substrate/abi/src/validator_sets.rs @@ -1,3 +1,5 @@ +use sp_core::{ConstU32, bounded_vec::BoundedVec}; + pub use serai_validator_sets_primitives as primitives; use serai_primitives::*; @@ -12,6 +14,11 @@ pub enum Call { key_pair: KeyPair, signature: Signature, }, + report_slashes { + network: NetworkId, + slashes: BoundedVec<(SeraiAddress, u32), ConstU32<{ MAX_KEY_SHARES_PER_SET / 3 }>>, + signature: Signature, + }, allocate { network: NetworkId, amount: Amount, @@ -41,6 +48,12 @@ pub enum Event { set: ValidatorSet, key_pair: KeyPair, }, + AcceptedHandover { + set: ValidatorSet, + }, + SetRetired { + set: ValidatorSet, + }, AllocationIncreased { validator: SeraiAddress, network: NetworkId, @@ -57,7 +70,4 @@ pub enum Event { network: NetworkId, session: Session, }, - SetRetired { - set: ValidatorSet, - }, } diff --git a/substrate/client/src/serai/validator_sets.rs b/substrate/client/src/serai/validator_sets.rs index 9b283635b..308b072b8 100644 --- a/substrate/client/src/serai/validator_sets.rs +++ b/substrate/client/src/serai/validator_sets.rs @@ -69,6 +69,23 @@ impl<'a> SeraiValidatorSets<'a> { .await } + pub async fn accepted_handover_events(&self) -> Result, SeraiError> { + self + .0 + .events(|event| { + if let serai_abi::Event::ValidatorSets(event) = event { + if matches!(event, ValidatorSetsEvent::AcceptedHandover { .. }) { + Some(event.clone()) + } else { + None + } + } else { + None + } + }) + .await + } + pub async fn set_retired_events(&self) -> Result, SeraiError> { self .0 @@ -131,6 +148,13 @@ impl<'a> SeraiValidatorSets<'a> { self.0.storage(PALLET, "Keys", (sp_core::hashing::twox_64(&set.encode()), set)).await } + pub async fn key_pending_slash_report( + &self, + network: NetworkId, + ) -> Result, SeraiError> { + self.0.storage(PALLET, "PendingSlashReport", network).await + } + pub fn set_keys( network: NetworkId, removed_participants: Vec, @@ -144,4 +168,17 @@ impl<'a> SeraiValidatorSets<'a> { signature, })) } + + pub fn report_slashes( + network: NetworkId, + slashes: sp_runtime::BoundedVec< + (SeraiAddress, u32), + sp_core::ConstU32<{ primitives::MAX_KEY_SHARES_PER_SET / 3 }>, + >, + signature: Signature, + ) -> Transaction { + Serai::unsigned(serai_abi::Call::ValidatorSets( + serai_abi::validator_sets::Call::report_slashes { network, slashes, signature }, + )) + } } diff --git a/substrate/validator-sets/pallet/src/lib.rs b/substrate/validator-sets/pallet/src/lib.rs index c1c7b1798..3c8418bf8 100644 --- a/substrate/validator-sets/pallet/src/lib.rs +++ b/substrate/validator-sets/pallet/src/lib.rs @@ -307,6 +307,10 @@ pub mod pallet { #[pallet::getter(fn keys)] pub type Keys = StorageMap<_, Twox64Concat, ValidatorSet, KeyPair, OptionQuery>; + /// The key for validator sets which can (and still need to) publish their slash reports. + #[pallet::storage] + pub type PendingSlashReport = StorageMap<_, Identity, NetworkId, Public, OptionQuery>; + /// Disabled validators. #[pallet::storage] pub type SeraiDisabledIndices = StorageMap<_, Identity, u32, Public, OptionQuery>; @@ -325,6 +329,12 @@ pub mod pallet { set: ValidatorSet, key_pair: KeyPair, }, + AcceptedHandover { + set: ValidatorSet, + }, + SetRetired { + set: ValidatorSet, + }, AllocationIncreased { validator: T::AccountId, network: NetworkId, @@ -341,9 +351,6 @@ pub mod pallet { network: NetworkId, session: Session, }, - SetRetired { - set: ValidatorSet, - }, } impl Pallet { @@ -681,8 +688,21 @@ pub mod pallet { } pub fn retire_set(set: ValidatorSet) { - Keys::::remove(set); - Pallet::::deposit_event(Event::SetRetired { set }); + let keys = Keys::::take(set).unwrap(); + // If the prior prior set didn't report, emit they're retired now + if PendingSlashReport::::get(set.network).is_some() { + Self::deposit_event(Event::SetRetired { + set: ValidatorSet { network: set.network, session: Session(set.session.0 - 1) }, + }); + } + // This overwrites the prior value as the prior to-report set's stake presumably just + // unlocked, making their report unenforceable + PendingSlashReport::::set(set.network, Some(keys.0)); + + // We're retiring this set because the set after it accepted the handover + Self::deposit_event(Event::AcceptedHandover { + set: ValidatorSet { network: set.network, session: Session(set.session.0 + 1) }, + }); } /// Take the amount deallocatable. @@ -883,6 +903,31 @@ pub mod pallet { Ok(()) } + #[pallet::call_index(1)] + #[pallet::weight(0)] // TODO + pub fn report_slashes( + origin: OriginFor, + network: NetworkId, + slashes: BoundedVec<(Public, u32), ConstU32<{ MAX_KEY_SHARES_PER_SET / 3 }>>, + signature: Signature, + ) -> DispatchResult { + ensure_none(origin)?; + + // signature isn't checked as this is an unsigned transaction, and validate_unsigned + // (called by pre_dispatch) checks it + let _ = signature; + + // TODO: Handle slashes + let _ = slashes; + + // Emit set retireed + Pallet::::deposit_event(Event::SetRetired { + set: ValidatorSet { network, session: Session(Self::session(network).unwrap().0 - 1) }, + }); + + Ok(()) + } + #[pallet::call_index(2)] #[pallet::weight(0)] // TODO pub fn allocate(origin: OriginFor, network: NetworkId, amount: Amount) -> DispatchResult { @@ -1012,11 +1057,34 @@ pub mod pallet { } ValidTransaction::with_tag_prefix("ValidatorSets") - .and_provides(set) + .and_provides((0, set)) .longevity(u64::MAX) .propagate(true) .build() } + Call::report_slashes { network, ref slashes, ref signature } => { + let network = *network; + // Don't allow Serai to publish a slash report as BABE/GRANDPA handles slashes directly + if network == NetworkId::Serai { + Err(InvalidTransaction::Custom(0))?; + } + let Some(key) = PendingSlashReport::::take(network) else { + // Assumed already published + Err(InvalidTransaction::Stale)? + }; + // There must have been a previous session is PendingSlashReport is populated + let set = + ValidatorSet { network, session: Session(Self::session(network).unwrap().0 - 1) }; + if !key.verify(&report_slashes_message(&set, slashes), signature) { + Err(InvalidTransaction::BadProof)?; + } + + ValidTransaction::with_tag_prefix("ValidatorSets") + .and_provides((1, set)) + .longevity(MAX_KEY_SHARES_PER_SET.into()) + .propagate(true) + .build() + } Call::allocate { .. } | Call::deallocate { .. } | Call::claim_deallocation { .. } => { Err(InvalidTransaction::Call)? } diff --git a/substrate/validator-sets/primitives/src/lib.rs b/substrate/validator-sets/primitives/src/lib.rs index df7cf18e5..644b19e18 100644 --- a/substrate/validator-sets/primitives/src/lib.rs +++ b/substrate/validator-sets/primitives/src/lib.rs @@ -107,6 +107,10 @@ pub fn set_keys_message( (b"ValidatorSets-set_keys", set, removed_participants, key_pair).encode() } +pub fn report_slashes_message(set: &ValidatorSet, slashes: &[(Public, u32)]) -> Vec { + (b"ValidatorSets-report_slashes", set, slashes).encode() +} + /// For a set of validators whose key shares may exceed the maximum, reduce until they equal the /// maximum. /// From cc75b52a4353eb0d52468da98a8778777e178564 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 31 Jan 2024 17:54:43 -0500 Subject: [PATCH 10/17] Don't allow constructing unusable serai_client::bitcoin::Address es --- processor/src/networks/bitcoin.rs | 26 ++---- substrate/client/src/networks/bitcoin.rs | 95 +++++++++++++-------- tests/full-stack/src/tests/mint_and_burn.rs | 2 +- tests/processor/src/networks.rs | 6 +- 4 files changed, 73 insertions(+), 56 deletions(-) diff --git a/processor/src/networks/bitcoin.rs b/processor/src/networks/bitcoin.rs index b47f0f033..65908aa38 100644 --- a/processor/src/networks/bitcoin.rs +++ b/processor/src/networks/bitcoin.rs @@ -134,8 +134,7 @@ impl OutputTrait for Output { fn write(&self, writer: &mut W) -> io::Result<()> { self.kind.write(writer)?; - let presumed_origin: Option> = - self.presumed_origin.clone().map(|presumed_origin| presumed_origin.try_into().unwrap()); + let presumed_origin: Option> = self.presumed_origin.clone().map(Into::into); writer.write_all(&presumed_origin.encode())?; self.output.write(writer)?; writer.write_all(&u16::try_from(self.data.len()).unwrap().to_le_bytes())?; @@ -415,7 +414,7 @@ impl Bitcoin { .iter() .map(|payment| { ( - payment.address.0.clone(), + payment.address.clone().into(), // If we're solely estimating the fee, don't specify the actual amount // This won't affect the fee calculation yet will ensure we don't hit a not enough funds // error @@ -427,7 +426,7 @@ impl Bitcoin { match BSignableTransaction::new( inputs.iter().map(|input| input.output.clone()).collect(), &payments, - change.as_ref().map(|change| &change.0), + change.as_ref().map(AsRef::as_ref), None, fee.0, ) { @@ -532,7 +531,8 @@ impl Network for Bitcoin { } fn external_address(key: ProjectivePoint) -> Address { - Address(BAddress::::new(BNetwork::Bitcoin, address_payload(key).unwrap())) + Address::new(BAddress::::new(BNetwork::Bitcoin, address_payload(key).unwrap())) + .unwrap() } fn branch_address(key: ProjectivePoint) -> Address { @@ -603,17 +603,9 @@ impl Network for Bitcoin { } tx.unwrap().output.swap_remove(usize::try_from(spent_output.vout).unwrap()) }; - BAddress::from_script(&spent_output.script_pubkey, BNetwork::Bitcoin).ok().and_then( - |address| { - let address = Address(address); - let encoded: Result, _> = address.clone().try_into(); - if encoded.is_ok() { - Some(address) - } else { - None - } - }, - ) + BAddress::from_script(&spent_output.script_pubkey, BNetwork::Bitcoin) + .ok() + .and_then(Address::new) }; let output = Output { kind, presumed_origin, output, data }; @@ -802,7 +794,7 @@ impl Network for Bitcoin { }], output: vec![TxOut { value: tx.output[0].value - BAmount::from_sat(10000), - script_pubkey: address.0.script_pubkey(), + script_pubkey: address.as_ref().script_pubkey(), }], }; diff --git a/substrate/client/src/networks/bitcoin.rs b/substrate/client/src/networks/bitcoin.rs index 336b17315..42cf41bfc 100644 --- a/substrate/client/src/networks/bitcoin.rs +++ b/substrate/client/src/networks/bitcoin.rs @@ -12,9 +12,8 @@ use bitcoin::{ type BAddress = BAddressGeneric; -// TODO: Add a new so you can't create an address which can't be encoded #[derive(Clone, Eq, Debug)] -pub struct Address(pub BAddress); +pub struct Address(BAddress); impl PartialEq for Address { fn eq(&self, other: &Self) -> bool { @@ -27,11 +26,12 @@ impl PartialEq for Address { impl FromStr for Address { type Err = Error; fn from_str(str: &str) -> Result { - Ok(Address( + Address::new( BAddressGeneric::from_str(str) .map_err(|_| Error::UnrecognizedScript)? .require_network(Network::Bitcoin)?, - )) + ) + .ok_or(Error::UnrecognizedScript) } } @@ -77,38 +77,63 @@ impl TryFrom> for Address { } } -#[allow(clippy::from_over_into)] -impl TryInto> for Address { - type Error = (); - fn try_into(self) -> Result, ()> { - Ok( - (match self.0.payload() { - Payload::PubkeyHash(hash) => EncodedAddress::P2PKH(*hash.as_raw_hash().as_byte_array()), - Payload::ScriptHash(hash) => EncodedAddress::P2SH(*hash.as_raw_hash().as_byte_array()), - Payload::WitnessProgram(program) => match program.version() { - WitnessVersion::V0 => { - let program = program.program(); - if program.len() == 20 { - let mut buf = [0; 20]; - buf.copy_from_slice(program.as_ref()); - EncodedAddress::P2WPKH(buf) - } else if program.len() == 32 { - let mut buf = [0; 32]; - buf.copy_from_slice(program.as_ref()); - EncodedAddress::P2WSH(buf) - } else { - Err(())? - } - } - WitnessVersion::V1 => { - let program_ref: &[u8] = program.program().as_ref(); - EncodedAddress::P2TR(program_ref.try_into().map_err(|_| ())?) +fn try_to_vec(addr: &Address) -> Result, ()> { + Ok( + (match addr.0.payload() { + Payload::PubkeyHash(hash) => EncodedAddress::P2PKH(*hash.as_raw_hash().as_byte_array()), + Payload::ScriptHash(hash) => EncodedAddress::P2SH(*hash.as_raw_hash().as_byte_array()), + Payload::WitnessProgram(program) => match program.version() { + WitnessVersion::V0 => { + let program = program.program(); + if program.len() == 20 { + let mut buf = [0; 20]; + buf.copy_from_slice(program.as_ref()); + EncodedAddress::P2WPKH(buf) + } else if program.len() == 32 { + let mut buf = [0; 32]; + buf.copy_from_slice(program.as_ref()); + EncodedAddress::P2WSH(buf) + } else { + Err(())? } - _ => Err(())?, - }, + } + WitnessVersion::V1 => { + let program_ref: &[u8] = program.program().as_ref(); + EncodedAddress::P2TR(program_ref.try_into().map_err(|_| ())?) + } _ => Err(())?, - }) - .encode(), - ) + }, + _ => Err(())?, + }) + .encode(), + ) +} + +impl From
for Vec { + fn from(addr: Address) -> Vec { + // Safe since only encodable addresses can be created + try_to_vec(&addr).unwrap() + } +} + +impl From
for BAddress { + fn from(addr: Address) -> BAddress { + addr.0 + } +} + +impl AsRef for Address { + fn as_ref(&self) -> &BAddress { + &self.0 + } +} + +impl Address { + pub fn new(address: BAddress) -> Option { + let res = Self(address); + if try_to_vec(&res).is_ok() { + return Some(res); + } + None } } diff --git a/tests/full-stack/src/tests/mint_and_burn.rs b/tests/full-stack/src/tests/mint_and_burn.rs index 4fe1378ed..9a18ac54a 100644 --- a/tests/full-stack/src/tests/mint_and_burn.rs +++ b/tests/full-stack/src/tests/mint_and_burn.rs @@ -514,7 +514,7 @@ async fn mint_and_burn_test() { Coin::Bitcoin, 1_000_000_00, ExternalAddress::new( - serai_client::networks::bitcoin::Address(bitcoin_addr.clone()).try_into().unwrap(), + serai_client::networks::bitcoin::Address::new(bitcoin_addr.clone()).unwrap().into(), ) .unwrap(), ) diff --git a/tests/processor/src/networks.rs b/tests/processor/src/networks.rs index a54703ce9..dc234476b 100644 --- a/tests/processor/src/networks.rs +++ b/tests/processor/src/networks.rs @@ -389,9 +389,9 @@ impl Wallet { Wallet::Bitcoin { public_key, .. } => { use bitcoin_serai::bitcoin::{Network, Address}; ExternalAddress::new( - networks::bitcoin::Address(Address::p2pkh(public_key, Network::Regtest)) - .try_into() - .unwrap(), + networks::bitcoin::Address::new(Address::p2pkh(public_key, Network::Regtest)) + .unwrap() + .into(), ) .unwrap() } From 05219c3ce8d091b0d3da62f7d2ec0935153b4a7c Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 31 Jan 2024 19:10:39 -0500 Subject: [PATCH 11/17] Windows Clippy (#525) * Add windows clippy * Adjust build-dependencies for Linux/Windows * Specifically use bash as a shell to try and get rustup to work on Windows * Use bash for the call to echo --- .github/actions/build-dependencies/action.yml | 11 +++++++++-- .github/workflows/lint.yml | 8 +++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/actions/build-dependencies/action.yml b/.github/actions/build-dependencies/action.yml index bc8db571e..1d5adc07f 100644 --- a/.github/actions/build-dependencies/action.yml +++ b/.github/actions/build-dependencies/action.yml @@ -20,15 +20,22 @@ runs: sudo apt autoremove -y sudo apt clean docker system prune -a --volumes + if: runner.os == 'Linux' - - name: Install apt dependencies + - name: Install dependencies shell: bash - run: sudo apt install -y ca-certificates + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt install -y ca-certificates + elif [ "$RUNNER_OS" == "Windows" ]; then + choco install protoc + fi - name: Install Protobuf uses: arduino/setup-protoc@a8b67ba40b37d35169e222f3bb352603327985b6 with: repo-token: ${{ inputs.github-token }} + if: runner.os == 'Linux' - name: Install solc shell: bash diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 167075552..fd26e4dd6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,12 +9,17 @@ on: jobs: clippy: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - name: Get nightly version to use id: nightly + shell: bash run: echo "version=$(cat .github/nightly-version)" >> $GITHUB_OUTPUT - name: Build Dependencies @@ -60,6 +65,7 @@ jobs: - name: Get nightly version to use id: nightly + shell: bash run: echo "version=$(cat .github/nightly-version)" >> $GITHUB_OUTPUT - name: Install nightly rust From 2b76e41c9abe94daad59cd0dc435f186966a008e Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 31 Jan 2024 19:21:26 -0500 Subject: [PATCH 12/17] Directly install protobuf-compiler without using an external action (#524) * Directly install protobuf-compiler without using an external action * Remove unused "github-token" input --- .github/actions/build-dependencies/action.yml | 14 +------------- .github/actions/test-dependencies/action.yml | 7 ------- .github/workflows/coins-tests.yml | 2 -- .github/workflows/common-tests.yml | 2 -- .github/workflows/coordinator-tests.yml | 2 -- .github/workflows/crypto-tests.yml | 2 -- .github/workflows/full-stack-tests.yml | 2 -- .github/workflows/lint.yml | 2 -- .github/workflows/message-queue-tests.yml | 2 -- .github/workflows/mini-tests.yml | 2 -- .github/workflows/monero-tests.yaml | 3 --- .github/workflows/no-std.yml | 2 -- .github/workflows/processor-tests.yml | 2 -- .github/workflows/reproducible-runtime.yml | 2 -- .github/workflows/tests.yml | 6 ------ 15 files changed, 1 insertion(+), 51 deletions(-) diff --git a/.github/actions/build-dependencies/action.yml b/.github/actions/build-dependencies/action.yml index 1d5adc07f..db0d7f523 100644 --- a/.github/actions/build-dependencies/action.yml +++ b/.github/actions/build-dependencies/action.yml @@ -1,12 +1,6 @@ name: build-dependencies description: Installs build dependencies for Serai -inputs: - github-token: - description: "GitHub token to install Protobuf with" - require: true - default: - runs: using: "composite" steps: @@ -26,17 +20,11 @@ runs: shell: bash run: | if [ "$RUNNER_OS" == "Linux" ]; then - sudo apt install -y ca-certificates + sudo apt install -y ca-certificates protobuf-compiler elif [ "$RUNNER_OS" == "Windows" ]; then choco install protoc fi - - name: Install Protobuf - uses: arduino/setup-protoc@a8b67ba40b37d35169e222f3bb352603327985b6 - with: - repo-token: ${{ inputs.github-token }} - if: runner.os == 'Linux' - - name: Install solc shell: bash run: | diff --git a/.github/actions/test-dependencies/action.yml b/.github/actions/test-dependencies/action.yml index d41f3e659..e4492dbb6 100644 --- a/.github/actions/test-dependencies/action.yml +++ b/.github/actions/test-dependencies/action.yml @@ -2,11 +2,6 @@ name: test-dependencies description: Installs test dependencies for Serai inputs: - github-token: - description: "GitHub token to install Protobuf with" - require: true - default: - monero-version: description: "Monero version to download and run as a regtest node" required: false @@ -22,8 +17,6 @@ runs: steps: - name: Install Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ inputs.github-token }} - name: Install Foundry uses: foundry-rs/foundry-toolchain@cb603ca0abb544f301eaed59ac0baf579aa6aecf diff --git a/.github/workflows/coins-tests.yml b/.github/workflows/coins-tests.yml index 255003743..a0437c61a 100644 --- a/.github/workflows/coins-tests.yml +++ b/.github/workflows/coins-tests.yml @@ -25,8 +25,6 @@ jobs: - name: Test Dependencies uses: ./.github/actions/test-dependencies - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run Tests run: | diff --git a/.github/workflows/common-tests.yml b/.github/workflows/common-tests.yml index 17ce42465..0135fcaff 100644 --- a/.github/workflows/common-tests.yml +++ b/.github/workflows/common-tests.yml @@ -21,8 +21,6 @@ jobs: - name: Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run Tests run: | diff --git a/.github/workflows/coordinator-tests.yml b/.github/workflows/coordinator-tests.yml index cc1fd3794..cf32e9305 100644 --- a/.github/workflows/coordinator-tests.yml +++ b/.github/workflows/coordinator-tests.yml @@ -37,8 +37,6 @@ jobs: - name: Install Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ inputs.github-token }} - name: Run coordinator Docker tests run: cd tests/coordinator && GITHUB_CI=true RUST_BACKTRACE=1 cargo test diff --git a/.github/workflows/crypto-tests.yml b/.github/workflows/crypto-tests.yml index 13f7a33ef..d9d1df08b 100644 --- a/.github/workflows/crypto-tests.yml +++ b/.github/workflows/crypto-tests.yml @@ -23,8 +23,6 @@ jobs: - name: Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run Tests run: | diff --git a/.github/workflows/full-stack-tests.yml b/.github/workflows/full-stack-tests.yml index f764bc838..3d1c86a19 100644 --- a/.github/workflows/full-stack-tests.yml +++ b/.github/workflows/full-stack-tests.yml @@ -17,8 +17,6 @@ jobs: - name: Install Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ inputs.github-token }} - name: Run Full Stack Docker tests run: cd tests/full-stack && GITHUB_CI=true RUST_BACKTRACE=1 cargo test diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fd26e4dd6..286dd73ff 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,8 +24,6 @@ jobs: - name: Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - name: Install nightly rust run: rustup toolchain install ${{ steps.nightly.outputs.version }} --profile minimal -t wasm32-unknown-unknown -c clippy diff --git a/.github/workflows/message-queue-tests.yml b/.github/workflows/message-queue-tests.yml index bdc5f233e..e6a5cfbf3 100644 --- a/.github/workflows/message-queue-tests.yml +++ b/.github/workflows/message-queue-tests.yml @@ -31,8 +31,6 @@ jobs: - name: Install Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ inputs.github-token }} - name: Run message-queue Docker tests run: cd tests/message-queue && GITHUB_CI=true RUST_BACKTRACE=1 cargo test diff --git a/.github/workflows/mini-tests.yml b/.github/workflows/mini-tests.yml index 4ee6f64e0..9728e040f 100644 --- a/.github/workflows/mini-tests.yml +++ b/.github/workflows/mini-tests.yml @@ -21,8 +21,6 @@ jobs: - name: Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run Tests run: GITHUB_CI=true RUST_BACKTRACE=1 cargo test --all-features -p mini-serai diff --git a/.github/workflows/monero-tests.yaml b/.github/workflows/monero-tests.yaml index 511535b57..3f2127cef 100644 --- a/.github/workflows/monero-tests.yaml +++ b/.github/workflows/monero-tests.yaml @@ -24,8 +24,6 @@ jobs: - name: Test Dependencies uses: ./.github/actions/test-dependencies - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run Unit Tests Without Features run: GITHUB_CI=true RUST_BACKTRACE=1 cargo test --package monero-serai --lib @@ -45,7 +43,6 @@ jobs: - name: Test Dependencies uses: ./.github/actions/test-dependencies with: - github-token: ${{ secrets.GITHUB_TOKEN }} monero-version: ${{ matrix.version }} - name: Run Integration Tests Without Features diff --git a/.github/workflows/no-std.yml b/.github/workflows/no-std.yml index a92047a7e..79ea57670 100644 --- a/.github/workflows/no-std.yml +++ b/.github/workflows/no-std.yml @@ -27,8 +27,6 @@ jobs: - name: Install Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ inputs.github-token }} - name: Install RISC-V Toolchain run: sudo apt update && sudo apt install -y gcc-riscv64-unknown-elf gcc-multilib && rustup target add riscv32imac-unknown-none-elf diff --git a/.github/workflows/processor-tests.yml b/.github/workflows/processor-tests.yml index fa6db151a..f124cecea 100644 --- a/.github/workflows/processor-tests.yml +++ b/.github/workflows/processor-tests.yml @@ -37,8 +37,6 @@ jobs: - name: Install Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ inputs.github-token }} - name: Run processor Docker tests run: cd tests/processor && GITHUB_CI=true RUST_BACKTRACE=1 cargo test diff --git a/.github/workflows/reproducible-runtime.yml b/.github/workflows/reproducible-runtime.yml index 6648d3e43..16256ab61 100644 --- a/.github/workflows/reproducible-runtime.yml +++ b/.github/workflows/reproducible-runtime.yml @@ -31,8 +31,6 @@ jobs: - name: Install Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ inputs.github-token }} - name: Run Reproducible Runtime tests run: cd tests/reproducible-runtime && GITHUB_CI=true RUST_BACKTRACE=1 cargo test diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8e0e7e3ee..257c1dd56 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,8 +33,6 @@ jobs: - name: Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run Tests run: | @@ -54,8 +52,6 @@ jobs: - name: Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run Tests run: | @@ -79,8 +75,6 @@ jobs: - name: Build Dependencies uses: ./.github/actions/build-dependencies - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run Tests run: GITHUB_CI=true RUST_BACKTRACE=1 cargo test --all-features -p serai-client From 9b25d0dad70a9b3b53bb4cf903154cf7c1e3dab9 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 1 Feb 2024 20:52:17 -0500 Subject: [PATCH 13/17] Update to node 20 GitHub cache action --- .github/actions/bitcoin/action.yml | 2 +- .github/actions/monero-wallet-rpc/action.yml | 2 +- .github/actions/monero/action.yml | 2 +- .github/workflows/daily-deny.yml | 2 +- .github/workflows/lint.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/bitcoin/action.yml b/.github/actions/bitcoin/action.yml index 471024e57..e15cc26e9 100644 --- a/.github/actions/bitcoin/action.yml +++ b/.github/actions/bitcoin/action.yml @@ -12,7 +12,7 @@ runs: steps: - name: Bitcoin Daemon Cache id: cache-bitcoind - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: bitcoin.tar.gz key: bitcoind-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }} diff --git a/.github/actions/monero-wallet-rpc/action.yml b/.github/actions/monero-wallet-rpc/action.yml index 4a5b48fd5..0e8aa7c79 100644 --- a/.github/actions/monero-wallet-rpc/action.yml +++ b/.github/actions/monero-wallet-rpc/action.yml @@ -12,7 +12,7 @@ runs: steps: - name: Monero Wallet RPC Cache id: cache-monero-wallet-rpc - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: monero-wallet-rpc key: monero-wallet-rpc-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }} diff --git a/.github/actions/monero/action.yml b/.github/actions/monero/action.yml index 783931898..cb80c841f 100644 --- a/.github/actions/monero/action.yml +++ b/.github/actions/monero/action.yml @@ -12,7 +12,7 @@ runs: steps: - name: Monero Daemon Cache id: cache-monerod - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: monerod key: monerod-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }} diff --git a/.github/workflows/daily-deny.yml b/.github/workflows/daily-deny.yml index a85c68816..5e1d0ac74 100644 --- a/.github/workflows/daily-deny.yml +++ b/.github/workflows/daily-deny.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - name: Advisory Cache - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: ~/.cargo/advisory-db key: rust-advisory-db diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 286dd73ff..90b3f60d5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - name: Advisory Cache - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: ~/.cargo/advisory-db key: rust-advisory-db From 745075af6ee45c64dddb875a7452fbb641f21289 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 1 Feb 2024 01:14:22 +0000 Subject: [PATCH 14/17] Update nightly --- .github/nightly-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/nightly-version b/.github/nightly-version index 6cb7e59b1..d7aace133 100644 --- a/.github/nightly-version +++ b/.github/nightly-version @@ -1 +1 @@ -nightly-2023-12-04 +nightly-2024-02-01 From 89788be034e487c38e4c51328179a385352c71a3 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 1 Feb 2024 21:31:02 -0500 Subject: [PATCH 15/17] macOS clippy (#526) * Specifically use bash as a shell to try and get rustup to work on Windows * Use bash for the call to echo * Add macOS clippy * Debug why git diff failed * Restore macos-latest to matrix * Allow whitespace before the fact 0 lines were modified * Add LC_ALL env variable to grep * Replace usage of -P with -e --- .github/actions/build-dependencies/action.yml | 2 ++ .github/workflows/lint.yml | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-dependencies/action.yml b/.github/actions/build-dependencies/action.yml index db0d7f523..bd66e70ff 100644 --- a/.github/actions/build-dependencies/action.yml +++ b/.github/actions/build-dependencies/action.yml @@ -23,6 +23,8 @@ runs: sudo apt install -y ca-certificates protobuf-compiler elif [ "$RUNNER_OS" == "Windows" ]; then choco install protoc + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install protobuf fi - name: Install solc diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 90b3f60d5..707112649 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ jobs: clippy: strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: @@ -37,7 +37,8 @@ jobs: # The above clippy run will cause it to be updated, so checking there's # no differences present now performs the desired check - name: Verify lockfile - run: git diff | wc -l | grep -x "0" + shell: bash + run: git diff | wc -l | LC_ALL="en_US.utf8" grep -x -e "^[ ]*0" deny: runs-on: ubuntu-latest From af12cec3b9618230b7f8aa8768b56bdd7f1702a6 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sun, 4 Feb 2024 01:13:48 -0500 Subject: [PATCH 16/17] cargo update Resolves deny warning around unintended behavior change (without semver bump). --- Cargo.lock | 149 ++++++++++++++++++++++++++--------------------------- 1 file changed, 74 insertions(+), 75 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9406a006..11791cf14 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -139,9 +139,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" [[package]] name = "anstyle-parse" @@ -262,9 +262,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb41eb19024a91746eba0773aa5e16036045bbf45733766661099e182ea6a744" +checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" dependencies = [ "async-lock", "cfg-if", @@ -349,14 +349,13 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] @@ -748,9 +747,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "ed2490600f404f2b94c167e31d3ed1d5f3c225a0f3b80230053b3e0b7b962bd9" [[package]] name = "byteorder" @@ -876,9 +875,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.32" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a" +checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" dependencies = [ "android-tzdata", "iana-time-zone", @@ -2059,9 +2058,9 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6267a1fa6f59179ea4afc8e50fd8612a3cc60bc858f786ff877a4a8cb042799" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" dependencies = [ "indenter", "once_cell", @@ -2681,7 +2680,7 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.4", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -2720,7 +2719,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.11", - "indexmap 2.1.0", + "indexmap 2.2.2", "slab", "tokio", "tokio-util", @@ -3001,9 +3000,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ "bytes", "futures-channel", @@ -3034,9 +3033,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -3181,9 +3180,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -3459,9 +3458,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libloading" @@ -3964,9 +3963,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.14" +version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "295c17e837573c8c821dbaeb3cceb3d745ad082f7572191409e69cbc1b3fd050" +checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" dependencies = [ "cc", "pkg-config", @@ -4043,9 +4042,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7" +checksum = "db2c024b41519440580066ba82aab04092b333e09066a5eb86c7c4890df31f22" dependencies = [ "hashbrown 0.14.3", ] @@ -4275,9 +4274,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -5217,7 +5216,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap 2.2.2", ] [[package]] @@ -5232,18 +5231,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", @@ -5435,7 +5434,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit 0.21.0", + "toml_edit 0.21.1", ] [[package]] @@ -5841,7 +5840,7 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.4", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -5856,9 +5855,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -6076,9 +6075,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ "bitflags 2.4.2", "errno", @@ -6107,7 +6106,7 @@ checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" dependencies = [ "ring 0.17.7", "rustls-pki-types", - "rustls-webpki 0.102.1", + "rustls-webpki 0.102.2", "subtle", "zeroize", ] @@ -6137,9 +6136,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9d979b3ce68192e42760c7810125eb6cf2ea10efae545a156063e61f314e2a" +checksum = "0a716eb65e3158e90e17cd93d855216e27bde02745ab842f2cab4a39dba1bacf" [[package]] name = "rustls-webpki" @@ -6153,9 +6152,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.1" +version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4ca26037c909dedb327b48c3327d0ba91d3dd3c4e05dad328f210ffb68e95b" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ "ring 0.17.7", "rustls-pki-types", @@ -7251,9 +7250,9 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f622567e3b4b38154fb8190bcf6b160d7a4301d70595a49195b48c116007a27" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" dependencies = [ "bitcoin_hashes", "rand", @@ -7873,9 +7872,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] @@ -7891,9 +7890,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -7902,9 +7901,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -7945,15 +7944,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58c3a1b3e418f61c25b2aeb43fc6c95eaa252b8cecdda67f401943e9e08d33f" +checksum = "1b0ed1662c5a68664f45b76d18deb0e234aff37207086803165c961eb695e981" dependencies = [ "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.1.0", + "indexmap 2.2.2", "serde", "serde_json", "time", @@ -8112,9 +8111,9 @@ checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" [[package]] name = "snow" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58021967fd0a5eeeb23b08df6cc244a4d4a5b4aec1d27c9e02fad1a58b4cd74e" +checksum = "850948bee068e713b8ab860fe1adc4d109676ab4c3b621fd8147f06b261f2f85" dependencies = [ "aes-gcm", "blake2", @@ -9233,9 +9232,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -9335,7 +9334,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.2", "serde", "serde_spanned", "toml_datetime", @@ -9344,11 +9343,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.2", "toml_datetime", "winnow", ] @@ -9948,7 +9947,7 @@ version = "0.110.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dfcdb72d96f01e6c85b6bf20102e7423bdbaad5c337301bab2bbf253d26413c" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.2", "semver 1.0.21", ] @@ -9963,7 +9962,7 @@ dependencies = [ "bumpalo", "cfg-if", "fxprof-processed-profile", - "indexmap 2.1.0", + "indexmap 2.2.2", "libc", "log", "object 0.31.1", @@ -10062,7 +10061,7 @@ dependencies = [ "anyhow", "cranelift-entity", "gimli 0.27.3", - "indexmap 2.1.0", + "indexmap 2.2.2", "log", "object 0.31.1", "serde", @@ -10129,7 +10128,7 @@ dependencies = [ "anyhow", "cc", "cfg-if", - "indexmap 2.1.0", + "indexmap 2.2.2", "libc", "log", "mach", @@ -10182,9 +10181,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.3" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "which" @@ -10200,9 +10199,9 @@ dependencies = [ [[package]] name = "wide" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b31891d644eba1789fb6715f27fbc322e4bdf2ecdc412ede1993246159271613" +checksum = "89beec544f246e679fc25490e3f8e08003bc4bf612068f325120dad4cea02c1c" dependencies = [ "bytemuck", "safe_arch", @@ -10407,9 +10406,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.34" +version = "0.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" dependencies = [ "memchr", ] From ad0ecc51858be97495fd2a29fd8f7c725c274507 Mon Sep 17 00:00:00 2001 From: akildemir <34187742+akildemir@users.noreply.github.com> Date: Mon, 5 Feb 2024 11:50:55 +0300 Subject: [PATCH 17/17] complete various todos in tributary (#520) * complete various todos * fix pr comments * Document bounds on unique hashes in TransactionKind --------- Co-authored-by: Luke Parker --- coordinator/tributary/src/block.rs | 9 +- coordinator/tributary/src/blockchain.rs | 31 +++-- coordinator/tributary/src/lib.rs | 6 +- coordinator/tributary/src/mempool.rs | 2 +- coordinator/tributary/src/tendermint/mod.rs | 25 +++- coordinator/tributary/src/tendermint/tx.rs | 126 +----------------- coordinator/tributary/src/tests/block.rs | 16 +-- coordinator/tributary/src/tests/mempool.rs | 4 +- .../src/tests/transaction/tendermint.rs | 8 +- coordinator/tributary/src/transaction.rs | 5 + coordinator/tributary/tendermint/src/lib.rs | 117 +++++++++++++++- 11 files changed, 184 insertions(+), 165 deletions(-) diff --git a/coordinator/tributary/src/block.rs b/coordinator/tributary/src/block.rs index 6b9a0543f..6f3374bdc 100644 --- a/coordinator/tributary/src/block.rs +++ b/coordinator/tributary/src/block.rs @@ -175,9 +175,8 @@ impl Block { mut locally_provided: HashMap<&'static str, VecDeque>, get_and_increment_nonce: &mut G, schema: &N::SignatureScheme, - commit: impl Fn(u32) -> Option>, - unsigned_in_chain: impl Fn([u8; 32]) -> bool, - provided_in_chain: impl Fn([u8; 32]) -> bool, // TODO: merge this with unsigned_on_chain? + commit: impl Fn(u64) -> Option>, + provided_or_unsigned_in_chain: impl Fn([u8; 32]) -> bool, allow_non_local_provided: bool, ) -> Result<(), BlockError> { #[derive(Clone, Copy, PartialEq, Eq, Debug)] @@ -213,7 +212,7 @@ impl Block { let current_tx_order = match tx.kind() { TransactionKind::Provided(order) => { - if provided_in_chain(tx_hash) { + if provided_or_unsigned_in_chain(tx_hash) { Err(BlockError::ProvidedAlreadyIncluded)?; } @@ -233,7 +232,7 @@ impl Block { } TransactionKind::Unsigned => { // check we don't already have the tx in the chain - if unsigned_in_chain(tx_hash) || included_in_block.contains(&tx_hash) { + if provided_or_unsigned_in_chain(tx_hash) || included_in_block.contains(&tx_hash) { Err(BlockError::UnsignedAlreadyIncluded)?; } included_in_block.insert(tx_hash); diff --git a/coordinator/tributary/src/blockchain.rs b/coordinator/tributary/src/blockchain.rs index 7063cea9b..1664860bb 100644 --- a/coordinator/tributary/src/blockchain.rs +++ b/coordinator/tributary/src/blockchain.rs @@ -18,7 +18,7 @@ pub(crate) struct Blockchain { db: Option, genesis: [u8; 32], - block_number: u32, + block_number: u64, tip: [u8; 32], participants: HashSet<::G>, @@ -38,7 +38,7 @@ impl Blockchain { fn block_key(genesis: &[u8], hash: &[u8; 32]) -> Vec { D::key(b"tributary_blockchain", b"block", [genesis, hash].concat()) } - fn block_hash_key(genesis: &[u8], block_number: u32) -> Vec { + fn block_hash_key(genesis: &[u8], block_number: u64) -> Vec { D::key(b"tributary_blockchain", b"block_hash", [genesis, &block_number.to_le_bytes()].concat()) } fn commit_key(genesis: &[u8], hash: &[u8; 32]) -> Vec { @@ -88,7 +88,7 @@ impl Blockchain { let db = res.db.as_ref().unwrap(); db.get(res.block_number_key()).map(|number| (number, db.get(Self::tip_key(genesis)).unwrap())) } { - res.block_number = u32::from_le_bytes(block_number.try_into().unwrap()); + res.block_number = u64::from_le_bytes(block_number.try_into().unwrap()); res.tip.copy_from_slice(&tip); } @@ -99,7 +99,7 @@ impl Blockchain { self.tip } - pub(crate) fn block_number(&self) -> u32 { + pub(crate) fn block_number(&self) -> u64 { self.block_number } @@ -112,7 +112,7 @@ impl Blockchain { db.get(Self::commit_key(&genesis, block)) } - pub(crate) fn block_hash_from_db(db: &D, genesis: [u8; 32], block: u32) -> Option<[u8; 32]> { + pub(crate) fn block_hash_from_db(db: &D, genesis: [u8; 32], block: u64) -> Option<[u8; 32]> { db.get(Self::block_hash_key(&genesis, block)).map(|h| h.try_into().unwrap()) } @@ -120,11 +120,11 @@ impl Blockchain { Self::commit_from_db(self.db.as_ref().unwrap(), self.genesis, block) } - pub(crate) fn block_hash(&self, block: u32) -> Option<[u8; 32]> { + pub(crate) fn block_hash(&self, block: u64) -> Option<[u8; 32]> { Self::block_hash_from_db(self.db.as_ref().unwrap(), self.genesis, block) } - pub(crate) fn commit_by_block_number(&self, block: u32) -> Option> { + pub(crate) fn commit_by_block_number(&self, block: u64) -> Option> { self.commit(&self.block_hash(block)?) } @@ -160,16 +160,16 @@ impl Blockchain { let db = self.db.as_ref().unwrap(); let genesis = self.genesis; - let commit = |block: u32| -> Option> { + let commit = |block: u64| -> Option> { let hash = Self::block_hash_from_db(db, genesis, block)?; // we must have a commit per valid hash let commit = Self::commit_from_db(db, genesis, &hash).unwrap(); // commit has to be valid if it is coming from our db Some(Commit::::decode(&mut commit.as_ref()).unwrap()) }; - let unsigned_in_chain = |hash: [u8; 32]| db.get(Self::unsigned_included_key(&self.genesis, &hash)).is_some(); + self.mempool.add::( |signer, order| { if self.participants.contains(&signer) { @@ -233,11 +233,11 @@ impl Blockchain { allow_non_local_provided: bool, ) -> Result<(), BlockError> { let db = self.db.as_ref().unwrap(); - let unsigned_in_chain = - |hash: [u8; 32]| db.get(Self::unsigned_included_key(&self.genesis, &hash)).is_some(); - let provided_in_chain = - |hash: [u8; 32]| db.get(Self::provided_included_key(&self.genesis, &hash)).is_some(); - let commit = |block: u32| -> Option> { + let provided_or_unsigned_in_chain = |hash: [u8; 32]| { + db.get(Self::unsigned_included_key(&self.genesis, &hash)).is_some() || + db.get(Self::provided_included_key(&self.genesis, &hash)).is_some() + }; + let commit = |block: u64| -> Option> { let commit = self.commit_by_block_number(block)?; // commit has to be valid if it is coming from our db Some(Commit::::decode(&mut commit.as_ref()).unwrap()) @@ -263,8 +263,7 @@ impl Blockchain { }, schema, &commit, - unsigned_in_chain, - provided_in_chain, + provided_or_unsigned_in_chain, allow_non_local_provided, ); // Drop this TXN's changes as we're solely verifying the block diff --git a/coordinator/tributary/src/lib.rs b/coordinator/tributary/src/lib.rs index dac7f4beb..5a5df1a7a 100644 --- a/coordinator/tributary/src/lib.rs +++ b/coordinator/tributary/src/lib.rs @@ -182,7 +182,7 @@ impl Tributary { let validators = Arc::new(Validators::new(genesis, validators)?); let mut blockchain = Blockchain::new(db.clone(), genesis, &validators_vec); - let block_number = BlockNumber(blockchain.block_number().into()); + let block_number = BlockNumber(blockchain.block_number()); let start_time = if let Some(commit) = blockchain.commit(&blockchain.tip()) { Commit::::decode(&mut commit.as_ref()).unwrap().end_time @@ -240,7 +240,7 @@ impl Tributary { self.genesis } - pub async fn block_number(&self) -> u32 { + pub async fn block_number(&self) -> u64 { self.network.blockchain.read().await.block_number() } pub async fn tip(&self) -> [u8; 32] { @@ -314,7 +314,7 @@ impl Tributary { return false; } - let number = BlockNumber((block_number + 1).into()); + let number = BlockNumber(block_number + 1); self.synced_block.write().await.send(SyncedBlock { number, block, commit }).await.unwrap(); result.next().await.unwrap() } diff --git a/coordinator/tributary/src/mempool.rs b/coordinator/tributary/src/mempool.rs index 344d45436..7558bae07 100644 --- a/coordinator/tributary/src/mempool.rs +++ b/coordinator/tributary/src/mempool.rs @@ -114,7 +114,7 @@ impl Mempool { tx: Transaction, schema: &N::SignatureScheme, unsigned_in_chain: impl Fn([u8; 32]) -> bool, - commit: impl Fn(u32) -> Option>, + commit: impl Fn(u64) -> Option>, ) -> Result { match &tx { Transaction::Tendermint(tendermint_tx) => { diff --git a/coordinator/tributary/src/tendermint/mod.rs b/coordinator/tributary/src/tendermint/mod.rs index 36f381c97..dc62c798a 100644 --- a/coordinator/tributary/src/tendermint/mod.rs +++ b/coordinator/tributary/src/tendermint/mod.rs @@ -275,9 +275,31 @@ pub struct TendermintNetwork { pub const BLOCK_PROCESSING_TIME: u32 = 999; pub const LATENCY_TIME: u32 = 1667; -// TODO: Add test asserting this pub const TARGET_BLOCK_TIME: u32 = BLOCK_PROCESSING_TIME + (3 * LATENCY_TIME); +#[test] +fn assert_target_block_time() { + use serai_db::MemDb; + + #[derive(Clone, Debug)] + pub struct DummyP2p; + + #[async_trait::async_trait] + impl P2p for DummyP2p { + async fn broadcast(&self, _: [u8; 32], _: Vec) { + unimplemented!() + } + } + + // Type paremeters don't matter here since we only need to call the block_time() + // and it only relies on the constants of the trait implementation. block_time() is in seconds, + // TARGET_BLOCK_TIME is in milliseconds. + assert_eq!( + as Network>::block_time(), + TARGET_BLOCK_TIME / 1000 + ) +} + #[async_trait] impl Network for TendermintNetwork { type ValidatorId = [u8; 32]; @@ -342,7 +364,6 @@ impl Network for TendermintNetwork }; // add tx to blockchain and broadcast to peers - // TODO: Make a function out of this following block let mut to_broadcast = vec![TRANSACTION_MESSAGE]; tx.write(&mut to_broadcast).unwrap(); if self.blockchain.write().await.add_transaction::( diff --git a/coordinator/tributary/src/tendermint/tx.rs b/coordinator/tributary/src/tendermint/tx.rs index 328ff3868..5f5102d31 100644 --- a/coordinator/tributary/src/tendermint/tx.rs +++ b/coordinator/tributary/src/tendermint/tx.rs @@ -12,14 +12,11 @@ use crate::{ }; use tendermint::{ - SignedMessageFor, Data, - round::RoundData, - time::CanonicalInstant, - commit_msg, - ext::{Network, Commit, RoundNumber, SignatureScheme}, + verify_tendermint_evience, + ext::{Network, Commit}, }; -pub use tendermint::Evidence; +pub use tendermint::{Evidence, decode_signed_message}; #[allow(clippy::large_enum_variant)] #[derive(Clone, PartialEq, Eq, Debug)] @@ -63,127 +60,16 @@ impl Transaction for TendermintTx { } } -pub fn decode_signed_message( - mut data: &[u8], -) -> Result, TransactionError> { - SignedMessageFor::::decode(&mut data).map_err(|_| TransactionError::InvalidContent) -} - -fn decode_and_verify_signed_message( - data: &[u8], - schema: &N::SignatureScheme, -) -> Result, TransactionError> { - let msg = decode_signed_message::(data)?; - - // verify that evidence messages are signed correctly - if !msg.verify_signature(schema) { - Err(TransactionError::InvalidSignature)? - } - Ok(msg) -} - -// TODO: Move this into tendermint-machine -// TODO: Strongly type Evidence, instead of having two messages and no idea what's supposedly -// wrong with them. Doing so will massively simplify the auditability of this (as this -// re-implements an entire foreign library's checks for malicious behavior). pub(crate) fn verify_tendermint_tx( tx: &TendermintTx, schema: &N::SignatureScheme, - commit: impl Fn(u32) -> Option>, + commit: impl Fn(u64) -> Option>, ) -> Result<(), TransactionError> { tx.verify()?; match tx { - // TODO: Only allow one evidence per validator, since evidence is fatal - TendermintTx::SlashEvidence(ev) => { - match ev { - Evidence::ConflictingMessages(first, second) => { - let first = decode_and_verify_signed_message::(first, schema)?.msg; - let second = decode_and_verify_signed_message::(second, schema)?.msg; - - // Make sure they're distinct messages, from the same sender, within the same block - if (first == second) || (first.sender != second.sender) || (first.block != second.block) { - Err(TransactionError::InvalidContent)?; - } - - // Distinct messages within the same step - if !((first.round == second.round) && (first.data.step() == second.data.step())) { - Err(TransactionError::InvalidContent)?; - } - } - Evidence::ConflictingPrecommit(first, second) => { - let first = decode_and_verify_signed_message::(first, schema)?.msg; - let second = decode_and_verify_signed_message::(second, schema)?.msg; - - if (first.sender != second.sender) || (first.block != second.block) { - Err(TransactionError::InvalidContent)?; - } - - // check whether messages are precommits to different blocks - // The inner signatures don't need to be verified since the outer signatures were - // While the inner signatures may be invalid, that would've yielded a invalid precommit - // signature slash instead of distinct precommit slash - if let Data::Precommit(Some((h1, _))) = first.data { - if let Data::Precommit(Some((h2, _))) = second.data { - if h1 == h2 { - Err(TransactionError::InvalidContent)?; - } - return Ok(()); - } - } - - // No fault identified - Err(TransactionError::InvalidContent)? - } - Evidence::InvalidPrecommit(msg) => { - let msg = decode_and_verify_signed_message::(msg, schema)?.msg; - - let Data::Precommit(Some((id, sig))) = &msg.data else { - Err(TransactionError::InvalidContent)? - }; - // TODO: We need to be passed in the genesis time to handle this edge case - if msg.block.0 == 0 { - todo!("invalid precommit signature on first block") - } - - // get the last commit - // TODO: Why do we use u32 when Tendermint uses u64? - let prior_commit = match u32::try_from(msg.block.0 - 1) { - Ok(n) => match commit(n) { - Some(c) => c, - // If we have yet to sync the block in question, we will return InvalidContent based - // on our own temporal ambiguity - // This will also cause an InvalidContent for anything using a non-existent block, - // yet that's valid behavior - // TODO: Double check the ramifications of this - _ => Err(TransactionError::InvalidContent)?, - }, - _ => Err(TransactionError::InvalidContent)?, - }; - - // calculate the end time till the msg round - let mut last_end_time = CanonicalInstant::new(prior_commit.end_time); - for r in 0 ..= msg.round.0 { - last_end_time = RoundData::::new(RoundNumber(r), last_end_time).end_time(); - } - - // verify that the commit was actually invalid - if schema.verify(msg.sender, &commit_msg(last_end_time.canonical(), id.as_ref()), sig) { - Err(TransactionError::InvalidContent)? - } - } - Evidence::InvalidValidRound(msg) => { - let msg = decode_and_verify_signed_message::(msg, schema)?.msg; - - let Data::Proposal(Some(vr), _) = &msg.data else { - Err(TransactionError::InvalidContent)? - }; - if vr.0 < msg.round.0 { - Err(TransactionError::InvalidContent)? - } - } - } - } + TendermintTx::SlashEvidence(ev) => verify_tendermint_evience::(ev, schema, commit) + .map_err(|_| TransactionError::InvalidContent)?, } Ok(()) diff --git a/coordinator/tributary/src/tests/block.rs b/coordinator/tributary/src/tests/block.rs index 0df72e6da..c5bf19c64 100644 --- a/coordinator/tributary/src/tests/block.rs +++ b/coordinator/tributary/src/tests/block.rs @@ -78,11 +78,10 @@ fn empty_block() { const GENESIS: [u8; 32] = [0xff; 32]; const LAST: [u8; 32] = [0x01; 32]; let validators = Arc::new(Validators::new(GENESIS, vec![]).unwrap()); - let commit = |_: u32| -> Option>> { + let commit = |_: u64| -> Option>> { Some(Commit::> { end_time: 0, validators: vec![], signature: vec![] }) }; - let unsigned_in_chain = |_: [u8; 32]| false; - let provided_in_chain = |_: [u8; 32]| false; + let provided_or_unsigned_in_chain = |_: [u8; 32]| false; Block::::new(LAST, vec![], vec![]) .verify::( GENESIS, @@ -91,8 +90,7 @@ fn empty_block() { &mut |_, _| None, &validators, commit, - unsigned_in_chain, - provided_in_chain, + provided_or_unsigned_in_chain, false, ) .unwrap(); @@ -113,11 +111,10 @@ fn duplicate_nonces() { insert(NonceTransaction::new(0, 0)); insert(NonceTransaction::new(i, 1)); - let commit = |_: u32| -> Option>> { + let commit = |_: u64| -> Option>> { Some(Commit::> { end_time: 0, validators: vec![], signature: vec![] }) }; - let unsigned_in_chain = |_: [u8; 32]| false; - let provided_in_chain = |_: [u8; 32]| false; + let provided_or_unsigned_in_chain = |_: [u8; 32]| false; let mut last_nonce = 0; let res = Block::new(LAST, vec![], mempool).verify::( @@ -131,8 +128,7 @@ fn duplicate_nonces() { }, &validators, commit, - unsigned_in_chain, - provided_in_chain, + provided_or_unsigned_in_chain, false, ); if i == 1 { diff --git a/coordinator/tributary/src/tests/mempool.rs b/coordinator/tributary/src/tests/mempool.rs index 34ed4cf98..66148cf30 100644 --- a/coordinator/tributary/src/tests/mempool.rs +++ b/coordinator/tributary/src/tests/mempool.rs @@ -28,7 +28,7 @@ fn new_mempool() -> ([u8; 32], MemDb, Mempool) { #[tokio::test] async fn mempool_addition() { let (genesis, db, mut mempool) = new_mempool::(); - let commit = |_: u32| -> Option>> { + let commit = |_: u64| -> Option>> { Some(Commit::> { end_time: 0, validators: vec![], signature: vec![] }) }; let unsigned_in_chain = |_: [u8; 32]| false; @@ -160,7 +160,7 @@ async fn mempool_addition() { fn too_many_mempool() { let (genesis, _, mut mempool) = new_mempool::(); let validators = Arc::new(Validators::new(genesis, vec![]).unwrap()); - let commit = |_: u32| -> Option>> { + let commit = |_: u64| -> Option>> { Some(Commit::> { end_time: 0, validators: vec![], signature: vec![] }) }; let unsigned_in_chain = |_: [u8; 32]| false; diff --git a/coordinator/tributary/src/tests/transaction/tendermint.rs b/coordinator/tributary/src/tests/transaction/tendermint.rs index e701f1361..0397674e2 100644 --- a/coordinator/tributary/src/tests/transaction/tendermint.rs +++ b/coordinator/tributary/src/tests/transaction/tendermint.rs @@ -42,7 +42,7 @@ async fn serialize_tendermint() { async fn invalid_valid_round() { // signer let (_, signer, signer_id, validators) = tendermint_meta().await; - let commit = |_: u32| -> Option>> { + let commit = |_: u64| -> Option>> { Some(Commit::> { end_time: 0, validators: vec![], signature: vec![] }) }; @@ -78,7 +78,7 @@ async fn invalid_valid_round() { #[tokio::test] async fn invalid_precommit_signature() { let (_, signer, signer_id, validators) = tendermint_meta().await; - let commit = |i: u32| -> Option>> { + let commit = |i: u64| -> Option>> { assert_eq!(i, 0); Some(Commit::> { end_time: 0, validators: vec![], signature: vec![] }) }; @@ -127,7 +127,7 @@ async fn invalid_precommit_signature() { #[tokio::test] async fn evidence_with_prevote() { let (_, signer, signer_id, validators) = tendermint_meta().await; - let commit = |_: u32| -> Option>> { + let commit = |_: u64| -> Option>> { Some(Commit::> { end_time: 0, validators: vec![], signature: vec![] }) }; @@ -180,7 +180,7 @@ async fn evidence_with_prevote() { #[tokio::test] async fn conflicting_msgs_evidence_tx() { let (genesis, signer, signer_id, validators) = tendermint_meta().await; - let commit = |i: u32| -> Option>> { + let commit = |i: u64| -> Option>> { assert_eq!(i, 0); Some(Commit::> { end_time: 0, validators: vec![], signature: vec![] }) }; diff --git a/coordinator/tributary/src/transaction.rs b/coordinator/tributary/src/transaction.rs index a773daa7a..8e9342d70 100644 --- a/coordinator/tributary/src/transaction.rs +++ b/coordinator/tributary/src/transaction.rs @@ -122,6 +122,9 @@ pub enum TransactionKind<'a> { /// If a supermajority of validators produce a commit for a block with a provided transaction /// which isn't locally held, the block will be added to the local chain. When the transaction is /// locally provided, it will be compared for correctness to the on-chain version + /// + /// In order to ensure TXs aren't accidentally provided multiple times, all provided transactions + /// must have a unique hash which is also unique to all Unsigned transactions. Provided(&'static str), /// An unsigned transaction, only able to be included by the block producer. @@ -129,6 +132,8 @@ pub enum TransactionKind<'a> { /// Once an Unsigned transaction is included on-chain, it may not be included again. In order to /// have multiple Unsigned transactions with the same values included on-chain, some distinct /// nonce must be included in order to cause a distinct hash. + /// + /// The hash must also be unique with all Provided transactions. Unsigned, /// A signed transaction. diff --git a/coordinator/tributary/tendermint/src/lib.rs b/coordinator/tributary/tendermint/src/lib.rs index c54160997..fd9b89d28 100644 --- a/coordinator/tributary/tendermint/src/lib.rs +++ b/coordinator/tributary/tendermint/src/lib.rs @@ -19,6 +19,7 @@ pub mod time; use time::{sys_time, CanonicalInstant}; pub mod round; +use round::RoundData; mod block; use block::BlockData; @@ -103,10 +104,11 @@ impl SignedMessage { } #[derive(Clone, PartialEq, Eq, Debug)] -enum TendermintError { +pub enum TendermintError { Malicious(N::ValidatorId, Option), Temporal, AlreadyHandled, + InvalidEvidence, } // Type aliases to abstract over generic hell @@ -139,6 +141,113 @@ pub enum Evidence { InvalidValidRound(Vec), } +pub fn decode_signed_message(mut data: &[u8]) -> Option> { + SignedMessageFor::::decode(&mut data).ok() +} + +fn decode_and_verify_signed_message( + data: &[u8], + schema: &N::SignatureScheme, +) -> Result, TendermintError> { + let msg = decode_signed_message::(data).ok_or(TendermintError::InvalidEvidence)?; + + // verify that evidence messages are signed correctly + if !msg.verify_signature(schema) { + Err(TendermintError::InvalidEvidence)?; + } + + Ok(msg) +} + +pub fn verify_tendermint_evience( + evidence: &Evidence, + schema: &N::SignatureScheme, + commit: impl Fn(u64) -> Option>, +) -> Result<(), TendermintError> { + match evidence { + Evidence::ConflictingMessages(first, second) => { + let first = decode_and_verify_signed_message::(first, schema)?.msg; + let second = decode_and_verify_signed_message::(second, schema)?.msg; + + // Make sure they're distinct messages, from the same sender, within the same block + if (first == second) || (first.sender != second.sender) || (first.block != second.block) { + Err(TendermintError::InvalidEvidence)?; + } + + // Distinct messages within the same step + if !((first.round == second.round) && (first.data.step() == second.data.step())) { + Err(TendermintError::InvalidEvidence)?; + } + } + Evidence::ConflictingPrecommit(first, second) => { + let first = decode_and_verify_signed_message::(first, schema)?.msg; + let second = decode_and_verify_signed_message::(second, schema)?.msg; + + if (first.sender != second.sender) || (first.block != second.block) { + Err(TendermintError::InvalidEvidence)?; + } + + // check whether messages are precommits to different blocks + // The inner signatures don't need to be verified since the outer signatures were + // While the inner signatures may be invalid, that would've yielded a invalid precommit + // signature slash instead of distinct precommit slash + if let Data::Precommit(Some((h1, _))) = first.data { + if let Data::Precommit(Some((h2, _))) = second.data { + if h1 == h2 { + Err(TendermintError::InvalidEvidence)?; + } + return Ok(()); + } + } + + // No fault identified + Err(TendermintError::InvalidEvidence)?; + } + Evidence::InvalidPrecommit(msg) => { + let msg = decode_and_verify_signed_message::(msg, schema)?.msg; + + let Data::Precommit(Some((id, sig))) = &msg.data else { + Err(TendermintError::InvalidEvidence)? + }; + // TODO: We need to be passed in the genesis time to handle this edge case + if msg.block.0 == 0 { + todo!("invalid precommit signature on first block") + } + + // get the last commit + let prior_commit = match commit(msg.block.0 - 1) { + Some(c) => c, + // If we have yet to sync the block in question, we will return InvalidContent based + // on our own temporal ambiguity + // This will also cause an InvalidContent for anything using a non-existent block, + // yet that's valid behavior + // TODO: Double check the ramifications of this + _ => Err(TendermintError::InvalidEvidence)?, + }; + + // calculate the end time till the msg round + let mut last_end_time = CanonicalInstant::new(prior_commit.end_time); + for r in 0 ..= msg.round.0 { + last_end_time = RoundData::::new(RoundNumber(r), last_end_time).end_time(); + } + + // verify that the commit was actually invalid + if schema.verify(msg.sender, &commit_msg(last_end_time.canonical(), id.as_ref()), sig) { + Err(TendermintError::InvalidEvidence)? + } + } + Evidence::InvalidValidRound(msg) => { + let msg = decode_and_verify_signed_message::(msg, schema)?.msg; + + let Data::Proposal(Some(vr), _) = &msg.data else { Err(TendermintError::InvalidEvidence)? }; + if vr.0 < msg.round.0 { + Err(TendermintError::InvalidEvidence)? + } + } + } + Ok(()) +} + #[derive(Clone, PartialEq, Eq, Debug)] pub enum SlashEvent { Id(SlashReason, u64, u32), @@ -543,7 +652,11 @@ impl TendermintMachine { self.slash(sender, slash).await } - Err(TendermintError::Temporal | TendermintError::AlreadyHandled) => (), + Err( + TendermintError::Temporal | + TendermintError::AlreadyHandled | + TendermintError::InvalidEvidence, + ) => (), } } }