Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add env support to all leader prog args #786

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 12 additions & 12 deletions zero/src/bin/leader/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,49 +54,49 @@
/// Reads input from stdin and writes output to stdout.
Stdio {
/// The previous proof output.
#[arg(long, short = 'f', value_hint = ValueHint::FilePath)]
#[arg(short = 'f', long, env="ZERO_BIN_PREVIOUS_PROOF", value_hint = ValueHint::FilePath)]
previous_proof: Option<PathBuf>,
},
/// Reads input from a node rpc and writes output to stdout.
Rpc {
// The node RPC URL.
#[arg(long, short = 'u', value_hint = ValueHint::Url)]
#[arg(short = 'u', long, env="ZERO_BIN_RPC_URL", value_hint = ValueHint::Url)]

Check warning on line 63 in zero/src/bin/leader/cli.rs

View workflow job for this annotation

GitHub Actions / cargo-fmt

Diff in /home/runner/work/zk_evm/zk_evm/zero/src/bin/leader/cli.rs
rpc_url: Url,
// The node RPC type (jerigon / native).
#[arg(long, short = 't', default_value = "jerigon")]
#[arg(short = 'T', long, env="ZERO_BIN_RPC_TYPE", default_value = "JERIGON")]
rpc_type: RpcType,
/// The start of the block range to prove (inclusive).
#[arg(long, short = 's')]
#[arg(short = 's', long, env="ZERO_BIN_START_BLOCK")]
start_block: BlockId,
/// The end of the block range to prove (inclusive).
/// If not provided, leader will work in dynamic mode from `start_block`
/// following head of the blockchain.

Check warning on line 73 in zero/src/bin/leader/cli.rs

View workflow job for this annotation

GitHub Actions / cargo-fmt

Diff in /home/runner/work/zk_evm/zk_evm/zero/src/bin/leader/cli.rs
#[arg(long, short = 'e')]
#[arg(short = 'e', long, env="ZERO_BIN_END_BLOCK")]
end_block: Option<BlockId>,
/// The checkpoint block.
#[arg(short, long, default_value = "0")]
#[arg(short, long, env="ZERO_BIN_CHECKPOINT_BLOCK", default_value = "0")]
checkpoint_block: BlockId,
/// The previous proof output.
#[arg(long, short = 'f', value_hint = ValueHint::FilePath)]
#[arg(short = 'f', long, env="ZERO_BIN_PREVIOUS_PROOF", value_hint = ValueHint::FilePath)]
previous_proof: Option<PathBuf>,

Check warning on line 81 in zero/src/bin/leader/cli.rs

View workflow job for this annotation

GitHub Actions / cargo-fmt

Diff in /home/runner/work/zk_evm/zk_evm/zero/src/bin/leader/cli.rs
/// Blockchain network block time in milliseconds. This value is used
/// to determine the blockchain node polling interval.
#[arg(short, long, env = "ZERO_BIN_BLOCK_TIME", default_value_t = 2000)]
#[arg(short, long, env="ZERO_BIN_BLOCK_TIME", env = "ZERO_BIN_BLOCK_TIME", default_value_t = 2000)]
BGluth marked this conversation as resolved.
Show resolved Hide resolved
block_time: u64,
/// Backoff in milliseconds for retry requests
#[arg(long, default_value_t = 0)]
#[arg(long, env="ZERO_BIN_BACKOFF", default_value_t = 0)]
backoff: u64,
/// The maximum number of retries
#[arg(long, default_value_t = 0)]
#[arg(long, env="ZERO_BIN_MAX_RETRIES", default_value_t = 0)]
max_retries: u32,
},
/// Reads input from HTTP and writes output to a directory.
Http {

Check warning on line 94 in zero/src/bin/leader/cli.rs

View workflow job for this annotation

GitHub Actions / cargo-fmt

Diff in /home/runner/work/zk_evm/zk_evm/zero/src/bin/leader/cli.rs
/// The port on which to listen.
#[arg(short, long, default_value_t = 8080)]
#[arg(short, long, env="ZERO_BIN_PORT", default_value_t = 8080)]
port: u16,
/// The directory to which output should be written.
#[arg(short, long, value_hint = ValueHint::DirPath)]
#[arg(short, long, env="ZERO_BIN_OUTPUT_DIR", value_hint = ValueHint::DirPath)]
output_dir: PathBuf,
},
}
12 changes: 6 additions & 6 deletions zero/src/bin/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
#[derive(Args, Clone, Debug)]
struct RpcToolConfig {
/// The RPC URL.
#[arg(short = 'u', long, value_hint = ValueHint::Url)]
#[arg(short = 'u', long, env="ZERO_BIN_RPC_URL", value_hint = ValueHint::Url)]

Check warning on line 33 in zero/src/bin/rpc.rs

View workflow job for this annotation

GitHub Actions / cargo-fmt

Diff in /home/runner/work/zk_evm/zk_evm/zero/src/bin/rpc.rs
rpc_url: Url,
/// The RPC Tracer Type.
#[arg(short = 't', long, default_value = "jerigon")]
#[arg(short = 't', long, env="ZERO_BIN_RPC_TYPE", default_value = "jerigon")]
rpc_type: RpcType,
/// Backoff in milliseconds for retry requests.
#[arg(long, default_value_t = 0)]
#[arg(long, env="ZERO_BIN_BACKOFF", default_value_t = 0)]
backoff: u64,
/// The maximum number of retries.
#[arg(long, default_value_t = 0)]
#[arg(long, env="ZERO_BIN_MAX_RETRIES", default_value_t = 0)]
max_retries: u32,
}

Expand All @@ -56,13 +56,13 @@
/// the block before the `start_block` is the checkpoint.
#[arg(short, long)]
checkpoint_block_number: Option<u64>,
},

Check warning on line 59 in zero/src/bin/rpc.rs

View workflow job for this annotation

GitHub Actions / cargo-fmt

Diff in /home/runner/work/zk_evm/zk_evm/zero/src/bin/rpc.rs
Extract {
/// Transaction hash.
#[arg(long, short)]
#[arg(short, long, env="ZERO_BIN_TX")]
tx: String,
/// Number of transactions in a batch to process at once.
#[arg(short, long, default_value_t = 1)]
#[arg(short, long, env="ZERO_BIN_BATCH_SIZE", default_value_t = 1)]
batch_size: usize,
},
}
Expand Down
2 changes: 1 addition & 1 deletion zero/src/bin/trie_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub(crate) struct Cli {
pub(crate) prover_config: CliProverConfig,

/// The previous proof output.
#[arg(long, short = 'f', value_hint = ValueHint::FilePath)]
#[arg(short = 'f', long, env="ZERO_BIN_PREVIOUS_PROOF", value_hint = ValueHint::FilePath)]
previous_proof: Option<PathBuf>,
}

Expand Down
14 changes: 7 additions & 7 deletions zero/src/prover/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
#[derive(Args, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Default)]
pub struct CliProverConfig {
/// The log of the max number of CPU cycles per proof.
#[arg(short, long, help_heading = HELP_HEADING, default_value_t = 19)]
#[arg(short, long, env="ZERO_BIN_MAX_CPU_LEN_LOG", help_heading = HELP_HEADING, default_value_t = 19)]
max_cpu_len_log: usize,
/// Number of transactions in a batch to process at once.
#[arg(short, long, help_heading = HELP_HEADING, default_value_t = 10)]
#[arg(short, long, env="ZERO_BIN_BATCH_SIZE", help_heading = HELP_HEADING, default_value_t = 10)]
batch_size: usize,
/// If true, save the public inputs to disk on error.
#[arg(short='i', long, help_heading = HELP_HEADING, default_value_t = false)]
#[arg(short='i', long, env="ZERO_BIN_SAVE_INPUTS_ON_ERROR", help_heading = HELP_HEADING, default_value_t = false)]
save_inputs_on_error: bool,
/// If true, only test the trace decoder and witness generation without
/// generating a proof.
#[arg(long, help_heading = HELP_HEADING, default_value_t = false)]
#[arg(long, env="ZERO_BIN_TEST_ONLY", help_heading = HELP_HEADING, default_value_t = false)]
test_only: bool,
/// Directory where the generated proofs will be written.
#[arg(long, short = 'o', value_hint = ValueHint::FilePath, default_value = get_default_output_path().into_os_string())]
#[arg(short = 'o', long, env="ZERO_BIN_PROOF_OUTPUT_DIR", value_hint = ValueHint::FilePath, default_value = get_default_output_path().into_os_string())]
proof_output_dir: PathBuf,
/// Keep intermediate proofs. Default action is to
/// delete them after the final proof is generated.
Expand All @@ -38,14 +38,14 @@
env = "ZERO_BIN_KEEP_INTERMEDIATE_PROOFS",
default_value_t = false
)]
keep_intermediate_proofs: bool,

Check warning on line 41 in zero/src/prover/cli.rs

View workflow job for this annotation

GitHub Actions / cargo-fmt

Diff in /home/runner/work/zk_evm/zk_evm/zero/src/prover/cli.rs
/// Number of blocks in a batch. For every block batch, the prover will
/// generate one proof file.
#[arg(long, default_value_t = 8)]
#[arg(long, env="ZERO_BIN_BLOCK_BATCH_SIZE", default_value_t = 8)]
block_batch_size: usize,
/// The maximum number of block proving tasks that can run in parallel. Must
/// be greater than zero.
#[arg(long, default_value_t = 16)]
#[arg(long, env="ZERO_BIN_BLOCK_POOL_SIZE", default_value_t = 16)]

Check warning on line 48 in zero/src/prover/cli.rs

View workflow job for this annotation

GitHub Actions / cargo-fmt

Diff in /home/runner/work/zk_evm/zk_evm/zero/src/prover/cli.rs
block_pool_size: usize,
}

Expand Down
Loading