Skip to content

Commit

Permalink
Tidy, fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Aug 9, 2023
1 parent 1a86fab commit 52ee315
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
14 changes: 11 additions & 3 deletions lcli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ mod generate_bootnode_enr;
mod indexed_attestations;
mod insecure_validators;
mod interop_genesis;
mod mock_el;
mod mnemonic_validators;
mod mock_el;
mod new_testnet;
mod parse_ssz;
mod replace_state_pubkeys;
Expand Down Expand Up @@ -887,7 +887,7 @@ fn main() {
SubCommand::with_name("mock-el")
.about("Creates a mock execution layer server. This is NOT SAFE and should only \
be used for testing and development on testnets. Do not use in production. Do not \
use on mainnet.")
use on mainnet. It cannot perform validator duties.")
.arg(
Arg::with_name("jwt-output-path")
.long("jwt-output-path")
Expand Down Expand Up @@ -918,7 +918,15 @@ fn main() {
.help("When set to true, the server will indicate that all payloads are \
valid.")
.default_value("true")

)
.arg(
Arg::with_name("shanghai-time")
.long("shanghai-time")
.value_name("UNIX_TIMESTAMP")
.takes_value(true)
.help("The payload timestamp that enables Shanghai. Defaults to the mainnet value.")
.default_value("1681338479")
)
)
.get_matches();

Expand Down
9 changes: 7 additions & 2 deletions lcli/src/mock_el.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
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 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();
std::fs::write(jwt_path, hex::encode(DEFAULT_JWT_SECRET)).unwrap();

let config = MockExecutionConfig {
server_config: Config {
Expand All @@ -31,6 +32,7 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
terminal_difficulty: spec.terminal_total_difficulty,
terminal_block: DEFAULT_TERMINAL_BLOCK,
terminal_block_hash: spec.terminal_block_hash,
shanghai_time: Some(shanghai_time),
};
let server: MockServer<T> = MockServer::new_with_config(&handle, config);

Expand All @@ -39,7 +41,10 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
server.all_payloads_valid();
}

eprintln!("This tool is for TESTING PURPOSES ONLY. Do not use in production or on mainnet.");
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()?;
Expand Down

0 comments on commit 52ee315

Please sign in to comment.