diff --git a/.env.example b/.env.example index 1c434a76..9b32d2b1 100644 --- a/.env.example +++ b/.env.example @@ -5,16 +5,16 @@ EIGENDA_PROXY_ADDR=127.0.0.1 EIGENDA_PROXY_PORT=3100 # Directory path to SRS tables -EIGENDA_PROXY_TARGET_CACHE_PATH= +EIGENDA_PROXY_TARGET_CACHE_PATH=resources/SRSTables # Directory path to g1.point file -EIGENDA_PROXY_TARGET_KZG_G1_PATH= +EIGENDA_PROXY_TARGET_KZG_G1_PATH=resources/g1.point # Directory path to g2.point.powerOf2 file -EIGENDA_PROXY_TARGET_G2_TAU_PATH= +EIGENDA_PROXY_TARGET_G2_TAU_PATH=resources/g2.point.powerOf2 # RPC endpoint of the EigenDA disperser -EIGENDA_PROXY_RPC= +EIGENDA_PROXY_EIGENDA_DISPERSER_RPC= # Wait time between retries of EigenDA blob status queries (default: 5s) EIGENDA_PROXY_STATUS_QUERY_INTERVAL=5s diff --git a/.gitignore b/.gitignore index 08205e05..58e0ab06 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ go.work .env ## kzg cache -e2e/resources/kzg/SRSTables/ +resources/SRSTables/ ## Vscode /.vscode diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e27a5589..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "operator-setup"] - path = operator-setup - url = https://github.com/Layr-Labs/eigenda-operator-setup.git diff --git a/Makefile b/Makefile index 1b791991..223b4d98 100644 --- a/Makefile +++ b/Makefile @@ -54,11 +54,6 @@ gosec: submodules: git submodule update --init --recursive -srs: - if ! test -f /operator-setup/resources/g1.point; then \ - cd operator-setup && ./srs_setup.sh; \ - fi - op-devnet-allocs: @echo "Generating devnet allocs..." @./scripts/op-devnet-allocs.sh diff --git a/README.md b/README.md index 0ac4be86..aaa16e2e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ In order to disperse to the EigenDA network in production, or at high throughput Additional CLI args are provided for targeting an EigenDA network backend: -* `--eigenda-rpc`: RPC host of disperser service. (e.g, on holesky this is `disperser-holesky.eigenda.xyz:443`, full network list [here](https://docs.eigenlayer.xyz/eigenda/networks/)) +* `--eigenda-disperser-rpc`: RPC host of disperser service. (e.g, on holesky this is `disperser-holesky.eigenda.xyz:443`, full network list [here](https://docs.eigenlayer.xyz/eigenda/networks/)) * `--eigenda-status-query-timeout`: (default: 30m) Duration for which a client will wait for a blob to finalize after being sent for dispersal. * `--eigenda-status-query-retry-interval`: (default: 5s) How often a client will attempt a retry when awaiting network blob finalization. * `--eigenda-disable-tls`: (default: false) Whether to disable TLS for grpc communication with disperser. @@ -28,18 +28,19 @@ Additional CLI args are provided for targeting an EigenDA network backend: * `--eigenda-cache-path`: Directory path to dump cached SRS tables * `--eigenda-max-blob-length`: The maximum blob length that this EigenDA sidecar proxy should expect to be written or read from EigenDA. This configuration setting is used to determine how many SRS points should be loaded into memory for generating/verifying KZG commitments returned by the EigenDA disperser. Valid byte units are either base-2 or base-10 byte amounts (not bits), e.g. `30 MiB`, `4Kb`, `30MB`. The maximum blob size is a little more than `1GB`. - ### Certificate verification + For additional security, there is a cert verification feature which verifies the blob metadata read from the disperser to ensure that: + 1. The respective batch hash can be computed locally and matches the one persisted on-chain in the `ServiceManager` contract 2. The blob inclusion proof can be merkalized to generate the proper batch root 3. All quorum params are adequately defined and expressed when compared to their on-chain counterparts To target this feature, the following CLI args should be provided: + * `--eigenda-svc-manager-addr`: The deployed EigenDA service manager address. The list can be found [here](https://github.com/Layr-Labs/eigenlayer-middleware/?tab=readme-ov-file#current-mainnet-deployment). * `--eigenda-eth-rpc` : JSON RPC node endpoint for the Ethereum network used for finalizing DA blobs. See available list [here](https://docs.eigenlayer.xyz/eigenda/networks/). - ### In-Memory Storage An ephemeral memory store backend can be used for faster feedback testing when performing rollup integrations. The following cli args can be used to target the feature: @@ -47,14 +48,15 @@ An ephemeral memory store backend can be used for faster feedback testing when p * `--memstore.enabled`: Boolean feature flag * `--memstore.expiration`: Duration for which a blob will exist -## Metrics +## Metrics + To the see list of available metrics, run `./bin/eigenda-proxy doc metrics` ## Running Locally 1. Compile binary: `make eigenda-proxy` 2. Generate a new private key and save it as `EIGENDA_PROXY_SIGNER_PRIVATE_KEY_HEX` env var without the `0x` prefix. -3. Run binary; e.g: `./bin/eigenda-proxy --addr 127.0.0.1 --port 5050 --eigenda-rpc 127.0.0.1:443 --eigenda-status-query-timeout 45m --eigenda-g1-path e2e/resources/kzg/g1.point --eigenda-g2-tau-path e2e/resources/kzg/g2.point.powerOf2 --eigenda-max-blob-length='90Kib'` +3. Run binary; e.g: `./bin/eigenda-proxy --addr 127.0.0.1 --port 5050 --eigenda-disperser-rpc disperser-holesky.eigenda.xyz:443 --eigenda-status-query-timeout 45m --eigenda-max-blob-length='90Kib'` **Env File** An env file can be provided to the binary for runtime process ingestion; e.g: @@ -84,23 +86,18 @@ The `raw commitment` for EigenDA is encoding certificate and kzg fields. ## Testing ### Unit + Unit tests can be ran via invoking `make test`. ### Holesky -A holesky integration test can be ran using `make holesky-test` to assert proper dispersal/retrieval against a public network. Please **note** that EigenDA Holesky network which is subject to rate-limiting and slow confirmation times *(i.e, >10 minutes per blob confirmation)*. Please advise EigenDA's [inabox](https://github.com/Layr-Labs/eigenda/tree/master/inabox#readme) if you'd like to spin-up a local DA network for faster iteration testing. +A holesky integration test can be ran using `make holesky-test` to assert proper dispersal/retrieval against a public network. Please **note** that EigenDA Holesky network which is subject to rate-limiting and slow confirmation times *(i.e, >10 minutes per blob confirmation)*. Please advise EigenDA's [inabox](https://github.com/Layr-Labs/eigenda/tree/master/inabox#readme) if you'd like to spin-up a local DA network for faster iteration testing. ### Optimism -An E2E test exists which spins up a local OP sequencer instance using the [op-e2e](https://github.com/ethereum-optimism/optimism/tree/develop/op-e2e) framework for asserting correct interaction behaviors with batch submission and state derivation. These tests can be ran via `make optimism-test`. -**NOTE:** - -## Downloading Mainnet SRS - -KZG commitment verification requires constructing the SRS string from the proper trusted setup values (g1, g2, g2.power_of_tau). These values can be downloaded locally using the [operator-setup](https://github.com/Layr-Labs/eigenda-operator-setup) submodule via the following commands. +An E2E test exists which spins up a local OP sequencer instance using the [op-e2e](https://github.com/ethereum-optimism/optimism/tree/develop/op-e2e) framework for asserting correct interaction behaviors with batch submission and state derivation. These tests can be ran via `make optimism-test`. -1. `make submodules` -2. `make srs` +**NOTE:** ## Hardware Requirements diff --git a/e2e/resources/kzg/g1.point b/e2e/resources/kzg/g1.point deleted file mode 100644 index afa9a885..00000000 Binary files a/e2e/resources/kzg/g1.point and /dev/null differ diff --git a/e2e/resources/kzg/g2.point b/e2e/resources/kzg/g2.point deleted file mode 100644 index d6bc8299..00000000 Binary files a/e2e/resources/kzg/g2.point and /dev/null differ diff --git a/e2e/resources/kzg/g2.point.powerOf2 b/e2e/resources/kzg/g2.point.powerOf2 deleted file mode 100644 index 3b97a479..00000000 Binary files a/e2e/resources/kzg/g2.point.powerOf2 and /dev/null differ diff --git a/e2e/setup.go b/e2e/setup.go index d11562fc..52fd8930 100644 --- a/e2e/setup.go +++ b/e2e/setup.go @@ -67,11 +67,11 @@ func CreateTestSuite(t *testing.T, useMemory bool) (TestSuite, func()) { }, EthRPC: ethRPC, SvcManagerAddr: "0xD4A7E1Bd8015057293f0D0A557088c286942e84b", // incompatible with non holeskly networks - CacheDir: "../operator-setup/resources/SRSTables", - G1Path: "../operator-setup/resources/g1_abbr.point", - G2Path: "../test/resources/kzg/g2.point", // do we need this? + CacheDir: "../resources/SRSTables", + G1Path: "../resources/g1.point", + G2Path: "", MaxBlobLength: "90kib", - G2PowerOfTauPath: "../operator-setup/resources/kzg/g2_abbr.point.powerOf2", + G2PowerOfTauPath: "../resources/g2.point.powerOf2", PutBlobEncodingVersion: 0x00, } diff --git a/eigenda/config.go b/eigenda/config.go index db61e493..98d9720e 100644 --- a/eigenda/config.go +++ b/eigenda/config.go @@ -16,7 +16,7 @@ import ( ) const ( - RPCFlagName = "eigenda-rpc" + EigenDADisperserRPCFlagName = "eigenda-disperser-rpc" EthRPCFlagName = "eigenda-eth-rpc" SvcManagerAddrFlagName = "eigenda-svc-manager-addr" StatusQueryRetryIntervalFlagName = "eigenda-status-query-retry-interval" @@ -118,7 +118,7 @@ func ReadConfig(ctx *cli.Context) Config { cfg := Config{ ClientConfig: clients.EigenDAClientConfig{ /* Required Flags */ - RPC: ctx.String(RPCFlagName), + RPC: ctx.String(EigenDADisperserRPCFlagName), StatusQueryRetryInterval: ctx.Duration(StatusQueryRetryIntervalFlagName), StatusQueryTimeout: ctx.Duration(StatusQueryTimeoutFlagName), DisableTLS: ctx.Bool(DisableTlsFlagName), @@ -152,9 +152,9 @@ func CLIFlags(envPrefix string) []cli.Flag { } return []cli.Flag{ &cli.StringFlag{ - Name: RPCFlagName, + Name: EigenDADisperserRPCFlagName, Usage: "RPC endpoint of the EigenDA disperser.", - EnvVars: prefixEnvVars("RPC"), + EnvVars: prefixEnvVars("EIGENDA_DISPERSER_RPC"), }, &cli.DurationFlag{ Name: StatusQueryTimeoutFlagName, @@ -213,16 +213,19 @@ func CLIFlags(envPrefix string) []cli.Flag { Name: G1PathFlagName, Usage: "Directory path to g1.point file", EnvVars: prefixEnvVars("TARGET_KZG_G1_PATH"), + Value: "resources/g1.point", }, &cli.StringFlag{ Name: G2TauFlagName, Usage: "Directory path to g2.point.powerOf2 file", EnvVars: prefixEnvVars("TARGET_G2_TAU_PATH"), + Value: "resources/g2.point.powerOf2", }, &cli.StringFlag{ Name: CachePathFlagName, Usage: "Directory path to SRS tables", EnvVars: prefixEnvVars("TARGET_CACHE_PATH"), + Value: "resources/SRSTables/", }, &cli.StringFlag{ Name: EthRPCFlagName, diff --git a/operator-setup b/operator-setup deleted file mode 160000 index 2a5a91f8..00000000 --- a/operator-setup +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2a5a91f81f7ff92d28f8febbffbb889d3ca3a855 diff --git a/resources/g1.point b/resources/g1.point new file mode 100644 index 00000000..483074e4 Binary files /dev/null and b/resources/g1.point differ diff --git a/resources/g2.point.powerOf2 b/resources/g2.point.powerOf2 new file mode 100644 index 00000000..58e349b6 Binary files /dev/null and b/resources/g2.point.powerOf2 differ diff --git a/store/memory_test.go b/store/memory_test.go index 3af5fb7f..202aa2b7 100644 --- a/store/memory_test.go +++ b/store/memory_test.go @@ -22,9 +22,9 @@ func TestGetSet(t *testing.T) { defer cancel() kzgConfig := &kzg.KzgConfig{ - G1Path: "../e2e/resources/kzg/g1.point", - G2PowerOf2Path: "../e2e/resources/kzg/g2.point.powerOf2", - CacheDir: "../e2e/resources/kzg/SRSTables", + G1Path: "../resources/g1.point", + G2PowerOf2Path: "../resources/g2.point.powerOf2", + CacheDir: "../resources/SRSTables", SRSOrder: 3000, SRSNumberToLoad: 3000, NumWorker: uint64(runtime.GOMAXPROCS(0)), @@ -67,9 +67,9 @@ func TestExpiration(t *testing.T) { defer cancel() kzgConfig := &kzg.KzgConfig{ - G1Path: "../e2e/resources/kzg/g1.point", - G2PowerOf2Path: "../e2e/resources/kzg/g2.point.powerOf2", - CacheDir: "../e2e/resources/kzg/SRSTables", + G1Path: "../resources/g1.point", + G2PowerOf2Path: "../resources/g2.point.powerOf2", + CacheDir: "../resources/SRSTables", SRSOrder: 3000, SRSNumberToLoad: 3000, NumWorker: uint64(runtime.GOMAXPROCS(0)), diff --git a/verify/verify_test.go b/verify/verify_test.go index 0e7ccdb3..be130db2 100644 --- a/verify/verify_test.go +++ b/verify/verify_test.go @@ -16,10 +16,10 @@ func TestCommitmentVerification(t *testing.T) { var data = []byte("inter-subjective and not objective!") - x, err := hex.DecodeString("2fc55f968a2d29d22aebf55b382528d1d9401577c166483e162355b19d8bc446") + x, err := hex.DecodeString("1021d699eac68ce312196d480266e8b82fd5fe5c4311e53313837b64db6df178") assert.NoError(t, err) - y, err := hex.DecodeString("149e2241c21c391e069b9f317710c7f57f31ee88245a5e61f0d294b11acf9aff") + y, err := hex.DecodeString("02efa5a7813233ae13f32bae9b8f48252fa45c1b06a5d70bed471a9bea8d98ae") assert.NoError(t, err) c := &common.G1Commitment{ @@ -28,9 +28,9 @@ func TestCommitmentVerification(t *testing.T) { } kzgConfig := &kzg.KzgConfig{ - G1Path: "../e2e/resources/kzg/g1.point", - G2PowerOf2Path: "../e2e/resources/kzg/g2.point.powerOf2", - CacheDir: "../e2e/resources/kzg/SRSTables", + G1Path: "../resources/g1.point", + G2PowerOf2Path: "../resources/g2.point.powerOf2", + CacheDir: "../resources/SRSTables", SRSOrder: 3000, SRSNumberToLoad: 3000, NumWorker: uint64(runtime.GOMAXPROCS(0)),