From e2e729f4216f8bb5936efed4f231c7747bfedbce Mon Sep 17 00:00:00 2001 From: ChengenH Date: Thu, 25 Apr 2024 20:50:39 +0800 Subject: [PATCH 1/3] refactor: Removed unused parameters for improved code readability. --- common/ratelimit.go | 2 +- retriever/cmd/main.go | 2 +- retriever/server.go | 2 -- retriever/server_test.go | 2 +- test/integration_test.go | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/common/ratelimit.go b/common/ratelimit.go index 4965467612..5d4950019e 100644 --- a/common/ratelimit.go +++ b/common/ratelimit.go @@ -63,7 +63,7 @@ type RateBucketParams struct { } // GetClientAddress returns the client address from the context. If the header is not empty, it will -// take the ip address located at the `numProxies“ position from the end of the header. If the ip address cannot be +// take the ip address located at the `numProxies` position from the end of the header. If the ip address cannot be // found in the header, it will use the connection ip if `allowDirectConnectionFallback` is true. Otherwise, it will return // an error. func GetClientAddress(ctx context.Context, header string, numProxies int, allowDirectConnectionFallback bool) (string, error) { diff --git a/retriever/cmd/main.go b/retriever/cmd/main.go index b10548f06c..5d23d815f7 100644 --- a/retriever/cmd/main.go +++ b/retriever/cmd/main.go @@ -135,7 +135,7 @@ func RetrieverMain(ctx *cli.Context) error { } chainClient := retrivereth.NewChainClient(gethClient, logger) - retrieverServiceServer := retriever.NewServer(config, logger, retrievalClient, v, ics, chainClient) + retrieverServiceServer := retriever.NewServer(config, logger, retrievalClient, ics, chainClient) if err = retrieverServiceServer.Start(context.Background()); err != nil { log.Fatalln("failed to start retriever service server", err) } diff --git a/retriever/server.go b/retriever/server.go index 22da29f9fb..a641fee6f4 100644 --- a/retriever/server.go +++ b/retriever/server.go @@ -7,7 +7,6 @@ import ( pb "github.com/Layr-Labs/eigenda/api/grpc/retriever" "github.com/Layr-Labs/eigenda/clients" "github.com/Layr-Labs/eigenda/core" - "github.com/Layr-Labs/eigenda/encoding" "github.com/Layr-Labs/eigenda/retriever/eth" "github.com/Layr-Labs/eigensdk-go/logging" gcommon "github.com/ethereum/go-ethereum/common" @@ -28,7 +27,6 @@ func NewServer( config *Config, logger logging.Logger, retrievalClient clients.RetrievalClient, - verifier encoding.Verifier, indexedState core.IndexedChainState, chainClient eth.ChainClient, ) *Server { diff --git a/retriever/server_test.go b/retriever/server_test.go index dcb48cc24c..12445c2533 100644 --- a/retriever/server_test.go +++ b/retriever/server_test.go @@ -78,7 +78,7 @@ func newTestServer(t *testing.T) *retriever.Server { retrievalClient = &clientsmock.MockRetrievalClient{} chainClient = mock.NewMockChainClient() - return retriever.NewServer(config, logger, retrievalClient, v, indexedChainState, chainClient) + return retriever.NewServer(config, logger, retrievalClient, indexedChainState, chainClient) } func TestRetrieveBlob(t *testing.T) { diff --git a/test/integration_test.go b/test/integration_test.go index 56c7c7d92b..3003560f12 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -335,7 +335,7 @@ func mustMakeRetriever(cst core.IndexedChainState, logger logging.Logger) (*comm gethClient := &commonmock.MockEthClient{} retrievalClient := &clientsmock.MockRetrievalClient{} chainClient := retrievermock.NewMockChainClient() - server := retriever.NewServer(config, logger, retrievalClient, v, cst, chainClient) + server := retriever.NewServer(config, logger, retrievalClient, cst, chainClient) return gethClient, TestRetriever{ Server: server, From 9e631a83a975cc47b5aad6794e322fff80cb8db3 Mon Sep 17 00:00:00 2001 From: ChengenH Date: Fri, 26 Apr 2024 07:23:40 +0800 Subject: [PATCH 2/3] refactor: Removed unused parameters for improved code readability. --- retriever/server_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retriever/server_test.go b/retriever/server_test.go index 12445c2533..227bbed83e 100644 --- a/retriever/server_test.go +++ b/retriever/server_test.go @@ -71,7 +71,7 @@ func newTestServer(t *testing.T) *retriever.Server { log.Fatalf("failed to create new mocked chain data: %s", err) } - _, v, err := makeTestComponents() + _, _, err = makeTestComponents() if err != nil { log.Fatal(err) } From 94de3eb9b88b94a93d5af9dc5e2ffe28e1eea8ce Mon Sep 17 00:00:00 2001 From: ChengenH Date: Fri, 26 Apr 2024 12:29:43 +0800 Subject: [PATCH 3/3] chore: update docs --- api/proto/node/node.proto | 2 +- encoding/data.go | 2 +- encoding/rs/encode.go | 2 +- indexer/accumulator.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/proto/node/node.proto b/api/proto/node/node.proto index 69228d721d..f31646742b 100644 --- a/api/proto/node/node.proto +++ b/api/proto/node/node.proto @@ -19,7 +19,7 @@ service Dispersal { service Retrieval { // RetrieveChunks retrieves the chunks for a blob custodied at the Node. rpc RetrieveChunks(RetrieveChunksRequest) returns (RetrieveChunksReply) {} - // Similar to RetrieveChunks, this just returns the header of the blob. + // GetBlobHeader is similar to RetrieveChunks, this just returns the header of the blob. rpc GetBlobHeader(GetBlobHeaderRequest) returns (GetBlobHeaderReply) {} } diff --git a/encoding/data.go b/encoding/data.go index 3ed8646677..5c9df99821 100644 --- a/encoding/data.go +++ b/encoding/data.go @@ -14,7 +14,7 @@ type G2Commitment bn254.G2Affine // LengthProof is a polynomial commitment on G2 (e.g. a kzg commitment) used for low degree proof type LengthProof = G2Commitment -// The proof used to open a commitment. In the case of Kzg, this is also a kzg commitment, and is different from a Commitment only semantically. +// Proof is used to open a commitment. In the case of Kzg, this is also a kzg commitment, and is different from a Commitment only semantically. type Proof = bn254.G1Affine // Symbol is a symbol in the field used for polynomial commitments diff --git a/encoding/rs/encode.go b/encoding/rs/encode.go index e6af5de81f..401b6f9639 100644 --- a/encoding/rs/encode.go +++ b/encoding/rs/encode.go @@ -66,7 +66,7 @@ func (g *Encoder) Encode(inputFr []fr.Element) (*GlobalPoly, []Frame, []uint32, return poly, frames, indices, nil } -// This Function takes extended evaluation data and bundles relevant information into Frame. +// MakeFrames function takes extended evaluation data and bundles relevant information into Frame. // Every frame is verifiable to the commitment. func (g *Encoder) MakeFrames( polyEvals []fr.Element, diff --git a/indexer/accumulator.go b/indexer/accumulator.go index 41b8dd4803..c2eb5504da 100644 --- a/indexer/accumulator.go +++ b/indexer/accumulator.go @@ -8,9 +8,9 @@ type Accumulator interface { UpdateObject(object AccumulatorObject, header *Header, event Event) (AccumulatorObject, error) - // Serialize object takes the accummulator object, and serializes it using the rules for the specified fork. + // SerializeObject takes the accumulator object, and serializes it using the rules for the specified fork. SerializeObject(object AccumulatorObject, fork UpgradeFork) ([]byte, error) - // DeSerialize object deserializes an accumulator object using the rules for the specified fork. + // DeserializeObject deserializes an accumulator object using the rules for the specified fork. DeserializeObject(data []byte, fork UpgradeFork) (AccumulatorObject, error) }