Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eigenda): implement eigenDA client remaining features #3243

Open
wants to merge 61 commits into
base: main
Choose a base branch
from

Conversation

juanbono
Copy link

@juanbono juanbono commented Nov 8, 2024

What ❔

This PR adds extra functionality to the eigen client:

Why ❔

These features are needed to have a full featured client and to have the same features as when communicating with the EigenDA proxy.

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 zkstack dev fmt and zkstack dev lint.

juan518munoz and others added 23 commits October 31, 2024 17:14
Implement non auth blob dispersal for eigen client

---------

Co-authored-by: Gianbelinche <39842759+gianbelinche@users.noreply.github.com>
feat(eigen-client-extra-features): get inclusion data
* initial commit

* Add tests

* Add memstore

* Add assert to tests

* Add rest of memstore

* Address pr comments

* Remove to retriable error

* Fix conflicts

* Document memstore

* Fix typo

---------

Co-authored-by: Juan Munoz <juanmunoz890@gmail.com>
blob size limit

---------

Co-authored-by: Gianbelinche <39842759+gianbelinche@users.noreply.github.com>
* initial commit

* Add tests

* Add memstore

* Add assert to tests

* Add rest of memstore

* Add soft confirmations

* Remove print

* Address pr comments

* Remove to retriable error

* Fix conflicts

* Add inclusion data

* Change status query timeout to millis

* Document memstore

* Fix typo

* Fix typo

* Format

---------

Co-authored-by: Juan Munoz <juanmunoz890@gmail.com>
* initial commit

* Add tests

* Add memstore

* Add assert to tests

* Add rest of memstore

* Address pr comments

* Remove to retriable error

* Fix conflicts

* Add verifier

* Fix verifier

* Add path to points to config

* Fix typo

* Fix eigenda env test

* Fix verifier test

* Move eigendaservicemanager to generated

* Remove unneeded imports

* Document verifier

* Modify errors

* Address comments

* Fix conflicts

---------

Co-authored-by: Juan Munoz <juanmunoz890@gmail.com>
* initial commit

* move file location

* fix step
#329)

* Remove unused custom quorum numbers

* Add serial to tests
feat(eigen-client-extra-features): fix clippy and add doc
feat(eigen-client-extra-features): merge main
@juanbono juanbono changed the title Eigen client extra features Implement eigenDA client remaining features Nov 8, 2024
juan518munoz and others added 2 commits November 12, 2024 11:02
…dule-update

feat(eigen-client-extra-features): update contracts submodule
core/lib/config/src/configs/da_client/eigen.rs Outdated Show resolved Hide resolved
core/lib/config/src/configs/da_client/eigen.rs Outdated Show resolved Hide resolved
core/lib/config/src/configs/da_client/eigen.rs Outdated Show resolved Hide resolved
core/lib/protobuf_config/src/proto/config/da_client.proto Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/sdk.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/sdk.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/verifier.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/verifier.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/verifier.rs Outdated Show resolved Hide resolved
gianbelinche and others added 11 commits November 28, 2024 15:38
* Move inclusion logic

* Remove unused import
* Move inclusion logic

* Remove verify cert
* Change eth conf depth for settlement layer

* Remove blob size limit

* Move reserved

* Change function name

* Add constants to lib

* Fix compilation
* initial commit

* remove anyhow err

* Format code

* Fix compilation

---------

Co-authored-by: Gianbelinche <39842759+gianbelinche@users.noreply.github.com>
* Add option to download points

* Fix test

* Fix clippy

* Change name to points source

* Fix test

* Fix test
…s with mock tests (#356)

* initial commit

* create verifier client trait

* remove unwraps

* Update core/node/da_clients/src/eigen/verifier.rs

Ignore test

Co-authored-by: Gianbelinche <39842759+gianbelinche@users.noreply.github.com>

* Update core/node/da_clients/src/eigen/sdk.rs

Co-authored-by: Gianbelinche <39842759+gianbelinche@users.noreply.github.com>

* change ignore test comment

* Format code

---------

Co-authored-by: Gianbelinche <39842759+gianbelinche@users.noreply.github.com>
…on docs (#360)

* Remove steps to run from integration docs

* Combine readme

* Clarify readme
…and-main

feat(eigen-client-extra-features): Merge Main
core/lib/config/src/configs/da_client/eigen.rs Outdated Show resolved Hide resolved
core/lib/config/src/configs/da_client/eigen.rs Outdated Show resolved Hide resolved
core/lib/protobuf_config/src/proto/config/da_client.proto Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/README.md Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/README.md Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/verifier.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/verifier.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/verifier.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/verifier.rs Outdated Show resolved Hide resolved
resources/g1.point Outdated Show resolved Hide resolved
gianbelinche and others added 4 commits December 6, 2024 15:03
* Remove verify cert

* Change names

* Create aux functions

* Remove milestones

* Add url crate to save pointsz

* Remove hex and rlp

* Make get inclusion data not return entire blob info

* Remove hardcoded function selectors

* move tests to a different file

* Remove retrys and add option to get inclusion data

* Solve clippy

* Get blob data from db

* Add async trait

* Change function to get blob data

* Remove path to points in favor of links

* Change link to url

* Update core/lib/env_config/src/da_client.rs

Co-authored-by: juan518munoz <62400508+juan518munoz@users.noreply.github.com>

---------

Co-authored-by: juan518munoz <62400508+juan518munoz@users.noreply.github.com>
Copy link
Contributor

@dimazhornyk dimazhornyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR logic look great, left mostly some nits and style-related comments

core/lib/env_config/src/da_client.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/README.md Show resolved Hide resolved
core/node/da_clients/src/eigen/sdk.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/sdk.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/sdk.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/verifier.rs Outdated Show resolved Hide resolved
core/lib/config/src/configs/da_client/eigen.rs Outdated Show resolved Hide resolved
* Add envy load

* Readd proto reference

* Rename blob id to request id

* Make literals constants

* Make point size constant

* Get pool unique

* Remaining comments

* Fix comment

* Add check for failed states

* Change l1 name
Copy link
Contributor

@dimazhornyk dimazhornyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! I will start the CI and ask for another reviewer to do a final look

core/lib/protobuf_config/src/da_client.rs Outdated Show resolved Hide resolved
core/node/da_clients/src/eigen/sdk.rs Outdated Show resolved Hide resolved
@juanbono juanbono changed the title Implement eigenDA client remaining features feat(eigenda): implement eigenDA client remaining features Dec 16, 2024
Copy link
Contributor

@slowli slowli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some preliminary comments. Will try to do another review round later this week.

pub disperser_rpc: String,
/// Block height needed to reach in order to consider the blob finalized
/// a value less or equal to 0 means that the disperser will not wait for finalization
pub settlement_layer_confirmation_depth: i32,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do different negative values have semantic differences? If not, please use u32.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here lambdaclass#375

pub disperser_rpc: String,
/// Block height needed to reach in order to consider the blob finalized
/// a value less or equal to 0 means that the disperser will not wait for finalization
pub settlement_layer_confirmation_depth: i32,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do different negative values have semantic differences? If not, please use u32.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here lambdaclass#375

pub rpc_node_url: String,
pub inclusion_polling_interval_ms: u64,
/// URL of the Disperser RPC server
pub disperser_rpc: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String::default() is not a reasonable default for URLs; please #[derive(Default)] (maybe replacing it with a manual impl, if the parameter does have a reasonable default value).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here lambdaclass#375 , the testnet url was used as default

/// URL of the Ethereum RPC server
pub eigenda_eth_rpc: Option<String>,
/// Address of the service manager contract
pub eigenda_svc_manager_address: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not Address? Also, again, addresses don't have meaningful defaults, and "" is not a valid address.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here lambdaclass#375, the testnet URL was used as default

Comment on lines +19 to +20
/// Url to the file containing the G1 point used for KZG
pub g1_url: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any integrity checks for the file contents? What is the outcome of receiving invalid points (e.g., is this an attack vector)?

impl GetBlobData for GetBlobFromDB {
async fn call(&self, input: &'_ str) -> anyhow::Result<Option<Vec<u8>>> {
let pool = self.pool.clone();
let input = input.to_string();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allocation is not required.

Copy link
Author

@juanbono juanbono Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed here lambdaclass#375

.data_availability_dal()
.get_blob_data_by_blob_id(&input)
.await?;
drop(conn);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useless.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here lambdaclass#375


#[async_trait::async_trait]
impl GetBlobData for GetBlobFromDB {
async fn call(&self, input: &'_ str) -> anyhow::Result<Option<Vec<u8>>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lifetime can be skipped, I think the only reason it's not flagged by Clippy is that it's inside the async_trait proc macro.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here lambdaclass#375

Comment on lines 549 to 550
self.verify_merkle_proof(cert.clone())?;
self.verify_security_params(cert.clone()).await?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reasonably sure cert can be passed by ref at least for the last two methods (verify_batch is tricky because of ethabi::Tokens created in hash_batch_metadata). In general, please pass values by ref where possible; there are too many examples in this module and adjacent modules to highlight.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here lambdaclass#375

rust-kzg-bn254.workspace = true
ark-bn254.workspace = true
num-bigint.workspace = true
serial_test.workspace = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a dev dependency.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here lambdaclass#375

* Change settlement layer for u32

* Change string to address

* Remove unwraps

* Remove error from name

* Remove unused to bytes

* Rename call for get blob data

* Revert "Change string to address"

This reverts commit 6dd94d4.

* Change string for address

* feat(eigen-client-extra-features): address PR comments (part 2) (#374)

* initial commit

* clippy suggestion

* feat(eigen-client-extra-features): address PR comments (part 3) (#376)

* use keccak256 fn

* simplify get_context_block

* use saturating sub

* feat(eigen-client-extra-features): address PR comments (part 4) (#378)

* Replace decode bytes for ethabi

* Add default to eigenconfig

* Change str to url

* Add index to data availability table

* Address comments

* Change error to verificationerror

* Format code

* feat(eigen-client-extra-features): address PR comments (part 5) (#377)

* use trait object

* prevent blocking non async code

* clippy suggestion

---------

Co-authored-by: juan518munoz <62400508+juan518munoz@users.noreply.github.com>

---------

Co-authored-by: Gianbelinche <39842759+gianbelinche@users.noreply.github.com>

---------

Co-authored-by: Gianbelinche <39842759+gianbelinche@users.noreply.github.com>

* Format code

---------

Co-authored-by: juan518munoz <62400508+juan518munoz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants