From 908c5183e7587ce6019024a9f91ca1a8007acd6f Mon Sep 17 00:00:00 2001 From: litt3 <102969658+litt3@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:53:51 -0500 Subject: [PATCH] Combine codec files Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com> --- api/clients/codecs/blob_codec.go | 77 ------------------- api/clients/codecs/blob_codec_test.go | 49 ------------ api/clients/config.go | 4 +- api/clients/eigenda_client.go | 30 ++++---- api/clients/eigenda_client_test.go | 38 ++++----- encoding/utils/codec/codec.go | 72 +++++++++++++++++ encoding/utils/codec/codec_test.go | 32 ++++++++ .../codecs => encoding/utils/codec}/fft.go | 2 +- .../utils/codec}/fft_test.go | 2 +- .../utils/codec}/polynomial_form.go | 2 +- 10 files changed, 143 insertions(+), 165 deletions(-) delete mode 100644 api/clients/codecs/blob_codec.go delete mode 100644 api/clients/codecs/blob_codec_test.go rename {api/clients/codecs => encoding/utils/codec}/fft.go (99%) rename {api/clients/codecs => encoding/utils/codec}/fft_test.go (98%) rename {api/clients/codecs => encoding/utils/codec}/polynomial_form.go (96%) diff --git a/api/clients/codecs/blob_codec.go b/api/clients/codecs/blob_codec.go deleted file mode 100644 index b524dd87c..000000000 --- a/api/clients/codecs/blob_codec.go +++ /dev/null @@ -1,77 +0,0 @@ -package codecs - -import ( - "bytes" - "encoding/binary" - "fmt" - - "github.com/Layr-Labs/eigenda/encoding/utils/codec" -) - -type BlobEncodingVersion byte - -const ( - // BlobEncodingVersion0 entails a 32 byte header = [0x00, version byte, big-endian uint32 len of payload, 0x00, 0x00,...] - // followed by the encoded data [0x00, 31 bytes of data, 0x00, 31 bytes of data,...] - BlobEncodingVersion0 BlobEncodingVersion = 0x0 -) - -// EncodePayload accepts an arbitrary payload byte array, and encodes it. -// -// The returned bytes shall be interpreted as a polynomial in Eval form, where each contained field element of -// length 32 represents the evaluation of the polynomial at an expanded root of unity -// -// The returned bytes may or may not represent a blob. If the system is configured to distribute blobs in Coeff form, -// then the data returned from this function must be IFFTed to produce the final blob. If the system is configured to -// distribute blobs in Eval form, then the data returned from this function is the final blob representation. -// -// Example encoding: -// Payload header (32 bytes total) Encoded Payload Data -// [0x00, version byte, big-endian uint32 len of payload, 0x00, ...] + [0x00, 31 bytes of data, 0x00, 31 bytes of data,...] -func EncodePayload(payload []byte) []byte { - payloadHeader := make([]byte, 32) - // first byte is always 0 to ensure the payloadHeader is a valid bn254 element - payloadHeader[1] = byte(BlobEncodingVersion0) // encode version byte - - // encode payload length as uint32 - binary.BigEndian.PutUint32( - payloadHeader[2:6], - uint32(len(payload))) // uint32 should be more than enough to store the length (approx 4gb) - - // encode payload modulo bn254 - // the resulting bytes subsequently may be treated as the evaluation of a polynomial - polynomialEval := codec.ConvertByPaddingEmptyByte(payload) - - encodedPayload := append(payloadHeader, polynomialEval...) - - return encodedPayload -} - -// DecodePayload accepts bytes representing an encoded payload, and returns the decoded payload -// -// This function expects the parameter bytes to be a polynomial in Eval form. In other words, if blobs in the system -// are being distributed in Coeff form, a blob must be FFTed prior to being passed into the function. -func DecodePayload(encodedPayload []byte) ([]byte, error) { - if len(encodedPayload) < 32 { - return nil, fmt.Errorf("encoded payload does not contain 32 header bytes, meaning it is malformed") - } - - payloadLength := binary.BigEndian.Uint32(encodedPayload[2:6]) - - // decode raw data modulo bn254 - nonPaddedData := codec.RemoveEmptyByteFromPaddedBytes(encodedPayload[32:]) - - reader := bytes.NewReader(nonPaddedData) - payload := make([]byte, payloadLength) - readLength, err := reader.Read(payload) - if err != nil { - return nil, fmt.Errorf( - "failed to copy unpadded data into final buffer, length: %d, bytes read: %d", - payloadLength, readLength) - } - if uint32(readLength) != payloadLength { - return nil, fmt.Errorf("data length does not match length prefix") - } - - return payload, nil -} diff --git a/api/clients/codecs/blob_codec_test.go b/api/clients/codecs/blob_codec_test.go deleted file mode 100644 index 9ead81240..000000000 --- a/api/clients/codecs/blob_codec_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package codecs_test - -import ( - "bytes" - "crypto/rand" - "math/big" - "testing" - - "github.com/Layr-Labs/eigenda/api/clients/codecs" -) - -// Helper function to generate a random byte slice of a given length -func randomByteSlice(length int64) []byte { - b := make([]byte, length) - _, err := rand.Read(b) - if err != nil { - panic(err) - } - return b -} - -// TestCodec tests the encoding and decoding of random byte streams -func TestCodec(t *testing.T) { - // Number of test iterations - const iterations = 100 - - for i := 0; i < iterations; i++ { - // Generate a random length for the byte slice - length, err := rand.Int(rand.Reader, big.NewInt(1024)) // Random length between 0 and 1023 - if err != nil { - panic(err) - } - originalData := randomByteSlice(length.Int64() + 1) // ensure it's not length 0 - - // Encode the original data - encodedData := codecs.EncodePayload(originalData) - - // Decode the encoded data - decodedData, err := codecs.DecodePayload(encodedData) - if err != nil { - t.Fatalf("Iteration %d: failed to decode blob: %v", i, err) - } - - // Compare the original data with the decoded data - if !bytes.Equal(originalData, decodedData) { - t.Fatalf("Iteration %d: original and decoded data do not match\nOriginal: %v\nDecoded: %v", i, originalData, decodedData) - } - } -} diff --git a/api/clients/config.go b/api/clients/config.go index f4d9caa9f..220dd303b 100644 --- a/api/clients/config.go +++ b/api/clients/config.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Layr-Labs/eigenda/api/clients/codecs" + "github.com/Layr-Labs/eigenda/encoding/utils/codec" ) type EigenDAClientConfig struct { @@ -64,7 +64,7 @@ type EigenDAClientConfig struct { DisableTLS bool // The blob encoding version to use when writing blobs from the high level interface. - PutBlobEncodingVersion codecs.BlobEncodingVersion + PutBlobEncodingVersion codec.BlobEncodingVersion // Point verification mode does an IFFT on data before it is written, and does an FFT on data after it is read. // This makes it possible to open points on the KZG commitment to prove that the field elements correspond to diff --git a/api/clients/eigenda_client.go b/api/clients/eigenda_client.go index 53d75b86b..e556c1cd8 100644 --- a/api/clients/eigenda_client.go +++ b/api/clients/eigenda_client.go @@ -10,13 +10,13 @@ import ( "net" "time" + "github.com/Layr-Labs/eigenda/encoding/utils/codec" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/log" "github.com/Layr-Labs/eigenda/api" - "github.com/Layr-Labs/eigenda/api/clients/codecs" grpcdisperser "github.com/Layr-Labs/eigenda/api/grpc/disperser" edasm "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDAServiceManager" "github.com/Layr-Labs/eigenda/core" @@ -28,7 +28,7 @@ import ( type IEigenDAClient interface { GetBlob(ctx context.Context, batchHeaderHash []byte, blobIndex uint32) ([]byte, error) PutBlob(ctx context.Context, txData []byte) (*grpcdisperser.BlobInfo, error) - GetPolynomialForm() codecs.PolynomialForm + GetPolynomialForm() codec.PolynomialForm Close() error } @@ -44,7 +44,7 @@ type EigenDAClient struct { Client DisperserClient ethClient *ethclient.Client edasmCaller *edasm.ContractEigenDAServiceManagerCaller - PolynomialForm codecs.PolynomialForm + PolynomialForm codec.PolynomialForm } var _ IEigenDAClient = &EigenDAClient{} @@ -115,11 +115,11 @@ func NewEigenDAClient(log log.Logger, config EigenDAClientConfig) (*EigenDAClien return nil, fmt.Errorf("new disperser-client: %w", err) } - var polynomialForm codecs.PolynomialForm + var polynomialForm codec.PolynomialForm if config.DisablePointVerificationMode { - polynomialForm = codecs.Eval + polynomialForm = codec.Eval } else { - polynomialForm = codecs.Coeff + polynomialForm = codec.Coeff } return &EigenDAClient{ @@ -136,7 +136,7 @@ func NewEigenDAClient(log log.Logger, config EigenDAClientConfig) (*EigenDAClien // // The polynomial form indicates how blobs must be constructed before dispersal, and how received blobs ought to be // interpreted. -func (m *EigenDAClient) GetPolynomialForm() codecs.PolynomialForm { +func (m *EigenDAClient) GetPolynomialForm() codec.PolynomialForm { return m.PolynomialForm } @@ -163,7 +163,7 @@ func (m *EigenDAClient) GetBlob(ctx context.Context, batchHeaderHash []byte, blo return nil, fmt.Errorf("blob to encoded payload: %w", err) } - decodedPayload, err := codecs.DecodePayload(encodedPayload) + decodedPayload, err := codec.DecodePayload(encodedPayload) if err != nil { return nil, fmt.Errorf("error decoding payload: %w", err) } @@ -224,7 +224,7 @@ func (m *EigenDAClient) PutBlobAsync(ctx context.Context, data []byte) (resultCh func (m *EigenDAClient) putBlob(ctxFinality context.Context, rawData []byte, resultChan chan *grpcdisperser.BlobInfo, errChan chan error) { m.Log.Info("Attempting to disperse blob to EigenDA") - encodedPayload := codecs.EncodePayload(rawData) + encodedPayload := codec.EncodePayload(rawData) blob, err := m.encodedPayloadToBlob(encodedPayload) if err != nil { @@ -417,10 +417,10 @@ func (m *EigenDAClient) batchIdConfirmedAtDepth(ctx context.Context, batchId uin // 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 { - case codecs.Eval: + case codec.Eval: return blob, nil - case codecs.Coeff: - encodedPayload, err := codecs.FFT(blob) + case codec.Coeff: + encodedPayload, err := codec.FFT(blob) if err != nil { return nil, fmt.Errorf("fft: %w", err) } @@ -437,10 +437,10 @@ func (m *EigenDAClient) blobToEncodedPayload(blob []byte) ([]byte, error) { // 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 { - case codecs.Eval: + case codec.Eval: return encodedPayload, nil - case codecs.Coeff: - coeffPolynomial, err := codecs.IFFT(encodedPayload) + case codec.Coeff: + coeffPolynomial, err := codec.IFFT(encodedPayload) if err != nil { return nil, fmt.Errorf("ifft: %w", err) } diff --git a/api/clients/eigenda_client_test.go b/api/clients/eigenda_client_test.go index 2aa559019..131e0c28f 100644 --- a/api/clients/eigenda_client_test.go +++ b/api/clients/eigenda_client_test.go @@ -7,11 +7,11 @@ import ( "time" "github.com/Layr-Labs/eigenda/api/clients" - "github.com/Layr-Labs/eigenda/api/clients/codecs" clientsmock "github.com/Layr-Labs/eigenda/api/clients/mock" "github.com/Layr-Labs/eigenda/api/grpc/common" grpcdisperser "github.com/Layr-Labs/eigenda/api/grpc/disperser" "github.com/Layr-Labs/eigenda/disperser" + "github.com/Layr-Labs/eigenda/encoding/utils/codec" "github.com/ethereum/go-ethereum/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -66,12 +66,12 @@ func TestPutRetrieveBlobIFFTSuccess(t *testing.T) { CustomQuorumIDs: []uint{}, SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d", DisableTLS: false, - PutBlobEncodingVersion: codecs.BlobEncodingVersion0, + PutBlobEncodingVersion: codec.BlobEncodingVersion0, DisablePointVerificationMode: false, WaitForFinalization: true, }, Client: disperserClient, - PolynomialForm: codecs.Coeff, + PolynomialForm: codec.Coeff, } expectedBlob := []byte("dc49e7df326cfb2e7da5cf68f263e1898443ec2e862350606e7dfbda55ad10b5d61ed1d54baf6ae7a86279c1b4fa9c49a7de721dacb211264c1f5df31bade51c") blobInfo, err := eigendaClient.PutBlob(context.Background(), expectedBlob) @@ -132,12 +132,12 @@ func TestPutRetrieveBlobNoIFFTSuccess(t *testing.T) { CustomQuorumIDs: []uint{}, SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d", DisableTLS: false, - PutBlobEncodingVersion: codecs.BlobEncodingVersion0, + PutBlobEncodingVersion: codec.BlobEncodingVersion0, DisablePointVerificationMode: true, WaitForFinalization: true, }, Client: disperserClient, - PolynomialForm: codecs.Eval, + PolynomialForm: codec.Eval, } expectedBlob := []byte("dc49e7df326cfb2e7da5cf68f263e1898443ec2e862350606e7dfbda55ad10b5d61ed1d54baf6ae7a86279c1b4fa9c49a7de721dacb211264c1f5df31bade51c") blobInfo, err := eigendaClient.PutBlob(context.Background(), expectedBlob) @@ -165,11 +165,11 @@ func TestPutBlobFailDispersal(t *testing.T) { CustomQuorumIDs: []uint{}, SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d", DisableTLS: false, - PutBlobEncodingVersion: codecs.BlobEncodingVersion0, + PutBlobEncodingVersion: codec.BlobEncodingVersion0, WaitForFinalization: true, }, Client: disperserClient, - PolynomialForm: codecs.Coeff, + PolynomialForm: codec.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -198,11 +198,11 @@ func TestPutBlobFailureInsufficentSignatures(t *testing.T) { CustomQuorumIDs: []uint{}, SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d", DisableTLS: false, - PutBlobEncodingVersion: codecs.BlobEncodingVersion0, + PutBlobEncodingVersion: codec.BlobEncodingVersion0, WaitForFinalization: true, }, Client: disperserClient, - PolynomialForm: codecs.Coeff, + PolynomialForm: codec.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -231,11 +231,11 @@ func TestPutBlobFailureGeneral(t *testing.T) { CustomQuorumIDs: []uint{}, SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d", DisableTLS: false, - PutBlobEncodingVersion: codecs.BlobEncodingVersion0, + PutBlobEncodingVersion: codec.BlobEncodingVersion0, WaitForFinalization: true, }, Client: disperserClient, - PolynomialForm: codecs.Coeff, + PolynomialForm: codec.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -264,11 +264,11 @@ func TestPutBlobFailureUnknown(t *testing.T) { CustomQuorumIDs: []uint{}, SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d", DisableTLS: false, - PutBlobEncodingVersion: codecs.BlobEncodingVersion0, + PutBlobEncodingVersion: codec.BlobEncodingVersion0, WaitForFinalization: true, }, Client: disperserClient, - PolynomialForm: codecs.Coeff, + PolynomialForm: codec.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -299,11 +299,11 @@ func TestPutBlobFinalizationTimeout(t *testing.T) { CustomQuorumIDs: []uint{}, SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d", DisableTLS: false, - PutBlobEncodingVersion: codecs.BlobEncodingVersion0, + PutBlobEncodingVersion: codec.BlobEncodingVersion0, WaitForFinalization: true, }, Client: disperserClient, - PolynomialForm: codecs.Coeff, + PolynomialForm: codec.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) require.Error(t, err) @@ -359,11 +359,11 @@ func TestPutBlobIndividualRequestTimeout(t *testing.T) { CustomQuorumIDs: []uint{}, SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d", DisableTLS: false, - PutBlobEncodingVersion: codecs.BlobEncodingVersion0, + PutBlobEncodingVersion: codec.BlobEncodingVersion0, WaitForFinalization: true, }, Client: disperserClient, - PolynomialForm: codecs.Coeff, + PolynomialForm: codec.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) @@ -422,11 +422,11 @@ func TestPutBlobTotalTimeout(t *testing.T) { CustomQuorumIDs: []uint{}, SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d", DisableTLS: false, - PutBlobEncodingVersion: codecs.BlobEncodingVersion0, + PutBlobEncodingVersion: codec.BlobEncodingVersion0, WaitForFinalization: true, }, Client: disperserClient, - PolynomialForm: codecs.Coeff, + PolynomialForm: codec.Coeff, } blobInfo, err := eigendaClient.PutBlob(context.Background(), []byte("hello")) diff --git a/encoding/utils/codec/codec.go b/encoding/utils/codec/codec.go index 09659d433..66987519b 100644 --- a/encoding/utils/codec/codec.go +++ b/encoding/utils/codec/codec.go @@ -1,9 +1,81 @@ package codec import ( + "bytes" + "encoding/binary" + "fmt" + "github.com/Layr-Labs/eigenda/encoding" ) +type BlobEncodingVersion byte + +const ( + // BlobEncodingVersion0 entails a 32 byte header = [0x00, version byte, big-endian uint32 len of payload, 0x00, 0x00,...] + // followed by the encoded data [0x00, 31 bytes of data, 0x00, 31 bytes of data,...] + BlobEncodingVersion0 BlobEncodingVersion = 0x0 +) + +// EncodePayload accepts an arbitrary payload byte array, and encodes it. +// +// The returned bytes shall be interpreted as a polynomial in Eval form, where each contained field element of +// length 32 represents the evaluation of the polynomial at an expanded root of unity +// +// The returned bytes may or may not represent a blob. If the system is configured to distribute blobs in Coeff form, +// then the data returned from this function must be IFFTed to produce the final blob. If the system is configured to +// distribute blobs in Eval form, then the data returned from this function is the final blob representation. +// +// Example encoding: +// Payload header (32 bytes total) Encoded Payload Data +// [0x00, version byte, big-endian uint32 len of payload, 0x00, ...] + [0x00, 31 bytes of data, 0x00, 31 bytes of data,...] +func EncodePayload(payload []byte) []byte { + payloadHeader := make([]byte, 32) + // first byte is always 0 to ensure the payloadHeader is a valid bn254 element + payloadHeader[1] = byte(BlobEncodingVersion0) // encode version byte + + // encode payload length as uint32 + binary.BigEndian.PutUint32( + payloadHeader[2:6], + uint32(len(payload))) // uint32 should be more than enough to store the length (approx 4gb) + + // encode payload modulo bn254 + // the resulting bytes subsequently may be treated as the evaluation of a polynomial + polynomialEval := ConvertByPaddingEmptyByte(payload) + + encodedPayload := append(payloadHeader, polynomialEval...) + + return encodedPayload +} + +// DecodePayload accepts bytes representing an encoded payload, and returns the decoded payload +// +// This function expects the parameter bytes to be a polynomial in Eval form. In other words, if blobs in the system +// are being distributed in Coeff form, a blob must be FFTed prior to being passed into the function. +func DecodePayload(encodedPayload []byte) ([]byte, error) { + if len(encodedPayload) < 32 { + return nil, fmt.Errorf("encoded payload does not contain 32 header bytes, meaning it is malformed") + } + + payloadLength := binary.BigEndian.Uint32(encodedPayload[2:6]) + + // decode raw data modulo bn254 + nonPaddedData := RemoveEmptyByteFromPaddedBytes(encodedPayload[32:]) + + reader := bytes.NewReader(nonPaddedData) + payload := make([]byte, payloadLength) + readLength, err := reader.Read(payload) + if err != nil { + return nil, fmt.Errorf( + "failed to copy unpadded data into final buffer, length: %d, bytes read: %d", + payloadLength, readLength) + } + if uint32(readLength) != payloadLength { + return nil, fmt.Errorf("data length does not match length prefix") + } + + return payload, nil +} + // ConvertByPaddingEmptyByte takes bytes and insert an empty byte at the front of every 31 byte. // The empty byte is padded at the low address, because we use big endian to interpret a field element. // This ensures every 32 bytes is within the valid range of a field element for bn254 curve. diff --git a/encoding/utils/codec/codec_test.go b/encoding/utils/codec/codec_test.go index 3137d7fe7..85dc6bb4f 100644 --- a/encoding/utils/codec/codec_test.go +++ b/encoding/utils/codec/codec_test.go @@ -1,9 +1,11 @@ package codec_test import ( + "bytes" "crypto/rand" "testing" + "github.com/Layr-Labs/eigenda/common/testutils/random" "github.com/Layr-Labs/eigenda/encoding/rs" "github.com/Layr-Labs/eigenda/encoding/utils/codec" "github.com/stretchr/testify/require" @@ -49,3 +51,33 @@ func TestSimplePaddingCodec_Fuzz(t *testing.T) { } } } + +// TestCodec tests the encoding and decoding of random byte streams +func TestPayloadEncoding(t *testing.T) { + testRandom := random.NewTestRandom(t) + + // Number of test iterations + const iterations = 100 + + for i := 0; i < iterations; i++ { + originalData := testRandom.Bytes(testRandom.Intn(1024) + 1) + + // Encode the original data + encodedData := codec.EncodePayload(originalData) + + // Decode the encoded data + decodedData, err := codec.DecodePayload(encodedData) + if err != nil { + t.Fatalf("Iteration %d: failed to decode blob: %v", i, err) + } + + // Compare the original data with the decoded data + if !bytes.Equal(originalData, decodedData) { + t.Fatalf( + "Iteration %d: original and decoded data do not match\nOriginal: %v\nDecoded: %v", + i, + originalData, + decodedData) + } + } +} diff --git a/api/clients/codecs/fft.go b/encoding/utils/codec/fft.go similarity index 99% rename from api/clients/codecs/fft.go rename to encoding/utils/codec/fft.go index a190d29d4..d0e9328dc 100644 --- a/api/clients/codecs/fft.go +++ b/encoding/utils/codec/fft.go @@ -1,4 +1,4 @@ -package codecs +package codec import ( "fmt" diff --git a/api/clients/codecs/fft_test.go b/encoding/utils/codec/fft_test.go similarity index 98% rename from api/clients/codecs/fft_test.go rename to encoding/utils/codec/fft_test.go index 80ccc5ff8..8ee67a120 100644 --- a/api/clients/codecs/fft_test.go +++ b/encoding/utils/codec/fft_test.go @@ -1,4 +1,4 @@ -package codecs +package codec import ( "bytes" diff --git a/api/clients/codecs/polynomial_form.go b/encoding/utils/codec/polynomial_form.go similarity index 96% rename from api/clients/codecs/polynomial_form.go rename to encoding/utils/codec/polynomial_form.go index b4687c52b..9f265ccf3 100644 --- a/api/clients/codecs/polynomial_form.go +++ b/encoding/utils/codec/polynomial_form.go @@ -1,4 +1,4 @@ -package codecs +package codec // PolynomialForm is an enum that represents the different ways that a blob polynomial may be represented type PolynomialForm uint