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..9c49edfd0 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,20 @@ 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.StatusServiceUnavailable { + return nil, ErrServiceUnavailable + } + + 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..4fbf99f6d 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 + +# shellcheck disable=SC2181 +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