From c1a9256cc59e2cc44055d1b4e06877dbbab6641c Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 5 Sep 2024 23:31:45 -0400 Subject: [PATCH] dockertest 0.5, correct errors from prior update commit --- Cargo.lock | 65 ++++++++++++++++++--------- Cargo.toml | 6 +-- deny.toml | 3 +- networks/ethereum/src/tests/mod.rs | 4 +- networks/ethereum/src/tests/router.rs | 1 - processor/Cargo.toml | 2 +- processor/src/networks/ethereum.rs | 11 ++--- substrate/client/Cargo.toml | 2 +- tests/coordinator/Cargo.toml | 2 +- tests/full-stack/Cargo.toml | 2 +- tests/message-queue/Cargo.toml | 2 +- tests/processor/Cargo.toml | 2 +- tests/processor/src/lib.rs | 6 +-- tests/processor/src/networks.rs | 6 +-- tests/reproducible-runtime/Cargo.toml | 2 +- 15 files changed, 67 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7b2288e..ef72a56f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -459,8 +459,7 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4691da83dce9c9b4c775dd701c87759f173bd3021cbf2e60cde00c5fe6d7241" +source = "git+https://github.com/alloy-rs/core?rev=446b9d2fbce12b88456152170709a3eaac929af0#446b9d2fbce12b88456152170709a3eaac929af0" dependencies = [ "serde", "winnow 0.6.18", @@ -1213,18 +1212,21 @@ dependencies = [ [[package]] name = "bollard" -version = "0.15.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03db470b3c0213c47e978da93200259a1eb4dae2e5512cba9955e2b540a6fc6" +checksum = "d41711ad46fda47cd701f6908e59d1bd6b9a2b7464c0d0aeab95c6d37096ff8a" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "bollard-stubs", "bytes", "futures-core", "futures-util", "hex", - "http 0.2.12", - "hyper 0.14.30", + "http 1.1.0", + "http-body-util", + "hyper 1.4.1", + "hyper-named-pipe", + "hyper-util", "hyperlocal", "log", "pin-project-lite", @@ -1236,15 +1238,16 @@ dependencies = [ "thiserror", "tokio", "tokio-util", + "tower-service", "url", "winapi", ] [[package]] name = "bollard-stubs" -version = "1.43.0-rc.2" +version = "1.45.0-rc.26.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b58071e8fd9ec1e930efd28e3a90c1251015872a2ce49f81f36421b86466932e" +checksum = "6d7c5415e3a6bc6d3e99eff6268e488fd4ee25e7b28c10f08fa6760bd9de16e4" dependencies = [ "serde", "serde_repr", @@ -2227,20 +2230,22 @@ dependencies = [ [[package]] name = "dockertest" -version = "0.4.0" -source = "git+https://github.com/orcalabs/dockertest-rs?rev=4dd6ae24738aa6dc5c89444cc822ea4745517493#4dd6ae24738aa6dc5c89444cc822ea4745517493" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8648c989dfd460932144f0ce5c55ff35cf0de758f89ea20e3b3d0d3f5e1cce6" dependencies = [ "anyhow", "async-trait", - "base64 0.21.7", + "base64 0.22.1", "bollard", + "bytes", "dyn-clone", "futures", - "lazy_static", "rand", "secrecy", "serde", "serde_json", + "strum 0.26.3", "thiserror", "tokio", "tracing", @@ -3402,7 +3407,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.7", "tokio", "tower-service", "tracing", @@ -3421,6 +3426,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "httparse", + "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -3428,6 +3434,21 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-named-pipe" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278" +dependencies = [ + "hex", + "hyper 1.4.1", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", + "winapi", +] + [[package]] name = "hyper-rustls" version = "0.27.3" @@ -3468,15 +3489,17 @@ dependencies = [ [[package]] name = "hyperlocal" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fafdf7b2b2de7c9784f76e02c0935e65a8117ec3b768644379983ab333ac98c" +checksum = "986c5ce3b994526b3cd75578e62554abd09f0899d6206de48b3e96ab34ccc8c7" dependencies = [ - "futures-util", "hex", - "hyper 0.14.30", - "pin-project", + "http-body-util", + "hyper 1.4.1", + "hyper-util", + "pin-project-lite", "tokio", + "tower-service", ] [[package]] @@ -3932,7 +3955,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -11063,7 +11086,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e270c510..3416d222 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -138,9 +138,6 @@ panic = "unwind" # https://github.com/rust-lang-nursery/lazy-static.rs/issues/201 lazy_static = { git = "https://github.com/rust-lang-nursery/lazy-static.rs", rev = "5735630d46572f1e5377c8f2ba0f79d18f53b10c" } -# Needed due to dockertest's usage of `Rc`s when we need `Arc`s -dockertest = { git = "https://github.com/orcalabs/dockertest-rs", rev = "4dd6ae24738aa6dc5c89444cc822ea4745517493" } - parking_lot_core = { path = "patches/parking_lot_core" } parking_lot = { path = "patches/parking_lot" } # wasmtime pulls in an old version for this @@ -161,6 +158,9 @@ matches = { path = "patches/matches" } option-ext = { path = "patches/option-ext" } directories-next = { path = "patches/directories-next" } +# https://github.com/alloy-rs/core/issues/717 +alloy-sol-type-parser = { git = "https://github.com/alloy-rs/core", rev = "446b9d2fbce12b88456152170709a3eaac929af0" } + [workspace.lints.clippy] unwrap_or_default = "allow" borrow_as_ptr = "deny" diff --git a/deny.toml b/deny.toml index ec9fb458..cfbc8bc0 100644 --- a/deny.toml +++ b/deny.toml @@ -10,6 +10,7 @@ ignore = [ "RUSTSEC-2020-0168", # mach is unmaintained "RUSTSEC-2021-0139", # https://github.com/serai-dex/serai/228 "RUSTSEC-2022-0061", # https://github.com/serai-dex/serai/227 + "RUSTSEC-2024-0370", # proc-macro-error is unmaintained ] [licenses] @@ -101,5 +102,5 @@ allow-git = [ "https://github.com/rust-lang-nursery/lazy-static.rs", "https://github.com/serai-dex/substrate-bip39", "https://github.com/serai-dex/substrate", - "https://github.com/orcalabs/dockertest-rs", + "https://github.com/alloy-rs/core", ] diff --git a/networks/ethereum/src/tests/mod.rs b/networks/ethereum/src/tests/mod.rs index 912513ff..dcdbedce 100644 --- a/networks/ethereum/src/tests/mod.rs +++ b/networks/ethereum/src/tests/mod.rs @@ -6,7 +6,7 @@ use k256::{Scalar, ProjectivePoint}; use frost::{curve::Secp256k1, Participant, ThresholdKeys, tests::key_gen as frost_key_gen}; use alloy_core::{ - primitives::{Address, U256, Bytes, TxKind}, + primitives::{Address, U256, Bytes, Signature, TxKind}, hex::FromHex, }; use alloy_consensus::{SignableTransaction, TxLegacy}; @@ -69,7 +69,7 @@ pub async fn send( ); let mut bytes = vec![]; - tx.encode_with_signature_fields(&sig.into(), &mut bytes); + tx.encode_with_signature_fields(&Signature::from(sig), &mut bytes); let pending_tx = provider.send_raw_transaction(&bytes).await.ok()?; pending_tx.get_receipt().await.ok() } diff --git a/networks/ethereum/src/tests/router.rs b/networks/ethereum/src/tests/router.rs index e3804d7e..724348cc 100644 --- a/networks/ethereum/src/tests/router.rs +++ b/networks/ethereum/src/tests/router.rs @@ -91,7 +91,6 @@ async fn latest_block_hash(client: &RootProvider) -> [u8; 32] { .unwrap() .header .hash - .unwrap() .0 } diff --git a/processor/Cargo.toml b/processor/Cargo.toml index 5ff7e94d..9d29bc7c 100644 --- a/processor/Cargo.toml +++ b/processor/Cargo.toml @@ -77,7 +77,7 @@ sp-application-crypto = { git = "https://github.com/serai-dex/substrate", defaul ethereum-serai = { path = "../networks/ethereum", default-features = false, features = ["tests"] } -dockertest = "0.4" +dockertest = "0.5" serai-docker-tests = { path = "../tests/docker" } [features] diff --git a/processor/src/networks/ethereum.rs b/processor/src/networks/ethereum.rs index 6a11b06d..3545f34a 100644 --- a/processor/src/networks/ethereum.rs +++ b/processor/src/networks/ethereum.rs @@ -437,8 +437,7 @@ impl Network for Ethereum { .map_err(|_| NetworkError::ConnectionError)? .ok_or(NetworkError::ConnectionError)? .header - .number - .unwrap(); + .number; // Error if there hasn't been a full epoch yet if actual_number < 32 { Err(NetworkError::ConnectionError)? @@ -467,7 +466,6 @@ impl Network for Ethereum { .ok_or(NetworkError::ConnectionError)? .header .hash - .unwrap() .into() }; @@ -480,7 +478,7 @@ impl Network for Ethereum { .ok_or(NetworkError::ConnectionError)? .header; - let end_hash = end_header.hash.unwrap().into(); + let end_hash = end_header.hash.into(); let time = end_header.timestamp; Ok(Epoch { prior_end_hash, start: start.try_into().unwrap(), end_hash, time }) @@ -813,7 +811,6 @@ impl Network for Ethereum { .unwrap() .header .number - .unwrap() .try_into() .unwrap() } @@ -921,13 +918,13 @@ impl Network for Ethereum { .into(), }; - use ethereum_serai::alloy::consensus::SignableTransaction; + use ethereum_serai::alloy::{primitives::Signature, consensus::SignableTransaction}; let sig = k256::ecdsa::SigningKey::from(k256::elliptic_curve::NonZeroScalar::new(key).unwrap()) .sign_prehash_recoverable(tx.signature_hash().as_ref()) .unwrap(); let mut bytes = vec![]; - tx.encode_with_signature_fields(&sig.into(), &mut bytes); + tx.encode_with_signature_fields(&Signature::from(sig), &mut bytes); let pending_tx = self.provider.send_raw_transaction(&bytes).await.ok().unwrap(); // Mine an epoch containing this TX diff --git a/substrate/client/Cargo.toml b/substrate/client/Cargo.toml index 7bb252ce..629312c0 100644 --- a/substrate/client/Cargo.toml +++ b/substrate/client/Cargo.toml @@ -53,7 +53,7 @@ schnorrkel = { path = "../../crypto/schnorrkel", package = "frost-schnorrkel" } tokio = "1" -dockertest = "0.4" +dockertest = "0.5" serai-docker-tests = { path = "../../tests/docker" } [features] diff --git a/tests/coordinator/Cargo.toml b/tests/coordinator/Cargo.toml index f5bc6426..89b168c0 100644 --- a/tests/coordinator/Cargo.toml +++ b/tests/coordinator/Cargo.toml @@ -39,6 +39,6 @@ borsh = { version = "1", features = ["de_strict_order"] } tokio = { version = "1", features = ["time"] } -dockertest = "0.4" +dockertest = "0.5" serai-docker-tests = { path = "../docker" } serai-message-queue-tests = { path = "../message-queue" } diff --git a/tests/full-stack/Cargo.toml b/tests/full-stack/Cargo.toml index 4e684752..12af01bd 100644 --- a/tests/full-stack/Cargo.toml +++ b/tests/full-stack/Cargo.toml @@ -40,7 +40,7 @@ serai-client = { path = "../../substrate/client", features = ["serai"] } tokio = { version = "1", features = ["time"] } -dockertest = "0.4" +dockertest = "0.5" serai-docker-tests = { path = "../docker" } serai-message-queue-tests = { path = "../message-queue" } serai-processor-tests = { path = "../processor" } diff --git a/tests/message-queue/Cargo.toml b/tests/message-queue/Cargo.toml index 2d735534..cd077e48 100644 --- a/tests/message-queue/Cargo.toml +++ b/tests/message-queue/Cargo.toml @@ -28,5 +28,5 @@ serai-primitives = { path = "../../substrate/primitives" } serai-message-queue = { path = "../../message-queue" } tokio = { version = "1", features = ["time"] } -dockertest = "0.4" +dockertest = "0.5" serai-docker-tests = { path = "../docker" } diff --git a/tests/processor/Cargo.toml b/tests/processor/Cargo.toml index 2eba0940..8817b0c9 100644 --- a/tests/processor/Cargo.toml +++ b/tests/processor/Cargo.toml @@ -48,6 +48,6 @@ tokio = { version = "1", features = ["time"] } processor = { package = "serai-processor", path = "../../processor", features = ["bitcoin", "ethereum", "monero"] } -dockertest = "0.4" +dockertest = "0.5" serai-docker-tests = { path = "../docker" } serai-message-queue-tests = { path = "../message-queue" } diff --git a/tests/processor/src/lib.rs b/tests/processor/src/lib.rs index c5dc678a..ec607a55 100644 --- a/tests/processor/src/lib.rs +++ b/tests/processor/src/lib.rs @@ -378,8 +378,7 @@ impl Coordinator { .unwrap() .unwrap() .header - .number - .unwrap(); + .number; // We mine 96 blocks to mine one epoch, then cause its finalization provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap(); let end_of_epoch = start + 31; @@ -389,8 +388,7 @@ impl Coordinator { .unwrap() .unwrap() .header - .hash - .unwrap(); + .hash; let state = provider .raw_request::<_, String>("anvil_dumpState".into(), ()) diff --git a/tests/processor/src/networks.rs b/tests/processor/src/networks.rs index d6ccb1f5..eae77c01 100644 --- a/tests/processor/src/networks.rs +++ b/tests/processor/src/networks.rs @@ -305,7 +305,7 @@ impl Wallet { use std::sync::Arc; use ethereum_serai::{ alloy::{ - primitives::{U256, TxKind}, + primitives::{U256, Signature, TxKind}, sol_types::SolCall, simple_request_transport::SimpleRequest, consensus::{TxLegacy, SignableTransaction}, @@ -355,7 +355,7 @@ impl Wallet { .unwrap(); let mut bytes = vec![]; - tx.encode_with_signature_fields(&sig, &mut bytes); + tx.encode_with_signature_fields(&Signature::from(sig), &mut bytes); let _ = provider.send_raw_transaction(&bytes).await.unwrap(); provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap(); @@ -395,7 +395,7 @@ impl Wallet { .unwrap(); let mut bytes = vec![]; - tx.encode_with_signature_fields(&sig.into(), &mut bytes); + tx.encode_with_signature_fields(&Signature::from(sig), &mut bytes); // We drop the bottom 10 decimals ( diff --git a/tests/reproducible-runtime/Cargo.toml b/tests/reproducible-runtime/Cargo.toml index 6e024111..e51740f6 100644 --- a/tests/reproducible-runtime/Cargo.toml +++ b/tests/reproducible-runtime/Cargo.toml @@ -20,7 +20,7 @@ workspace = true rand_core = "0.6" hex = "0.4" -dockertest = "0.4" +dockertest = "0.5" serai-docker-tests = { path = "../docker" } tokio = { version = "1", features = ["time"] }