Compare commits

...

12 Commits

Author SHA1 Message Date
Omar Abdulla 93f6e5efdf Increase the wait duration of kurtosis 2025-09-28 15:33:20 +03:00
Omar Abdulla ecd6252666 Skip lighthouse tests in MacOS in CI 2025-09-28 15:19:52 +03:00
Omar Abdulla 1d1642887b fix ci 2025-09-28 15:07:04 +03:00
Omar Abdulla db0522aa71 Install kurtosis in cli 2025-09-28 14:59:16 +03:00
Omar Abdulla ca5cad8e43 Add the cargo clippy component 2025-09-28 14:49:22 +03:00
Omar Abdulla 33911b5ce3 Fix CI 2025-09-28 14:25:47 +03:00
Omar Abdulla 5b730d914e Add formatting component for macos 2025-09-28 14:18:16 +03:00
Omar Abdulla 9f7a314b20 Add rustfmt to ci 2025-09-28 14:13:30 +03:00
Omar Abdulla 5cd3dd8c83 Update the ci to include cargo fmt 2025-09-28 14:03:46 +03:00
Omar Abdulla 8d15f87ff0 Connect the lighthouse node with the platforms 2025-09-26 18:34:41 +03:00
Omar Abdulla 566dd06d9a Implement production geth using kurtosis 2025-09-26 18:15:11 +03:00
Omar Abdulla 5c30e8a5bf Add a lighthouse node implementation 2025-09-24 17:13:52 +03:00
12 changed files with 1352 additions and 14 deletions
+32 -4
View File
@@ -91,10 +91,10 @@ jobs:
with: with:
rustflags: "" rustflags: ""
- name: Add wasm32 target - name: Add wasm32 target and formatting
run: | run: |
rustup target add wasm32-unknown-unknown rustup target add wasm32-unknown-unknown
rustup component add rust-src rustup component add rust-src rustfmt clippy
- name: Install Geth on Ubuntu - name: Install Geth on Ubuntu
if: matrix.os == 'ubuntu-24.04' if: matrix.os == 'ubuntu-24.04'
@@ -141,6 +141,17 @@ jobs:
chmod +x resolc chmod +x resolc
sudo mv resolc /usr/local/bin sudo mv resolc /usr/local/bin
- name: Install Kurtosis on macOS
if: matrix.os == 'macos-14'
run: brew install kurtosis-tech/tap/kurtosis-cli
- name: Install Kurtosis on Ubuntu
if: matrix.os == 'ubuntu-24.04'
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
- name: Machete - name: Machete
uses: bnjbvr/cargo-machete@v0.7.1 uses: bnjbvr/cargo-machete@v0.7.1
@@ -159,5 +170,22 @@ jobs:
- name: Check resolc version - name: Check resolc version
run: resolc --version run: resolc --version
- name: Test cargo workspace - name: Test Formatting
run: make test run: make format
- name: Test Clippy
run: make clippy
- name: Test Machete
run: make machete
- name: Unit Tests
if: matrix.os == 'ubuntu-24.04'
run: cargo test --workspace -- --nocapture
# We can't install docker in the MacOS image used in CI and therefore we need to skip the
# Kurtosis and lighthouse related tests when running the CI on MacOS.
- name: Unit Tests
if: matrix.os == 'macos-14'
run: |
cargo test --workspace -- --nocapture --skip lighthouse_geth::tests::
Generated
+154
View File
@@ -87,6 +87,7 @@ dependencies = [
"alloy-transport", "alloy-transport",
"alloy-transport-http", "alloy-transport-http",
"alloy-transport-ipc", "alloy-transport-ipc",
"alloy-transport-ws",
] ]
[[package]] [[package]]
@@ -378,6 +379,7 @@ dependencies = [
"alloy-transport", "alloy-transport",
"alloy-transport-http", "alloy-transport-http",
"alloy-transport-ipc", "alloy-transport-ipc",
"alloy-transport-ws",
"async-stream", "async-stream",
"async-trait", "async-trait",
"auto_impl", "auto_impl",
@@ -454,6 +456,7 @@ dependencies = [
"alloy-transport", "alloy-transport",
"alloy-transport-http", "alloy-transport-http",
"alloy-transport-ipc", "alloy-transport-ipc",
"alloy-transport-ws",
"futures", "futures",
"pin-project", "pin-project",
"reqwest", "reqwest",
@@ -709,6 +712,24 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "alloy-transport-ws"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e915e1250dc129ad48d264573ccd08e4716fdda564a772fd217875b8459aff9"
dependencies = [
"alloy-pubsub",
"alloy-transport",
"futures",
"http",
"rustls",
"serde_json",
"tokio",
"tokio-tungstenite",
"tracing",
"ws_stream_wasm",
]
[[package]] [[package]]
name = "alloy-trie" name = "alloy-trie"
version = "0.9.0" version = "0.9.0"
@@ -1373,6 +1394,17 @@ dependencies = [
"syn 2.0.101", "syn 2.0.101",
] ]
[[package]]
name = "async_io_stream"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c"
dependencies = [
"futures",
"pharos",
"rustc_version 0.4.1",
]
[[package]] [[package]]
name = "atomic-waker" name = "atomic-waker"
version = "1.1.2" version = "1.1.2"
@@ -2021,6 +2053,12 @@ dependencies = [
"parking_lot_core", "parking_lot_core",
] ]
[[package]]
name = "data-encoding"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476"
[[package]] [[package]]
name = "der" name = "der"
version = "0.7.10" version = "0.7.10"
@@ -3956,6 +3994,16 @@ dependencies = [
"ucd-trie", "ucd-trie",
] ]
[[package]]
name = "pharos"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414"
dependencies = [
"futures",
"rustc_version 0.4.1",
]
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "1.1.10" version = "1.1.10"
@@ -4577,6 +4625,8 @@ dependencies = [
"revive-dt-node-interaction", "revive-dt-node-interaction",
"serde", "serde",
"serde_json", "serde_json",
"serde_with",
"serde_yaml_ng",
"sp-core", "sp-core",
"sp-runtime", "sp-runtime",
"temp-dir", "temp-dir",
@@ -4768,6 +4818,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321" checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"ring",
"rustls-pki-types", "rustls-pki-types",
"rustls-webpki", "rustls-webpki",
"subtle", "subtle",
@@ -5055,6 +5106,12 @@ dependencies = [
"pest", "pest",
] ]
[[package]]
name = "send_wrapper"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.219" version = "1.0.219"
@@ -5171,6 +5228,19 @@ dependencies = [
"syn 2.0.101", "syn 2.0.101",
] ]
[[package]]
name = "serde_yaml_ng"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4db627b98b36d4203a7b458cf3573730f2bb591b28871d916dfa9efabfd41f"
dependencies = [
"indexmap 2.10.0",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]] [[package]]
name = "serdect" name = "serdect"
version = "0.2.0" version = "0.2.0"
@@ -6067,6 +6137,22 @@ dependencies = [
"tokio-util", "tokio-util",
] ]
[[package]]
name = "tokio-tungstenite"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084"
dependencies = [
"futures-util",
"log",
"rustls",
"rustls-pki-types",
"tokio",
"tokio-rustls",
"tungstenite",
"webpki-roots 0.26.11",
]
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.7.15" version = "0.7.15"
@@ -6281,6 +6367,25 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "tungstenite"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13"
dependencies = [
"bytes",
"data-encoding",
"http",
"httparse",
"log",
"rand 0.9.2",
"rustls",
"rustls-pki-types",
"sha1",
"thiserror 2.0.12",
"utf-8",
]
[[package]] [[package]]
name = "tuplex" name = "tuplex"
version = "0.1.2" version = "0.1.2"
@@ -6368,6 +6473,12 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]] [[package]]
name = "untrusted" name = "untrusted"
version = "0.9.0" version = "0.9.0"
@@ -6385,6 +6496,12 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "utf-8"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]] [[package]]
name = "utf8_iter" name = "utf8_iter"
version = "1.0.4" version = "1.0.4"
@@ -6639,6 +6756,24 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "webpki-roots"
version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
"webpki-roots 1.0.2",
]
[[package]]
name = "webpki-roots"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2"
dependencies = [
"rustls-pki-types",
]
[[package]] [[package]]
name = "widestring" name = "widestring"
version = "1.2.0" version = "1.2.0"
@@ -6977,6 +7112,25 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
[[package]]
name = "ws_stream_wasm"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c173014acad22e83f16403ee360115b38846fe754e735c5d9d3803fe70c6abc"
dependencies = [
"async_io_stream",
"futures",
"js-sys",
"log",
"pharos",
"rustc_version 0.4.1",
"send_wrapper",
"thiserror 2.0.12",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]] [[package]]
name = "wyz" name = "wyz"
version = "0.5.1" version = "0.5.1"
+3 -1
View File
@@ -45,7 +45,8 @@ serde_json = { version = "1.0", default-features = false, features = [
"std", "std",
"unbounded_depth", "unbounded_depth",
] } ] }
serde_with = { version = "3.14.0" } serde_with = { version = "3.14.0", features = ["hex"] }
serde_yaml_ng = { version = "0.10.0" }
sha2 = { version = "0.10.9" } sha2 = { version = "0.10.9" }
sp-core = "36.1.0" sp-core = "36.1.0"
sp-runtime = "41.1.0" sp-runtime = "41.1.0"
@@ -80,6 +81,7 @@ features = [
"json-abi", "json-abi",
"providers", "providers",
"provider-ipc", "provider-ipc",
"provider-ws",
"provider-debug-api", "provider-debug-api",
"reqwest", "reqwest",
"rpc-types", "rpc-types",
+1
View File
@@ -44,6 +44,7 @@ This section describes the required dependencies that this framework requires to
- ETH-RPC - All communication with Kitchensink is done through the ETH RPC. - ETH-RPC - All communication with Kitchensink is done through the ETH RPC.
- Solc - This is actually a transitive dependency, while this tool doesn't require solc as it downloads the versions that it requires, resolc requires that Solc is installed and available in the path. - Solc - This is actually a transitive dependency, while this tool doesn't require solc as it downloads the versions that it requires, resolc requires that Solc is installed and available in the path.
- Resolc - This is required to compile the contracts to PolkaVM bytecode. - Resolc - This is required to compile the contracts to PolkaVM bytecode.
- Kurtosis - The Kurtosis CLI tool is required for the production Ethereum mainnet-like node configuration with Geth as the execution layer and lighthouse as the consensus layer. Kurtosis also requires docker to be installed since it runs everything inside of docker containers.
All of the above need to be installed and available in the path in order for the tool to work. All of the above need to be installed and available in the path in order for the tool to work.
+4
View File
@@ -29,6 +29,8 @@ use strum::{AsRefStr, Display, EnumString, IntoStaticStr};
pub enum PlatformIdentifier { pub enum PlatformIdentifier {
/// The Go-ethereum reference full node EVM implementation with the solc compiler. /// The Go-ethereum reference full node EVM implementation with the solc compiler.
GethEvmSolc, GethEvmSolc,
/// The Lighthouse Go-ethereum reference full node EVM implementation with the solc compiler.
LighthouseGethEvmSolc,
/// The kitchensink node with the PolkaVM backend with the resolc compiler. /// The kitchensink node with the PolkaVM backend with the resolc compiler.
KitchensinkPolkavmResolc, KitchensinkPolkavmResolc,
/// The kitchensink node with the REVM backend with the solc compiler. /// The kitchensink node with the REVM backend with the solc compiler.
@@ -87,6 +89,8 @@ pub enum CompilerIdentifier {
pub enum NodeIdentifier { pub enum NodeIdentifier {
/// The go-ethereum node implementation. /// The go-ethereum node implementation.
Geth, Geth,
/// The go-ethereum node implementation.
LighthouseGeth,
/// The Kitchensink node implementation. /// The Kitchensink node implementation.
Kitchensink, Kitchensink,
/// The revive dev node implementation. /// The revive dev node implementation.
+40 -6
View File
@@ -79,6 +79,15 @@ impl AsRef<GethConfiguration> for Context {
} }
} }
impl AsRef<KurtosisConfiguration> for Context {
fn as_ref(&self) -> &KurtosisConfiguration {
match self {
Self::ExecuteTests(context) => context.as_ref().as_ref(),
Self::ExportJsonSchema => unreachable!(),
}
}
}
impl AsRef<KitchensinkConfiguration> for Context { impl AsRef<KitchensinkConfiguration> for Context {
fn as_ref(&self) -> &KitchensinkConfiguration { fn as_ref(&self) -> &KitchensinkConfiguration {
match self { match self {
@@ -190,6 +199,10 @@ pub struct TestExecutionContext {
#[clap(flatten, next_help_heading = "Geth Configuration")] #[clap(flatten, next_help_heading = "Geth Configuration")]
pub geth_configuration: GethConfiguration, pub geth_configuration: GethConfiguration,
/// Configuration parameters for the lighthouse node.
#[clap(flatten, next_help_heading = "Lighthouse Configuration")]
pub lighthouse_configuration: KurtosisConfiguration,
/// Configuration parameters for the Kitchensink. /// Configuration parameters for the Kitchensink.
#[clap(flatten, next_help_heading = "Kitchensink Configuration")] #[clap(flatten, next_help_heading = "Kitchensink Configuration")]
pub kitchensink_configuration: KitchensinkConfiguration, pub kitchensink_configuration: KitchensinkConfiguration,
@@ -253,6 +266,12 @@ impl AsRef<GethConfiguration> for TestExecutionContext {
} }
} }
impl AsRef<KurtosisConfiguration> for TestExecutionContext {
fn as_ref(&self) -> &KurtosisConfiguration {
&self.lighthouse_configuration
}
}
impl AsRef<KitchensinkConfiguration> for TestExecutionContext { impl AsRef<KitchensinkConfiguration> for TestExecutionContext {
fn as_ref(&self) -> &KitchensinkConfiguration { fn as_ref(&self) -> &KitchensinkConfiguration {
&self.kitchensink_configuration &self.kitchensink_configuration
@@ -335,12 +354,27 @@ pub struct GethConfiguration {
#[clap( #[clap(
id = "geth.start-timeout-ms", id = "geth.start-timeout-ms",
long = "geth.start-timeout-ms", long = "geth.start-timeout-ms",
default_value = "5000", default_value = "30000",
value_parser = parse_duration value_parser = parse_duration
)] )]
pub start_timeout_ms: Duration, pub start_timeout_ms: Duration,
} }
/// A set of configuration parameters for kurtosis.
#[derive(Clone, Debug, Parser, Serialize)]
pub struct KurtosisConfiguration {
/// Specifies the path of the kurtosis node to be used by the tool.
///
/// If this is not specified, then the tool assumes that it should use the kurtosis binary that's
/// provided in the user's $PATH.
#[clap(
id = "kurtosis.path",
long = "kurtosis.path",
default_value = "kurtosis"
)]
pub path: PathBuf,
}
/// A set of configuration parameters for Kitchensink. /// A set of configuration parameters for Kitchensink.
#[derive(Clone, Debug, Parser, Serialize)] #[derive(Clone, Debug, Parser, Serialize)]
pub struct KitchensinkConfiguration { pub struct KitchensinkConfiguration {
@@ -359,7 +393,7 @@ pub struct KitchensinkConfiguration {
#[clap( #[clap(
id = "kitchensink.start-timeout-ms", id = "kitchensink.start-timeout-ms",
long = "kitchensink.start-timeout-ms", long = "kitchensink.start-timeout-ms",
default_value = "5000", default_value = "30000",
value_parser = parse_duration value_parser = parse_duration
)] )]
pub start_timeout_ms: Duration, pub start_timeout_ms: Duration,
@@ -387,7 +421,7 @@ pub struct ReviveDevNodeConfiguration {
#[clap( #[clap(
id = "revive-dev-node.start-timeout-ms", id = "revive-dev-node.start-timeout-ms",
long = "revive-dev-node.start-timeout-ms", long = "revive-dev-node.start-timeout-ms",
default_value = "5000", default_value = "30000",
value_parser = parse_duration value_parser = parse_duration
)] )]
pub start_timeout_ms: Duration, pub start_timeout_ms: Duration,
@@ -407,7 +441,7 @@ pub struct EthRpcConfiguration {
#[clap( #[clap(
id = "eth-rpc.start-timeout-ms", id = "eth-rpc.start-timeout-ms",
long = "eth-rpc.start-timeout-ms", long = "eth-rpc.start-timeout-ms",
default_value = "5000", default_value = "30000",
value_parser = parse_duration value_parser = parse_duration
)] )]
pub start_timeout_ms: Duration, pub start_timeout_ms: Duration,
@@ -431,7 +465,7 @@ pub struct GenesisConfiguration {
impl GenesisConfiguration { impl GenesisConfiguration {
pub fn genesis(&self) -> anyhow::Result<&Genesis> { pub fn genesis(&self) -> anyhow::Result<&Genesis> {
static DEFAULT_GENESIS: LazyLock<Genesis> = LazyLock::new(|| { static DEFAULT_GENESIS: LazyLock<Genesis> = LazyLock::new(|| {
let genesis = include_str!("../../../dev-genesis.json"); let genesis = include_str!("../../../assets/dev-genesis.json");
serde_json::from_str(genesis).unwrap() serde_json::from_str(genesis).unwrap()
}); });
@@ -465,7 +499,7 @@ pub struct WalletConfiguration {
/// This argument controls which private keys the nodes should have access to and be added to /// This argument controls which private keys the nodes should have access to and be added to
/// its wallet signers. With a value of N, private keys (0, N] will be added to the signer set /// its wallet signers. With a value of N, private keys (0, N] will be added to the signer set
/// of the node. /// of the node.
#[clap(long = "wallet.additional-keys", default_value_t = 100_000)] #[clap(long = "wallet.additional-keys", default_value_t = 200)]
additional_keys: usize, additional_keys: usize,
/// The wallet object that will be used. /// The wallet object that will be used.
+54 -1
View File
@@ -13,7 +13,9 @@ use anyhow::Context as _;
use revive_dt_common::types::*; use revive_dt_common::types::*;
use revive_dt_compiler::{SolidityCompiler, revive_resolc::Resolc, solc::Solc}; use revive_dt_compiler::{SolidityCompiler, revive_resolc::Resolc, solc::Solc};
use revive_dt_config::*; use revive_dt_config::*;
use revive_dt_node::{Node, geth::GethNode, substrate::SubstrateNode}; use revive_dt_node::{
Node, geth::GethNode, lighthouse_geth::LighthouseGethNode, substrate::SubstrateNode,
};
use revive_dt_node_interaction::EthereumNode; use revive_dt_node_interaction::EthereumNode;
use tracing::info; use tracing::info;
@@ -104,6 +106,51 @@ impl Platform for GethEvmSolcPlatform {
} }
} }
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
pub struct LighthouseGethEvmSolcPlatform;
impl Platform for LighthouseGethEvmSolcPlatform {
fn platform_identifier(&self) -> PlatformIdentifier {
PlatformIdentifier::LighthouseGethEvmSolc
}
fn node_identifier(&self) -> NodeIdentifier {
NodeIdentifier::LighthouseGeth
}
fn vm_identifier(&self) -> VmIdentifier {
VmIdentifier::Evm
}
fn compiler_identifier(&self) -> CompilerIdentifier {
CompilerIdentifier::Solc
}
fn new_node(
&self,
context: Context,
) -> anyhow::Result<JoinHandle<anyhow::Result<Box<dyn EthereumNode + Send + Sync>>>> {
let genesis_configuration = AsRef::<GenesisConfiguration>::as_ref(&context);
let genesis = genesis_configuration.genesis()?.clone();
Ok(thread::spawn(move || {
let node = LighthouseGethNode::new(context);
let node = spawn_node::<LighthouseGethNode>(node, genesis)?;
Ok(Box::new(node) as Box<_>)
}))
}
fn new_compiler(
&self,
context: Context,
version: Option<VersionOrRequirement>,
) -> Pin<Box<dyn Future<Output = anyhow::Result<Box<dyn SolidityCompiler>>>>> {
Box::pin(async move {
let compiler = Solc::new(context, version).await;
compiler.map(|compiler| Box::new(compiler) as Box<dyn SolidityCompiler>)
})
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
pub struct KitchensinkPolkavmResolcPlatform; pub struct KitchensinkPolkavmResolcPlatform;
@@ -316,6 +363,9 @@ impl From<PlatformIdentifier> for Box<dyn Platform> {
fn from(value: PlatformIdentifier) -> Self { fn from(value: PlatformIdentifier) -> Self {
match value { match value {
PlatformIdentifier::GethEvmSolc => Box::new(GethEvmSolcPlatform) as Box<_>, PlatformIdentifier::GethEvmSolc => Box::new(GethEvmSolcPlatform) as Box<_>,
PlatformIdentifier::LighthouseGethEvmSolc => {
Box::new(LighthouseGethEvmSolcPlatform) as Box<_>
}
PlatformIdentifier::KitchensinkPolkavmResolc => { PlatformIdentifier::KitchensinkPolkavmResolc => {
Box::new(KitchensinkPolkavmResolcPlatform) as Box<_> Box::new(KitchensinkPolkavmResolcPlatform) as Box<_>
} }
@@ -336,6 +386,9 @@ impl From<PlatformIdentifier> for &dyn Platform {
fn from(value: PlatformIdentifier) -> Self { fn from(value: PlatformIdentifier) -> Self {
match value { match value {
PlatformIdentifier::GethEvmSolc => &GethEvmSolcPlatform as &dyn Platform, PlatformIdentifier::GethEvmSolc => &GethEvmSolcPlatform as &dyn Platform,
PlatformIdentifier::LighthouseGethEvmSolc => {
&LighthouseGethEvmSolcPlatform as &dyn Platform
}
PlatformIdentifier::KitchensinkPolkavmResolc => { PlatformIdentifier::KitchensinkPolkavmResolc => {
&KitchensinkPolkavmResolcPlatform as &dyn Platform &KitchensinkPolkavmResolcPlatform as &dyn Platform
} }
+2
View File
@@ -22,6 +22,8 @@ revive-dt-node-interaction = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
serde_with = { workspace = true }
serde_yaml_ng = { workspace = true }
sp-core = { workspace = true } sp-core = { workspace = true }
sp-runtime = { workspace = true } sp-runtime = { workspace = true }
+1
View File
@@ -6,6 +6,7 @@ use revive_dt_node_interaction::EthereumNode;
pub mod common; pub mod common;
pub mod constants; pub mod constants;
pub mod geth; pub mod geth;
pub mod lighthouse_geth;
pub mod process; pub mod process;
pub mod substrate; pub mod substrate;
File diff suppressed because it is too large Load Diff
+28 -2
View File
@@ -68,7 +68,7 @@ impl Process {
command_building_callback(&mut command, stdout_logs_file, stderr_logs_file); command_building_callback(&mut command, stdout_logs_file, stderr_logs_file);
command command
}; };
let child = command let mut child = command
.spawn() .spawn()
.context("Failed to spawn the built command")?; .context("Failed to spawn the built command")?;
@@ -93,10 +93,22 @@ impl Process {
let mut stdout_lines = BufReader::new(stdout_logs_file).lines(); let mut stdout_lines = BufReader::new(stdout_logs_file).lines();
let mut stderr_lines = BufReader::new(stderr_logs_file).lines(); let mut stderr_lines = BufReader::new(stderr_logs_file).lines();
let mut stdout = String::new();
let mut stderr = String::new();
loop { loop {
let stdout_line = stdout_lines.next().and_then(Result::ok); let stdout_line = stdout_lines.next().and_then(Result::ok);
let stderr_line = stderr_lines.next().and_then(Result::ok); let stderr_line = stderr_lines.next().and_then(Result::ok);
if let Some(stdout_line) = stdout_line.as_ref() {
stdout.push_str(stdout_line);
stdout.push('\n');
}
if let Some(stderr_line) = stderr_line.as_ref() {
stderr.push_str(stderr_line);
stderr.push('\n');
}
let check_result = let check_result =
check_function(stdout_line.as_deref(), stderr_line.as_deref()) check_function(stdout_line.as_deref(), stderr_line.as_deref())
.context("Failed to wait for the process to be ready")?; .context("Failed to wait for the process to be ready")?;
@@ -106,10 +118,21 @@ impl Process {
} }
if Instant::now().duration_since(spawn_time) > max_wait_duration { if Instant::now().duration_since(spawn_time) > max_wait_duration {
bail!("Waited for the process to start but it failed to start in time") bail!(
"Waited for the process to start but it failed to start in time. stderr {stderr} - stdout {stdout}"
)
} }
} }
} }
ProcessReadinessWaitBehavior::WaitForCommandToExit => {
if !child
.wait()
.context("Failed waiting for kurtosis run process to finish")?
.success()
{
anyhow::bail!("Failed to initialize kurtosis network",);
}
}
} }
Ok(Self { Ok(Self {
@@ -137,6 +160,9 @@ pub enum ProcessReadinessWaitBehavior {
/// straight away. /// straight away.
NoStartupWait, NoStartupWait,
/// Waits for the command to exit.
WaitForCommandToExit,
/// The process does require some amount of wait duration after it's been started. /// The process does require some amount of wait duration after it's been started.
WaitDuration(Duration), WaitDuration(Duration),