mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
Add merge support to simulator (#3292)
## Issue Addressed N/A ## Proposed Changes Make simulator merge compatible. Adds a `--post_merge` flag to the eth1 simulator that enables a ttd and simulates the merge transition. Uses the `MockServer` in the execution layer test utils to simulate a dummy execution node. Adds the merge transition simulation to CI.
This commit is contained in:
@@ -13,3 +13,4 @@ eth2 = { path = "../../common/eth2" }
|
||||
validator_client = { path = "../../validator_client" }
|
||||
validator_dir = { path = "../../common/validator_dir", features = ["insecure_keys"] }
|
||||
sensitive_url = { path = "../../common/sensitive_url" }
|
||||
execution_layer = { path = "../../beacon_node/execution_layer" }
|
||||
@@ -17,6 +17,9 @@ use validator_dir::insecure_keys::build_deterministic_validator_dirs;
|
||||
pub use beacon_node::{ClientConfig, ClientGenesis, ProductionClient};
|
||||
pub use environment;
|
||||
pub use eth2;
|
||||
pub use execution_layer::test_utils::{
|
||||
Config as MockServerConfig, MockExecutionConfig, MockServer,
|
||||
};
|
||||
pub use validator_client::Config as ValidatorConfig;
|
||||
|
||||
/// The global timeout for HTTP requests to the beacon node.
|
||||
@@ -211,3 +214,29 @@ impl<E: EthSpec> LocalValidatorClient<E> {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Provides an execution engine api server that is running in the current process on a given tokio executor (it
|
||||
/// is _local_ to this process).
|
||||
///
|
||||
/// Intended for use in testing and simulation. Not for production.
|
||||
pub struct LocalExecutionNode<E: EthSpec> {
|
||||
pub server: MockServer<E>,
|
||||
pub datadir: TempDir,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> LocalExecutionNode<E> {
|
||||
pub fn new(context: RuntimeContext<E>, config: MockExecutionConfig) -> Self {
|
||||
let datadir = TempBuilder::new()
|
||||
.prefix("lighthouse_node_test_rig_el")
|
||||
.tempdir()
|
||||
.expect("should create temp directory for client datadir");
|
||||
let jwt_file_path = datadir.path().join("jwt.hex");
|
||||
if let Err(e) = std::fs::write(&jwt_file_path, config.jwt_key.hex_string()) {
|
||||
panic!("Failed to write jwt file {}", e);
|
||||
}
|
||||
Self {
|
||||
server: MockServer::new_with_config(&context.executor.handle().unwrap(), config),
|
||||
datadir,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user