Connect the lighthouse node with the platforms

This commit is contained in:
Omar Abdulla
2025-09-26 18:34:41 +03:00
parent 566dd06d9a
commit 8d15f87ff0
3 changed files with 62 additions and 9 deletions
+4
View File
@@ -29,6 +29,8 @@ use strum::{AsRefStr, Display, EnumString, IntoStaticStr};
pub enum PlatformIdentifier {
/// The Go-ethereum reference full node EVM implementation with the solc compiler.
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.
KitchensinkPolkavmResolc,
/// The kitchensink node with the REVM backend with the solc compiler.
@@ -87,6 +89,8 @@ pub enum CompilerIdentifier {
pub enum NodeIdentifier {
/// The go-ethereum node implementation.
Geth,
/// The go-ethereum node implementation.
LighthouseGeth,
/// The Kitchensink node implementation.
Kitchensink,
/// The revive dev node implementation.
+54 -1
View File
@@ -13,7 +13,9 @@ use anyhow::Context as _;
use revive_dt_common::types::*;
use revive_dt_compiler::{SolidityCompiler, revive_resolc::Resolc, solc::Solc};
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 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)]
pub struct KitchensinkPolkavmResolcPlatform;
@@ -316,6 +363,9 @@ impl From<PlatformIdentifier> for Box<dyn Platform> {
fn from(value: PlatformIdentifier) -> Self {
match value {
PlatformIdentifier::GethEvmSolc => Box::new(GethEvmSolcPlatform) as Box<_>,
PlatformIdentifier::LighthouseGethEvmSolc => {
Box::new(LighthouseGethEvmSolcPlatform) as Box<_>
}
PlatformIdentifier::KitchensinkPolkavmResolc => {
Box::new(KitchensinkPolkavmResolcPlatform) as Box<_>
}
@@ -336,6 +386,9 @@ impl From<PlatformIdentifier> for &dyn Platform {
fn from(value: PlatformIdentifier) -> Self {
match value {
PlatformIdentifier::GethEvmSolc => &GethEvmSolcPlatform as &dyn Platform,
PlatformIdentifier::LighthouseGethEvmSolc => {
&LighthouseGethEvmSolcPlatform as &dyn Platform
}
PlatformIdentifier::KitchensinkPolkavmResolc => {
&KitchensinkPolkavmResolcPlatform as &dyn Platform
}
+4 -8
View File
@@ -245,7 +245,7 @@ impl LighthouseGethNode {
execution_layer_port_publisher_parameters: Some(
PortPublisherSingleItemParameters {
enabled: Some(true),
public_port_start: None,
public_port_start: Some(32000 + self.id as u16 * 1000),
},
),
consensus_layer_port_publisher_parameters: Default::default(),
@@ -281,14 +281,10 @@ impl LighthouseGethNode {
ProcessReadinessWaitBehavior::TimeBoundedWaitFunction {
max_wait_duration: Duration::from_secs(5 * 60),
check_function: Box::new(|stdout, stderr| {
for line in [stdout, stderr]
.iter()
.flatten()
.map(|line| line.to_lowercase())
{
if line.contains("error encountered") {
for line in [stdout, stderr].iter().flatten() {
if line.to_lowercase().contains("error encountered") {
anyhow::bail!("Encountered an error when starting Kurtosis")
} else if line.contains("status") && line.contains("running") {
} else if line.contains("RUNNING") {
return Ok(true);
}
}