dockertest 0.5, correct errors from prior update commit

This commit is contained in:
Luke Parker 2024-09-05 23:31:45 -04:00
parent 0d5756ffcf
commit c1a9256cc5
No known key found for this signature in database
15 changed files with 67 additions and 49 deletions

65
Cargo.lock generated
View file

@ -459,8 +459,7 @@ dependencies = [
[[package]] [[package]]
name = "alloy-sol-type-parser" name = "alloy-sol-type-parser"
version = "0.8.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/alloy-rs/core?rev=446b9d2fbce12b88456152170709a3eaac929af0#446b9d2fbce12b88456152170709a3eaac929af0"
checksum = "f4691da83dce9c9b4c775dd701c87759f173bd3021cbf2e60cde00c5fe6d7241"
dependencies = [ dependencies = [
"serde", "serde",
"winnow 0.6.18", "winnow 0.6.18",
@ -1213,18 +1212,21 @@ dependencies = [
[[package]] [[package]]
name = "bollard" name = "bollard"
version = "0.15.0" version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f03db470b3c0213c47e978da93200259a1eb4dae2e5512cba9955e2b540a6fc6" checksum = "d41711ad46fda47cd701f6908e59d1bd6b9a2b7464c0d0aeab95c6d37096ff8a"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.22.1",
"bollard-stubs", "bollard-stubs",
"bytes", "bytes",
"futures-core", "futures-core",
"futures-util", "futures-util",
"hex", "hex",
"http 0.2.12", "http 1.1.0",
"hyper 0.14.30", "http-body-util",
"hyper 1.4.1",
"hyper-named-pipe",
"hyper-util",
"hyperlocal", "hyperlocal",
"log", "log",
"pin-project-lite", "pin-project-lite",
@ -1236,15 +1238,16 @@ dependencies = [
"thiserror", "thiserror",
"tokio", "tokio",
"tokio-util", "tokio-util",
"tower-service",
"url", "url",
"winapi", "winapi",
] ]
[[package]] [[package]]
name = "bollard-stubs" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b58071e8fd9ec1e930efd28e3a90c1251015872a2ce49f81f36421b86466932e" checksum = "6d7c5415e3a6bc6d3e99eff6268e488fd4ee25e7b28c10f08fa6760bd9de16e4"
dependencies = [ dependencies = [
"serde", "serde",
"serde_repr", "serde_repr",
@ -2227,20 +2230,22 @@ dependencies = [
[[package]] [[package]]
name = "dockertest" name = "dockertest"
version = "0.4.0" version = "0.5.0"
source = "git+https://github.com/orcalabs/dockertest-rs?rev=4dd6ae24738aa6dc5c89444cc822ea4745517493#4dd6ae24738aa6dc5c89444cc822ea4745517493" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8648c989dfd460932144f0ce5c55ff35cf0de758f89ea20e3b3d0d3f5e1cce6"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
"base64 0.21.7", "base64 0.22.1",
"bollard", "bollard",
"bytes",
"dyn-clone", "dyn-clone",
"futures", "futures",
"lazy_static",
"rand", "rand",
"secrecy", "secrecy",
"serde", "serde",
"serde_json", "serde_json",
"strum 0.26.3",
"thiserror", "thiserror",
"tokio", "tokio",
"tracing", "tracing",
@ -3402,7 +3407,7 @@ dependencies = [
"httpdate", "httpdate",
"itoa", "itoa",
"pin-project-lite", "pin-project-lite",
"socket2 0.4.10", "socket2 0.5.7",
"tokio", "tokio",
"tower-service", "tower-service",
"tracing", "tracing",
@ -3421,6 +3426,7 @@ dependencies = [
"http 1.1.0", "http 1.1.0",
"http-body 1.0.1", "http-body 1.0.1",
"httparse", "httparse",
"httpdate",
"itoa", "itoa",
"pin-project-lite", "pin-project-lite",
"smallvec", "smallvec",
@ -3428,6 +3434,21 @@ dependencies = [
"want", "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]] [[package]]
name = "hyper-rustls" name = "hyper-rustls"
version = "0.27.3" version = "0.27.3"
@ -3468,15 +3489,17 @@ dependencies = [
[[package]] [[package]]
name = "hyperlocal" name = "hyperlocal"
version = "0.8.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fafdf7b2b2de7c9784f76e02c0935e65a8117ec3b768644379983ab333ac98c" checksum = "986c5ce3b994526b3cd75578e62554abd09f0899d6206de48b3e96ab34ccc8c7"
dependencies = [ dependencies = [
"futures-util",
"hex", "hex",
"hyper 0.14.30", "http-body-util",
"pin-project", "hyper 1.4.1",
"hyper-util",
"pin-project-lite",
"tokio", "tokio",
"tower-service",
] ]
[[package]] [[package]]
@ -3932,7 +3955,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"windows-targets 0.48.5", "windows-targets 0.52.6",
] ]
[[package]] [[package]]
@ -11063,7 +11086,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]

View file

@ -138,9 +138,6 @@ panic = "unwind"
# https://github.com/rust-lang-nursery/lazy-static.rs/issues/201 # 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" } 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_core = { path = "patches/parking_lot_core" }
parking_lot = { path = "patches/parking_lot" } parking_lot = { path = "patches/parking_lot" }
# wasmtime pulls in an old version for this # wasmtime pulls in an old version for this
@ -161,6 +158,9 @@ matches = { path = "patches/matches" }
option-ext = { path = "patches/option-ext" } option-ext = { path = "patches/option-ext" }
directories-next = { path = "patches/directories-next" } 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] [workspace.lints.clippy]
unwrap_or_default = "allow" unwrap_or_default = "allow"
borrow_as_ptr = "deny" borrow_as_ptr = "deny"

View file

@ -10,6 +10,7 @@ ignore = [
"RUSTSEC-2020-0168", # mach is unmaintained "RUSTSEC-2020-0168", # mach is unmaintained
"RUSTSEC-2021-0139", # https://github.com/serai-dex/serai/228 "RUSTSEC-2021-0139", # https://github.com/serai-dex/serai/228
"RUSTSEC-2022-0061", # https://github.com/serai-dex/serai/227 "RUSTSEC-2022-0061", # https://github.com/serai-dex/serai/227
"RUSTSEC-2024-0370", # proc-macro-error is unmaintained
] ]
[licenses] [licenses]
@ -101,5 +102,5 @@ allow-git = [
"https://github.com/rust-lang-nursery/lazy-static.rs", "https://github.com/rust-lang-nursery/lazy-static.rs",
"https://github.com/serai-dex/substrate-bip39", "https://github.com/serai-dex/substrate-bip39",
"https://github.com/serai-dex/substrate", "https://github.com/serai-dex/substrate",
"https://github.com/orcalabs/dockertest-rs", "https://github.com/alloy-rs/core",
] ]

View file

@ -6,7 +6,7 @@ use k256::{Scalar, ProjectivePoint};
use frost::{curve::Secp256k1, Participant, ThresholdKeys, tests::key_gen as frost_key_gen}; use frost::{curve::Secp256k1, Participant, ThresholdKeys, tests::key_gen as frost_key_gen};
use alloy_core::{ use alloy_core::{
primitives::{Address, U256, Bytes, TxKind}, primitives::{Address, U256, Bytes, Signature, TxKind},
hex::FromHex, hex::FromHex,
}; };
use alloy_consensus::{SignableTransaction, TxLegacy}; use alloy_consensus::{SignableTransaction, TxLegacy};
@ -69,7 +69,7 @@ pub async fn send(
); );
let mut bytes = vec![]; 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()?; let pending_tx = provider.send_raw_transaction(&bytes).await.ok()?;
pending_tx.get_receipt().await.ok() pending_tx.get_receipt().await.ok()
} }

View file

@ -91,7 +91,6 @@ async fn latest_block_hash(client: &RootProvider<SimpleRequest>) -> [u8; 32] {
.unwrap() .unwrap()
.header .header
.hash .hash
.unwrap()
.0 .0
} }

View file

@ -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"] } ethereum-serai = { path = "../networks/ethereum", default-features = false, features = ["tests"] }
dockertest = "0.4" dockertest = "0.5"
serai-docker-tests = { path = "../tests/docker" } serai-docker-tests = { path = "../tests/docker" }
[features] [features]

View file

@ -437,8 +437,7 @@ impl<D: Db> Network for Ethereum<D> {
.map_err(|_| NetworkError::ConnectionError)? .map_err(|_| NetworkError::ConnectionError)?
.ok_or(NetworkError::ConnectionError)? .ok_or(NetworkError::ConnectionError)?
.header .header
.number .number;
.unwrap();
// Error if there hasn't been a full epoch yet // Error if there hasn't been a full epoch yet
if actual_number < 32 { if actual_number < 32 {
Err(NetworkError::ConnectionError)? Err(NetworkError::ConnectionError)?
@ -467,7 +466,6 @@ impl<D: Db> Network for Ethereum<D> {
.ok_or(NetworkError::ConnectionError)? .ok_or(NetworkError::ConnectionError)?
.header .header
.hash .hash
.unwrap()
.into() .into()
}; };
@ -480,7 +478,7 @@ impl<D: Db> Network for Ethereum<D> {
.ok_or(NetworkError::ConnectionError)? .ok_or(NetworkError::ConnectionError)?
.header; .header;
let end_hash = end_header.hash.unwrap().into(); let end_hash = end_header.hash.into();
let time = end_header.timestamp; let time = end_header.timestamp;
Ok(Epoch { prior_end_hash, start: start.try_into().unwrap(), end_hash, time }) Ok(Epoch { prior_end_hash, start: start.try_into().unwrap(), end_hash, time })
@ -813,7 +811,6 @@ impl<D: Db> Network for Ethereum<D> {
.unwrap() .unwrap()
.header .header
.number .number
.unwrap()
.try_into() .try_into()
.unwrap() .unwrap()
} }
@ -921,13 +918,13 @@ impl<D: Db> Network for Ethereum<D> {
.into(), .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()) let sig = k256::ecdsa::SigningKey::from(k256::elliptic_curve::NonZeroScalar::new(key).unwrap())
.sign_prehash_recoverable(tx.signature_hash().as_ref()) .sign_prehash_recoverable(tx.signature_hash().as_ref())
.unwrap(); .unwrap();
let mut bytes = vec![]; 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(); let pending_tx = self.provider.send_raw_transaction(&bytes).await.ok().unwrap();
// Mine an epoch containing this TX // Mine an epoch containing this TX

View file

@ -53,7 +53,7 @@ schnorrkel = { path = "../../crypto/schnorrkel", package = "frost-schnorrkel" }
tokio = "1" tokio = "1"
dockertest = "0.4" dockertest = "0.5"
serai-docker-tests = { path = "../../tests/docker" } serai-docker-tests = { path = "../../tests/docker" }
[features] [features]

View file

@ -39,6 +39,6 @@ borsh = { version = "1", features = ["de_strict_order"] }
tokio = { version = "1", features = ["time"] } tokio = { version = "1", features = ["time"] }
dockertest = "0.4" dockertest = "0.5"
serai-docker-tests = { path = "../docker" } serai-docker-tests = { path = "../docker" }
serai-message-queue-tests = { path = "../message-queue" } serai-message-queue-tests = { path = "../message-queue" }

View file

@ -40,7 +40,7 @@ serai-client = { path = "../../substrate/client", features = ["serai"] }
tokio = { version = "1", features = ["time"] } tokio = { version = "1", features = ["time"] }
dockertest = "0.4" dockertest = "0.5"
serai-docker-tests = { path = "../docker" } serai-docker-tests = { path = "../docker" }
serai-message-queue-tests = { path = "../message-queue" } serai-message-queue-tests = { path = "../message-queue" }
serai-processor-tests = { path = "../processor" } serai-processor-tests = { path = "../processor" }

View file

@ -28,5 +28,5 @@ serai-primitives = { path = "../../substrate/primitives" }
serai-message-queue = { path = "../../message-queue" } serai-message-queue = { path = "../../message-queue" }
tokio = { version = "1", features = ["time"] } tokio = { version = "1", features = ["time"] }
dockertest = "0.4" dockertest = "0.5"
serai-docker-tests = { path = "../docker" } serai-docker-tests = { path = "../docker" }

View file

@ -48,6 +48,6 @@ tokio = { version = "1", features = ["time"] }
processor = { package = "serai-processor", path = "../../processor", features = ["bitcoin", "ethereum", "monero"] } processor = { package = "serai-processor", path = "../../processor", features = ["bitcoin", "ethereum", "monero"] }
dockertest = "0.4" dockertest = "0.5"
serai-docker-tests = { path = "../docker" } serai-docker-tests = { path = "../docker" }
serai-message-queue-tests = { path = "../message-queue" } serai-message-queue-tests = { path = "../message-queue" }

View file

@ -378,8 +378,7 @@ impl Coordinator {
.unwrap() .unwrap()
.unwrap() .unwrap()
.header .header
.number .number;
.unwrap();
// We mine 96 blocks to mine one epoch, then cause its finalization // We mine 96 blocks to mine one epoch, then cause its finalization
provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap(); provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap();
let end_of_epoch = start + 31; let end_of_epoch = start + 31;
@ -389,8 +388,7 @@ impl Coordinator {
.unwrap() .unwrap()
.unwrap() .unwrap()
.header .header
.hash .hash;
.unwrap();
let state = provider let state = provider
.raw_request::<_, String>("anvil_dumpState".into(), ()) .raw_request::<_, String>("anvil_dumpState".into(), ())

View file

@ -305,7 +305,7 @@ impl Wallet {
use std::sync::Arc; use std::sync::Arc;
use ethereum_serai::{ use ethereum_serai::{
alloy::{ alloy::{
primitives::{U256, TxKind}, primitives::{U256, Signature, TxKind},
sol_types::SolCall, sol_types::SolCall,
simple_request_transport::SimpleRequest, simple_request_transport::SimpleRequest,
consensus::{TxLegacy, SignableTransaction}, consensus::{TxLegacy, SignableTransaction},
@ -355,7 +355,7 @@ impl Wallet {
.unwrap(); .unwrap();
let mut bytes = vec![]; 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(); let _ = provider.send_raw_transaction(&bytes).await.unwrap();
provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap(); provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap();
@ -395,7 +395,7 @@ impl Wallet {
.unwrap(); .unwrap();
let mut bytes = vec![]; 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 // We drop the bottom 10 decimals
( (

View file

@ -20,7 +20,7 @@ workspace = true
rand_core = "0.6" rand_core = "0.6"
hex = "0.4" hex = "0.4"
dockertest = "0.4" dockertest = "0.5"
serai-docker-tests = { path = "../docker" } serai-docker-tests = { path = "../docker" }
tokio = { version = "1", features = ["time"] } tokio = { version = "1", features = ["time"] }