-
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.
feat(da-clients): add EigenDA client (#3155)
## What ❔ This PR adds an EigenDA client. The implementation uses the gRPC streams to send the authenticated requests to dispatch the blob. The protogen situation is very similar to Celestia, we use the generated files as a temporary solution until there is a separate crate that provides those. This kind of function can be used to generate them in the future: ```rust pub fn compile_protos() { let fds = protox::compile( [ "proto/common.proto", "proto/disperser.proto", ], ["."], ) .expect("protox failed to build"); tonic_build::configure() .build_client(true) .build_server(false) .skip_protoc_run() .out_dir("generated") .compile_fds(fds) .unwrap(); } ``` Example config: ``` da_client: eigen: rpc_node_url: https://disperser-holesky.eigenda.xyz:443 inclusion_polling_interval_ms: 10000 ``` secrets: ``` da: eigen: private_key: PRIVATE_KEY_WITHOUT_0x_PREFIX ``` ## Why ❔ To enable EigenDA in ZK stack ## 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 `zkstack dev fmt` and `zkstack dev lint`.
- Loading branch information
1 parent
c41db9e
commit 5161eed
Showing
25 changed files
with
1,071 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use serde::Deserialize; | ||
use zksync_basic_types::secrets::PrivateKey; | ||
|
||
#[derive(Clone, Debug, Default, PartialEq, Deserialize)] | ||
pub struct EigenConfig { | ||
pub rpc_node_url: String, | ||
pub inclusion_polling_interval_ms: u64, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq)] | ||
pub struct EigenSecrets { | ||
pub private_key: PrivateKey, | ||
} |
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 |
---|---|---|
@@ -1,15 +1,18 @@ | ||
use crate::{AvailConfig, CelestiaConfig, ObjectStoreConfig}; | ||
use crate::{AvailConfig, CelestiaConfig, EigenConfig, ObjectStoreConfig}; | ||
|
||
pub mod avail; | ||
pub mod celestia; | ||
pub mod eigen; | ||
|
||
pub const AVAIL_CLIENT_CONFIG_NAME: &str = "Avail"; | ||
pub const CELESTIA_CLIENT_CONFIG_NAME: &str = "Celestia"; | ||
pub const EIGEN_CLIENT_CONFIG_NAME: &str = "Eigen"; | ||
pub const OBJECT_STORE_CLIENT_CONFIG_NAME: &str = "ObjectStore"; | ||
|
||
#[derive(Debug, Clone, PartialEq)] | ||
pub enum DAClientConfig { | ||
Avail(AvailConfig), | ||
Celestia(CelestiaConfig), | ||
Eigen(EigenConfig), | ||
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 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,35 @@ | ||
# EigenDA client | ||
|
||
--- | ||
|
||
This is an implementation of the EigenDA client capable of sending the blobs to DA layer. It uses authenticated | ||
requests, though the auth headers are kind of mocked in the current API implementation. | ||
|
||
The generated files are received by compiling the `.proto` files from EigenDA repo using the following function: | ||
|
||
```rust | ||
pub fn compile_protos() { | ||
let fds = protox::compile( | ||
[ | ||
"proto/common.proto", | ||
"proto/disperser.proto", | ||
], | ||
["."], | ||
) | ||
.expect("protox failed to build"); | ||
|
||
tonic_build::configure() | ||
.build_client(true) | ||
.build_server(false) | ||
.skip_protoc_run() | ||
.out_dir("generated") | ||
.compile_fds(fds) | ||
.unwrap(); | ||
} | ||
``` | ||
|
||
proto files are not included here to not create confusion in case they are not updated in time, so the EigenDA | ||
[repo](https://github.com/Layr-Labs/eigenda/tree/master/api/proto) has to be a source of truth for the proto files. | ||
|
||
The generated folder here is considered a temporary solution until the EigenDA has a library with either a protogen, or | ||
preferably a full Rust client implementation. |
Oops, something went wrong.