diff --git a/Cargo.lock b/Cargo.lock index 0e9b14880..2d80a9eaa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2506,6 +2506,33 @@ dependencies = [ "reqwest 0.12.7", ] +[[package]] +name = "eigensdk" +version = "0.0.1-alpha" +dependencies = [ + "eigen-chainio-txmanager", + "eigen-chainio-utils", + "eigen-client-avsregistry", + "eigen-client-elcontracts", + "eigen-client-eth", + "eigen-client-fireblocks", + "eigen-contract-bindings", + "eigen-crypto-bls", + "eigen-crypto-bn254", + "eigen-logging", + "eigen-metrics", + "eigen-metrics-collectors-economic", + "eigen-metrics-collectors-rpc-calls", + "eigen-nodeapi", + "eigen-services-avsregistry", + "eigen-services-blsaggregation", + "eigen-services-operatorsinfo", + "eigen-signer", + "eigen-testing-utils", + "eigen-types", + "eigen-utils", +] + [[package]] name = "either" version = "1.13.0" @@ -5633,8 +5660,9 @@ checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" [[package]] name = "rust-bls-bn254" -version = "0.1.0" -source = "git+https://github.com/Layr-Labs/rust-bls-bn254.git?rev=be3ef87#be3ef873f484bb09c2db7b6491715236df8c6174" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ee74e41c4bdfb5720a8d5743e089cb7c7b3ea7dfed73de1fe0a02c5fe744f9" dependencies = [ "aes", "ark-bn254", diff --git a/Cargo.toml b/Cargo.toml index f6d9d4244..dea822005 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ members = [ "crates/types/", "crates/utils/", "crates/nodeapi/", + "crates/eigensdk/", "examples/anvil-utils", "examples/avsregistry-read", "examples/avsregistry-write", @@ -57,7 +58,6 @@ ark-serialize = "0.4.2" async-trait = "0.1.81" aws-config = "1.5.4" aws-sdk-kms = "1.37.0" -bn254 = { git = "https://github.com/sedaprotocol/bn254" } clap = { version = "4.5.11", features = ["derive"] } eigen-chainio-txmanager = { path = "crates/chainio/txmanager/" } eigen-chainio-utils = { path = "crates/chainio/utils/" } @@ -73,7 +73,7 @@ eigen-metrics = { version = "0.0.1-alpha", path = "crates/metrics/" } eigen-metrics-collectors-economic = { path = "crates/metrics/collectors/economic" } eigen-metrics-collectors-rpc-calls = { path = "crates/metrics/collectors/rpc_calls" } eigen-services-avsregistry = { path = "crates/services/avsregistry" } -eigen-services-bls_aggregation = { path = "crates/services/bls_aggregation" } +eigen-services-blsaggregation = { path = "crates/services/bls_aggregation" } eigen-services-operatorsinfo = { path = "crates/services/operatorsinfo" } eigen-signer = { path = "crates/signer/" } eigen-testing-utils = { path = "testing/testing-utils" } @@ -99,7 +99,6 @@ quote = "1.0" rand = "0.8" rand_core = "0.6" reqwest = "0.12.4" -reth = { git = "https://github.com/paradigmxyz/reth" } rstest = "0.22.0" serde = { version = "1.0.197", features = ["derive"] } serde_json = "1.0.121" @@ -114,7 +113,7 @@ tracing-subscriber = { version = "0.3", features = ["json"] } url = "2.5.2" #misc -rust-bls-bn254 = { git = "https://github.com/Layr-Labs/rust-bls-bn254.git", rev = "be3ef87", features = [ +rust-bls-bn254 = { version = "0.2.0", features = [ "std", ] } uuid = { version = "1.10.0", features = ["v4"] } diff --git a/README.md b/README.md index cddd54ecd..aa0a06b00 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ You can run any [example](https://github.com/Layr-Labs/eigensdk-rs/tree/main/exa Example : -``` +```bash cargo run --example get_quorum_count ``` @@ -40,7 +40,7 @@ To test locally and raise a PR :- You need `foundry` , `docker` and `make` and `nightly rust` to successfully run it. Also, the `docker` engine has to be running for all the tests to execute correctly. -``` +```bash make pr ``` At least 1 `approving` review is required to merge the PR. @@ -55,7 +55,7 @@ Add the following variables to your env and then run the following command -``` +```bash make fireblocks-tests ``` @@ -67,17 +67,17 @@ Test coverage should aim to be around 80%. Here's how to generate test coverage reports: Install llvm tools: -``` +```bash make deps ``` Run the tests with coverage instrumentations: -``` +```bash make coverage ``` Open the coverage html report in a web browser: -``` +```bash open target/llvm-cov/html/index.html ``` diff --git a/crates/chainio/clients/eth/Cargo.toml b/crates/chainio/clients/eth/Cargo.toml index 65f38e2ce..8472803a4 100644 --- a/crates/chainio/clients/eth/Cargo.toml +++ b/crates/chainio/clients/eth/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +description = "eigen layer instrumented client " +license-file.workspace = true [dependencies] alloy-consensus.workspace = true diff --git a/crates/chainio/clients/fireblocks/Cargo.toml b/crates/chainio/clients/fireblocks/Cargo.toml index c1f80a1ea..b5165a395 100644 --- a/crates/chainio/clients/fireblocks/Cargo.toml +++ b/crates/chainio/clients/fireblocks/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +description = "fireblocks support for eigenlayer" +license-file.workspace = true [dependencies] alloy-contract.workspace = true diff --git a/crates/eigen-cli/Cargo.toml b/crates/eigen-cli/Cargo.toml index 63c4aaca2..db8b104c4 100644 --- a/crates/eigen-cli/Cargo.toml +++ b/crates/eigen-cli/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +description = "eigen layer cli" +license-file.workspace = true [dependencies] alloy-contract.workspace = true diff --git a/crates/eigensdk/Cargo.toml b/crates/eigensdk/Cargo.toml new file mode 100644 index 000000000..a8e7bddd4 --- /dev/null +++ b/crates/eigensdk/Cargo.toml @@ -0,0 +1,101 @@ +[package] +name = "eigensdk" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +repository.workspace = true +description = "SDK for eigenlayer" +license-file.workspace = true + +[dependencies] +eigen-chainio-txmanager = {workspace = true, optional = true} +eigen-chainio-utils = {workspace = true, optional = true} +eigen-client-avsregistry = {workspace = true, optional = true} +eigen-client-elcontracts = {workspace = true, optional = true} +eigen-client-eth = {workspace = true, optional = true} +eigen-client-fireblocks = {workspace = true, optional = true} +eigen-contract-bindings = {workspace = true, optional = true} +eigen-crypto-bls = {workspace = true, optional = true} +eigen-crypto-bn254 = {workspace = true, optional = true} +eigen-logging = {workspace = true, optional = true} +eigen-metrics = {workspace = true, optional = true} +eigen-metrics-collectors-economic = {workspace = true, optional = true} +eigen-metrics-collectors-rpc-calls = {workspace = true, optional = true} +eigen-services-avsregistry = {workspace = true, optional = true} +eigen-services-blsaggregation = {workspace = true, optional = true} +eigen-services-operatorsinfo = {workspace = true, optional = true} +eigen-signer = {workspace = true, optional = true} +eigen-testing-utils = {workspace = true, optional = true} +eigen-types = {workspace = true, optional = true} +eigen-utils = {workspace = true, optional = true} +eigen-nodeapi = {workspace = true, optional = true} + + +# Feature configurations +[features] +default = [] + + +# Full features set for full usage +full = [ + "chainio-txmanager", + "chainio-utils", + "client-avsregistry", + "client-elcontracts", + "client-eth", + "client-fireblocks", + "contract-bindings", + "crypto-bls", + "crypto-bn254", + "logging", + "metrics", + "services-avsregistry", + "services-blsaggregation", + "services-operatorsinfo", + "signer", + "testing-utils", + "nodeapi", +] + +# Chain IO related features +chainio-txmanager = ["dep:eigen-chainio-txmanager"] +chainio-utils = ["dep:eigen-chainio-utils"] + +# Client-related features +client-avsregistry = ["dep:eigen-client-avsregistry"] +client-elcontracts = ["dep:eigen-client-elcontracts"] +client-eth = ["dep:eigen-client-eth"] +client-fireblocks = ["dep:eigen-client-fireblocks"] + +# Contract-related features +contract-bindings = ["dep:eigen-contract-bindings"] + +# Crypto-related features +crypto-bls = ["dep:eigen-crypto-bls"] +crypto-bn254 = ["dep:eigen-crypto-bn254"] + +# Metrics and collectors +metrics = ["dep:eigen-metrics"] +metrics-collectors-economic = ["dep:eigen-metrics-collectors-economic"] +metrics-collectors-rpc-calls = ["dep:eigen-metrics-collectors-rpc-calls"] + +# Service-related features +services-avsregistry = ["dep:eigen-services-avsregistry"] +services-blsaggregation = ["dep:eigen-services-blsaggregation"] +services-operatorsinfo = ["dep:eigen-services-operatorsinfo"] + +# Node API related features +nodeapi = ["dep:eigen-nodeapi"] + +# Logging and utilities +logging = ["dep:eigen-logging"] +utils = ["dep:eigen-utils"] + +# Testing utilities +testing-utils = ["dep:eigen-testing-utils"] + +# Signer-related features +signer = ["dep:eigen-signer"] + +# types +types = ["dep:eigen-types"] diff --git a/crates/eigensdk/README.md b/crates/eigensdk/README.md new file mode 100644 index 000000000..aa0a06b00 --- /dev/null +++ b/crates/eigensdk/README.md @@ -0,0 +1,97 @@ +# eigen-rs + +Rust <> EigenLayer developer tools + +![eigen-rs](https://github.com/user-attachments/assets/bf1d1090-db70-487a-a49a-40f727849251) + +## Overview + +List of crates in the repository :- + +- [eigen-client-avsregistry](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/chainio/clients/avsregistry) - Read, Write and subscribe methods for AvsRegistry +- [eigen-client-elcontracts](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/chainio/clients/elcontracts) - Convenience methods to call Eigenlayer contracts +- [eigen-chainio-utils](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/chainio/utils) +- [eigen-contracts-bindings](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/contracts/bindings) - Generate ethers bindings for Eigen Layer. +- [eigen-crypto-bls](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/crypto/bls) - bls utilities +- [eigen-crypto-bn254](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/crypto/bn254) - bn254 utilities +- [eigen-metrics](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/metrics) - performance , rpc and economic metrics +- [eigen-services](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/services) - Spawn tokio services for operators info , bls aggregation +- [eigen-types](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/types) - Common types +- [eigen-utils](https://github.com/Layr-Labs/eigensdk-rs/tree/main/crates/utils) - Publicly exportable `m2-mainnet` compatible alloy bindings. +- [eigen-testing-utils](https://github.com/Layr-Labs/eigensdk-rs/tree/main/testing/testing-utils) - Contains publicly exportable anvil , holesky , mainnet addresses for eigen contracts . + + +## Examples + +You can run any [example](https://github.com/Layr-Labs/eigensdk-rs/tree/main/examples) using the command cargo run --example + +Example : + +```bash +cargo run --example get_quorum_count +``` + +## Contributor Guidelines + +We are actively looking for contributors. Thank you for your interest. We have strict ci checks in place. In case of any questions and support , feel free to raise an issue. + +### PR +To test locally and raise a PR :- + + +You need `foundry` , `docker` and `make` and `nightly rust` to successfully run it. Also, the `docker` engine has to be running for all the tests to execute correctly. +```bash +make pr +``` +At least 1 `approving` review is required to merge the PR. + +### To run fireblocks tests + +Add the following variables to your env + +- FIREBLOCKS_API_KEY +- FIREBLOCKS_PRIVATE_KEY_PATH +- FIREBLOCKS_API_URL + + and then run the following command + +```bash +make fireblocks-tests + +``` +Note: The tests were written using sandbox environment , you would need to modify the testing parameters according to your own asset id's , tx-id etc. + +### Test Coverage +Test coverage should aim to be around 80%. + +Here's how to generate test coverage reports: + +Install llvm tools: +```bash +make deps +``` + +Run the tests with coverage instrumentations: +```bash +make coverage +``` + +Open the coverage html report in a web browser: +```bash +open target/llvm-cov/html/index.html +``` + +## Supported Rust Version +Rolling `MSRV` policy of 6 months. The current `MSRV` is 1.79 + +## Disclaimer +This software is `unaudited`.This is experimental software and is provided on an "as is" and "as available" basis and may not work at all. It should not be used in production. + +# Credits +- [Layer-labs](https://github.com/Layr-Labs/eigensdk-go/tree/master) + +# Security Bugs +Please report security vulnerabilities to security@eigenlabs.org. Do NOT report security bugs via Github Issues. + +## Contact +Telegram - supernovahs444 diff --git a/crates/eigensdk/src/lib.rs b/crates/eigensdk/src/lib.rs new file mode 100644 index 000000000..e6dbb40e6 --- /dev/null +++ b/crates/eigensdk/src/lib.rs @@ -0,0 +1,101 @@ +#![doc = include_str!("../README.md")] +#![cfg_attr(not(test), warn(unused_crate_dependencies))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + +/* --------------------------------------- Core re-exports -------------------------------------- */ + +#[doc(inline)] +#[cfg(feature = "types")] +pub use eigen_types as types; + +#[cfg(feature = "utils")] +#[doc(inline)] +pub use eigen_utils as utils; + +#[cfg(feature = "crypto-bls")] +#[doc(inline)] +pub use eigen_crypto_bls as crypto_bls; + +#[cfg(feature = "crypto-bn254")] +#[doc(inline)] +pub use eigen_crypto_bn254 as crypto_bn254; + +#[cfg(feature = "signer")] +#[doc(inline)] +pub use eigen_signer as signer; + +#[cfg(feature = "logging")] +#[doc(inline)] +pub use eigen_logging as logging; + +#[cfg(feature = "metrics")] +#[doc(inline)] +pub use eigen_metrics as metrics; + +#[cfg(feature = "contract-bindings")] +#[doc(inline)] +pub use eigen_contract_bindings as contract_bindings; + +/* ------------------------------------- Client Re-exports ------------------------------------- */ + +#[cfg(feature = "client-avsregistry")] +#[doc(inline)] +pub use eigen_client_avsregistry as client_avsregistry; + +#[cfg(feature = "client-elcontracts")] +#[doc(inline)] +pub use eigen_client_elcontracts as client_elcontracts; + +#[cfg(feature = "client-eth")] +#[doc(inline)] +pub use eigen_client_eth as client_eth; + +#[cfg(feature = "client-fireblocks")] +#[doc(inline)] +pub use eigen_client_fireblocks as client_fireblocks; + +/* ------------------------------------- Services Re-exports ------------------------------------- */ + +#[cfg(feature = "services-avsregistry")] +#[doc(inline)] +pub use eigen_services_avsregistry as services_avsregistry; + +#[cfg(feature = "services-blsaggregation")] +#[doc(inline)] +pub use eigen_services_blsaggregation as services_blsaggregation; + +#[cfg(feature = "services-operatorsinfo")] +#[doc(inline)] +pub use eigen_services_operatorsinfo as services_operatorsinfo; + +/* ------------------------------------ Node API Re-export ------------------------------------ */ + +#[cfg(feature = "nodeapi")] +#[doc(inline)] +pub use eigen_nodeapi as nodeapi; + +/* ------------------------------------ Testing Utils Re-export -------------------------------- */ + +#[cfg(feature = "testing-utils")] +#[doc(inline)] +pub use eigen_testing_utils as testing_utils; + +/* ------------------------------------ Chain IO Re-exports ------------------------------------ */ + +#[cfg(feature = "chainio-txmanager")] +#[doc(inline)] +pub use eigen_chainio_txmanager as chainio_txmanager; + +#[cfg(feature = "chainio-utils")] +#[doc(inline)] +pub use eigen_chainio_utils as chainio_utils; + +/* ------------------------------------ Metrics Collectors Re-exports -------------------------- */ + +#[cfg(feature = "metrics-collectors-economic")] +#[doc(inline)] +pub use eigen_metrics_collectors_economic as metrics_collectors_economic; + +#[cfg(feature = "metrics-collectors-rpc-calls")] +#[doc(inline)] +pub use eigen_metrics_collectors_rpc_calls as metrics_collectors_rpc_calls; diff --git a/crates/logging/Cargo.toml b/crates/logging/Cargo.toml index 9816ba97e..da91c6ac2 100644 --- a/crates/logging/Cargo.toml +++ b/crates/logging/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +description = "logging utilities" +license-file.workspace = true [dependencies] ctor = "0.2.8" diff --git a/crates/metrics/Cargo.toml b/crates/metrics/Cargo.toml index 99a9c70c8..f9d3b9577 100644 --- a/crates/metrics/Cargo.toml +++ b/crates/metrics/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +description ="prometheus server for metrics" +license-file.workspace = true [dependencies] eigen-logging.workspace = true diff --git a/crates/metrics/collectors/economic/Cargo.toml b/crates/metrics/collectors/economic/Cargo.toml index 4d8bfe388..23f254ba0 100644 --- a/crates/metrics/collectors/economic/Cargo.toml +++ b/crates/metrics/collectors/economic/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +description = "eigenlayer economic metrics" +license-file.workspace = true [dependencies] alloy-primitives.workspace = true diff --git a/crates/metrics/collectors/rpc_calls/Cargo.toml b/crates/metrics/collectors/rpc_calls/Cargo.toml index 364fc4a2d..63633e26b 100644 --- a/crates/metrics/collectors/rpc_calls/Cargo.toml +++ b/crates/metrics/collectors/rpc_calls/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +description = "eigenlayer rpc calls metrics" +license-file.workspace = true [dependencies] eigen-logging.workspace = true diff --git a/crates/nodeapi/Cargo.toml b/crates/nodeapi/Cargo.toml index 426f60ea7..3f4a24612 100644 --- a/crates/nodeapi/Cargo.toml +++ b/crates/nodeapi/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +license-file.workspace = true +description = "eigenlayer nodeapi implementation" [dependencies] serde_json.workspace =true diff --git a/crates/signer/Cargo.toml b/crates/signer/Cargo.toml index 85cb4a5c0..1bfd85c1f 100644 --- a/crates/signer/Cargo.toml +++ b/crates/signer/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +description = "aws,keystore,web3,private_key signers" +license-file.workspace = true [dependencies] alloy-consensus.workspace = true diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index 7185dafbc..032c88633 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -4,6 +4,8 @@ version.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true +description = "publicly exportable alloy bindings and utilities" +license-file.workspace = true [dependencies] alloy-contract.workspace = true diff --git a/examples/anvil-utils/Cargo.toml b/examples/anvil-utils/Cargo.toml index db0c27fd1..23cf1b248 100644 --- a/examples/anvil-utils/Cargo.toml +++ b/examples/anvil-utils/Cargo.toml @@ -6,7 +6,7 @@ rust-version.workspace = true repository.workspace = true license-file.workspace = true authors.workspace = true - +description = "anvil utilities examples" [lints] workspace = true diff --git a/examples/avsregistry-read/Cargo.toml b/examples/avsregistry-read/Cargo.toml index bf49b26ae..46c49f66f 100644 --- a/examples/avsregistry-read/Cargo.toml +++ b/examples/avsregistry-read/Cargo.toml @@ -6,7 +6,7 @@ rust-version.workspace = true repository.workspace = true license-file.workspace = true authors.workspace = true - +description = "avsregistry read examples" [lints] workspace = true diff --git a/examples/avsregistry-write/Cargo.toml b/examples/avsregistry-write/Cargo.toml index ea3c7ca1b..aed062b73 100644 --- a/examples/avsregistry-write/Cargo.toml +++ b/examples/avsregistry-write/Cargo.toml @@ -6,7 +6,7 @@ rust-version.workspace = true repository.workspace = true license-file.workspace = true authors.workspace = true - +description = "avsregistry write examples" [lints] workspace = true diff --git a/examples/info-operator-service/Cargo.toml b/examples/info-operator-service/Cargo.toml index 3e72fd677..6258c47e5 100644 --- a/examples/info-operator-service/Cargo.toml +++ b/examples/info-operator-service/Cargo.toml @@ -1,7 +1,6 @@ [package] name = "info-operator-service" description = "Example demonstrating the operatorsinfo crate" - version.workspace = true edition.workspace = true rust-version.workspace = true