diff --git a/builder/src/bin/permissionless-builder.rs b/builder/src/bin/permissionless-builder.rs index 0e5f0c2b527..56700ab4972 100644 --- a/builder/src/bin/permissionless-builder.rs +++ b/builder/src/bin/permissionless-builder.rs @@ -18,7 +18,7 @@ use vbs::version::StaticVersionType; struct NonPermissionedBuilderOptions { /// URL of hotshot events API running on Espresso Sequencer DA committee node /// The builder will subscribe to this server to receive hotshot events - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_HOTSHOT_EVENT_STREAMING_API_URL", default_value = "http://localhost:22001" @@ -29,15 +29,15 @@ struct NonPermissionedBuilderOptions { /// /// This is the address fees will be charged to. /// It must be funded with ETH in the Espresso fee ledger - #[clap(long, env = "ESPRESSO_BUILDER_ETH_MNEMONIC")] + #[arg(long, env = "ESPRESSO_BUILDER_ETH_MNEMONIC")] eth_mnemonic: String, /// Index of a funded account derived from eth-mnemonic. - #[clap(long, env = "ESPRESSO_BUILDER_ETH_ACCOUNT_INDEX", default_value = "8")] + #[arg(long, env = "ESPRESSO_BUILDER_ETH_ACCOUNT_INDEX", default_value = "8")] eth_account_index: u32, /// Url we will use for RPC communication with L1. - #[clap( + #[arg( long, env = "ESPRESSO_BUILDER_L1_PROVIDER", value_delimiter = ',', @@ -46,31 +46,31 @@ struct NonPermissionedBuilderOptions { l1_provider_url: Vec, /// Peer nodes use to fetch missing state - #[clap(long, env = "ESPRESSO_SEQUENCER_STATE_PEERS", value_delimiter = ',')] + #[arg(long, env = "ESPRESSO_SEQUENCER_STATE_PEERS", value_delimiter = ',')] state_peers: Vec, /// Port to run the builder server on. - #[clap(short, long, env = "ESPRESSO_BUILDER_SERVER_PORT")] + #[arg(short, long, env = "ESPRESSO_BUILDER_SERVER_PORT")] port: u16, /// Bootstrapping View number - #[clap(short, long, env = "ESPRESSO_BUILDER_BOOTSTRAPPED_VIEW")] + #[arg(short, long, env = "ESPRESSO_BUILDER_BOOTSTRAPPED_VIEW")] view_number: u64, /// BUILDER TRANSACTIONS CHANNEL CAPACITY - #[clap(long, env = "ESPRESSO_BUILDER_TX_CHANNEL_CAPACITY")] + #[arg(long, env = "ESPRESSO_BUILDER_TX_CHANNEL_CAPACITY")] pub tx_channel_capacity: NonZeroUsize, /// BUILDER HS EVENTS CHANNEL CAPACITY - #[clap(long, env = "ESPRESSO_BUILDER_EVENT_CHANNEL_CAPACITY")] + #[arg(long, env = "ESPRESSO_BUILDER_EVENT_CHANNEL_CAPACITY")] pub event_channel_capacity: NonZeroUsize, /// NETWORK INITIAL NODE COUNT - #[clap(short, long, env = "ESPRESSO_BUILDER_INIT_NODE_COUNT")] + #[arg(short, long, env = "ESPRESSO_BUILDER_INIT_NODE_COUNT")] node_count: NonZeroUsize, /// The amount of time a builder can wait before timing out a request to the API. - #[clap( + #[arg( short, long, env = "ESPRESSO_BUILDER_WEBSERVER_RESPONSE_TIMEOUT_DURATION", @@ -80,7 +80,7 @@ struct NonPermissionedBuilderOptions { max_api_timeout_duration: Duration, /// The amount of time a builder can wait before incrementing the max block size. - #[clap( + #[arg( short = 'M', long, env = "ESPRESSO_BUILDER_MAX_BLOCK_SIZE_INCREMENT_PERIOD", @@ -90,7 +90,7 @@ struct NonPermissionedBuilderOptions { max_block_size_increment_period: Duration, /// The amount of time a builder can wait before incrementing the max block size. - #[clap( + #[arg( long, env = "ESPRESSO_BUILDER_TX_STATUS_CACHE_SIZE", default_value = "819200" @@ -98,10 +98,10 @@ struct NonPermissionedBuilderOptions { tx_status_cache_size: usize, /// Path to TOML file containing genesis state. - #[clap(long, name = "GENESIS_FILE", env = "ESPRESSO_BUILDER_GENESIS_FILE")] + #[arg(long, value_name = "GENESIS_FILE", env = "ESPRESSO_BUILDER_GENESIS_FILE")] genesis_file: PathBuf, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } diff --git a/contracts/rust/deployer/src/lib.rs b/contracts/rust/deployer/src/lib.rs index 5c122bab34f..eacf53aa32f 100644 --- a/contracts/rust/deployer/src/lib.rs +++ b/contracts/rust/deployer/src/lib.rs @@ -66,44 +66,44 @@ pub const MAX_HISTORY_RETENTION_SECONDS: u32 = 864000; #[derive(Clone, Debug, Parser)] pub struct DeployedContracts { /// Use an already-deployed PlonkVerifier.sol instead of deploying a new one. - #[clap(long, env = Contract::PlonkVerifier)] + #[arg(long, env = Contract::PlonkVerifier)] plonk_verifier: Option
, /// Timelock.sol - #[clap(long, env = Contract::Timelock)] + #[arg(long, env = Contract::Timelock)] timelock: Option
, /// PlonkVerifierV2.sol - #[clap(long, env = Contract::PlonkVerifierV2)] + #[arg(long, env = Contract::PlonkVerifierV2)] plonk_verifier_v2: Option
, /// Use an already-deployed LightClient.sol instead of deploying a new one. - #[clap(long, env = Contract::LightClient)] + #[arg(long, env = Contract::LightClient)] light_client: Option
, /// LightClientV2.sol - #[clap(long, env = Contract::LightClientV2)] + #[arg(long, env = Contract::LightClientV2)] light_client_v2: Option
, /// Use an already-deployed LightClient.sol proxy instead of deploying a new one. - #[clap(long, env = Contract::LightClientProxy)] + #[arg(long, env = Contract::LightClientProxy)] light_client_proxy: Option
, /// Use an already-deployed FeeContract.sol instead of deploying a new one. - #[clap(long, env = Contract::FeeContract)] + #[arg(long, env = Contract::FeeContract)] fee_contract: Option
, /// Use an already-deployed FeeContract.sol proxy instead of deploying a new one. - #[clap(long, env = Contract::FeeContractProxy)] + #[arg(long, env = Contract::FeeContractProxy)] fee_contract_proxy: Option
, /// Use an already-deployed EspToken.sol instead of deploying a new one. - #[clap(long, env = Contract::EspToken)] + #[arg(long, env = Contract::EspToken)] esp_token: Option
, /// Use an already-deployed EspToken.sol proxy instead of deploying a new one. - #[clap(long, env = Contract::EspTokenProxy)] + #[arg(long, env = Contract::EspTokenProxy)] esp_token_proxy: Option
, /// Use an already-deployed StakeTable.sol instead of deploying a new one. - #[clap(long, env = Contract::StakeTable)] + #[arg(long, env = Contract::StakeTable)] stake_table: Option
, /// Use an already-deployed StakeTableV2.sol instead of deploying a new one. @@ -111,7 +111,7 @@ pub struct DeployedContracts { stake_table_v2: Option
, /// Use an already-deployed StakeTable.sol proxy instead of deploying a new one. - #[clap(long, env = Contract::StakeTableProxy)] + #[arg(long, env = Contract::StakeTableProxy)] stake_table_proxy: Option
, } diff --git a/contracts/rust/diff-test/src/main.rs b/contracts/rust/diff-test/src/main.rs index 947dd549678..eecbf6aac1d 100644 --- a/contracts/rust/diff-test/src/main.rs +++ b/contracts/rust/diff-test/src/main.rs @@ -39,7 +39,7 @@ struct Cli { #[arg(value_enum)] action: Action, /// Optional arguments for the `action` - #[arg(value_parser, num_args = 1.., value_delimiter = ' ')] + #[arg(num_args = 1.., value_delimiter = ' ')] args: Vec, } diff --git a/hotshot-query-service/examples/simple-server.rs b/hotshot-query-service/examples/simple-server.rs index 605bb43efb1..2e2357c73a6 100644 --- a/hotshot-query-service/examples/simple-server.rs +++ b/hotshot-query-service/examples/simple-server.rs @@ -57,11 +57,11 @@ const NUM_NODES: usize = 2; #[derive(Parser)] struct Options { /// Port on which to host the query service for the first consensus node. - #[clap(long, default_value = "18080")] + #[arg(long, default_value = "18080")] port1: u16, /// Port on which to host the query service for the second consensus node. - #[clap(long, default_value = "28080")] + #[arg(long, default_value = "28080")] port2: u16, } diff --git a/hotshot-state-prover/src/bin/gen-demo-genesis.rs b/hotshot-state-prover/src/bin/gen-demo-genesis.rs index 2270bf26e21..d8866726abf 100644 --- a/hotshot-state-prover/src/bin/gen-demo-genesis.rs +++ b/hotshot-state-prover/src/bin/gen-demo-genesis.rs @@ -8,7 +8,7 @@ use url::Url; #[derive(Parser)] struct Args { /// URL of the HotShot orchestrator. - #[clap( + #[arg( short, long, env = "ESPRESSO_SEQUENCER_ORCHESTRATOR_URL", diff --git a/hotshot-state-prover/src/bin/state-prover.rs b/hotshot-state-prover/src/bin/state-prover.rs index 841d56d38d6..9b721a3d229 100644 --- a/hotshot-state-prover/src/bin/state-prover.rs +++ b/hotshot-state-prover/src/bin/state-prover.rs @@ -20,11 +20,11 @@ use vbs::version::StaticVersion; #[derive(Parser)] struct Args { /// Start the prover service daemon - #[clap(short, long, action)] + #[arg(short, long)] daemon: bool, /// Url of the state relay server - #[clap( + #[arg( long, default_value = "http://localhost:8083", env = "ESPRESSO_STATE_RELAY_SERVER_URL" @@ -32,15 +32,15 @@ struct Args { relay_server: Url, /// The frequency of updating the light client state, expressed in update interval - #[clap(short, long = "freq", value_parser = parse_duration, default_value = "10m", env = "ESPRESSO_STATE_PROVER_UPDATE_INTERVAL")] + #[arg(short, long = "freq", value_parser = parse_duration, default_value = "10m", env = "ESPRESSO_STATE_PROVER_UPDATE_INTERVAL")] update_interval: Duration, /// Interval between retries if a state update fails - #[clap(long = "retry-freq", value_parser = parse_duration, default_value = "2s", env = "ESPRESSO_STATE_PROVER_RETRY_INTERVAL")] + #[arg(long = "retry-freq", value_parser = parse_duration, default_value = "2s", env = "ESPRESSO_STATE_PROVER_RETRY_INTERVAL")] retry_interval: Duration, /// Interval between retries if a state update fails - #[clap( + #[arg( long = "retries", default_value = "10", env = "ESPRESSO_STATE_PROVER_ONESHOT_RETRIES" @@ -48,7 +48,7 @@ struct Args { max_retries: u64, /// URL of layer 1 Ethereum JSON-RPC provider. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_PROVIDER", default_value = "http://localhost:8545" @@ -56,15 +56,15 @@ struct Args { l1_provider: Url, /// Address of LightClient contract on layer 1. - #[clap(long, env = "ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS")] + #[arg(long, env = "ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS")] light_client_address: Address, /// Mnemonic phrase for a funded Ethereum wallet. - #[clap(long, env = "ESPRESSO_SEQUENCER_ETH_MNEMONIC", default_value = None)] + #[arg(long, env = "ESPRESSO_SEQUENCER_ETH_MNEMONIC", default_value = None)] eth_mnemonic: String, /// Index of a funded account derived from eth-mnemonic. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_STATE_PROVER_ACCOUNT_INDEX", default_value = "0" @@ -73,7 +73,7 @@ struct Args { /// URL of a sequencer node that is currently providing the HotShot config. /// This is used to initialize the stake table. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_URL", default_value = "http://localhost:24000" @@ -83,26 +83,26 @@ struct Args { /// If daemon and provided, the service will run a basic HTTP server on the given port. /// /// The server provides healthcheck and version endpoints. - #[clap(short, long, env = "ESPRESSO_PROVER_SERVICE_PORT")] + #[arg(short, long, env = "ESPRESSO_PROVER_SERVICE_PORT")] pub port: Option, /// Stake table capacity for the prover circuit - #[clap(short, long, env = "ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY", default_value_t = DEFAULT_STAKE_TABLE_CAPACITY)] + #[arg(short, long, env = "ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY", default_value_t = DEFAULT_STAKE_TABLE_CAPACITY)] pub stake_table_capacity: usize, /// max acceptable gas price **in Gwei** for prover to send light client update transaction - #[clap(short, long, env = "ESPRESSO_STATE_PROVER_MAX_GAS_PRICE_IN_GWEI")] + #[arg(short, long, env = "ESPRESSO_STATE_PROVER_MAX_GAS_PRICE_IN_GWEI")] pub max_gas_price: Option, /// Indicated if the prover is using the old V1 LightClient contract - #[clap( + #[arg( long = "v1-contract", env = "ESPRESSO_STATE_PROVER_V1_CONTRACT", default_value = "false" )] pub v1_contract: bool, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } diff --git a/node-metrics/src/lib.rs b/node-metrics/src/lib.rs index e1b8dfa39d4..fb94b1d4f5a 100644 --- a/node-metrics/src/lib.rs +++ b/node-metrics/src/lib.rs @@ -131,7 +131,7 @@ pub struct Options { /// URL. /// Example: /// - https://query.cappuccino.testnet.espresso.network/v0/ - #[clap(long, env = "ESPRESSO_NODE_VALIDATOR_STAKE_TABLE_SOURCE_BASE_URL")] + #[arg(long, env = "ESPRESSO_NODE_VALIDATOR_STAKE_TABLE_SOURCE_BASE_URL")] stake_table_source_base_url: Url, /// leaf_stream_base_url is the base URL for the availability API endpoint @@ -142,7 +142,7 @@ pub struct Options { /// Example: /// - https://query.cappuccino.testnet.espresso.network/v0/ /// - #[clap(long, env = "ESPRESSO_NODE_VALIDATOR_LEAF_STREAM_SOURCE_BASE_URL")] + #[arg(long, env = "ESPRESSO_NODE_VALIDATOR_LEAF_STREAM_SOURCE_BASE_URL")] leaf_stream_base_url: Url, /// initial_node_public_base_urls is a list of URLs that are the initial @@ -155,7 +155,7 @@ pub struct Options { /// /// Example URL: /// - https://query-1.cappuccino.testnet.espresso.network/ - #[clap( + #[arg( long, env = "ESPRESSO_NODE_VALIDATOR_INITIAL_NODE_PUBLIC_BASE_URLS", value_delimiter = ',' @@ -165,9 +165,8 @@ pub struct Options { /// port is the port that the node validator service will listen on. /// This port is expected to be a valid port number that is available /// for the service to bind to. - #[clap( + #[arg( long, - value_parser, env = "ESPRESSO_NODE_VALIDATOR_PORT", default_value = "9000" )] diff --git a/sequencer/src/api/options.rs b/sequencer/src/api/options.rs index d0eb2e17d21..4a5ad1161d3 100644 --- a/sequencer/src/api/options.rs +++ b/sequencer/src/api/options.rs @@ -568,7 +568,7 @@ impl Options { #[derive(Parser, Clone, Copy, Debug)] pub struct Http { /// Port that the HTTP API will use. - #[clap(long, env = "ESPRESSO_SEQUENCER_API_PORT", default_value = "8080")] + #[arg(long, env = "ESPRESSO_SEQUENCER_API_PORT", default_value = "8080")] pub port: u16, /// Maximum number of concurrent HTTP connections the server will allow. @@ -576,7 +576,7 @@ pub struct Http { /// Connections exceeding this will receive and immediate 429 response and be closed. /// /// Leave unset for no connection limit. - #[clap(long, env = "ESPRESSO_SEQUENCER_MAX_CONNECTIONS")] + #[arg(long, env = "ESPRESSO_SEQUENCER_MAX_CONNECTIONS")] pub max_connections: Option, } @@ -610,7 +610,7 @@ pub struct Config; #[derive(Parser, Clone, Debug, Default)] pub struct Query { /// Peers for fetching missing data for the query service. - #[clap(long, env = "ESPRESSO_SEQUENCER_API_PEERS", value_delimiter = ',')] + #[arg(long, env = "ESPRESSO_SEQUENCER_API_PEERS", value_delimiter = ',')] pub peers: Vec, } @@ -622,7 +622,7 @@ pub struct State; #[derive(Parser, Clone, Copy, Debug, Default)] pub struct HotshotEvents { /// Port that the HTTP Hotshot Event streaming API will use. - #[clap(long, env = "ESPRESSO_SEQUENCER_HOTSHOT_EVENT_STREAMING_API_PORT")] + #[arg(long, env = "ESPRESSO_SEQUENCER_HOTSHOT_EVENT_STREAMING_API_PORT")] pub events_service_port: u16, } diff --git a/sequencer/src/bin/deploy.rs b/sequencer/src/bin/deploy.rs index a3783040e6f..e91c0c41883 100644 --- a/sequencer/src/bin/deploy.rs +++ b/sequencer/src/bin/deploy.rs @@ -33,7 +33,7 @@ use vbs::version::StaticVersion; #[derive(Clone, Debug, Parser)] struct Options { /// A JSON-RPC endpoint for the L1 to deploy to. - #[clap( + #[arg( short, long, env = "ESPRESSO_SEQUENCER_L1_PROVIDER", @@ -42,7 +42,7 @@ struct Options { rpc_url: Url, /// Request rate when polling L1. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_POLLING_INTERVAL", default_value = "7s", @@ -52,7 +52,7 @@ struct Options { /// URL of a sequencer node that is currently providing the HotShot config. /// This is used to initialize the stake table. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_URL", default_value = "http://localhost:24000" @@ -63,9 +63,9 @@ struct Options { /// /// This wallet is used to deploy the contracts, so the account indicated by ACCOUNT_INDEX must /// be funded with with ETH. - #[clap( + #[arg( long, - name = "MNEMONIC", + value_name = "MNEMONIC", env = "ESPRESSO_SEQUENCER_ETH_MNEMONIC", default_value = "test test test test test test test test test test test junk" )] @@ -76,34 +76,34 @@ struct Options { /// If provided, this the multisig wallet that will be able to upgrade contracts and execute /// admin only functions on contracts. If not provided, admin power for all contracts will be /// held by the account used to deploy the contracts (determined from MNEMONIC, ACCOUNT_INDEX). - #[clap( + #[arg( long, - name = "MULTISIG_ADDRESS", + value_name = "MULTISIG_ADDRESS", env = "ESPRESSO_SEQUENCER_ETH_MULTISIG_ADDRESS" )] multisig_address: Option
, /// Account index in the L1 wallet generated by MNEMONIC to use when deploying the contracts. - #[clap( + #[arg( long, - name = "ACCOUNT_INDEX", + value_name = "ACCOUNT_INDEX", env = "ESPRESSO_DEPLOYER_ACCOUNT_INDEX", default_value = "0" )] account_index: u32, /// Option to deploy fee contracts - #[clap(long, default_value = "false")] + #[arg(long, default_value = "false")] deploy_fee: bool, /// Option to deploy LightClient V1 and proxy - #[clap(long, default_value = "false")] + #[arg(long, default_value = "false")] deploy_light_client_v1: bool, /// Option to upgrade to LightClient V2 - #[clap(long, default_value = "false")] + #[arg(long, default_value = "false")] upgrade_light_client_v2: bool, - #[clap(long, default_value = "false")] + #[arg(long, default_value = "false")] deploy_esp_token: bool, - #[clap(long, default_value = "false")] + #[arg(long, default_value = "false")] deploy_stake_table: bool, #[clap(long, default_value = "false")] upgrade_stake_table_v2: bool, @@ -111,19 +111,19 @@ struct Options { /// Write deployment results to OUT as a .env file. /// /// If not provided, the results will be written to stdout. - #[clap(short, long, name = "OUT", env = "ESPRESSO_DEPLOYER_OUT_PATH")] + #[arg(short, long, value_name = "OUT", env = "ESPRESSO_DEPLOYER_OUT_PATH")] out: Option, - #[clap(flatten)] + #[command(flatten)] contracts: DeployedContracts, /// If toggled, launch a mock LightClient contract with a smaller verification key for testing. /// Applies to both V1 and V2 of LightClient. - #[clap(short, long)] + #[arg(short, long)] pub use_mock: bool, /// Stake table capacity for the prover circuit - #[clap(short, long, env = "ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY", default_value_t = DEFAULT_STAKE_TABLE_CAPACITY)] + #[arg(short, long, env = "ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY", default_value_t = DEFAULT_STAKE_TABLE_CAPACITY)] pub stake_table_capacity: usize, /// /// If the light client contract is being deployed and this is set, the prover will be @@ -131,7 +131,7 @@ struct Options { /// will be permissionless. /// /// If the light client contract is not being deployed, this option is ignored. - #[clap(long, env = "ESPRESSO_SEQUENCER_PERMISSIONED_PROVER")] + #[arg(long, env = "ESPRESSO_SEQUENCER_PERMISSIONED_PROVER")] permissioned_prover: Option
, /// Exit escrow period for the stake table contract. @@ -140,28 +140,28 @@ struct Options { /// been requested. It should be set to a value that is at least 3 hotshot epochs plus ample /// time to allow for submission of slashing evidence. Initially it will probably be around one /// week. - #[clap(long, env = "ESPRESSO_SEQUENCER_STAKE_TABLE_EXIT_ESCROW_PERIOD", value_parser = parse_duration)] + #[arg(long, env = "ESPRESSO_SEQUENCER_STAKE_TABLE_EXIT_ESCROW_PERIOD", value_parser = parse_duration)] exit_escrow_period: Option, /// The address that the tokens will be minted to. /// /// If unset the tokens will be minted to the deployer account. - #[clap(long, env = "ESP_TOKEN_INITIAL_GRANT_RECIPIENT_ADDRESS")] + #[arg(long, env = "ESP_TOKEN_INITIAL_GRANT_RECIPIENT_ADDRESS")] initial_token_grant_recipient: Option
, /// The initial supply of the tokens. - #[clap(long, env = "ESP_TOKEN_INITIAL_SUPPLY", default_value_t = U256::from(3590000000u64))] + #[arg(long, env = "ESP_TOKEN_INITIAL_SUPPLY", default_value_t = U256::from(3590000000u64))] initial_token_supply: U256, /// The name of the tokens. - #[clap(long, env = "ESP_TOKEN_NAME", default_value = "Espresso")] + #[arg(long, env = "ESP_TOKEN_NAME", default_value = "Espresso")] token_name: String, /// The symbol of the tokens. - #[clap(long, env = "ESP_TOKEN_SYMBOL", default_value = "ESP")] + #[arg(long, env = "ESP_TOKEN_SYMBOL", default_value = "ESP")] token_symbol: String, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } diff --git a/sequencer/src/bin/espresso-bridge.rs b/sequencer/src/bin/espresso-bridge.rs index 01445734ed4..8a16a261aa6 100644 --- a/sequencer/src/bin/espresso-bridge.rs +++ b/sequencer/src/bin/espresso-bridge.rs @@ -18,7 +18,7 @@ use surf_disco::Url; /// Command-line utility for working with the Espresso bridge. #[derive(Debug, Parser)] struct Options { - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, #[command(subcommand)] @@ -36,11 +36,11 @@ enum Command { #[derive(Debug, Parser)] struct Deposit { /// L1 JSON-RPC provider. - #[clap(short, long, env = "L1_PROVIDER")] + #[arg(short, long, env = "L1_PROVIDER")] rpc_url: Url, /// Request rate when polling L1. - #[clap( + #[arg( short, long, env = "L1_POLLING_INTERVAL", @@ -53,29 +53,29 @@ struct Deposit { /// /// This must point to an Espresso node running the /availability, /node and Merklized state /// (/fee-state and /block-state) APIs. - #[clap(short, long, env = "ESPRESSO_PROVIDER")] + #[arg(short, long, env = "ESPRESSO_PROVIDER")] espresso_provider: Url, /// The address of the Espresso fee contract on the L1. - #[clap(short, long, env = "CONTRACT_ADDRESS")] + #[arg(short, long, env = "CONTRACT_ADDRESS")] contract_address: Address, /// Mnemonic to generate the account from which to deposit. - #[clap(short, long, env = "MNEMONIC")] + #[arg(short, long, env = "MNEMONIC")] mnemonic: String, /// Account index when deriving an account from MNEMONIC. - #[clap(short = 'i', long, env = "ACCOUNT_INDEX", default_value = "0")] + #[arg(short = 'i', long, env = "ACCOUNT_INDEX", default_value = "0")] account_index: u32, /// Amount of WEI to deposit. // Note: we use u64 because U256 parses in hex, which is annoying. We can easily convert to U256 // after parsing. - #[clap(short, long, env = "AMOUNT")] + #[arg(short, long, env = "AMOUNT")] amount: u64, /// Number of confirmations to wait for before considering an L1 transaction mined. - #[clap(long, env = "CONFIRMATIONS", default_value = "6")] + #[arg(long, env = "CONFIRMATIONS", default_value = "6")] confirmations: usize, } @@ -85,19 +85,19 @@ struct Balance { /// Espresso query service provider. /// /// This must point to an Espresso node running the node and Merklized state APIs. - #[clap(short, long, env = "ESPRESSO_PROVIDER")] + #[arg(short, long, env = "ESPRESSO_PROVIDER")] espresso_provider: Url, /// Account to check. - #[clap(short, long, env = "ADDRESS", required_unless_present = "mnemonic")] + #[arg(short, long, env = "ADDRESS", required_unless_present = "mnemonic")] address: Option
, /// Mnemonic to generate the account to check. - #[clap(short, long, env = "MNEMONIC", conflicts_with = "address")] + #[arg(short, long, env = "MNEMONIC", conflicts_with = "address")] mnemonic: Option, /// Account index when deriving an account from MNEMONIC. - #[clap( + #[arg( short = 'i', long, env = "ACCOUNT_INDEX", @@ -107,7 +107,7 @@ struct Balance { account_index: u32, /// Espresso block number at which to check (default: latest). - #[clap(short, long, env = "BLOCK")] + #[arg(short, long, env = "BLOCK")] block: Option, } @@ -115,11 +115,11 @@ struct Balance { #[derive(Debug, Parser)] struct L1Balance { /// L1 JSON-RPC provider. - #[clap(short, long, env = "L1_PROVIDER")] + #[arg(short, long, env = "L1_PROVIDER")] rpc_url: Url, /// Request rate when polling L1. - #[clap( + #[arg( short, long, env = "L1_POLLING_INTERVAL", @@ -129,15 +129,15 @@ struct L1Balance { l1_interval: Duration, /// Account to check. - #[clap(short, long, env = "ADDRESS", required_unless_present = "mnemonic")] + #[arg(short, long, env = "ADDRESS", required_unless_present = "mnemonic")] address: Option
, /// Mnemonic to generate the account to check. - #[clap(short, long, env = "MNEMONIC", conflicts_with = "address")] + #[arg(short, long, env = "MNEMONIC", conflicts_with = "address")] mnemonic: Option, /// Account index when deriving an account from MNEMONIC. - #[clap( + #[arg( short = 'i', long, env = "ACCOUNT_INDEX", @@ -147,7 +147,7 @@ struct L1Balance { account_index: u32, /// L1 block number at which to check (default: latest). - #[clap(short, long, env = "BLOCK")] + #[arg(short, long, env = "BLOCK")] block: Option, } diff --git a/sequencer/src/bin/espresso-dev-node.rs b/sequencer/src/bin/espresso-dev-node.rs index 94616eca9a1..14362267e0b 100644 --- a/sequencer/src/bin/espresso-dev-node.rs +++ b/sequencer/src/bin/espresso-dev-node.rs @@ -74,17 +74,17 @@ enum L1Deployment { struct Args { /// A JSON-RPC endpoint for the L1 to deploy to. /// If this is not provided, an Avil node will be launched automatically. - #[clap(short, long, env = "ESPRESSO_SEQUENCER_L1_PROVIDER")] + #[arg(short, long, env = "ESPRESSO_SEQUENCER_L1_PROVIDER")] rpc_url: Option, - #[clap(flatten)] + #[command(flatten)] l1_opt: L1ClientOptions, /// Mnemonic for an L1 wallet. /// /// This wallet is used to deploy the contracts, /// so the account indicated by ACCOUNT_INDEX must be funded with with ETH. - #[clap( + #[arg( long, name = "MNEMONIC", env = "ESPRESSO_SEQUENCER_ETH_MNEMONIC", @@ -92,7 +92,7 @@ struct Args { )] mnemonic: String, /// Account index in the L1 wallet generated by MNEMONIC to use when deploying the contracts. - #[clap( + #[arg( long, name = "ACCOUNT_INDEX", env = "ESPRESSO_DEPLOYER_ACCOUNT_INDEX", @@ -103,7 +103,7 @@ struct Args { /// Address for the multisig wallet that will be the admin /// /// This the multisig wallet that will be upgrade contracts and execute admin only functions on contracts - #[clap( + #[arg( long, name = "MULTISIG_ADDRESS", env = "ESPRESSO_SEQUENCER_ETH_MULTISIG_ADDRESS" @@ -111,11 +111,11 @@ struct Args { multisig_address: Option
, /// The frequency of updating the light client state, expressed in update interval - #[clap( long, value_parser = parse_duration, default_value = "10s", env = "ESPRESSO_STATE_PROVER_UPDATE_INTERVAL")] + #[arg( long, value_parser = parse_duration, default_value = "10s", env = "ESPRESSO_STATE_PROVER_UPDATE_INTERVAL")] update_interval: Duration, /// Interval between retries if a state update fails - #[clap(long , value_parser = parse_duration, default_value = "2s", env = "ESPRESSO_STATE_PROVER_RETRY_INTERVAL")] + #[arg(long , value_parser = parse_duration, default_value = "2s", env = "ESPRESSO_STATE_PROVER_RETRY_INTERVAL")] retry_interval: Duration, /// Optional list of URLs representing alternate chains @@ -132,7 +132,7 @@ struct Args { /// Alternate account indices generated by the mnemonics to use when deploying the contracts. /// If there are fewer indices provided than chains, the base ACCOUNT_INDEX will be used. - #[clap(long, env = "ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES")] + #[arg(long, env = "ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES")] alt_account_indices: Vec, /// Optional list of multisig addresses for the alternate chains. @@ -140,7 +140,7 @@ struct Args { #[arg(long, env = "ESPRESSO_DEPLOYER_ALT_MULTISIG_ADDRESSES", num_args = 1.., value_delimiter = ',')] alt_multisig_addresses: Vec
, - #[clap(flatten)] + #[command(flatten)] contracts: DeployedContracts, /// L1 deployment mode @@ -154,38 +154,38 @@ struct Args { /// The frequency of updating the light client state for alt chains. /// If there are fewer intervals provided than chains, the base update interval will be used. - #[clap(long, value_parser = parse_duration, env = "ESPRESSO_STATE_PROVER_ALT_UPDATE_INTERVALS", num_args = 1.., value_delimiter = ',')] + #[arg(long, value_parser = parse_duration, env = "ESPRESSO_STATE_PROVER_ALT_UPDATE_INTERVALS", num_args = 1.., value_delimiter = ',')] alt_prover_update_intervals: Vec, /// Interval between retries if a state update fails for alt chains /// If there are fewer intervals provided than chains, the base update interval will be used. - #[clap(long, value_parser = parse_duration, env = "ESPRESSO_STATE_PROVER_ALT_RETRY_INTERVALS", num_args = 1.., value_delimiter = ',')] + #[arg(long, value_parser = parse_duration, env = "ESPRESSO_STATE_PROVER_ALT_RETRY_INTERVALS", num_args = 1.., value_delimiter = ',')] alt_prover_retry_intervals: Vec, /// Port that the HTTP API will use. - #[clap(long, env = "ESPRESSO_SEQUENCER_API_PORT")] + #[arg(long, env = "ESPRESSO_SEQUENCER_API_PORT")] sequencer_api_port: u16, /// Maximum concurrent connections allowed by the HTTP API server. - #[clap(long, env = "ESPRESSO_SEQUENCER_MAX_CONNECTIONS")] + #[arg(long, env = "ESPRESSO_SEQUENCER_MAX_CONNECTIONS")] sequencer_api_max_connections: Option, /// Port for connecting to the builder. - #[clap(short, long, env = "ESPRESSO_BUILDER_PORT")] + #[arg(short, long, env = "ESPRESSO_BUILDER_PORT")] builder_port: Option, /// Port for connecting to the prover. - #[clap(short, long, env = "ESPRESSO_PROVER_PORT")] + #[arg(short, long, env = "ESPRESSO_PROVER_PORT")] prover_port: Option, /// Port for the dev node. /// /// This is used to provide tools and information to facilitate developers debugging. - #[clap(short, long, env = "ESPRESSO_DEV_NODE_PORT", default_value = "20000")] + #[arg(short, long, env = "ESPRESSO_DEV_NODE_PORT", default_value = "20000")] dev_node_port: u16, /// Port for connecting to the builder. - #[clap( + #[arg( short, long, env = "ESPRESSO_DEV_NODE_MAX_BLOCK_SIZE", @@ -198,25 +198,25 @@ struct Args { /// When using your own L1 this value needs to be set such that by the time the espresso node /// reaches block epoch_height - 5 the _finalized_ stake table contract on L1 is initialized /// with delegators. - #[clap(long, env = "ESPRESSO_DEV_NODE_EPOCH_HEIGHT", default_value_t = 300)] + #[arg(long, env = "ESPRESSO_DEV_NODE_EPOCH_HEIGHT", default_value_t = 300)] epoch_height: u64, /// The initial supply of the tokens. - #[clap(long, env = "ESP_TOKEN_INITIAL_SUPPLY", default_value_t = U256::from(3590000000u64))] + #[arg(long, env = "ESP_TOKEN_INITIAL_SUPPLY", default_value_t = U256::from(3590000000u64))] initial_token_supply: U256, /// The name of the tokens. - #[clap(long, env = "ESP_TOKEN_NAME", default_value = "Espresso")] + #[arg(long, env = "ESP_TOKEN_NAME", default_value = "Espresso")] token_name: String, /// The symbol of the tokens. - #[clap(long, env = "ESP_TOKEN_SYMBOL", default_value = "ESP")] + #[arg(long, env = "ESP_TOKEN_SYMBOL", default_value = "ESP")] token_symbol: String, - #[clap(flatten)] + #[command(flatten)] sql: persistence::sql::Options, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } diff --git a/sequencer/src/bin/keygen.rs b/sequencer/src/bin/keygen.rs index 5b41153ddd6..58393bf940e 100644 --- a/sequencer/src/bin/keygen.rs +++ b/sequencer/src/bin/keygen.rs @@ -72,7 +72,7 @@ struct Options { /// Seed for generating keys. /// /// If not provided, a random seed will be generated using system entropy. - #[clap(long, short = 's', value_parser = parse_seed)] + #[arg(long, short = 's', value_parser = parse_seed)] seed: Option<[u8; 32]>, /// Signature scheme to generate. @@ -81,13 +81,13 @@ struct Options { /// the state key). By default, this program generates these keys in pairs, to make it easy to /// configure sequencer nodes, but this option can be specified to generate keys for only one of /// the signature schemes. - #[clap(long, default_value = "all")] + #[arg(long, default_value = "all")] scheme: Scheme, /// Number of setups to generate. /// /// Default is 1. - #[clap(long, short = 'n', name = "N", default_value = "1")] + #[arg(long, short = 'n', value_name = "N", default_value = "1")] num: usize, /// Write private keys to .env files under DIR. @@ -96,10 +96,10 @@ struct Options { /// be written to files immediately under DIR, with names like 0.env, 1.env, etc. for 0 through /// N - 1. The random seed used to generate the keys will also be written to a file in DIR /// called .seed. - #[clap(short, long, name = "OUT")] + #[arg(short, long, value_name = "OUT")] out: PathBuf, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } diff --git a/sequencer/src/bin/nasty-client.rs b/sequencer/src/bin/nasty-client.rs index f36d15dee4c..06631a2ee34 100644 --- a/sequencer/src/bin/nasty-client.rs +++ b/sequencer/src/bin/nasty-client.rs @@ -65,7 +65,7 @@ use vbs::version::StaticVersionType; #[derive(Clone, Debug, Parser)] struct Options { /// Port on which to serve the nasty-client API. - #[clap( + #[arg( short, long, env = "ESPRESSO_NASTY_CLIENT_PORT", @@ -74,16 +74,16 @@ struct Options { port: u16, /// The URL of the query service to connect to. - #[clap(env = "ESPRESSO_SEQUENCER_URL")] + #[arg(env = "ESPRESSO_SEQUENCER_URL")] url: Url, - #[clap(flatten)] + #[command(flatten)] client_config: ClientConfig, - #[clap(flatten)] + #[command(flatten)] distribution: ActionDistribution, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } @@ -93,7 +93,7 @@ struct ClientConfig { /// /// Requests that take longer than this will fail, causing an error log and an increment of the /// `failed_actions` metric. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_HTTP_TIMEOUT_ERROR", default_value = "5s", @@ -105,7 +105,7 @@ struct ClientConfig { /// /// Requests that take longer than this but shorter than HTTP_TIMEOUT_ERROR will not generate an /// error but will output a warning and increment a counter of slow HTTP requests. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_HTTP_TIMEOUT_WARNING", default_value = "1s", @@ -114,7 +114,7 @@ struct ClientConfig { http_timeout_warning: Duration, /// The maximum number of open WebSockets connections for each resource type at any time. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_MAX_OPEN_STREAMS", default_value = "100" @@ -122,7 +122,7 @@ struct ClientConfig { max_open_streams: usize, /// The maximum number of consecutive blocking polls to make at one time. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_MAX_BLOCKING_POLLS", default_value = "10" @@ -130,11 +130,11 @@ struct ClientConfig { max_blocking_polls: u8, /// The maximum number of retries before considering a fallible query failed. - #[clap(long, env = "ESPRESSO_NASTY_CLIENT_MAX_RETRIES", default_value = "3")] + #[arg(long, env = "ESPRESSO_NASTY_CLIENT_MAX_RETRIES", default_value = "3")] max_retries: usize, /// The amount of time to wait between each retry of a fallible query. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_RETRY_DELAY", default_value = "1s", @@ -143,7 +143,7 @@ struct ClientConfig { retry_delay: Duration, /// The minimum number of successful tries to consider a failed operation "healed". - #[clap(long, env = "ESPRESSO_NASTY_CLIENT_MIN_RETRIES", default_value = "5")] + #[arg(long, env = "ESPRESSO_NASTY_CLIENT_MIN_RETRIES", default_value = "5")] min_retries: usize, /// Time after which WebSockets connection failures are allowed. @@ -155,7 +155,7 @@ struct ClientConfig { /// If there is an error polling a WebSockets connection last used more recently than this /// duration, it is considered an error. If the connection is staler than this, it is only a /// warning, and the connection is automatically refreshed. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_WEB_SOCKET_TIMEOUT", default_value = "60s", @@ -167,11 +167,11 @@ struct ClientConfig { #[derive(Clone, Debug, Parser)] struct ActionDistribution { /// The weight of query actions in the random distribution. - #[clap(long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_QUERY", default_value = "20")] + #[arg(long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_QUERY", default_value = "20")] weight_query: u8, /// The weight of query range actions in the random distribution. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_QUERY_RANGE", default_value = "10" @@ -179,7 +179,7 @@ struct ActionDistribution { weight_query_range: u8, /// The weight of "open stream" actions in the random distribution. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_OPEN_STREAM", default_value = "2" @@ -187,7 +187,7 @@ struct ActionDistribution { weight_open_stream: u8, /// The weight of "close stream" actions in the random distribution. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_CLOSE_STREAM", default_value = "1" @@ -195,7 +195,7 @@ struct ActionDistribution { weight_close_stream: u8, /// The weight of "poll stream" actions in the random distribution. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_POLL_STREAM", default_value = "10" @@ -203,7 +203,7 @@ struct ActionDistribution { weight_poll_stream: u8, /// The weight of "query window" actions in the random distribution. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_QUERY_WINDOW", default_value = "15" @@ -211,7 +211,7 @@ struct ActionDistribution { weight_query_window: u8, /// The weight of "query namespace" actions in the random distribution. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_QUERY_NAMESPACE", default_value = "15" @@ -219,7 +219,7 @@ struct ActionDistribution { weight_query_namespace: u8, /// The weight of "query block state" actions in the random distribution. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_QUERY_BLOCK_STATE", default_value = "15" @@ -227,7 +227,7 @@ struct ActionDistribution { weight_query_block_state: u8, /// The weight of "query fee state" actions in the random distribution. - #[clap( + #[arg( long, env = "ESPRESSO_NASTY_CLIENT_WEIGHT_QUERY_FEE_STATE", default_value = "15" diff --git a/sequencer/src/bin/orchestrator.rs b/sequencer/src/bin/orchestrator.rs index b2b0dabed27..f657f0a40a3 100644 --- a/sequencer/src/bin/orchestrator.rs +++ b/sequencer/src/bin/orchestrator.rs @@ -14,19 +14,19 @@ use vec1::Vec1; #[derive(Parser)] struct Args { /// Port to run the server on. - #[clap(short, long, env = "ESPRESSO_ORCHESTRATOR_PORT")] + #[arg(short, long, env = "ESPRESSO_ORCHESTRATOR_PORT")] port: u16, /// Port to run the server on. - #[clap(short, long, env = "ESPRESSO_ORCHESTRATOR_MANUAL_START_PASSWORD")] + #[arg(short, long, env = "ESPRESSO_ORCHESTRATOR_MANUAL_START_PASSWORD")] manual_start_password: Option, /// Number of nodes in the network. - #[clap(short, long, env = "ESPRESSO_ORCHESTRATOR_NUM_NODES")] + #[arg(short, long, env = "ESPRESSO_ORCHESTRATOR_NUM_NODES")] num_nodes: NonZeroUsize, /// Duration to wait after all nodes are connected before starting the run. - #[clap(long, env = "ESPRESSO_ORCHESTRATOR_START_DELAY", default_value = "10s", value_parser = parse_duration)] + #[arg(long, env = "ESPRESSO_ORCHESTRATOR_START_DELAY", default_value = "10s", value_parser = parse_duration)] start_delay: Duration, /// Base duration for next-view timeout. @@ -94,7 +94,7 @@ struct Args { )] builder_timeout: Duration, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } diff --git a/sequencer/src/bin/pub-key.rs b/sequencer/src/bin/pub-key.rs index 38efb49a86c..2850c69e720 100644 --- a/sequencer/src/bin/pub-key.rs +++ b/sequencer/src/bin/pub-key.rs @@ -37,7 +37,7 @@ struct Options { key: PrivateKey, // Whether or not to derive the libp2p peer ID from the private key. - #[clap(long, short)] + #[arg(long, short)] libp2p: bool, } diff --git a/sequencer/src/bin/reset-storage.rs b/sequencer/src/bin/reset-storage.rs index 88d83fd1fd4..4adba85126f 100644 --- a/sequencer/src/bin/reset-storage.rs +++ b/sequencer/src/bin/reset-storage.rs @@ -11,7 +11,7 @@ use sequencer_utils::logging; /// its genesis state. Do not run this program while the sequencer is running. #[derive(Clone, Debug, Parser)] struct Options { - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, #[command(subcommand)] diff --git a/sequencer/src/bin/state-relay-server.rs b/sequencer/src/bin/state-relay-server.rs index 1279ec19e6f..6dd0960b7d5 100644 --- a/sequencer/src/bin/state-relay-server.rs +++ b/sequencer/src/bin/state-relay-server.rs @@ -8,7 +8,7 @@ use vbs::version::StaticVersionType; #[derive(Parser)] struct Args { /// Port to run the server on. - #[clap( + #[arg( short, long, env = "ESPRESSO_STATE_RELAY_SERVER_PORT", @@ -18,7 +18,7 @@ struct Args { /// URL of a sequencer node that is currently providing the HotShot config. /// This is used to initialize the stake table. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_URL", default_value = "http://localhost:24000" @@ -26,10 +26,10 @@ struct Args { pub sequencer_url: Url, /// Stake table capacity for the prover circuit - #[clap(short, long, env = "ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY", default_value_t = DEFAULT_STAKE_TABLE_CAPACITY)] + #[arg(short, long, env = "ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY", default_value_t = DEFAULT_STAKE_TABLE_CAPACITY)] pub stake_table_capacity: usize, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } diff --git a/sequencer/src/bin/submit-transactions.rs b/sequencer/src/bin/submit-transactions.rs index 6485308c794..0a69a162d02 100644 --- a/sequencer/src/bin/submit-transactions.rs +++ b/sequencer/src/bin/submit-transactions.rs @@ -36,30 +36,30 @@ struct Options { /// Minimum size of transaction to submit. /// /// The size of each transaction will be chosen uniformly between MIN_SIZE and MAX_SIZE. - #[clap(long, name = "MIN_SIZE", default_value = "1", value_parser = parse_size, env = "ESPRESSO_SUBMIT_TRANSACTIONS_MIN_SIZE")] + #[arg(long, value_name = "MIN_SIZE", default_value = "1", value_parser = parse_size, env = "ESPRESSO_SUBMIT_TRANSACTIONS_MIN_SIZE")] min_size: u64, /// Maximum size of transaction to submit. /// /// The size of each transaction will be chosen uniformly between MIN_SIZE and MAX_SIZE. - #[clap(long, name = "MAX_SIZE", default_value = "1kb", value_parser = parse_size, env = "ESPRESSO_SUBMIT_TRANSACTIONS_MAX_SIZE")] + #[arg(long, value_name = "MAX_SIZE", default_value = "1kb", value_parser = parse_size, env = "ESPRESSO_SUBMIT_TRANSACTIONS_MAX_SIZE")] max_size: u64, /// Minimum size of batch of transactions to submit. /// /// Batches will be a random count between MIN_BATCH_SIZE and MAX_BATCH_SIZE, with a falling distribution favoring smaller batches. /// This is by selecting a random size S on each iteration I since last batch, and collecting a batch whenever that S <= I. - #[clap(long, name = "MIN_BATCH_SIZE", default_value = "1", value_parser = parse_size, env = "ESPRESSO_SUBMIT_TRANSACTIONS_MIN_BATCH_SIZE")] + #[arg(long, value_name = "MIN_BATCH_SIZE", default_value = "1", value_parser = parse_size, env = "ESPRESSO_SUBMIT_TRANSACTIONS_MIN_BATCH_SIZE")] min_batch_size: u64, /// Maximum size of batch of transactions to submit. /// /// Batches will be a random count between MIN_BATCH_SIZE and MAX_BATCH_SIZE, with a falling distribution favoring smaller batches. - #[clap(long, name = "MAX_BATCH_SIZE", default_value = "20", value_parser = parse_size, env = "ESPRESSO_SUBMIT_TRANSACTIONS_MAX_BATCH_SIZE")] + #[arg(long, value_name = "MAX_BATCH_SIZE", default_value = "20", value_parser = parse_size, env = "ESPRESSO_SUBMIT_TRANSACTIONS_MAX_BATCH_SIZE")] max_batch_size: u64, /// Minimum namespace ID to submit to. - #[clap( + #[arg( long, default_value = "10000", env = "ESPRESSO_SUBMIT_TRANSACTIONS_MIN_NAMESPACE" @@ -67,7 +67,7 @@ struct Options { min_namespace: u32, /// Maximum namespace ID to submit to. - #[clap( + #[arg( long, default_value = "10010", env = "ESPRESSO_SUBMIT_TRANSACTIONS_MAX_NAMESPACE" @@ -78,14 +78,14 @@ struct Options { /// /// The delay after each transaction will be sampled from an exponential distribution with mean /// DELAY. - #[clap(long, name = "DELAY", value_parser = parse_duration, default_value = "30s", env = "ESPRESSO_SUBMIT_TRANSACTIONS_DELAY")] + #[arg(long, value_name = "DELAY", value_parser = parse_duration, default_value = "30s", env = "ESPRESSO_SUBMIT_TRANSACTIONS_DELAY")] delay: Duration, /// Maximum number of unprocessed transaction submissions. /// /// This can be used to apply backpressure so that the tasks submitting transactions do not get /// too far ahead of the task processing results. - #[clap( + #[arg( long, default_value = "1000", env = "ESPRESSO_SUBMIT_TRANSACTIONS_CHANNEL_BOUND" @@ -93,11 +93,11 @@ struct Options { channel_bound: usize, /// Seed for reproducible randomness. - #[clap(long, env = "ESPRESSO_SUBMIT_TRANSACTIONS_SEED")] + #[arg(long, env = "ESPRESSO_SUBMIT_TRANSACTIONS_SEED")] seed: Option, /// Number of parallel tasks to run. - #[clap( + #[arg( short, long, default_value = "1", @@ -106,7 +106,7 @@ struct Options { jobs: usize, /// Number of accumulated pending transactions which should trigger a warning. - #[clap( + #[arg( long, default_value = "10", env = "ESPRESSO_SUBMIT_TRANSACTIONS_PENDING_TRANSACTIONS_WARNING_THRESHOLD" @@ -114,37 +114,37 @@ struct Options { pending_transactions_warning_threshold: usize, /// Duration after which we should warn about a pending transaction. - #[clap(long, value_parser = parse_duration, default_value = "30s", env = "ESPRESSO_SUBMIT_TRANSACTIONS_SLOW_TRANSACTION_WARNING_THRESHOLD")] + #[arg(long, value_parser = parse_duration, default_value = "30s", env = "ESPRESSO_SUBMIT_TRANSACTIONS_SLOW_TRANSACTION_WARNING_THRESHOLD")] slow_transaction_warning_threshold: Duration, /// Enable an HTTP server with a healthcheck endpoint on this port. - #[clap(short, long, env = "ESPRESSO_SUBMIT_TRANSACTIONS_PORT")] + #[arg(short, long, env = "ESPRESSO_SUBMIT_TRANSACTIONS_PORT")] port: Option, /// Alternative URL to submit transactions to, if not the query service URL. - #[clap(long, env = "ESPRESSO_SUBMIT_TRANSACTIONS_SUBMIT_URL")] + #[arg(long, env = "ESPRESSO_SUBMIT_TRANSACTIONS_SUBMIT_URL")] submit_url: Option, /// URL of the query service. - #[clap(env = "ESPRESSO_SEQUENCER_URL")] + #[arg(env = "ESPRESSO_SEQUENCER_URL")] url: Url, /// Relay num_nodes for benchmark results output #[cfg(feature = "benchmarking")] - #[clap(short, long, env = "ESPRESSO_ORCHESTRATOR_NUM_NODES")] + #[arg(short, long, env = "ESPRESSO_ORCHESTRATOR_NUM_NODES")] num_nodes: NonZeroUsize, /// The first block that benchmark starts counting in #[cfg(feature = "benchmarking")] - #[clap(short, long, env = "ESPRESSO_BENCH_START_BLOCK")] + #[arg(short, long, env = "ESPRESSO_BENCH_START_BLOCK")] benchmark_start_block: NonZeroUsize, /// The final block that benchmark counts in #[cfg(feature = "benchmarking")] - #[clap(short, long, env = "ESPRESSO_BENCH_END_BLOCK")] + #[arg(short, long, env = "ESPRESSO_BENCH_END_BLOCK")] benchmark_end_block: NonZeroUsize, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } diff --git a/sequencer/src/bin/utils/keygen.rs b/sequencer/src/bin/utils/keygen.rs index 50feed4f1c7..118bf8d3d98 100644 --- a/sequencer/src/bin/utils/keygen.rs +++ b/sequencer/src/bin/utils/keygen.rs @@ -71,7 +71,7 @@ pub struct Options { /// Seed for generating keys. /// /// If not provided, a random seed will be generated using system entropy. - #[clap(long, short = 's', value_parser = parse_seed)] + #[arg(long, short = 's', value_parser = parse_seed)] seed: Option<[u8; 32]>, /// Signature scheme to generate. @@ -80,13 +80,13 @@ pub struct Options { /// the state key). By default, this program generates these keys in pairs, to make it easy to /// configure sequencer nodes, but this option can be specified to generate keys for only one of /// the signature schemes. - #[clap(long, default_value = "all")] + #[arg(long, default_value = "all")] scheme: Scheme, /// Number of setups to generate. /// /// Default is 1. - #[clap(long, short = 'n', name = "N", default_value = "1")] + #[arg(long, short = 'n', value_name = "N", default_value = "1")] num: usize, /// Write private keys to .env files under DIR. @@ -95,7 +95,7 @@ pub struct Options { /// be written to files immediately under DIR, with names like 0.env, 1.env, etc. for 0 through /// N - 1. The random seed used to generate the keys will also be written to a file in DIR /// called .seed. - #[clap(short, long, name = "OUT")] + #[arg(short, long, value_name = "OUT")] out: PathBuf, } diff --git a/sequencer/src/bin/utils/main.rs b/sequencer/src/bin/utils/main.rs index 888c2255349..a561cb0fad7 100644 --- a/sequencer/src/bin/utils/main.rs +++ b/sequencer/src/bin/utils/main.rs @@ -9,7 +9,7 @@ mod reset_storage; #[derive(Debug, Parser)] struct Options { - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, #[command(subcommand)] diff --git a/sequencer/src/bin/utils/ns_aggregator.rs b/sequencer/src/bin/utils/ns_aggregator.rs index 0c7ff719cbe..0f808ac9da3 100644 --- a/sequencer/src/bin/utils/ns_aggregator.rs +++ b/sequencer/src/bin/utils/ns_aggregator.rs @@ -11,25 +11,25 @@ use surf_disco::Url; #[derive(Debug, Parser)] pub struct Options { /// Block to start counting from. - #[clap(short, long, default_value = "0")] + #[arg(short, long, default_value = "0")] from_block: usize, /// Last block to count (inclusive). /// /// If not specified, will count until the end of the chain at the moment the program is /// invoked. - #[clap(short, long)] + #[arg(short, long)] to_block: Option, /// Namespace to aggregate. - #[clap(short, long)] + #[arg(short, long)] namespace: u64, /// Number of parallel tasks to run. /// /// Since the process is mostly I/O bound, increasing this can dramatically speed up /// aggregation. - #[clap(short, long, default_value = "1")] + #[arg(short, long, default_value = "1")] jobs: usize, /// Espresso query service URL. diff --git a/sequencer/src/bin/utils/pubkey.rs b/sequencer/src/bin/utils/pubkey.rs index bd4156df8bc..481691c47c5 100644 --- a/sequencer/src/bin/utils/pubkey.rs +++ b/sequencer/src/bin/utils/pubkey.rs @@ -38,7 +38,7 @@ pub struct Options { key: PrivateKey, // Whether or not to derive the libp2p peer ID from the private key. - #[clap(long, short)] + #[arg(long, short)] libp2p: bool, } diff --git a/sequencer/src/bin/verify-headers.rs b/sequencer/src/bin/verify-headers.rs index ef4536787c7..c5ed757822e 100644 --- a/sequencer/src/bin/verify-headers.rs +++ b/sequencer/src/bin/verify-headers.rs @@ -21,40 +21,40 @@ use vbs::version::StaticVersionType; #[derive(Clone, Debug, Parser)] struct Options { /// Start counting from block FROM. - #[clap(long, name = "FROM")] + #[arg(long, value_name = "FROM")] from: Option, /// Stop counting at block TO. - #[clap(long, name = "TO")] + #[arg(long, value_name = "TO")] to: Option, /// Skip verifying header timestamps. - #[clap(long)] + #[arg(long)] no_timestamps: bool, /// Skip verifying L1 head numbers. - #[clap(long)] + #[arg(long)] no_l1_heads: bool, /// Skip verifying L1 finalized references. - #[clap(long)] + #[arg(long)] no_l1_finalized: bool, /// L1 RPC URL /// /// This will be used to verify the hashes and timestamps of L1 finalized references. If not /// provided, only block numbers will be verified. - #[clap(long)] + #[arg(long)] l1: Option, /// Number of parallel tasks to run. - #[clap(short, long, default_value = "1")] + #[arg(short, long, default_value = "1")] jobs: usize, /// URL of the HotShot query service. url: Url, - #[clap(flatten)] + #[command(flatten)] logging: logging::Config, } diff --git a/sequencer/src/options.rs b/sequencer/src/options.rs index b6e69bbc9a1..ee0e9148d61 100644 --- a/sequencer/src/options.rs +++ b/sequencer/src/options.rs @@ -46,7 +46,7 @@ use crate::{api, persistence, proposal_fetcher::ProposalFetcherConfig}; #[derivative(Debug(bound = ""))] pub struct Options { /// URL of the HotShot orchestrator. - #[clap( + #[arg( short, long, env = "ESPRESSO_SEQUENCER_ORCHESTRATOR_URL", @@ -57,7 +57,7 @@ pub struct Options { /// The socket address of the HotShot CDN's main entry point (the marshal) /// in `IP:port` form - #[clap( + #[arg( short, long, env = "ESPRESSO_SEQUENCER_CDN_ENDPOINT", @@ -66,7 +66,7 @@ pub struct Options { pub cdn_endpoint: String, /// The address to bind to for Libp2p (in `host:port` form) - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_BIND_ADDRESS", default_value = "0.0.0.0:1769" @@ -74,11 +74,11 @@ pub struct Options { pub libp2p_bind_address: String, /// Time between each Libp2p heartbeat - #[clap(long, env = "ESPRESSO_SEQUENCER_LIBP2P_HEARTBEAT_INTERVAL", default_value = "1s", value_parser = parse_duration)] + #[arg(long, env = "ESPRESSO_SEQUENCER_LIBP2P_HEARTBEAT_INTERVAL", default_value = "1s", value_parser = parse_duration)] pub libp2p_heartbeat_interval: Duration, /// Number of past heartbeats to gossip about on Libp2p - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_HISTORY_GOSSIP", default_value = "3" @@ -86,7 +86,7 @@ pub struct Options { pub libp2p_history_gossip: usize, /// Number of heartbeats to keep in the Libp2p `memcache` - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_HISTORY_LENGTH", default_value = "5" @@ -94,11 +94,11 @@ pub struct Options { pub libp2p_history_length: usize, /// Target number of peers for the Libp2p mesh network - #[clap(long, env = "ESPRESSO_SEQUENCER_LIBP2P_MESH_N", default_value = "8")] + #[arg(long, env = "ESPRESSO_SEQUENCER_LIBP2P_MESH_N", default_value = "8")] pub libp2p_mesh_n: usize, /// Maximum number of peers in the Libp2p mesh network before removing some - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_MESH_N_HIGH", default_value = "12" @@ -106,7 +106,7 @@ pub struct Options { pub libp2p_mesh_n_high: usize, /// Minimum number of peers in the Libp2p mesh network before adding more - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_MESH_N_LOW", default_value = "6" @@ -114,7 +114,7 @@ pub struct Options { pub libp2p_mesh_n_low: usize, /// Minimum number of outbound Libp2p peers in the mesh network before adding more - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_MESH_OUTBOUND_MIN", default_value = "2" @@ -122,7 +122,7 @@ pub struct Options { pub libp2p_mesh_outbound_min: usize, /// The maximum number of messages to include in a Libp2p IHAVE message - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_MAX_IHAVE_LENGTH", default_value = "5000" @@ -130,7 +130,7 @@ pub struct Options { pub libp2p_max_ihave_length: usize, /// The maximum number of IHAVE messages to accept from a Libp2p peer within a heartbeat - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_MAX_IHAVE_MESSAGES", default_value = "10" @@ -138,11 +138,11 @@ pub struct Options { pub libp2p_max_ihave_messages: usize, /// Libp2p published message ids time cache duration - #[clap(long, env = "ESPRESSO_SEQUENCER_LIBP2P_PUBLISHED_MESSAGE_IDS_CACHE_TIME", default_value = "10s", value_parser = parse_duration)] + #[arg(long, env = "ESPRESSO_SEQUENCER_LIBP2P_PUBLISHED_MESSAGE_IDS_CACHE_TIME", default_value = "10s", value_parser = parse_duration)] pub libp2p_published_message_ids_cache_time: Duration, /// Time to wait for a Libp2p message requested through IWANT following an IHAVE advertisement - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_MAX_IWANT_FOLLOWUP_TIME", default_value = "3s", value_parser = parse_duration @@ -150,11 +150,11 @@ pub struct Options { pub libp2p_iwant_followup_time: Duration, /// The maximum number of Libp2p messages we will process in a given RPC - #[clap(long, env = "ESPRESSO_SEQUENCER_LIBP2P_MAX_MESSAGES_PER_RPC")] + #[arg(long, env = "ESPRESSO_SEQUENCER_LIBP2P_MAX_MESSAGES_PER_RPC")] pub libp2p_max_messages_per_rpc: Option, /// How many times we will allow a Libp2p peer to request the same message id through IWANT gossip before we start ignoring them - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_GOSSIP_RETRANSMISSION", default_value = "3" @@ -162,7 +162,7 @@ pub struct Options { pub libp2p_gossip_retransmission: u32, /// If enabled newly created messages will always be sent to all peers that are subscribed to the topic and have a good enough score - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_FLOOD_PUBLISH", default_value = "true" @@ -170,19 +170,19 @@ pub struct Options { pub libp2p_flood_publish: bool, /// The time period that Libp2p message hashes are stored in the cache - #[clap(long, env = "ESPRESSO_SEQUENCER_LIBP2P_DUPLICATE_CACHE_TIME", default_value = "20m", value_parser = parse_duration)] + #[arg(long, env = "ESPRESSO_SEQUENCER_LIBP2P_DUPLICATE_CACHE_TIME", default_value = "20m", value_parser = parse_duration)] pub libp2p_duplicate_cache_time: Duration, /// Time to live for Libp2p fanout peers - #[clap(long, env = "ESPRESSO_SEQUENCER_LIBP2P_FANOUT_TTL", default_value = "60s", value_parser = parse_duration)] + #[arg(long, env = "ESPRESSO_SEQUENCER_LIBP2P_FANOUT_TTL", default_value = "60s", value_parser = parse_duration)] pub libp2p_fanout_ttl: Duration, /// Initial delay in each Libp2p heartbeat - #[clap(long, env = "ESPRESSO_SEQUENCER_LIBP2P_HEARTBEAT_INITIAL_DELAY", default_value = "5s", value_parser = parse_duration)] + #[arg(long, env = "ESPRESSO_SEQUENCER_LIBP2P_HEARTBEAT_INITIAL_DELAY", default_value = "5s", value_parser = parse_duration)] pub libp2p_heartbeat_initial_delay: Duration, /// How many Libp2p peers we will emit gossip to at each heartbeat - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_GOSSIP_FACTOR", default_value = "0.25" @@ -190,7 +190,7 @@ pub struct Options { pub libp2p_gossip_factor: f64, /// Minimum number of Libp2p peers to emit gossip to during a heartbeat - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_GOSSIP_LAZY", default_value = "6" @@ -198,7 +198,7 @@ pub struct Options { pub libp2p_gossip_lazy: usize, /// The maximum number of bytes we will send in a single Libp2p gossip message - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_MAX_GOSSIP_TRANSMIT_SIZE", default_value = "2000000" @@ -206,7 +206,7 @@ pub struct Options { pub libp2p_max_gossip_transmit_size: usize, /// The maximum number of bytes we will send in a single Libp2p direct message - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_MAX_DIRECT_TRANSMIT_SIZE", default_value = "20000000" @@ -215,12 +215,12 @@ pub struct Options { /// The URL we advertise to other nodes as being for our public API. /// Should be supplied in `http://host:port` form. - #[clap(long, env = "ESPRESSO_SEQUENCER_PUBLIC_API_URL")] + #[arg(long, env = "ESPRESSO_SEQUENCER_PUBLIC_API_URL")] pub public_api_url: Option, /// The address we advertise to other nodes as being a Libp2p endpoint. /// Should be supplied in `host:port` form. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_ADVERTISE_ADDRESS", default_value = "localhost:1769" @@ -231,7 +231,7 @@ pub struct Options { /// nodes. /// /// Overrides those loaded from the `HotShot` config. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIBP2P_BOOTSTRAP_NODES", value_delimiter = ',', @@ -240,7 +240,7 @@ pub struct Options { pub libp2p_bootstrap_nodes: Option>, /// URL of the Light Client State Relay Server - #[clap( + #[arg( long, env = "ESPRESSO_STATE_RELAY_SERVER_URL", default_value = "http://localhost:8083" @@ -249,9 +249,9 @@ pub struct Options { pub state_relay_server_url: Url, /// Path to TOML file containing genesis state. - #[clap( + #[arg( long, - name = "GENESIS_FILE", + value_name = "GENESIS_FILE", env = "ESPRESSO_SEQUENCER_GENESIS_FILE", default_value = "/genesis/demo.toml" )] @@ -264,13 +264,13 @@ pub struct Options { /// * ESPRESSO_SEQUENCER_PRIVATE_STATE_KEY /// /// Appropriate key files can be generated with the `keygen` utility program. - #[clap(long, name = "KEY_FILE", env = "ESPRESSO_SEQUENCER_KEY_FILE")] + #[arg(long, value_name = "KEY_FILE", env = "ESPRESSO_SEQUENCER_KEY_FILE")] pub key_file: Option, /// Private staking key. /// /// This can be used as an alternative to KEY_FILE. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_PRIVATE_STAKING_KEY", conflicts_with = "KEY_FILE" @@ -281,7 +281,7 @@ pub struct Options { /// Private state signing key. /// /// This can be used as an alternative to KEY_FILE. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_PRIVATE_STATE_KEY", conflicts_with = "KEY_FILE" @@ -302,11 +302,11 @@ pub struct Options { /// sequencer -- help /// /// Multiple modules can be specified, provided they are separated by -- - #[clap(raw = true)] + #[arg(raw = true)] modules: Vec, /// Url we will use for RPC communication with L1. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_PROVIDER", default_value = "http://localhost:8545", @@ -317,15 +317,15 @@ pub struct Options { pub l1_provider_url: Vec, /// Configuration for the L1 client. - #[clap(flatten)] + #[command(flatten)] pub l1_options: L1ClientOptions, /// Whether or not we are a DA node. - #[clap(long, env = "ESPRESSO_SEQUENCER_IS_DA", action)] + #[arg(long, env = "ESPRESSO_SEQUENCER_IS_DA")] pub is_da: bool, /// Peer nodes use to fetch missing state - #[clap(long, env = "ESPRESSO_SEQUENCER_STATE_PEERS", value_delimiter = ',')] + #[arg(long, env = "ESPRESSO_SEQUENCER_STATE_PEERS", value_delimiter = ',')] #[derivative(Debug(format_with = "fmt_urls"))] pub state_peers: Vec, @@ -335,21 +335,21 @@ pub struct Options { /// persisted and loaded from local storage each time the node restarts. However, if the /// persisted config is missing when the node restarts (for example, the node is being migrated /// to new persistent storage), it can instead be fetched directly from a peer. - #[clap(long, env = "ESPRESSO_SEQUENCER_CONFIG_PEERS", value_delimiter = ',')] + #[arg(long, env = "ESPRESSO_SEQUENCER_CONFIG_PEERS", value_delimiter = ',')] #[derivative(Debug(format_with = "fmt_opt_urls"))] pub config_peers: Option>, /// Exponential backoff for fetching missing state from peers. - #[clap(flatten)] + #[command(flatten)] pub catchup_backoff: BackoffParams, - #[clap(flatten)] + #[command(flatten)] pub logging: logging::Config, - #[clap(flatten)] + #[command(flatten)] pub identity: Identity, - #[clap(flatten)] + #[command(flatten)] pub proposal_fetcher_config: ProposalFetcherConfig, } @@ -395,25 +395,25 @@ impl Options { #[derive(Parser, Clone, Derivative)] #[derivative(Debug(bound = ""))] pub struct Identity { - #[clap(long, env = "ESPRESSO_SEQUENCER_IDENTITY_COUNTRY_CODE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_IDENTITY_COUNTRY_CODE")] pub country_code: Option, - #[clap(long, env = "ESPRESSO_SEQUENCER_IDENTITY_LATITUDE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_IDENTITY_LATITUDE")] pub latitude: Option, - #[clap(long, env = "ESPRESSO_SEQUENCER_IDENTITY_LONGITUDE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_IDENTITY_LONGITUDE")] pub longitude: Option, - #[clap(long, env = "ESPRESSO_SEQUENCER_IDENTITY_NODE_NAME")] + #[arg(long, env = "ESPRESSO_SEQUENCER_IDENTITY_NODE_NAME")] pub node_name: Option, - #[clap(long, env = "ESPRESSO_SEQUENCER_IDENTITY_COMPANY_NAME")] + #[arg(long, env = "ESPRESSO_SEQUENCER_IDENTITY_COMPANY_NAME")] pub company_name: Option, - #[clap(long, env = "ESPRESSO_SEQUENCER_IDENTITY_COMPANY_WEBSITE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_IDENTITY_COMPANY_WEBSITE")] pub company_website: Option, - #[clap(long, env = "ESPRESSO_SEQUENCER_IDENTITY_OPERATING_SYSTEM", default_value = std::env::consts::OS)] + #[arg(long, env = "ESPRESSO_SEQUENCER_IDENTITY_OPERATING_SYSTEM", default_value = std::env::consts::OS)] pub operating_system: Option, - #[clap(long, env = "ESPRESSO_SEQUENCER_IDENTITY_NODE_TYPE", default_value = get_default_node_type())] + #[arg(long, env = "ESPRESSO_SEQUENCER_IDENTITY_NODE_TYPE", default_value = get_default_node_type())] pub node_type: Option, - #[clap(long, env = "ESPRESSO_SEQUENCER_IDENTITY_NETWORK_TYPE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_IDENTITY_NETWORK_TYPE")] pub network_type: Option, } @@ -561,11 +561,11 @@ module!("explorer", api::options::Explorer, requires: "http", "storage-sql"); #[derive(Clone, Debug, Args)] struct Module { - #[clap(flatten)] + #[command(flatten)] options: Box, /// Add more optional modules. - #[clap(raw = true)] + #[arg(raw = true)] modules: Vec, } diff --git a/sequencer/src/persistence/fs.rs b/sequencer/src/persistence/fs.rs index b16e1fc799d..7be1d9b3389 100644 --- a/sequencer/src/persistence/fs.rs +++ b/sequencer/src/persistence/fs.rs @@ -49,7 +49,7 @@ use crate::{ViewNumber, RECENT_STAKE_TABLES_LIMIT}; #[derive(Parser, Clone, Debug)] pub struct Options { /// Storage path for persistent data. - #[clap(long, env = "ESPRESSO_SEQUENCER_STORAGE_PATH")] + #[arg(long, env = "ESPRESSO_SEQUENCER_STORAGE_PATH")] path: PathBuf, /// Number of views to retain in consensus storage before data that hasn't been archived is @@ -63,7 +63,7 @@ pub struct Options { /// /// The default of 130000 views equates to approximately 3 days (259200 seconds) at an average /// view time of 2s. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_CONSENSUS_VIEW_RETENTION", default_value = "130000" diff --git a/sequencer/src/persistence/sql.rs b/sequencer/src/persistence/sql.rs index 2a6a2b923f8..2b57d313a08 100644 --- a/sequencer/src/persistence/sql.rs +++ b/sequencer/src/persistence/sql.rs @@ -67,29 +67,29 @@ use crate::{catchup::SqlStateCatchup, NodeType, SeqTypes, ViewNumber, RECENT_STA #[derivative(Debug)] pub struct PostgresOptions { /// Hostname for the remote Postgres database server. - #[clap(long, env = "ESPRESSO_SEQUENCER_POSTGRES_HOST")] + #[arg(long, env = "ESPRESSO_SEQUENCER_POSTGRES_HOST")] pub(crate) host: Option, /// Port for the remote Postgres database server. - #[clap(long, env = "ESPRESSO_SEQUENCER_POSTGRES_PORT")] + #[arg(long, env = "ESPRESSO_SEQUENCER_POSTGRES_PORT")] pub(crate) port: Option, /// Name of database to connect to. - #[clap(long, env = "ESPRESSO_SEQUENCER_POSTGRES_DATABASE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_POSTGRES_DATABASE")] pub(crate) database: Option, /// Postgres user to connect as. - #[clap(long, env = "ESPRESSO_SEQUENCER_POSTGRES_USER")] + #[arg(long, env = "ESPRESSO_SEQUENCER_POSTGRES_USER")] pub(crate) user: Option, /// Password for Postgres user. - #[clap(long, env = "ESPRESSO_SEQUENCER_POSTGRES_PASSWORD")] + #[arg(long, env = "ESPRESSO_SEQUENCER_POSTGRES_PASSWORD")] // Hide from debug output since may contain sensitive data. #[derivative(Debug = "ignore")] pub(crate) password: Option, /// Use TLS for an encrypted connection to the database. - #[clap(long, env = "ESPRESSO_SEQUENCER_POSTGRES_USE_TLS")] + #[arg(long, env = "ESPRESSO_SEQUENCER_POSTGRES_USE_TLS")] pub(crate) use_tls: bool, } @@ -104,7 +104,7 @@ impl Default for PostgresOptions { pub struct SqliteOptions { /// Base directory for the SQLite database. /// The SQLite file will be created in the `sqlite` subdirectory with filename as `database`. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_STORAGE_PATH", value_parser = build_sqlite_path @@ -129,11 +129,11 @@ pub fn build_sqlite_path(path: &str) -> anyhow::Result { #[derivative(Debug)] pub struct Options { #[cfg(not(feature = "embedded-db"))] - #[clap(flatten)] + #[command(flatten)] pub(crate) postgres_options: PostgresOptions, #[cfg(feature = "embedded-db")] - #[clap(flatten)] + #[command(flatten)] pub(crate) sqlite_options: SqliteOptions, /// Database URI for Postgres or SQLite. @@ -159,27 +159,27 @@ pub struct Options { /// - batch_size: 1000 /// - max_usage: 80% /// - interval: 1 hour - #[clap(long, env = "ESPRESSO_SEQUENCER_DATABASE_PRUNE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_DATABASE_PRUNE")] pub(crate) prune: bool, /// Pruning parameters. - #[clap(flatten)] + #[command(flatten)] pub(crate) pruning: PruningOptions, /// Pruning parameters for ephemeral consensus storage. - #[clap(flatten)] + #[command(flatten)] pub(crate) consensus_pruning: ConsensusPruningOptions, /// Specifies the maximum number of concurrent fetch requests allowed from peers. - #[clap(long, env = "ESPRESSO_SEQUENCER_FETCH_RATE_LIMIT")] + #[arg(long, env = "ESPRESSO_SEQUENCER_FETCH_RATE_LIMIT")] pub(crate) fetch_rate_limit: Option, /// The minimum delay between active fetches in a stream. - #[clap(long, env = "ESPRESSO_SEQUENCER_ACTIVE_FETCH_DELAY", value_parser = parse_duration)] + #[arg(long, env = "ESPRESSO_SEQUENCER_ACTIVE_FETCH_DELAY", value_parser = parse_duration)] pub(crate) active_fetch_delay: Option, /// The minimum delay between loading chunks in a stream. - #[clap(long, env = "ESPRESSO_SEQUENCER_CHUNK_FETCH_DELAY", value_parser = parse_duration)] + #[arg(long, env = "ESPRESSO_SEQUENCER_CHUNK_FETCH_DELAY", value_parser = parse_duration)] pub(crate) chunk_fetch_delay: Option, /// Disable pruning and reconstruct previously pruned data. @@ -188,11 +188,11 @@ pub struct Options { /// reconstruct data that was pruned in a previous run where pruning was enabled. This option /// instructs the service to run without pruning _and_ reconstruct all previously pruned data by /// fetching from peers. - #[clap(long, env = "ESPRESSO_SEQUENCER_ARCHIVE", conflicts_with = "prune")] + #[arg(long, env = "ESPRESSO_SEQUENCER_ARCHIVE", conflicts_with = "prune")] pub(crate) archive: bool, /// Turns on leaf only data storage - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_LIGHTWEIGHT", default_value_t = false, @@ -204,7 +204,7 @@ pub struct Options { /// /// Any connection which has been open and unused longer than this duration will be /// automatically closed to reduce load on the server. - #[clap(long, env = "ESPRESSO_SEQUENCER_DATABASE_IDLE_CONNECTION_TIMEOUT", value_parser = parse_duration, default_value = "10m")] + #[arg(long, env = "ESPRESSO_SEQUENCER_DATABASE_IDLE_CONNECTION_TIMEOUT", value_parser = parse_duration, default_value = "10m")] pub(crate) idle_connection_timeout: Duration, /// The maximum lifetime of a database connection. @@ -213,10 +213,10 @@ pub struct Options { /// (and, if needed, replaced), even if it is otherwise healthy. It is good practice to refresh /// even healthy connections once in a while (e.g. daily) in case of resource leaks in the /// server implementation. - #[clap(long, env = "ESPRESSO_SEQUENCER_DATABASE_CONNECTION_TIMEOUT", value_parser = parse_duration, default_value = "30m")] + #[arg(long, env = "ESPRESSO_SEQUENCER_DATABASE_CONNECTION_TIMEOUT", value_parser = parse_duration, default_value = "30m")] pub(crate) connection_timeout: Duration, - #[clap(long, env = "ESPRESSO_SEQUENCER_DATABASE_SLOW_STATEMENT_THRESHOLD", value_parser = parse_duration, default_value = "1s")] + #[arg(long, env = "ESPRESSO_SEQUENCER_DATABASE_SLOW_STATEMENT_THRESHOLD", value_parser = parse_duration, default_value = "1s")] pub(crate) slow_statement_threshold: Duration, /// The minimum number of database connections to maintain at any time. @@ -224,7 +224,7 @@ pub struct Options { /// The database client will, to the best of its ability, maintain at least `min` open /// connections at all times. This can be used to reduce the latency hit of opening new /// connections when at least this many simultaneous connections are frequently needed. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_DATABASE_MIN_CONNECTIONS", default_value = "0" @@ -235,7 +235,7 @@ pub struct Options { /// /// Once `max` connections are in use simultaneously, further attempts to acquire a connection /// (or begin a transaction) will block until one of the existing connections is released. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_DATABASE_MAX_CONNECTIONS", default_value = "25" @@ -246,7 +246,7 @@ pub struct Options { /// Determines how many `(leaf, vid)` rows are selected from the old types table /// and migrated at once. /// Default is `10000`` if not set - #[clap(long, env = "ESPRESSO_SEQUENCER_DATABASE_TYPES_MIGRATION_BATCH_SIZE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_DATABASE_TYPES_MIGRATION_BATCH_SIZE")] pub(crate) types_migration_batch_size: Option, // Keep the database connection pool when persistence is created, @@ -256,7 +256,7 @@ pub struct Options { // // Note: Cloning the `Pool` is lightweight and efficient because it simply // creates a new reference-counted handle to the underlying pool state. - #[clap(skip)] + #[arg(skip)] pub(crate) pool: Option>, } @@ -428,12 +428,12 @@ pub struct PruningOptions { /// Threshold for pruning, specified in bytes. /// If the disk usage surpasses this threshold, pruning is initiated for data older than the specified minimum retention period. /// Pruning continues until the disk usage drops below the MAX USAGE. - #[clap(long, env = "ESPRESSO_SEQUENCER_PRUNER_PRUNING_THRESHOLD", value_parser = parse_size)] + #[arg(long, env = "ESPRESSO_SEQUENCER_PRUNER_PRUNING_THRESHOLD", value_parser = parse_size)] pruning_threshold: Option, /// Minimum retention period. /// Data is retained for at least this duration, even if there's no free disk space. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_PRUNER_MINIMUM_RETENTION", value_parser = parse_duration, @@ -442,7 +442,7 @@ pub struct PruningOptions { /// Target retention period. /// Data older than this is pruned to free up space. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_PRUNER_TARGET_RETENTION", value_parser = parse_duration, @@ -451,7 +451,7 @@ pub struct PruningOptions { /// Batch size for pruning. /// This is the number of blocks data to delete in a single transaction. - #[clap(long, env = "ESPRESSO_SEQUENCER_PRUNER_BATCH_SIZE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_PRUNER_BATCH_SIZE")] batch_size: Option, /// Maximum disk usage (in basis points). @@ -459,11 +459,11 @@ pub struct PruningOptions { /// Pruning stops once the disk usage falls below this value, even if /// some data older than the `MINIMUM_RETENTION` remains. Values range /// from 0 (0%) to 10000 (100%). - #[clap(long, env = "ESPRESSO_SEQUENCER_PRUNER_MAX_USAGE")] + #[arg(long, env = "ESPRESSO_SEQUENCER_PRUNER_MAX_USAGE")] max_usage: Option, /// Interval for running the pruner. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_PRUNER_INTERVAL", value_parser = parse_duration, @@ -473,7 +473,7 @@ pub struct PruningOptions { /// Number of SQLite pages to vacuum from the freelist /// during each pruner cycle. /// This value corresponds to `N` in the SQLite PRAGMA `incremental_vacuum(N)`, - #[clap(long, env = "ESPRESSO_SEQUENCER_PRUNER_INCREMENTAL_VACUUM_PAGES")] + #[arg(long, env = "ESPRESSO_SEQUENCER_PRUNER_INCREMENTAL_VACUUM_PAGES")] pages: Option, } @@ -530,8 +530,8 @@ pub struct ConsensusPruningOptions { /// /// The default of 302000 views equates to approximately 1 week (604800 seconds) at an average /// view time of 2s. - #[clap( - name = "TARGET_RETENTION", + #[arg( + value_name = "TARGET_RETENTION", long = "consensus-storage-target-retention", env = "ESPRESSO_SEQUENCER_CONSENSUS_STORAGE_TARGET_RETENTION", default_value = "302000" @@ -548,8 +548,8 @@ pub struct ConsensusPruningOptions { /// /// The default of 130000 views equates to approximately 3 days (259200 seconds) at an average /// view time of 2s. - #[clap( - name = "MINIMUM_RETENTION", + #[arg( + value_name = "MINIMUM_RETENTION", long = "consensus-storage-minimum-retention", env = "ESPRESSO_SEQUENCER_CONSENSUS_STORAGE_MINIMUM_RETENTION", default_value = "130000" @@ -560,8 +560,8 @@ pub struct ConsensusPruningOptions { /// aggressively. /// /// See also TARGET_RETENTION and MINIMUM_RETENTION. - #[clap( - name = "TARGET_USAGE", + #[arg( + value_name = "TARGET_USAGE", long = "consensus-storage-target-usage", env = "ESPRESSO_SEQUENCER_CONSENSUS_STORAGE_TARGET_USAGE", default_value = "1000000000" diff --git a/sequencer/src/proposal_fetcher.rs b/sequencer/src/proposal_fetcher.rs index 2a783914fbf..911a9e219c0 100644 --- a/sequencer/src/proposal_fetcher.rs +++ b/sequencer/src/proposal_fetcher.rs @@ -29,14 +29,14 @@ use crate::{ #[derive(Clone, Copy, Debug, Parser)] pub struct ProposalFetcherConfig { - #[clap( + #[arg( long = "proposal-fetcher-num-workers", env = "ESPRESSO_SEQUENCER_PROPOSAL_FETCHER_NUM_WORKERS", default_value = "2" )] pub num_workers: usize, - #[clap( + #[arg( long = "proposal-fetcher-fetch-timeout", env = "ESPRESSO_SEQUENCER_PROPOSAL_FETCHER_FETCH_TIMEOUT", default_value = "2s", diff --git a/staking-cli/src/lib.rs b/staking-cli/src/lib.rs index 4aa3fe4d2bb..e8fc104d265 100644 --- a/staking-cli/src/lib.rs +++ b/staking-cli/src/lib.rs @@ -35,22 +35,22 @@ pub const DEV_MNEMONIC: &str = "test test test test test test test test test tes #[command(version, about, long_about = None)] pub struct Config { /// L1 Ethereum RPC. - #[clap(long, env = "L1_PROVIDER")] + #[arg(long, env = "L1_PROVIDER")] #[default(Url::parse("http://localhost:8545").unwrap())] pub rpc_url: Url, /// Deployed ESP token contract address. - #[clap(long, env = "ESP_TOKEN_ADDRESS")] + #[arg(long, env = "ESP_TOKEN_ADDRESS")] pub token_address: Address, /// Deployed stake table contract address. - #[clap(long, env = "STAKE_TABLE_ADDRESS")] + #[arg(long, env = "STAKE_TABLE_ADDRESS")] pub stake_table_address: Address, - #[clap(flatten)] + #[command(flatten)] pub signer: SignerConfig, - #[clap(flatten)] + #[command(flatten)] #[serde(skip)] pub logging: logging::Config, @@ -62,11 +62,11 @@ pub struct Config { #[derive(ClapSerde, Parser, Clone, Debug, Deserialize, Serialize)] pub struct SignerConfig { /// The mnemonic to use when deriving the key. - #[clap(long, env = "MNEMONIC")] + #[arg(long, env = "MNEMONIC")] pub mnemonic: Option, /// The mnemonic account index to use when deriving the key. - #[clap(long, env = "ACCOUNT_INDEX")] + #[arg(long, env = "ACCOUNT_INDEX")] #[default(Some(0))] pub account_index: Option, @@ -74,7 +74,7 @@ pub struct SignerConfig { /// /// NOTE: ledger must be unlocked, Ethereum app open and blind signing must be enabled in the /// Ethereum app settings. - #[clap(long, env = "USE_LEDGER")] + #[arg(long, env = "USE_LEDGER")] pub ledger: bool, } @@ -207,21 +207,21 @@ pub enum Commands { /// Initialize the config file with deployment and wallet info. Init { /// The mnemonic to use when deriving the key. - #[clap(long, env = "MNEMONIC", required_unless_present = "ledger")] + #[arg(long, env = "MNEMONIC", required_unless_present = "ledger")] mnemonic: Option, /// The mnemonic account index to use when deriving the key. - #[clap(long, env = "ACCOUNT_INDEX", default_value_t = 0)] + #[arg(long, env = "ACCOUNT_INDEX", default_value_t = 0)] account_index: u32, /// The ledger account index to use when deriving the key. - #[clap(long, env = "LEDGER_INDEX", required_unless_present = "mnemonic")] + #[arg(long, env = "LEDGER_INDEX", required_unless_present = "mnemonic")] ledger: bool, }, /// Remove the config file. Purge { /// Don't ask for confirmation. - #[clap(long)] + #[arg(long)] force: bool, }, /// Show the stake table in the Espresso stake table contract. @@ -229,11 +229,11 @@ pub enum Commands { /// The block numberto use for the stake table. /// /// Defaults to the latest block for convenience. - #[clap(long)] + #[arg(long)] l1_block_number: Option, /// Abbreviate the very long BLS public keys. - #[clap(long)] + #[arg(long)] compact: bool, }, /// Print the signer account address. @@ -241,84 +241,84 @@ pub enum Commands { /// Register to become a validator. RegisterValidator { /// The consensus signing key. Used to sign a message to prove ownership of the key. - #[clap(long, value_parser = parse::parse_bls_priv_key, env = "CONSENSUS_PRIVATE_KEY")] + #[arg(long, value_parser = parse::parse_bls_priv_key, env = "CONSENSUS_PRIVATE_KEY")] consensus_private_key: BLSPrivKey, /// The state signing key. /// /// TODO: Used to sign a message to prove ownership of the key. - #[clap(long, value_parser = parse::parse_state_priv_key, env = "STATE_PRIVATE_KEY")] + #[arg(long, value_parser = parse::parse_state_priv_key, env = "STATE_PRIVATE_KEY")] state_private_key: StateSignKey, /// The commission to charge delegators - #[clap(long, value_parser = parse::parse_commission, env = "COMMISSION")] + #[arg(long, value_parser = parse::parse_commission, env = "COMMISSION")] commission: Commission, }, /// Update a validators Espresso consensus signing keys. UpdateConsensusKeys { /// The consensus signing key. Used to sign a message to prove ownership of the key. - #[clap(long, value_parser = parse::parse_bls_priv_key, env = "CONSENSUS_PRIVATE_KEY")] + #[arg(long, value_parser = parse::parse_bls_priv_key, env = "CONSENSUS_PRIVATE_KEY")] consensus_private_key: BLSPrivKey, /// The state signing key. /// /// TODO: Used to sign a message to prove ownership of the key. - #[clap(long, value_parser = parse::parse_state_priv_key, env = "STATE_PRIVATE_KEY")] + #[arg(long, value_parser = parse::parse_state_priv_key, env = "STATE_PRIVATE_KEY")] state_private_key: StateSignKey, }, /// Deregister a validator. DeregisterValidator {}, /// Approve stake table contract to move tokens Approve { - #[clap(long, value_parser = parse_ether)] + #[arg(long, value_parser = parse_ether)] amount: U256, }, /// Delegate funds to a validator. Delegate { - #[clap(long)] + #[arg(long)] validator_address: Address, - #[clap(long, value_parser = parse_ether)] + #[arg(long, value_parser = parse_ether)] amount: U256, }, /// Initiate a withdrawal of delegated funds from a validator. Undelegate { - #[clap(long)] + #[arg(long)] validator_address: Address, - #[clap(long, value_parser = parse_ether)] + #[arg(long, value_parser = parse_ether)] amount: U256, }, /// Claim withdrawal after an undelegation. ClaimWithdrawal { - #[clap(long)] + #[arg(long)] validator_address: Address, }, /// Claim withdrawal after validator exit. ClaimValidatorExit { - #[clap(long)] + #[arg(long)] validator_address: Address, }, /// Check ESP token balance. TokenBalance { /// The address to check. - #[clap(long)] + #[arg(long)] address: Option
, }, /// Check ESP token allowance of stake table contract. TokenAllowance { /// The address to check. - #[clap(long)] + #[arg(long)] owner: Option
, }, /// Transfer ESP tokens Transfer { /// The address to transfer to. - #[clap(long)] + #[arg(long)] to: Address, /// The amount to transfer - #[clap(long, value_parser = parse_ether)] + #[arg(long, value_parser = parse_ether)] amount: U256, }, /// Register the validators and delegates for the local demo. @@ -326,7 +326,7 @@ pub enum Commands { /// The number of validators to register. /// /// The default (5) works for the local native and docker demos. - #[clap(long, default_value_t = 5)] + #[arg(long, default_value_t = 5)] num_validators: u16, #[arg(long, value_enum, default_value_t = DelegationConfig::default())] diff --git a/types/src/v0/utils.rs b/types/src/v0/utils.rs index f0fecb127e1..a3bc3072871 100644 --- a/types/src/v0/utils.rs +++ b/types/src/v0/utils.rs @@ -202,7 +202,7 @@ pub const BACKOFF_JITTER: (u64, u64) = (1, 10); #[derive(Clone, Copy, Debug, Parser, PartialEq, Eq, PartialOrd, Ord)] pub struct BackoffParams { /// Exponential backoff exponent. - #[clap( + #[arg( long = "catchup-backoff-factor", env = "ESPRESSO_SEQUENCER_CATCHUP_BACKOFF_FACTOR", default_value = "4" @@ -210,7 +210,7 @@ pub struct BackoffParams { factor: u32, /// Exponential backoff base delay. - #[clap( + #[arg( long = "catchup-base-retry-delay", env = "ESPRESSO_SEQUENCER_CATCHUP_BASE_RETRY_DELAY", default_value = "200ms", @@ -219,7 +219,7 @@ pub struct BackoffParams { base: Duration, /// Exponential max delay. - #[clap( + #[arg( long = "catchup-max-retry-delay", env = "ESPRESSO_SEQUENCER_CATCHUP_MAX_RETRY_DELAY", default_value = "5s", @@ -228,7 +228,7 @@ pub struct BackoffParams { max: Duration, /// Exponential backoff jitter as a ratio of the backoff delay, numerator:denominator. - #[clap( + #[arg( long = "catchup-backoff-jitter", env = "ESPRESSO_SEQUENCER_CATCHUP_BACKOFF_JITTER", default_value = "1:10" @@ -236,7 +236,7 @@ pub struct BackoffParams { jitter: Ratio, /// Disable retries and just fail after one failed attempt. - #[clap(short, long, env = "ESPRESSO_SEQUENCER_CATCHUP_BACKOFF_DISABLE")] + #[arg(short, long, env = "ESPRESSO_SEQUENCER_CATCHUP_BACKOFF_DISABLE")] disable: bool, } diff --git a/types/src/v0/v0_1/l1.rs b/types/src/v0/v0_1/l1.rs index 94280ff887e..797112a2d54 100644 --- a/types/src/v0/v0_1/l1.rs +++ b/types/src/v0/v0_1/l1.rs @@ -68,7 +68,7 @@ pub struct L1Snapshot { #[derive(Clone, Debug, Parser)] pub struct L1ClientOptions { /// Delay when retrying failed L1 queries. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_RETRY_DELAY", default_value = "1s", @@ -77,7 +77,7 @@ pub struct L1ClientOptions { pub l1_retry_delay: Duration, /// Request rate when polling L1. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_POLLING_INTERVAL", default_value = "7s", @@ -86,7 +86,7 @@ pub struct L1ClientOptions { pub l1_polling_interval: Duration, /// Maximum number of L1 blocks to keep in cache at once. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_BLOCKS_CACHE_SIZE", default_value = "100" @@ -94,7 +94,7 @@ pub struct L1ClientOptions { pub l1_blocks_cache_size: NonZeroUsize, /// Number of L1 events to buffer before discarding. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_EVENTS_CHANNEL_CAPACITY", default_value = "100" @@ -102,7 +102,7 @@ pub struct L1ClientOptions { pub l1_events_channel_capacity: usize, /// Maximum number of L1 blocks that can be scanned for events in a single query. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_EVENTS_MAX_BLOCK_RANGE", default_value = "10000" @@ -110,7 +110,7 @@ pub struct L1ClientOptions { pub l1_events_max_block_range: u64, /// Maximum time to wait for new heads before considering a stream invalid and reconnecting. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_SUBSCRIPTION_TIMEOUT", default_value = "1m", @@ -119,7 +119,7 @@ pub struct L1ClientOptions { pub subscription_timeout: Duration, /// Fail over to another provider if the current provider fails twice within this window. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_FREQUENT_FAILURE_TOLERANCE", default_value = "1m", @@ -129,7 +129,7 @@ pub struct L1ClientOptions { /// Fail over to another provider if the current provider fails many times in a row, within any /// time window. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_CONSECUTIVE_FAILURE_TOLERANCE", default_value = "10" @@ -137,7 +137,7 @@ pub struct L1ClientOptions { pub l1_consecutive_failure_tolerance: usize, /// Revert back to the first provider this duration after failing over. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_FAILOVER_REVERT", default_value = "30m", @@ -148,7 +148,7 @@ pub struct L1ClientOptions { /// Amount of time to wait after receiving a 429 response before making more L1 RPC requests. /// /// If not set, the general l1-retry-delay will be used. - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_RATE_LIMIT_DELAY", value_parser = parse_duration, @@ -158,13 +158,13 @@ pub struct L1ClientOptions { /// Separate provider to use for subscription feeds. /// /// Typically this would be a WebSockets endpoint while the main provider uses HTTP. - #[clap(long, env = "ESPRESSO_SEQUENCER_L1_WS_PROVIDER", value_delimiter = ',')] + #[arg(long, env = "ESPRESSO_SEQUENCER_L1_WS_PROVIDER", value_delimiter = ',')] pub l1_ws_provider: Option>, /// Interval at which the background update loop polls the L1 stake table contract for new events /// and updates local persistence. /// - #[clap( + #[arg( long, env = "ESPRESSO_SEQUENCER_L1_STAKE_TABLE_UPDATE_INTERVAL", default_value = "60m", @@ -185,10 +185,10 @@ pub struct L1ClientOptions { /// the hashes. This is fine and good for blocks very near the finalized head, but for /// extremely old blocks it is prohibitively expensive, and these old blocks are extremely /// unlikely to be unfinalized anyways. - #[clap(long, env = "ESPRESSO_SEQUENCER_L1_FINALIZED_SAFETY_MARGIN")] + #[arg(long, env = "ESPRESSO_SEQUENCER_L1_FINALIZED_SAFETY_MARGIN")] pub l1_finalized_safety_margin: Option, - #[clap(skip = Arc::>::new(Box::new(NoMetrics)))] + #[arg(skip = Arc::>::new(Box::new(NoMetrics)))] pub metrics: Arc>, } diff --git a/utils/src/logging.rs b/utils/src/logging.rs index 75f4c4cbc87..8d84f2b658f 100644 --- a/utils/src/logging.rs +++ b/utils/src/logging.rs @@ -23,7 +23,7 @@ enum BacktraceLoggingMode { /// Logging configuration. #[derive(Clone, Debug, Default, Parser)] pub struct Config { - #[clap(long, env = "RUST_LOG_FORMAT")] + #[arg(long, env = "RUST_LOG_FORMAT")] backtrace_mode: Option, }