diff --git a/api/clients/eigenda_client.go b/api/clients/eigenda_client.go index d811539e1..685d5502f 100644 --- a/api/clients/eigenda_client.go +++ b/api/clients/eigenda_client.go @@ -43,7 +43,7 @@ type EigenDAClient struct { Client DisperserClient ethClient *ethclient.Client edasmCaller *edasm.ContractEigenDAServiceManagerCaller - polynomialForm codecs.PolynomialForm + PolynomialForm codecs.PolynomialForm } var _ IEigenDAClient = &EigenDAClient{} @@ -127,7 +127,7 @@ func NewEigenDAClient(log log.Logger, config EigenDAClientConfig) (*EigenDAClien Client: disperserClient, ethClient: ethClient, edasmCaller: edasmCaller, - polynomialForm: polynomialForm, + PolynomialForm: polynomialForm, }, nil } @@ -365,12 +365,12 @@ func (m *EigenDAClient) putBlob(ctxFinality context.Context, rawData []byte, res // Close simply calls Close() on the wrapped disperserClient, to close the grpc connection to the disperser server. // It is thread safe and can be called multiple times. -func (c *EigenDAClient) Close() error { - return c.Client.Close() +func (m *EigenDAClient) Close() error { + return m.Client.Close() } // getConfDeepBlockNumber returns the block number that is `depth` blocks behind the current block number. -func (m EigenDAClient) getConfDeepBlockNumber(ctx context.Context, depth uint64) (*big.Int, error) { +func (m *EigenDAClient) getConfDeepBlockNumber(ctx context.Context, depth uint64) (*big.Int, error) { curBlockNumber, err := m.ethClient.BlockNumber(ctx) if err != nil { return nil, fmt.Errorf("failed to get latest block number: %w", err) @@ -387,7 +387,7 @@ func (m EigenDAClient) getConfDeepBlockNumber(ctx context.Context, depth uint64) // batchIdConfirmedAtDepth checks if a batch ID has been confirmed at a certain depth. // It returns true if the batch ID has been confirmed at the given depth, and false otherwise, // or returns an error if any of the network calls fail. -func (m EigenDAClient) batchIdConfirmedAtDepth(ctx context.Context, batchId uint32, depth uint64) (bool, error) { +func (m *EigenDAClient) batchIdConfirmedAtDepth(ctx context.Context, batchId uint32, depth uint64) (bool, error) { confDeepBlockNumber, err := m.getConfDeepBlockNumber(ctx, depth) if err != nil { return false, fmt.Errorf("failed to get confirmation deep block number: %w", err) @@ -406,8 +406,8 @@ func (m EigenDAClient) batchIdConfirmedAtDepth(ctx context.Context, batchId uint // // If the system is configured to distribute blobs in Eval form, the returned bytes exactly match the blob bytes. // If the system is configured to distribute blobs in Coeff form, the blob is FFTed before being returned -func (m EigenDAClient) blobToEncodedPayload(blob []byte) ([]byte, error) { - switch m.polynomialForm { +func (m *EigenDAClient) blobToEncodedPayload(blob []byte) ([]byte, error) { + switch m.PolynomialForm { case codecs.Eval: return blob, nil case codecs.Coeff: @@ -418,7 +418,7 @@ func (m EigenDAClient) blobToEncodedPayload(blob []byte) ([]byte, error) { return encodedPayload, nil default: - return nil, fmt.Errorf("unknown polynomial form: %v", m.polynomialForm) + return nil, fmt.Errorf("unknown polynomial form: %v", m.PolynomialForm) } } @@ -426,8 +426,8 @@ func (m EigenDAClient) blobToEncodedPayload(blob []byte) ([]byte, error) { // // If the system is configured to distribute blobs in Eval form, the returned bytes exactly match the input bytes // If the system is configured to distribute blobs in Coeff form, the encoded payload is IFFTed before being returned -func (m EigenDAClient) encodedPayloadToBlob(encodedPayload []byte) ([]byte, error) { - switch m.polynomialForm { +func (m *EigenDAClient) encodedPayloadToBlob(encodedPayload []byte) ([]byte, error) { + switch m.PolynomialForm { case codecs.Eval: return encodedPayload, nil case codecs.Coeff: @@ -438,6 +438,6 @@ func (m EigenDAClient) encodedPayloadToBlob(encodedPayload []byte) ([]byte, erro return coeffPolynomial, nil default: - return nil, fmt.Errorf("unknown polynomial form: %v", m.polynomialForm) + return nil, fmt.Errorf("unknown polynomial form: %v", m.PolynomialForm) } } diff --git a/api/clients/eigenda_client_test.go b/api/clients/eigenda_client_test.go index 3ca515e38..c0edb918a 100644 --- a/api/clients/eigenda_client_test.go +++ b/api/clients/eigenda_client_test.go @@ -71,6 +71,7 @@ func TestPutRetrieveBlobIFFTSuccess(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Coeff, } expectedBlob := []byte("dc49e7df326cfb2e7da5cf68f263e1898443ec2e862350606e7dfbda55ad10b5d61ed1d54baf6ae7a86279c1b4fa9c49a7de721dacb211264c1f5df31bade51c") blobInfo, err := eigendaClient.PutBlob(context.Background(), expectedBlob) @@ -136,6 +137,7 @@ func TestPutRetrieveBlobIFFTNoDecodeSuccess(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Coeff, } expectedBlob := []byte("dc49e7df326cfb2e7da5cf68f263e1898443ec2e862350606e7dfbda55ad10b5d61ed1d54baf6ae7a86279c1b4fa9c49a7de721dacb211264c1f5df31bade51c") blobInfo, err := eigendaClient.PutBlob(context.Background(), expectedBlob) @@ -207,6 +209,7 @@ func TestPutRetrieveBlobNoIFFTSuccess(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Eval, } expectedBlob := []byte("dc49e7df326cfb2e7da5cf68f263e1898443ec2e862350606e7dfbda55ad10b5d61ed1d54baf6ae7a86279c1b4fa9c49a7de721dacb211264c1f5df31bade51c") blobInfo, err := eigendaClient.PutBlob(context.Background(), expectedBlob) @@ -238,6 +241,7 @@ func TestPutBlobFailDispersal(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -270,6 +274,7 @@ func TestPutBlobFailureInsufficentSignatures(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -302,6 +307,7 @@ func TestPutBlobFailureGeneral(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -334,6 +340,7 @@ func TestPutBlobFailureUnknown(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -368,6 +375,7 @@ func TestPutBlobFinalizationTimeout(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -427,6 +435,7 @@ func TestPutBlobIndividualRequestTimeout(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) @@ -489,6 +498,7 @@ func TestPutBlobTotalTimeout(t *testing.T) { WaitForFinalization: true, }, Client: disperserClient, + PolynomialForm: codecs.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello"))