mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-13 21:01:03 +00:00
Add a lighthouse node implementation
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
CONFIG_NAME: localnet
|
||||||
|
PRESET_BASE: mainnet
|
||||||
|
|
||||||
|
ALTAIR_FORK_EPOCH: 0
|
||||||
|
BELLATRIX_FORK_EPOCH: 0
|
||||||
|
CAPELLA_FORK_EPOCH: 0
|
||||||
|
DENEB_FORK_EPOCH: 0
|
||||||
|
ELECTRA_FORK_EPOCH: 0
|
||||||
|
|
||||||
|
TERMINAL_TOTAL_DIFFICULTY: 0
|
||||||
|
|
||||||
|
SECONDS_PER_SLOT: 12
|
||||||
|
SECONDS_PER_ETH1_BLOCK: 14
|
||||||
|
|
||||||
|
MIN_GENESIS_TIME: 0
|
||||||
|
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 1
|
||||||
|
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
|
||||||
|
SHARD_COMMITTEE_PERIOD: 256
|
||||||
|
ETH1_FOLLOW_DISTANCE: 2048
|
||||||
|
GENESIS_DELAY: 0
|
||||||
|
INACTIVITY_SCORE_BIAS: 4
|
||||||
|
INACTIVITY_SCORE_RECOVERY_RATE: 16
|
||||||
|
EJECTION_BALANCE: 16000000000
|
||||||
|
MIN_PER_EPOCH_CHURN_LIMIT: 4
|
||||||
|
CHURN_LIMIT_QUOTIENT: 65536
|
||||||
|
PROPOSER_SCORE_BOOST: 40
|
||||||
|
|
||||||
|
GENESIS_FORK_VERSION: 0x00000000
|
||||||
|
ALTAIR_FORK_VERSION: 0x01000000
|
||||||
|
BELLATRIX_FORK_VERSION: 0x02000000
|
||||||
|
CAPELLA_FORK_VERSION: 0x03000000
|
||||||
|
DENEB_FORK_VERSION: 0x04000000
|
||||||
|
ELECTRA_FORK_VERSION: 0x05000000
|
||||||
|
|
||||||
|
DEPOSIT_CHAIN_ID: 420420420
|
||||||
|
DEPOSIT_NETWORK_ID: 420420420
|
||||||
|
DEPOSIT_CONTRACT_ADDRESS: 0x0000000000000000000000000000000000000000
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- mnemonic: "test test test test test test test test test test test junk"
|
||||||
|
count: 1
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"chainId": 420420420,
|
||||||
|
"homesteadBlock": 0,
|
||||||
|
"eip150Block": 0,
|
||||||
|
"eip155Block": 0,
|
||||||
|
"eip158Block": 0,
|
||||||
|
"byzantiumBlock": 0,
|
||||||
|
"constantinopleBlock": 0,
|
||||||
|
"petersburgBlock": 0,
|
||||||
|
"istanbulBlock": 0,
|
||||||
|
"berlinBlock": 0,
|
||||||
|
"londonBlock": 0,
|
||||||
|
"arrowGlacierBlock": 0,
|
||||||
|
"grayGlacierBlock": 0,
|
||||||
|
"shanghaiTime": 0,
|
||||||
|
"cancunTime": 0,
|
||||||
|
"pragueTime": 0,
|
||||||
|
"terminalTotalDifficulty": 0,
|
||||||
|
"terminalTotalDifficultyPassed": true,
|
||||||
|
"ethash": {},
|
||||||
|
"blobSchedule": {
|
||||||
|
"cancun": {
|
||||||
|
"target": 3,
|
||||||
|
"max": 6,
|
||||||
|
"baseFeeUpdateFraction": 3338477
|
||||||
|
},
|
||||||
|
"prague": {
|
||||||
|
"target": 6,
|
||||||
|
"max": 9,
|
||||||
|
"baseFeeUpdateFraction": 5007716
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"timestamp": "0x0",
|
||||||
|
"extraData": "0x",
|
||||||
|
"gasLimit": "0x01c9c380",
|
||||||
|
"difficulty": "0x1",
|
||||||
|
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"coinbase": "0x0000000000000000000000000000000000000000",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"baseFeePerGas": "0x3b9aca00",
|
||||||
|
"excessBlobGas": "0x0",
|
||||||
|
"blobGasUsed": "0x0",
|
||||||
|
"requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||||
|
"alloc": {}
|
||||||
|
}
|
||||||
@@ -79,6 +79,15 @@ impl AsRef<GethConfiguration> for Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<LighthouseConfiguration> for Context {
|
||||||
|
fn as_ref(&self) -> &LighthouseConfiguration {
|
||||||
|
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: LighthouseConfiguration,
|
||||||
|
|
||||||
/// 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<LighthouseConfiguration> for TestExecutionContext {
|
||||||
|
fn as_ref(&self) -> &LighthouseConfiguration {
|
||||||
|
&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,7 +354,31 @@ 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
|
||||||
|
)]
|
||||||
|
pub start_timeout_ms: Duration,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A set of configuration parameters for lighthouse.
|
||||||
|
#[derive(Clone, Debug, Parser, Serialize)]
|
||||||
|
pub struct LighthouseConfiguration {
|
||||||
|
/// Specifies the path of the lighthouse node to be used by the tool.
|
||||||
|
///
|
||||||
|
/// If this is not specified, then the tool assumes that it should use the lighthouse binary that's
|
||||||
|
/// provided in the user's $PATH.
|
||||||
|
#[clap(
|
||||||
|
id = "lighthouse.path",
|
||||||
|
long = "lighthouse.path",
|
||||||
|
default_value = "lighthouse"
|
||||||
|
)]
|
||||||
|
pub path: PathBuf,
|
||||||
|
|
||||||
|
/// The amount of time to wait upon startup before considering that the node timed out.
|
||||||
|
#[clap(
|
||||||
|
id = "lighthouse.start-timeout-ms",
|
||||||
|
long = "lighthouse.start-timeout-ms",
|
||||||
|
default_value = "30000",
|
||||||
value_parser = parse_duration
|
value_parser = parse_duration
|
||||||
)]
|
)]
|
||||||
pub start_timeout_ms: Duration,
|
pub start_timeout_ms: Duration,
|
||||||
@@ -359,7 +402,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 +430,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 +450,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 +474,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()
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -595,6 +638,7 @@ impl AsRef<Path> for WorkingDirectoryConfiguration {
|
|||||||
impl Default for WorkingDirectoryConfiguration {
|
impl Default for WorkingDirectoryConfiguration {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
TempDir::new()
|
TempDir::new()
|
||||||
|
.map(|tempdir| dbg!(tempdir.dont_delete_on_drop()))
|
||||||
.map(Arc::new)
|
.map(Arc::new)
|
||||||
.map(Self::TemporaryDirectory)
|
.map(Self::TemporaryDirectory)
|
||||||
.expect("Failed to create the temporary directory")
|
.expect("Failed to create the temporary directory")
|
||||||
|
|||||||
@@ -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
@@ -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);
|
||||||
|
stdout.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,7 +118,9 @@ 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}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user