From 59f7ae6676a513a3581e9799f64361d9f535c287 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Tue, 3 Dec 2024 19:08:06 +0700 Subject: [PATCH 1/5] chore(eigenda): Bump eigenda-proxy to latest v1.6.0 --- arbnode/batch_poster.go | 4 ++-- eigenda/proxy.go | 22 ++++++++++++---------- eigenda/proxy_mock.go | 4 ++-- scripts/start-eigenda-proxy.sh | 30 ++++++++++++++++++++---------- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/arbnode/batch_poster.go b/arbnode/batch_poster.go index ea1352d8b..5a2ab45c6 100644 --- a/arbnode/batch_poster.go +++ b/arbnode/batch_poster.go @@ -1476,13 +1476,13 @@ func (b *BatchPoster) maybePostSequencerBatch(ctx context.Context) (bool, error) } eigenDaBlobInfo, err = b.eigenDAWriter.Store(ctx, sequencerMsg) - if err != nil && errors.Is(err, eigenda.SvcUnavailableErr) && b.config().EnableEigenDAFailover && b.dapWriter != nil { // Failover to anytrust commitee if enabled + if err != nil && errors.Is(err, eigenda.ErrServiceUnavailable) && b.config().EnableEigenDAFailover && b.dapWriter != nil { // Failover to anytrust commitee if enabled log.Error("EigenDA service is unavailable, failing over to any trust mode") b.building.useEigenDA = false failOver = true } - if err != nil && errors.Is(err, eigenda.SvcUnavailableErr) && b.config().EnableEigenDAFailover && b.dapWriter == nil { // Failover to ETH DA if enabled + if err != nil && errors.Is(err, eigenda.ErrServiceUnavailable) && b.config().EnableEigenDAFailover && b.dapWriter == nil { // Failover to ETH DA if enabled // when failing over to ETHDA (i.e 4844, calldata), we may need to re-encode the batch. To do this in compliance with the existing code, it's easiest // to update an internal field and retrigger the poster's event loop. Since the batch poster can be distributed across mulitple nodes, there could be // degraded temporary performance as each batch poster will re-encode the batch on another event loop tick using the coordination lock which could worst case diff --git a/eigenda/proxy.go b/eigenda/proxy.go index d7dc52464..687c24b92 100644 --- a/eigenda/proxy.go +++ b/eigenda/proxy.go @@ -12,7 +12,7 @@ import ( ) var ( - SvcUnavailableErr = fmt.Errorf("eigenda service is unavailable") + ErrServiceUnavailable = fmt.Errorf("eigenda service is unavailable") ) type EigenDAProxyClient struct { @@ -123,21 +123,22 @@ func (c *client) GetData(ctx context.Context, comm []byte) ([]byte, error) { defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("received unexpected response code: %d", resp.StatusCode) + b, err := io.ReadAll(resp.Body) + if err != nil { + return nil, err } - if resp.StatusCode == http.StatusServiceUnavailable { - return nil, SvcUnavailableErr + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("received error response, code=%d, msg = %s", resp.StatusCode, string(b)) } - return io.ReadAll(resp.Body) + return b, nil } // SetData writes raw byte data to DA and returns the associated certificate // which should be verified within the proxy func (c *client) SetData(ctx context.Context, b []byte) ([]byte, error) { - url := fmt.Sprintf("%s/put/?commitment_mode=simple", c.cfg.URL) + url := fmt.Sprintf("%s/put?commitment_mode=simple", c.cfg.URL) req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(b)) if err != nil { return nil, fmt.Errorf("failed to create HTTP request: %w", err) @@ -148,15 +149,16 @@ func (c *client) SetData(ctx context.Context, b []byte) ([]byte, error) { return nil, err } defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("failed to store data: %v", resp.StatusCode) - } b, err = io.ReadAll(resp.Body) if err != nil { return nil, err } + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("failed to store data: %v, err = %s", resp.StatusCode, string(b)) + } + if len(b) == 0 { return nil, fmt.Errorf("read certificate is empty") } diff --git a/eigenda/proxy_mock.go b/eigenda/proxy_mock.go index eb2532b66..544c219e8 100644 --- a/eigenda/proxy_mock.go +++ b/eigenda/proxy_mock.go @@ -92,7 +92,7 @@ func NewMockEigenDAProxyClient(shouldFail bool) *MockEigenDAProxyClient { func (c *MockEigenDAProxyClient) Put(ctx context.Context, data []byte) (*disperser.BlobInfo, error) { if c.client.(*MockProxyClient).ShouldFail { - return nil, SvcUnavailableErr + return nil, ErrServiceUnavailable } return &mockBlobInfo, nil } @@ -103,7 +103,7 @@ func (c *MockEigenDAProxyClient) Get(ctx context.Context, blobInfo *disperser.Bl } if c.client.(*MockProxyClient).ShouldReturn503 { - return nil, SvcUnavailableErr + return nil, ErrServiceUnavailable } return mockBlobData, nil diff --git a/scripts/start-eigenda-proxy.sh b/scripts/start-eigenda-proxy.sh index de349980e..d137f4e80 100755 --- a/scripts/start-eigenda-proxy.sh +++ b/scripts/start-eigenda-proxy.sh @@ -1,21 +1,31 @@ #!/usr/bin/env bash -echo "Pull eigenda-proxy container" -docker pull ghcr.io/layr-labs/eigenda-proxy@sha256:10a4762f5c43e9037835617e6ec0b03da34012df87048a363f43b969ab93679b +echo "==== Pull eigenda-proxy container ====" +docker pull ghcr.io/layr-labs/eigenda-proxy:v1.6.0 -echo "Tagging image" -docker tag ghcr.io/layr-labs/eigenda-proxy@sha256:10a4762f5c43e9037835617e6ec0b03da34012df87048a363f43b969ab93679b eigenda-proxy-nitro-test +echo "==== Starting eigenda-proxy container ====" -echo "Start eigenda-proxy container" +# proxy has a bug currently which forces the use of the service manager address +# & eth rpc despite cert verification being disabled. -docker run -d --name eigenda-proxy-nitro-test \ +docker run -d --name eigenda-proxy-nitro-test-instance \ -p 4242:6666 \ -e EIGENDA_PROXY_ADDR=0.0.0.0 \ -e EIGENDA_PROXY_PORT=6666 \ - -e MEMSTORE_ENABLED=true \ - -e MEMSTORE_EXPIRATION=1m \ - -e EIGENDA_PROXY_TARGET_URL=http://localhost:3000 \ - eigenda-proxy-nitro-test + -e EIGENDA_PROXY_MEMSTORE_ENABLED=true \ + -e EIGENDA_PROXY_MEMSTORE_EXPIRATION=1m \ + -e EIGENDA_PROXY_EIGENDA_ETH_RPC=http://localhost:6969 \ + -e EIGENDA_PROXY_EIGENDA_SERVICE_MANAGER_ADDR="0x0000000000000000000000000000000000000000" \ + -e EIGENDA_PROXY_EIGENDA_CERT_VERIFICATION_DISABLED=true \ + ghcr.io/layr-labs/eigenda-proxy:v1.6.0 + + +if [ $? -ne 0 ]; then + echo "==== Failed to start eigenda-proxy container ====" + exit 1 +fi + +echo "==== eigenda-proxy container started ====" ## TODO - support teardown or embed a docker client wrapper that spins up and tears down resource # within system tests. Since this is only used by one system test, it's not a large priority atm. \ No newline at end of file From a53fe5cd148c545dedcf5ff26e6f312772fc47fa Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Tue, 3 Dec 2024 19:45:31 +0700 Subject: [PATCH 2/5] chore(eigenda): Bump eigenda-proxy to latest v1.6.0 - fix fmt bug in sh script --- scripts/start-eigenda-proxy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start-eigenda-proxy.sh b/scripts/start-eigenda-proxy.sh index d137f4e80..1faffd09f 100755 --- a/scripts/start-eigenda-proxy.sh +++ b/scripts/start-eigenda-proxy.sh @@ -14,7 +14,7 @@ docker run -d --name eigenda-proxy-nitro-test-instance \ -e EIGENDA_PROXY_PORT=6666 \ -e EIGENDA_PROXY_MEMSTORE_ENABLED=true \ -e EIGENDA_PROXY_MEMSTORE_EXPIRATION=1m \ - -e EIGENDA_PROXY_EIGENDA_ETH_RPC=http://localhost:6969 \ + -e EIGENDA_PROXY_EIGENDA_ETH_RPC=http://localhost:6969 \ -e EIGENDA_PROXY_EIGENDA_SERVICE_MANAGER_ADDR="0x0000000000000000000000000000000000000000" \ -e EIGENDA_PROXY_EIGENDA_CERT_VERIFICATION_DISABLED=true \ ghcr.io/layr-labs/eigenda-proxy:v1.6.0 From 17436e9b4fdc4995fffc4988fa6f74b9e41501b3 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Tue, 3 Dec 2024 20:29:39 +0700 Subject: [PATCH 3/5] chore(eigenda): Bump eigenda-proxy to latest v1.6.0 - suppress shellcheck warning --- scripts/start-eigenda-proxy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start-eigenda-proxy.sh b/scripts/start-eigenda-proxy.sh index 1faffd09f..4fbf99f6d 100755 --- a/scripts/start-eigenda-proxy.sh +++ b/scripts/start-eigenda-proxy.sh @@ -19,7 +19,7 @@ docker run -d --name eigenda-proxy-nitro-test-instance \ -e EIGENDA_PROXY_EIGENDA_CERT_VERIFICATION_DISABLED=true \ ghcr.io/layr-labs/eigenda-proxy:v1.6.0 - +# shellcheck disable=SC2181 if [ $? -ne 0 ]; then echo "==== Failed to start eigenda-proxy container ====" exit 1 From ddeea5fe4cc3ee63a2b2e37debfae4ddebce8f1d Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Tue, 3 Dec 2024 23:13:46 +0700 Subject: [PATCH 4/5] chore(eigenda): Bump eigenda-proxy to latest v1.6.0 - fix failover bug --- eigenda/proxy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eigenda/proxy.go b/eigenda/proxy.go index 687c24b92..1639ca0d0 100644 --- a/eigenda/proxy.go +++ b/eigenda/proxy.go @@ -128,6 +128,10 @@ func (c *client) GetData(ctx context.Context, comm []byte) ([]byte, error) { return nil, err } + if resp.StatusCode == http.StatusServiceUnavailable { + return nil, ErrServiceUnavailable + } + if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("received error response, code=%d, msg = %s", resp.StatusCode, string(b)) } @@ -155,6 +159,10 @@ func (c *client) SetData(ctx context.Context, b []byte) ([]byte, error) { return nil, err } + if resp.StatusCode == http.StatusServiceUnavailable { + return nil, ErrServiceUnavailable + } + if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("failed to store data: %v, err = %s", resp.StatusCode, string(b)) } From b29bf11a46f1aaf66ac5865f7488c4c144e88fc5 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Wed, 4 Dec 2024 00:01:15 +0700 Subject: [PATCH 5/5] chore(eigenda): Bump eigenda-proxy to latest v1.6.0 - fix failover bug --- eigenda/proxy.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/eigenda/proxy.go b/eigenda/proxy.go index 1639ca0d0..9c49edfd0 100644 --- a/eigenda/proxy.go +++ b/eigenda/proxy.go @@ -128,10 +128,6 @@ func (c *client) GetData(ctx context.Context, comm []byte) ([]byte, error) { return nil, err } - if resp.StatusCode == http.StatusServiceUnavailable { - return nil, ErrServiceUnavailable - } - if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("received error response, code=%d, msg = %s", resp.StatusCode, string(b)) }