Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion cmd/ethrex/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,19 @@ pub struct Options {
pub authrpc_jwtsecret: String,
#[arg(long = "p2p.disabled", default_value = "false", value_name = "P2P_DISABLED", action = ArgAction::SetFalse, help_heading = "P2P options")]
pub p2p_disabled: bool,
#[arg(
long = "p2p.addr",
default_value = None,
value_name = "ADDRESS",
help = "Listening address for the P2P protocol.",
help_heading = "P2P options"
)]
pub p2p_addr: Option<String>,
#[arg(
long = "p2p.port",
default_value = "30303",
value_name = "PORT",
help = "TCP port for P2P protocol.",
help = "TCP port for the P2P protocol.",
help_heading = "P2P options"
)]
pub p2p_port: String,
Expand Down Expand Up @@ -308,6 +316,7 @@ impl Default for Options {
authrpc_port: Default::default(),
authrpc_jwtsecret: Default::default(),
p2p_disabled: Default::default(),
p2p_addr: None,
p2p_port: Default::default(),
discovery_port: Default::default(),
network: Default::default(),
Expand Down
28 changes: 14 additions & 14 deletions cmd/ethrex/initializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use std::env;
use std::{
fs,
io::IsTerminal,
net::SocketAddr,
net::{IpAddr, SocketAddr},
path::{Path, PathBuf},
sync::Arc,
time::{SystemTime, UNIX_EPOCH},
Expand Down Expand Up @@ -299,22 +299,22 @@ pub fn get_signer(datadir: &Path) -> SecretKey {
}

pub fn get_local_p2p_node(opts: &Options, signer: &SecretKey) -> Node {
let udp_socket_addr = parse_socket_addr("::", &opts.discovery_port)
.expect("Failed to parse discovery address and port");
let tcp_socket_addr =
parse_socket_addr("::", &opts.p2p_port).expect("Failed to parse addr and port");

let p2p_node_ip = local_ip()
.unwrap_or_else(|_| local_ipv6().expect("Neither ipv4 nor ipv6 local address found"));
let tcp_port = opts.p2p_port.parse().expect("Failed to parse p2p port");
let udp_port = opts
.discovery_port
.parse()
.expect("Failed to parse discovery port");

let p2p_node_ip: IpAddr = if let Some(addr) = &opts.p2p_addr {
addr.parse().expect("Failed to parse p2p address")
} else {
local_ip()
.unwrap_or_else(|_| local_ipv6().expect("Neither ipv4 nor ipv6 local address found"))
};

let local_public_key = public_key_from_signing_key(signer);

let node = Node::new(
p2p_node_ip,
udp_socket_addr.port(),
tcp_socket_addr.port(),
local_public_key,
);
let node = Node::new(p2p_node_ip, udp_port, tcp_port, local_public_key);

// TODO Find a proper place to show node information
// https://github.com/lambdaclass/ethrex/issues/836
Expand Down
30 changes: 21 additions & 9 deletions docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ P2P options:
--p2p.disabled


--p2p.addr <ADDRESS>
Listening address for the P2P protocol.

--p2p.port <PORT>
TCP port for P2P protocol.
TCP port for the P2P protocol.

[default: 30303]

Expand Down Expand Up @@ -176,6 +179,11 @@ Commands:
help Print this message or the help of the given subcommand(s)

Options:
--osaka-activation-time <UINT64>
Block timestamp at which the Osaka fork is activated on L1. If not set, it will assume Osaka is already active.

[env: ETHREX_OSAKA_ACTIVATION_TIME=]

-t, --tick-rate <TICK_RATE>
time in ms between two ticks

Expand Down Expand Up @@ -242,8 +250,11 @@ P2P options:
--p2p.disabled


--p2p.addr <ADDRESS>
Listening address for the P2P protocol.

--p2p.port <PORT>
TCP port for P2P protocol.
TCP port for the P2P protocol.

[default: 30303]

Expand Down Expand Up @@ -369,6 +380,10 @@ L1 Watcher options:
[default: 10]

Block producer options:
--watcher.l1-fee-update-interval-ms <ADDRESS>
[env: ETHREX_WATCHER_L1_FEE_UPDATE_INTERVAL_MS=]
[default: 60000]

--block-producer.block-time <UINT64>
How often does the sequencer produce new blocks to the L1 in milliseconds.

Expand All @@ -384,11 +399,14 @@ Block producer options:
--block-producer.operator-fee-vault-address <ADDRESS>
[env: ETHREX_BLOCK_PRODUCER_OPERATOR_FEE_VAULT_ADDRESS=]

--operator-fee-per-gas <UINT64>
--block-producer.operator-fee-per-gas <UINT64>
Fee that the operator will receive for each unit of gas consumed in a block.

[env: ETHREX_BLOCK_PRODUCER_OPERATOR_FEE_PER_GAS=]

--block-producer.l1-fee-vault-address <ADDRESS>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some options weren't updated since they're not checked in the CI

[env: ETHREX_BLOCK_PRODUCER_L1_FEE_VAULT_ADDRESS=]

--block-producer.block-gas-limit <UINT64>
Maximum gas limit for the L2 blocks.

Expand Down Expand Up @@ -553,7 +571,6 @@ L2 options:
Monitor options:
--no-monitor
[env: ETHREX_NO_MONITOR=]

```

## ethrex l2 prover
Expand Down Expand Up @@ -589,11 +606,6 @@ Prover client options:

[default: INFO]

--aligned
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option was moved, but wasn't removed from here.

Activate aligned proving system

[env: PROVER_CLIENT_ALIGNED=]

--sp1-server <URL>
Url to the moongate server to use when using sp1 backend

Expand Down
Loading