Skip to content

Commit

Permalink
Set ESPRESSO_SEQUENCER_IS_DA in docker demo
Browse files Browse the repository at this point in the history
- In order for the is_da variable to be set to true the env var cannot
  be empty.
- Log the non-sensitive sequencer options on startup instead of only the
  modules.
- Log with info level instead of warn since they aren't indications of
  anything potentially being wrong.
  • Loading branch information
sveitser committed May 1, 2024
1 parent 9dff3ce commit eec3bd7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ services:
- ESPRESSO_SEQUENCER_PREFUNDED_BUILDER_ACCOUNTS
- ESPRESSO_SEQUENCER_MAX_BLOCK_SIZE
- ESPRESSO_SEQUENCER_BASE_FEE
- ESPRESSO_SEQUENCER_IS_DA
- ESPRESSO_SEQUENCER_IS_DA=true
- RUST_LOG
- RUST_LOG_FORMAT
- ASYNC_STD_THREAD_COUNT
Expand Down Expand Up @@ -238,7 +238,7 @@ services:
- ESPRESSO_SEQUENCER_PREFUNDED_BUILDER_ACCOUNTS
- ESPRESSO_SEQUENCER_MAX_BLOCK_SIZE
- ESPRESSO_SEQUENCER_BASE_FEE
- ESPRESSO_SEQUENCER_IS_DA
- ESPRESSO_SEQUENCER_IS_DA=true
- RUST_LOG
- RUST_LOG_FORMAT
- ASYNC_STD_THREAD_COUNT
Expand Down Expand Up @@ -276,7 +276,7 @@ services:
- ESPRESSO_SEQUENCER_PREFUNDED_BUILDER_ACCOUNTS
- ESPRESSO_SEQUENCER_MAX_BLOCK_SIZE
- ESPRESSO_SEQUENCER_BASE_FEE
- ESPRESSO_SEQUENCER_IS_DA
- ESPRESSO_SEQUENCER_IS_DA=true
- RUST_LOG
- RUST_LOG_FORMAT
- ASYNC_STD_THREAD_COUNT
Expand Down
4 changes: 2 additions & 2 deletions sequencer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ async fn main() -> anyhow::Result<()> {
setup_logging();
setup_backtrace();

tracing::warn!("sequencer starting up");
tracing::info!("sequencer starting up");
let opt = Options::parse();
tracing::info!("options: {:?}", opt);
let mut modules = opt.modules();
tracing::warn!("modules: {:?}", modules);

if let Some(storage) = modules.storage_fs.take() {
init_with_storage(modules, opt, storage, SEQUENCER_VERSION).await
Expand Down
22 changes: 21 additions & 1 deletion sequencer/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use anyhow::{bail, Context};
use bytesize::ByteSize;
use clap::{error::ErrorKind, Args, FromArgMatches, Parser};
use cld::ClDuration;
use core::fmt::Display;
use derivative::Derivative;
use derive_more::From;
use ethers::types::{Address, U256};
use hotshot_stake_table::config::STAKE_TABLE_CAPACITY;
Expand Down Expand Up @@ -37,7 +39,9 @@ use url::Url;
// BEST NOT TO ADD REQUIRED ARGUMENTS TO THIS TYPE, since the required arguments will be required
// even if the user is only asking for help on a module. Try to give every argument on this type a
// default value, even if it is a bit arbitrary.
#[derive(Parser, Clone, Debug)]

#[derive(Parser, Clone, Derivative)]
#[derivative(Debug(bound = ""))]
pub struct Options {
/// Unique identifier for this instance of the sequencer network.
#[clap(long, env = "ESPRESSO_SEQUENCER_CHAIN_ID", default_value = "0")]
Expand All @@ -50,6 +54,7 @@ pub struct Options {
env = "ESPRESSO_SEQUENCER_ORCHESTRATOR_URL",
default_value = "http://localhost:8080"
)]
#[derivative(Debug(format_with = "Display::fmt"))]
pub orchestrator_url: Url,

/// The socket address of the HotShot CDN's main entry point (the marshal)
Expand Down Expand Up @@ -88,6 +93,7 @@ pub struct Options {
env = "ESPRESSO_STATE_RELAY_SERVER_URL",
default_value = "http://localhost:8083"
)]
#[derivative(Debug(format_with = "Display::fmt"))]
pub state_relay_server_url: Url,

/// Path to file containing private keys.
Expand All @@ -108,6 +114,7 @@ pub struct Options {
env = "ESPRESSO_SEQUENCER_PRIVATE_STAKING_KEY",
conflicts_with = "key_file"
)]
#[derivative(Debug = "ignore")]
pub private_staking_key: Option<BLSPrivKey>,

/// Private state signing key.
Expand All @@ -118,6 +125,7 @@ pub struct Options {
env = "ESPRESSO_SEQUENCER_PRIVATE_STATE_KEY",
conflicts_with = "key_file"
)]
#[derivative(Debug = "ignore")]
pub private_state_key: Option<StateSignKey>,

/// Add optional modules to the service.
Expand Down Expand Up @@ -148,6 +156,7 @@ pub struct Options {

/// Url we will use for RPC communication with L1.
#[clap(long, env = "ESPRESSO_SEQUENCER_L1_PROVIDER")]
#[derivative(Debug(format_with = "Display::fmt"))]
pub l1_provider_url: Url,

/// Whether or not we are a DA node.
Expand All @@ -156,11 +165,13 @@ pub struct Options {

/// Peer nodes use to fetch missing state
#[clap(long, env = "ESPRESSO_SEQUENCER_STATE_PEERS", value_delimiter = ',')]
#[derivative(Debug(format_with = "fmt_urls"))]
pub state_peers: Vec<Url>,

/// Stake table capacity for the prover circuit
#[clap(short, long, env = "ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY", default_value_t = STAKE_TABLE_CAPACITY)]
pub stake_table_capacity: usize,

/// Maximum size in bytes of a block
#[clap(long, env = "ESPRESSO_SEQUENCER_MAX_BLOCK_SIZE", value_parser = parse_size)]
pub max_block_size: u64,
Expand Down Expand Up @@ -198,6 +209,15 @@ impl Options {
}
}

// The Debug implementation for Url is noisy, we just want to see the URL
fn fmt_urls(v: &[Url], fmt: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
write!(
fmt,
"{:?}",
v.iter().map(|i| i.to_string()).collect::<Vec<_>>()
)
}

#[derive(Clone, Debug, Snafu)]
pub struct ParseDurationError {
reason: String,
Expand Down

0 comments on commit eec3bd7

Please sign in to comment.