mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-20 02:11:05 +00:00
Connect the lighthouse node with the platforms
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
+54
-1
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ impl LighthouseGethNode {
|
|||||||
execution_layer_port_publisher_parameters: Some(
|
execution_layer_port_publisher_parameters: Some(
|
||||||
PortPublisherSingleItemParameters {
|
PortPublisherSingleItemParameters {
|
||||||
enabled: Some(true),
|
enabled: Some(true),
|
||||||
public_port_start: None,
|
public_port_start: Some(32000 + self.id as u16 * 1000),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
consensus_layer_port_publisher_parameters: Default::default(),
|
consensus_layer_port_publisher_parameters: Default::default(),
|
||||||
@@ -281,14 +281,10 @@ impl LighthouseGethNode {
|
|||||||
ProcessReadinessWaitBehavior::TimeBoundedWaitFunction {
|
ProcessReadinessWaitBehavior::TimeBoundedWaitFunction {
|
||||||
max_wait_duration: Duration::from_secs(5 * 60),
|
max_wait_duration: Duration::from_secs(5 * 60),
|
||||||
check_function: Box::new(|stdout, stderr| {
|
check_function: Box::new(|stdout, stderr| {
|
||||||
for line in [stdout, stderr]
|
for line in [stdout, stderr].iter().flatten() {
|
||||||
.iter()
|
if line.to_lowercase().contains("error encountered") {
|
||||||
.flatten()
|
|
||||||
.map(|line| line.to_lowercase())
|
|
||||||
{
|
|
||||||
if line.contains("error encountered") {
|
|
||||||
anyhow::bail!("Encountered an error when starting Kurtosis")
|
anyhow::bail!("Encountered an error when starting Kurtosis")
|
||||||
} else if line.contains("status") && line.contains("running") {
|
} else if line.contains("RUNNING") {
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user