Skip to content

Commit

Permalink
feat(eigen-client-m1): Add eigenda to zkstack (#379)
Browse files Browse the repository at this point in the history
* Add eigenda to zkstack

* Format code

* Add comment
  • Loading branch information
gianbelinche authored Jan 6, 2025
1 parent 1619c30 commit b30e452
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts
4 changes: 3 additions & 1 deletion zkstack_cli/crates/config/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use xshell::Shell;
use zksync_basic_types::L2ChainId;
use zksync_config::{
configs::{gateway::GatewayChainConfig, GatewayConfig},
DAClientConfig::Avail,
DAClientConfig::{Avail, Eigen},
};

use crate::{
Expand Down Expand Up @@ -75,6 +75,7 @@ pub enum DAValidatorType {
Rollup = 0,
NoDA = 1,
Avail = 2,
EigenDA = 3,
}

impl Serialize for ChainConfig {
Expand Down Expand Up @@ -121,6 +122,7 @@ impl ChainConfig {
(L1BatchCommitmentMode::Rollup, _) => Ok(DAValidatorType::Rollup),
(L1BatchCommitmentMode::Validium, None) => Ok(DAValidatorType::NoDA),
(L1BatchCommitmentMode::Validium, Some(Avail(_))) => Ok(DAValidatorType::Avail),
(L1BatchCommitmentMode::Validium, Some(Eigen(_))) => Ok(DAValidatorType::EigenDA),
_ => anyhow::bail!("DAValidatorType is not supported"),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub struct ValidiumTypeArgs {
pub enum ValidiumTypeInternal {
NoDA,
Avail,
EigenDA,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, EnumIter, Display, ValueEnum)]
Expand All @@ -43,11 +44,13 @@ pub enum AvailClientTypeInternal {
pub enum ValidiumType {
NoDA,
Avail((AvailConfig, AvailSecrets)),
EigenDA,
}

impl ValidiumType {
pub fn read() -> Self {
match PromptSelect::new(MSG_VALIDIUM_TYPE_PROMPT, ValidiumTypeInternal::iter()).ask() {
ValidiumTypeInternal::EigenDA => ValidiumType::EigenDA,
ValidiumTypeInternal::NoDA => ValidiumType::NoDA,
ValidiumTypeInternal::Avail => {
let avail_client_type = PromptSelect::new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ impl InitArgs {
Some(da_configs::ValidiumTypeInternal::Avail) => panic!(
"Avail is not supported via CLI args, use interactive mode" // TODO: Add support for configuration via CLI args
),
Some(da_configs::ValidiumTypeInternal::EigenDA) => Some(ValidiumType::EigenDA),
},
_ => None,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pub async fn init_configs(
general_config.da_client_config = Some(avail_config.into());
secrets.data_availability = Some(DataAvailabilitySecrets::Avail(avail_secrets));
}
ValidiumType::EigenDA => {} // This is left blank to be able to define the config by file instead of giving it via CLI
}
}

Expand Down
3 changes: 3 additions & 0 deletions zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ pub(crate) fn get_l1_da_validator(chain_config: &ChainConfig) -> anyhow::Result<
if let Some(da_client_config) = general_config.da_client_config {
match da_client_config {
DAClientConfig::Avail(_) => contracts_config.l1.avail_l1_da_validator_addr,
DAClientConfig::Eigen(_) => {
contracts_config.l1.no_da_validium_l1_validator_addr
} // TODO: change to EigenDA
_ => anyhow::bail!("DA client config is not supported"),
}
} else {
Expand Down

0 comments on commit b30e452

Please sign in to comment.