-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## What ❔ This PR changes the approach to managing 3rd party DA clients. It was assumed before that they will be stored in a separate repository (hyperchain-da), but to simplify the processes and solve a recursive dependency problem, we decided to manage those within `zksync-era`. The config now defines which DA client will be used, for proto-based configuration it requires adding these lines to general.yaml: ``` da_client: avail: api_node_url: wss://turing-rpc.avail.so/ws bridge_api_url: undefined seed: SEED_PHRASE app_id: 82 timeout: 3 max_retries: 5 ``` for env-based: ``` DA_CLIENT="Avail" DA_API_NODE_URL="localhost:12345" DA_BRIDGE_API_URL="localhost:54321" DA_SEED="SEED_PHRASE" DA_APP_ID=1 DA_TIMEOUT=2 DA_MAX_RETRIES=3 ``` If no config is provided - the default behavior is to use NoDA client (same as now). The `da_client` config might be merged with `da_dispatcher` at some point as the second depends on the first one, so their separation does not make much sense (apart from simplification of the configs). But I'd prefer to do it as a separate PR in case we decide to merge them. The client was reimplemented using only lightweight libraries from crates.io, so it doesn't have any visible impact on build time. ## Why ❔ To enable seamless integration with 3rd party DA clients in `zksync-era`. ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`.
- Loading branch information
1 parent
527b5ab
commit 9218612
Showing
42 changed files
with
2,352 additions
and
252 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use serde::Deserialize; | ||
|
||
#[derive(Clone, Debug, PartialEq, Deserialize)] | ||
pub struct AvailConfig { | ||
pub api_node_url: String, | ||
pub bridge_api_url: String, | ||
pub seed: String, | ||
pub app_id: u32, | ||
pub timeout: usize, | ||
pub max_retries: usize, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use serde::Deserialize; | ||
|
||
use crate::{AvailConfig, ObjectStoreConfig}; | ||
|
||
pub mod avail; | ||
|
||
pub const AVAIL_CLIENT_CONFIG_NAME: &str = "Avail"; | ||
pub const OBJECT_STORE_CLIENT_CONFIG_NAME: &str = "ObjectStore"; | ||
|
||
#[derive(Debug, Clone, PartialEq)] | ||
pub struct DAClientConfig { | ||
pub client: DAClient, | ||
} | ||
|
||
#[derive(Debug, Clone, PartialEq, Deserialize)] | ||
#[serde(tag = "client")] | ||
pub enum DAClient { | ||
Avail(AvailConfig), | ||
ObjectStore(ObjectStoreConfig), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.