forked from lambdaclass/ethlambda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.rs
More file actions
152 lines (144 loc) · 7.26 KB
/
Copy pathcli.rs
File metadata and controls
152 lines (144 loc) · 7.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
//! Command-line interface for the ethlambda binary.
use std::net::IpAddr;
use std::path::PathBuf;
use crate::version;
#[derive(Debug, clap::Parser)]
#[command(name = "ethlambda", author = "LambdaClass", version = version::CLIENT_VERSION, about = "ethlambda consensus client")]
pub(crate) struct CliOptions {
/// Path to the chain genesis config (e.g., config.yaml).
#[arg(long)]
pub(crate) genesis: PathBuf,
/// Path to the validator registry (e.g., annotated_validators.yaml).
#[arg(long)]
pub(crate) validators: PathBuf,
/// Path to the bootnode list (e.g., nodes.yaml).
#[arg(long)]
pub(crate) bootnodes: PathBuf,
/// Path to validator-config.yaml (validator name registry for metrics labels).
#[arg(long)]
pub(crate) validator_config: PathBuf,
/// Directory containing per-validator XMSS keys (e.g., hash-sig-keys/).
#[arg(long)]
pub(crate) hash_sig_keys_dir: PathBuf,
#[arg(long, default_value = "9000")]
pub(crate) gossipsub_port: u16,
#[arg(long, default_value = "127.0.0.1")]
pub(crate) http_address: IpAddr,
#[arg(long, default_value = "5052")]
pub(crate) api_port: u16,
#[arg(long, default_value = "5054")]
pub(crate) metrics_port: u16,
#[arg(long)]
pub(crate) node_key: PathBuf,
/// The node ID to look up in annotated_validators.yaml (e.g., "ethlambda_0")
#[arg(long)]
pub(crate) node_id: String,
/// Base URL(s) of checkpoint-sync peer API servers (e.g., http://peer:5052).
/// When set, skips genesis initialization and fetches the finalized state
/// and block from each peer's `/lean/v0/states/finalized` and
/// `/lean/v0/blocks/finalized` endpoints. For backward compatibility, a
/// URL ending in `/lean/v0/states/finalized` is accepted and the trailing
/// path is stripped.
///
/// Multiple URLs may be supplied for redundancy, either comma-separated
/// (`--checkpoint-sync-url u1,u2`) or by repeating the flag
/// (`--checkpoint-sync-url u1 --checkpoint-sync-url u2`). URLs are tried
/// in order; the first one that succeeds is used and any failures fall
/// over to the next URL. Startup only aborts if every URL fails.
#[arg(long, value_delimiter = ',')]
pub(crate) checkpoint_sync_url: Vec<String>,
/// Whether this node acts as a committee aggregator.
///
/// Seeds the initial value of the live aggregator flag shared by the
/// blockchain actor and the admin API. The flag can be toggled at
/// runtime via `POST /lean/v0/admin/aggregator`. Runtime toggles do
/// NOT persist across restarts and do NOT update gossip subnet
/// subscriptions, which are frozen at startup — standby aggregators
/// should boot with this flag enabled to establish subscriptions, then
/// use the admin endpoint to rotate duties (hot-standby model).
#[arg(long, default_value = "false")]
pub(crate) is_aggregator: bool,
/// Number of attestation committees (subnets) per slot.
///
/// If unset, falls back to `config.attestation_committee_count` from
/// `validator-config.yaml` in the network config dir, or `1` if that
/// field is also absent.
#[arg(long, value_parser = clap::value_parser!(u64).range(1..))]
pub(crate) attestation_committee_count: Option<u64>,
/// Subnet IDs this aggregator should subscribe to (comma-separated).
/// Requires --is-aggregator. Defaults to the subnets of the node's validators.
#[arg(long, value_delimiter = ',', requires = "is_aggregator")]
pub(crate) aggregate_subnet_ids: Option<Vec<u64>>,
/// Directory for RocksDB storage
#[arg(long, default_value = "./data")]
pub(crate) data_dir: PathBuf,
/// Disable the sync-gate's suppression of validator duties.
///
/// By default a node that judges itself to be syncing (local head lagging
/// wall clock while the network still progresses) skips block proposal,
/// attestation production, and aggregate re-derivation. With this flag the
/// sync state is still tracked and exported via `lean_node_sync_status`,
/// but it no longer suppresses any duty: the gate becomes observe-only.
#[arg(long, default_value = "false")]
pub(crate) disable_duty_sync_gate: bool,
/// Enable proposer-side aggregation of attestation proofs when building a
/// block.
///
/// A block may carry at most one entry per `AttestationData`, so the
/// proposer must collapse same-data proofs either way. When set,
/// `build_block` merges them via recursive single-message aggregation into a single
/// union-coverage proof per data (leanSpec #510), maximizing voter coverage
/// at the cost of a leanVM aggregation per duplicated data entry. When unset
/// (the default), it instead keeps only the single best-coverage proof per
/// data and drops the rest, skipping the leanVM work at the cost of lower
/// coverage.
#[arg(long, default_value = "false")]
pub(crate) enable_proposer_aggregation: bool,
/// Maximum number of distinct attestations to pack when building a block.
///
/// Bounds how many distinct `AttestationData` entries the proposer includes
/// in a block it builds. This is a proposer-side self-limit only: it does
/// NOT change the consensus cap for accepting blocks from peers, which
/// stays at `MAX_ATTESTATIONS_DATA`. Values above `MAX_ATTESTATIONS_DATA`
/// are clamped to it, since a block carrying more would be rejected by
/// `on_block`.
#[arg(long, default_value = "3")]
pub(crate) max_attestations_per_block: usize,
/// Shadow-simulator sim-cost + fake-XMSS flags (only under the
/// `shadow-integration` feature).
#[cfg(feature = "shadow-integration")]
#[command(flatten)]
pub(crate) shadow: ShadowOptions,
}
/// Shadow-simulator sim-cost + fake-XMSS flags. Compiled only under the
/// `shadow-integration` feature.
#[cfg(feature = "shadow-integration")]
#[derive(Debug, clap::Args)]
pub(crate) struct ShadowOptions {
/// Shadow sim only: replace the XMSS aggregation prover/verifier with a
/// deterministic stub (no leanVM proving/verifying). Off by default.
#[arg(long, default_value = "false")]
pub(crate) shadow_xmss_fake: bool,
/// Shadow sim only: signatures aggregated per second. Injects a sleep of
/// n/rate seconds into aggregation so its CPU cost shows up on Shadow's
/// virtual clock. Unset or <= 0 disables.
#[arg(long)]
pub(crate) shadow_xmss_aggregate_signatures_rate: Option<f64>,
/// Shadow sim only: signatures verified per aggregate per second; injects
/// a sleep of n/rate seconds into verification. Unset or <= 0 disables.
#[arg(long)]
pub(crate) shadow_xmss_verify_aggregated_signatures_rate: Option<f64>,
/// Shadow sim only: Type-1 components merged into a Type-2 per second;
/// injects a sleep of n/rate seconds into the proposal Type-2 merge.
/// Unset or <= 0 disables.
#[arg(long)]
pub(crate) shadow_xmss_merge_rate: Option<f64>,
/// Shadow sim only: byte length of each fake stub proof. Defaults to 32
/// KiB; capped at the 512 KiB on-wire proof limit.
#[arg(
long,
default_value_t = ethlambda_crypto::shadow_cost::DEFAULT_FAKE_PROOF_SIZE as u64,
value_parser = clap::value_parser!(u64).range(1..=524_288)
)]
pub(crate) shadow_xmss_fake_proof_size: u64,
}