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: Initial V2 E2E Prototype #260

Open
wants to merge 21 commits into
base: eigenda_v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ae6a199
feat: Initial V2 scaffolds
ethenotethan Jan 24, 2025
6806969
feat: Initial V2 scaffolds - add boilerplate dependency injection and…
ethenotethan Jan 29, 2025
f92ba1d
feat: Initial V2 scaffolds - go fmt
ethenotethan Jan 29, 2025
355fc24
feat: Initial V2 scaffolds - wire up disperser and retriever clients
ethenotethan Jan 30, 2025
33b2cc8
feat: EigenDAV2 commitment processing and generation (#265)
ethenotethan Jan 30, 2025
8c52290
Merge branch 'main' of github.com:Layr-Labs/eigenda-proxy into epocia…
ethenotethan Jan 30, 2025
b8a3fd6
Merge branch 'epociask--feat-init-v2-scaffolds' of github.com:Layr-La…
ethenotethan Jan 30, 2025
534a29e
feat: Initial V2 scaffolds - dependency injection working, current bu…
ethenotethan Jan 30, 2025
165dd85
feat: Initial V2 scaffolds - E2E proof of concept sort've
ethenotethan Jan 31, 2025
a6970a3
feat: Initial V2 scaffolds - bump EigenDA
ethenotethan Feb 1, 2025
f211b5d
feat: Initial V2 scaffolds - update dependency injection
ethenotethan Feb 1, 2025
b0d014f
feat: Initial V2 scaffolds - hardcode quorums
ethenotethan Feb 3, 2025
65090b4
Merge branch 'main' of github.com:Layr-Labs/eigenda-proxy into epocia…
ethenotethan Feb 5, 2025
10a3b7f
feat: Initial V2 scaffolds - working mvp
ethenotethan Feb 5, 2025
5ea4d48
feat: Initial V2 scaffolds - working lint and tests
ethenotethan Feb 6, 2025
c47aa1b
Merge branch 'main' into epociask--feat-init-v2-scaffolds
ethenotethan Feb 6, 2025
01c54de
feat: Initial V2 scaffolds - add todo around G2 ingestion
ethenotethan Feb 10, 2025
d684f1f
Merge branch 'epociask--feat-init-v2-scaffolds' of github.com:Layr-La…
ethenotethan Feb 10, 2025
16a50b0
feat: Initial V2 scaffolds - change all usage of directory path to ju…
ethenotethan Feb 10, 2025
c68d7f3
feat: Initial V2 scaffolds - refactor manager
ethenotethan Feb 10, 2025
440493e
feat: Initial V2 scaffolds - refactor commitments
ethenotethan Feb 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.example.holesky
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ EIGENDA_PROXY_EIGENDA_SERVICE_MANAGER_ADDR=0xD4A7E1Bd8015057293f0D0A557088c28694
# Custom quorum IDs for writing blobs. Should not include default quorums 0 or 1.
# EIGENDA_PROXY_EIGENDA_CUSTOM_QUORUM_IDS=

# Directory path to SRS tables
# path to SRS tables
# EIGENDA_PROXY_EIGENDA_TARGET_CACHE_PATH=resources/SRSTables

# The number of Ethereum blocks of confirmation that the DA briging transaction must have before it is assumed by the proxy to be final. The value of `0` indicates that the proxy shouldn't wait for any confirmations
# and 0 indicates that the proxy should wait for finalization.
# EIGENDA_PROXY_EIGENDA_ETH_CONFIRMATION_DEPTH=6

# Directory path to g1.point file
# path to g1.point file
# EIGENDA_PROXY_EIGENDA_TARGET_KZG_G1_PATH=resources/g1.point

# Directory path to g2.point.powerOf2 file
# path to g2.point.powerOf2 file
# EIGENDA_PROXY_EIGENDA_TARGET_KZG_G2_POWER_OF_2_PATH=resources/g2.point.powerOf2

# Disable point verification mode. This mode performs IFFT on data before writing and FFT on data after reading. Disabling requires supplying the entire blob for verification against the KZG commitment.
Expand Down
6 changes: 3 additions & 3 deletions .env.example.mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ EIGENDA_PROXY_EIGENDA_SERVICE_MANAGER_ADDR=0x870679E138bCdf293b7Ff14dD44b70FC97e
# Custom quorum IDs for writing blobs. Should not include default quorums 0 or 1.
# EIGENDA_PROXY_EIGENDA_CUSTOM_QUORUM_IDS=

# Directory path to SRS tables
# path to SRS tables
# EIGENDA_PROXY_EIGENDA_TARGET_CACHE_PATH=resources/SRSTables

# The number of Ethereum blocks of confirmation that the DA briging transaction must have before it is assumed by the proxy to be final. The value of `0` indicates that the proxy shouldn't wait for any confirmations.
# EIGENDA_PROXY_EIGENDA_ETH_CONFIRMATION_DEPTH=6

# Directory path to g1.point file
# path to g1.point file
# EIGENDA_PROXY_EIGENDA_TARGET_KZG_G1_PATH=resources/g1.point

# Directory path to g2.point.powerOf2 file
# path to g2.point.powerOf2 file
# EIGENDA_PROXY_EIGENDA_TARGET_KZG_G2_POWER_OF_2_PATH=resources/g2.point.powerOf2

# Disable point verification mode. This mode performs IFFT on data before writing and FFT on data after reading. Disabling requires supplying the entire blob for verification against the KZG commitment.
Expand Down
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "debug",
"env": {
"ENV_PATH": "../../.env",
"EIGENDA_PROXY_EIGENDA_CERT_VERIFICATION_DISABLED": "true",
"EIGENDA_PROXY_EIGENDA_TARGET_KZG_G1_PATH": "../../resources/g1.point",
"EIGENDA_PROXY_EIGENDA_TARGET_KZG_G2_POWER_OF_2_PATH": "../../resources/g2.point.powerOf2"
Comment on lines +13 to +16
Copy link
Collaborator

Choose a reason for hiding this comment

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

why ../..? Which folder is this being run from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cmd/server

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is kind of weird though no? Typically a binary is ran from root, like go run cmd/server? Is this something specific to how vscode launches the binary?

How does this work actually? Does this add a button on the main() function in cmd/server/main.go on the vscode UI?

},
"program": "cmd/server"
}
]
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ To quickly set up monitoring dashboard, add eigenda-proxy metrics endpoint to a
| Flag | Default Value | Environment Variable | Description |
| ------------------------------------------- | ------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--addr` | `"127.0.0.1"` | `$EIGENDA_PROXY_ADDR` | Server listening address |
| `--eigenda.cache-path` | `"resources/SRSTables/"` | `$EIGENDA_PROXY_EIGENDA_TARGET_CACHE_PATH` | Directory path to SRS tables for caching. |
| `--eigenda.cache-path` | `"resources/SRSTables/"` | `$EIGENDA_PROXY_EIGENDA_TARGET_CACHE_PATH` | path to SRS tables for caching. |
| `--eigenda.custom-quorum-ids` | | `$EIGENDA_PROXY_EIGENDA_CUSTOM_QUORUM_IDS` | Custom quorum IDs for writing blobs. Should not include default quorums 0 or 1. |
| `--eigenda.disable-point-verification-mode` | `false` | `$EIGENDA_PROXY_EIGENDA_DISABLE_POINT_VERIFICATION_MODE` | Disable point verification mode. This mode performs IFFT on data before writing and FFT on data after reading. Disabling requires supplying the entire blob for verification against the KZG commitment. |
| `--eigenda.disable-tls` | `false` | `$EIGENDA_PROXY_EIGENDA_GRPC_DISABLE_TLS` | Disable TLS for gRPC communication with the EigenDA disperser. Default is false. |
Expand All @@ -266,8 +266,8 @@ To quickly set up monitoring dashboard, add eigenda-proxy metrics endpoint to a
| `--eigenda.svc-manager-addr` | | `$EIGENDA_PROXY_EIGENDA_SERVICE_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-confirmation-depth` | `-1` | `$EIGENDA_PROXY_EIGENDA_ETH_CONFIRMATION_DEPTH` | The number of Ethereum blocks of confirmation that the DA bridging transaction must have before it is assumed by the proxy to be final. If set negative the proxy will always wait for blob finalization. |
| `--eigenda.eth-rpc` | | `$EIGENDA_PROXY_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/ |
| `--eigenda.g1-path` | `"resources/g1.point"` | `$EIGENDA_PROXY_EIGENDA_TARGET_KZG_G1_PATH` | Directory path to g1.point file. |
| `--eigenda.g2-power-of-2-path` | `"resources/g2.point.powerOf2"` | `$EIGENDA_PROXY_EIGENDA_TARGET_KZG_G2_POWER_OF_2_PATH` | Directory path to g2.point.powerOf2 file. |
| `--eigenda.g1-path` | `"resources/g1.point"` | `$EIGENDA_PROXY_EIGENDA_TARGET_KZG_G1_PATH` | path to g1.point file. |
| `--eigenda.g2-power-of-2-path` | `"resources/g2.point.powerOf2"` | `$EIGENDA_PROXY_EIGENDA_TARGET_KZG_G2_POWER_OF_2_PATH` | path to g2.point.powerOf2 file. |
| `--eigenda.max-blob-length` | `"16MiB"` | `$EIGENDA_PROXY_EIGENDA_MAX_BLOB_LENGTH` | Maximum blob length to be written or read from EigenDA. Determines the number of SRS points loaded into memory for KZG commitments. Example units: '30MiB', '4Kb', '30MB'. Maximum size slightly exceeds 1GB. |
| `--eigenda.put-blob-encoding-version` | `0` | `$EIGENDA_PROXY_EIGENDA_PUT_BLOB_ENCODING_VERSION` | Blob encoding version to use when writing blobs from the high-level interface. |
| `--eigenda.response-timeout` | `60s` | `$EIGENDA_PROXY_EIGENDA_RESPONSE_TIMEOUT` | Total time to wait for a response from the EigenDA disperser. Default is 60 seconds. |
Expand Down
11 changes: 5 additions & 6 deletions cmd/server/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
proxy_logging "github.com/Layr-Labs/eigenda-proxy/logging"
"github.com/Layr-Labs/eigensdk-go/logging"

"github.com/Layr-Labs/eigenda-proxy/flags"
"github.com/Layr-Labs/eigenda-proxy/metrics"
"github.com/Layr-Labs/eigenda-proxy/server"
"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -47,7 +46,7 @@ func StartProxySvr(cliCtx *cli.Context) error {
if err != nil {
return fmt.Errorf("failed to create store: %w", err)
}
server := server.NewServer(cliCtx.String(flags.ListenAddrFlagName), cliCtx.Int(flags.PortFlagName), sm, log, m)
server := server.NewServer(&cfg.EigenDAConfig, sm, log, m)

if err := server.Start(); err != nil {
return fmt.Errorf("failed to start the DA server: %w", err)
Expand Down Expand Up @@ -85,11 +84,11 @@ func StartProxySvr(cliCtx *cli.Context) error {
func prettyPrintConfig(cliCtx *cli.Context, log logging.Logger) error {
// we read a new config which we modify to hide private info in order to log the rest
cfg := server.ReadCLIConfig(cliCtx)
if cfg.EigenDAConfig.EdaClientConfig.SignerPrivateKeyHex != "" {
cfg.EigenDAConfig.EdaClientConfig.SignerPrivateKeyHex = "*****" // marshaling defined in client config
if cfg.EigenDAConfig.EdaV1ClientConfig.SignerPrivateKeyHex != "" {
cfg.EigenDAConfig.EdaV1ClientConfig.SignerPrivateKeyHex = "*****" // marshaling defined in client config
}
if cfg.EigenDAConfig.EdaClientConfig.EthRpcUrl != "" {
cfg.EigenDAConfig.EdaClientConfig.EthRpcUrl = "*****" // hiding as RPC providers typically use sensitive API keys within
if cfg.EigenDAConfig.EdaV1ClientConfig.EthRpcUrl != "" {
cfg.EigenDAConfig.EdaV1ClientConfig.EthRpcUrl = "*****" // hiding as RPC providers typically use sensitive API keys within
}

configJSON, err := json.MarshalIndent(cfg, "", " ")
Expand Down
39 changes: 20 additions & 19 deletions commitments/eigenda.go
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
package commitments

type CertEncodingCommitment byte
type EigenDACommit byte
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we rename this to EigenDACertVersion or something more explicit. Prefer to reserve commitment for the full bytes sent to batcher inbox only.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we use the term commitment throughout other representations in this package though....

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@litt3 litt3 Feb 10, 2025

Choose a reason for hiding this comment

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

Perpendicular to the "commitment" vs "cert" discussion, IMO this should be named EigenDA_____Version or EigenDA_____Type, especially considering there is a very similarly named struct EigenDACommitment


const (
CertV0 CertEncodingCommitment = 0
// EigenDA V1
CertV0 EigenDACommit = iota
// EigenDA V2
CertV1
)

// OPCommitment is the binary representation of a commitment.
// CertCommitment is the binary representation of a commitment.
type CertCommitment interface {
CommitmentType() CertEncodingCommitment
CommitmentType() EigenDACommit
Encode() []byte
Verify(input []byte) error
}

type CertCommitmentV0 []byte

// NewV0CertCommitment creates a new commitment from the given input.
func NewV0CertCommitment(input []byte) CertCommitmentV0 {
return CertCommitmentV0(input)
type EigenDACommitment struct {
prefix EigenDACommit
b []byte
}

// DecodeCertCommitment validates and casts the commitment into a Keccak256Commitment.
func DecodeCertCommitment(commitment []byte) (CertCommitmentV0, error) {
if len(commitment) == 0 {
return nil, ErrInvalidCommitment
// NewEigenDACommitment creates a new commitment from the given input.
func NewEigenDACommitment(input []byte, v EigenDACommit) EigenDACommitment {
return EigenDACommitment{
prefix: v,
b: input,
}
return commitment, nil
}

// CommitmentType returns the commitment type of Keccak256.
func (c CertCommitmentV0) CommitmentType() CertEncodingCommitment {
return CertV0
// CommitmentType returns the commitment type of EigenDACommitment.
func (c EigenDACommitment) CommitmentType() EigenDACommit {
return c.prefix
}

// Encode adds a commitment type prefix self describing the commitment.
func (c CertCommitmentV0) Encode() []byte {
return append([]byte{byte(CertV0)}, c...)
func (c EigenDACommitment) Encode() []byte {
return append([]byte{byte(c.prefix)}, c.b...)
}
14 changes: 7 additions & 7 deletions commitments/mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

type CommitmentMeta struct {
Mode CommitmentMode
// CertVersion is shared for all modes and denotes version of the EigenDA certificate
CertVersion uint8
// version is shared for all modes and denotes version of the EigenDA certificate
Version EigenDACommit
Comment on lines +9 to +10
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is not used for keccak commitment right?
Also can we rename to EigenDACertVersion or something? Prefer to reserve "commitment" for the bytes sent to batcher inbox

}

type CommitmentMode string
Expand All @@ -31,19 +31,19 @@ func StringToCommitmentMode(s string) (CommitmentMode, error) {
}
}

func EncodeCommitment(b []byte, c CommitmentMode) ([]byte, error) {
switch c {
func EncodeCommitment(b []byte, cm CommitmentMode, daVersion EigenDACommit) ([]byte, error) {
switch cm {
case OptimismKeccak:
return Keccak256Commitment(b).Encode(), nil

case OptimismGeneric:
certCommit := NewV0CertCommitment(b).Encode()
certCommit := NewEigenDACommitment(b, daVersion).Encode()
svcCommit := EigenDASvcCommitment(certCommit).Encode()
altDACommit := NewGenericCommitment(svcCommit).Encode()
return altDACommit, nil

case Standard:
return NewV0CertCommitment(b).Encode(), nil
case Standard: // (i.e, Arbitrum)
return NewEigenDACommitment(b, daVersion).Encode(), nil
}

return nil, fmt.Errorf("unknown commitment mode")
Expand Down
5 changes: 5 additions & 0 deletions common/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type BackendType uint8

const (
EigenDABackendType BackendType = iota
EigenDAV2BackendType
MemoryBackendType
S3BackendType
RedisBackendType
Expand All @@ -26,6 +27,8 @@ func (b BackendType) String() string {
switch b {
case EigenDABackendType:
return "EigenDA"
case EigenDAV2BackendType:
return "EigenDAV2"
case MemoryBackendType:
return "Memory"
case S3BackendType:
Expand All @@ -45,6 +48,8 @@ func StringToBackendType(s string) BackendType {
switch lower {
case "eigenda":
return EigenDABackendType
case "eigenda_v2":
return EigenDAV2BackendType
case "memory":
return MemoryBackendType
case "s3":
Expand Down
4 changes: 2 additions & 2 deletions e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"github.com/stretchr/testify/require"
)

// Integration tests are run against memstore whereas.
// Testnetintegration tests are run against eigenda backend talking to testnet disperser.
// Integration tests are run against memstore whereas
// testnet integration tests are run against eigenda backend talking to testnet disperser.
// Some of the assertions in the tests are different based on the backend as well.
// e.g, in TestProxyServerCaching we only assert to read metrics with EigenDA
// when referencing memstore since we don't profile the eigenDAClient interactions
Expand Down
22 changes: 11 additions & 11 deletions e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/Layr-Labs/eigenda-proxy/store/generated_key/memstore"
"github.com/Layr-Labs/eigenda-proxy/store/precomputed_key/redis"
"github.com/Layr-Labs/eigenda-proxy/store/precomputed_key/s3"
"github.com/Layr-Labs/eigenda-proxy/verify"
"github.com/Layr-Labs/eigenda-proxy/verify/v1"
"github.com/Layr-Labs/eigenda/api/clients"
"github.com/Layr-Labs/eigenda/encoding/kzg"
"github.com/Layr-Labs/eigensdk-go/logging"
Expand All @@ -29,12 +29,12 @@ import (
)

const (
privateKey = "SIGNER_PRIVATE_KEY"
ethRPC = "ETHEREUM_RPC"
transport = "http"
svcName = "eigenda_proxy"
host = "127.0.0.1"
holeskyDA = "disperser-holesky.eigenda.xyz:443"
privateKey = "SIGNER_PRIVATE_KEY"
ethRPC = "ETHEREUM_RPC"
transport = "http"
svcName = "eigenda_proxy"
host = "127.0.0.1"
v1DisperserHolesky = "disperser-holesky.eigenda.xyz:443"
)

var (
Expand Down Expand Up @@ -183,8 +183,8 @@ func TestSuiteConfig(testCfg *Cfg) server.CLIConfig {

svcManagerAddr := "0xD4A7E1Bd8015057293f0D0A557088c286942e84b" // holesky testnet
eigendaCfg := server.Config{
EdaClientConfig: clients.EigenDAClientConfig{
RPC: holeskyDA,
EdaV1ClientConfig: clients.EigenDAClientConfig{
RPC: v1DisperserHolesky,
StatusQueryTimeout: time.Minute * 45,
StatusQueryRetryInterval: pollInterval,
DisableTLS: false,
Expand Down Expand Up @@ -218,7 +218,7 @@ func TestSuiteConfig(testCfg *Cfg) server.CLIConfig {
}

if testCfg.UseMemory {
eigendaCfg.EdaClientConfig.SignerPrivateKeyHex = "0000000000000000000100000000000000000000000000000000000000000000"
eigendaCfg.EdaV1ClientConfig.SignerPrivateKeyHex = "0000000000000000000100000000000000000000000000000000000000000000"
}

var cfg server.CLIConfig
Expand Down Expand Up @@ -271,7 +271,7 @@ func CreateTestSuite(testSuiteCfg server.CLIConfig) (TestSuite, func()) {
panic(err)
}

proxySvr := server.NewServer(host, 0, sm, log, m)
proxySvr := server.NewServer(&testSuiteCfg.EigenDAConfig, sm, log, m)

log.Info("Starting proxy server...")
err = proxySvr.Start()
Expand Down
Loading
Loading