-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Track time to early attester cache * Add debug log for early attester cache * Add mock-el command to lcli * Revert beacon chain changes * Tidy, fix compilation errors * Add required flag * Default to SYNCING response * Hide flag
- Loading branch information
1 parent
8a599ec
commit 86163d9
Showing
4 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use clap::ArgMatches; | ||
use clap_utils::{parse_optional, parse_required}; | ||
use environment::Environment; | ||
use execution_layer::{ | ||
auth::JwtKey, | ||
test_utils::{ | ||
Config, MockExecutionConfig, MockServer, DEFAULT_JWT_SECRET, DEFAULT_TERMINAL_BLOCK, | ||
}, | ||
}; | ||
use std::net::Ipv4Addr; | ||
use std::path::PathBuf; | ||
use types::*; | ||
|
||
pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<(), String> { | ||
let jwt_path: PathBuf = parse_required(matches, "jwt-output-path")?; | ||
let listen_addr: Ipv4Addr = parse_required(matches, "listen-address")?; | ||
let listen_port: u16 = parse_required(matches, "listen-port")?; | ||
let all_payloads_valid: bool = parse_required(matches, "all-payloads-valid")?; | ||
let shanghai_time = parse_required(matches, "shanghai-time")?; | ||
let cancun_time = parse_optional(matches, "cancun-time")?; | ||
|
||
let handle = env.core_context().executor.handle().unwrap(); | ||
let spec = &T::default_spec(); | ||
let jwt_key = JwtKey::from_slice(&DEFAULT_JWT_SECRET).unwrap(); | ||
std::fs::write(jwt_path, hex::encode(DEFAULT_JWT_SECRET)).unwrap(); | ||
|
||
let config = MockExecutionConfig { | ||
server_config: Config { | ||
listen_addr, | ||
listen_port, | ||
}, | ||
jwt_key, | ||
terminal_difficulty: spec.terminal_total_difficulty, | ||
terminal_block: DEFAULT_TERMINAL_BLOCK, | ||
terminal_block_hash: spec.terminal_block_hash, | ||
shanghai_time: Some(shanghai_time), | ||
cancun_time, | ||
}; | ||
let kzg = None; | ||
let server: MockServer<T> = MockServer::new_with_config(&handle, config, kzg); | ||
|
||
if all_payloads_valid { | ||
eprintln!( | ||
"Using --all-payloads-valid=true can be dangerous. \ | ||
Never use this flag when operating validators." | ||
); | ||
// Indicate that all payloads are valid. | ||
server.all_payloads_valid(); | ||
} | ||
|
||
eprintln!( | ||
"This tool is for TESTING PURPOSES ONLY. Do not use in production or on mainnet. \ | ||
It cannot perform validator duties. It may cause nodes to follow an invalid chain." | ||
); | ||
eprintln!("Server listening on {}:{}", listen_addr, listen_port); | ||
|
||
let shutdown_reason = env.block_until_shutdown_requested()?; | ||
|
||
eprintln!("Shutting down: {:?}", shutdown_reason); | ||
|
||
Ok(()) | ||
} |