This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
forked from matter-labs/zksync-era
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Validium with DA (matter-labs#2010)
## What ❔ This PR adds an opportunity to use external DA layers to submit the pubdata. The implementations of the clients will be created in this repo: https://github.com/matter-labs/hyperchain-da This is only the first stage, and doesn't include any modifications to the `commitBatches` or bootloader memory, those will be added as a follow-up. Design doc for the feature (might be a bit outdated, but main concepts are valid): https://matterlabs.notion.site/Validium-with-DA-EXTERNAL-8deccba433be4ff88592a3b0f8774062 It is assumed that the pubdata publishing is subsidized by the operators at this points, it shouldn't be a concern because: - the DA layers' storage costs are quite low - for most DA layers, the blob size is around 2MB (or they work on increasing it to be like that), so we could in theory fit ~30-35k txs there, which makes that cost even lower per tx ## Why ❔ We have many partners who want to use the different DA layers, this PR provides a common interface for all of them ## Checklist - [ ] 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`. - [ ] Spellcheck has been run via `zk spellcheck`.
- Loading branch information
1 parent
45c7a0a
commit fe03d0e
Showing
79 changed files
with
1,519 additions
and
152 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,43 @@ | ||
use std::time::Duration; | ||
|
||
use serde::Deserialize; | ||
|
||
pub const DEFAULT_POLLING_INTERVAL_MS: u32 = 5000; | ||
pub const DEFAULT_MAX_ROWS_TO_DISPATCH: u32 = 100; | ||
pub const DEFAULT_MAX_RETRIES: u16 = 5; | ||
|
||
#[derive(Debug, Clone, PartialEq, Deserialize)] | ||
pub struct DADispatcherConfig { | ||
/// The interval between the `da_dispatcher's` iterations. | ||
pub polling_interval_ms: Option<u32>, | ||
/// The maximum number of rows to query from the database in a single query. | ||
pub max_rows_to_dispatch: Option<u32>, | ||
/// The maximum number of retries for the dispatch of a blob. | ||
pub max_retries: Option<u16>, | ||
} | ||
|
||
impl DADispatcherConfig { | ||
pub fn for_tests() -> Self { | ||
Self { | ||
polling_interval_ms: Some(DEFAULT_POLLING_INTERVAL_MS), | ||
max_rows_to_dispatch: Some(DEFAULT_MAX_ROWS_TO_DISPATCH), | ||
max_retries: Some(DEFAULT_MAX_RETRIES), | ||
} | ||
} | ||
|
||
pub fn polling_interval(&self) -> Duration { | ||
match self.polling_interval_ms { | ||
Some(interval) => Duration::from_millis(interval as u64), | ||
None => Duration::from_millis(DEFAULT_POLLING_INTERVAL_MS as u64), | ||
} | ||
} | ||
|
||
pub fn max_rows_to_dispatch(&self) -> u32 { | ||
self.max_rows_to_dispatch | ||
.unwrap_or(DEFAULT_MAX_ROWS_TO_DISPATCH) | ||
} | ||
|
||
pub fn max_retries(&self) -> u16 { | ||
self.max_retries.unwrap_or(DEFAULT_MAX_RETRIES) | ||
} | ||
} |
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
Oops, something went wrong.