From a5f9e243b2e39985d359de7d21e9ebcfbd837ee6 Mon Sep 17 00:00:00 2001 From: Ian Shim <100327837+ian-shim@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:34:06 -0700 Subject: [PATCH] Minor fixes (#358) --- api/docs/disperser.md | 2 +- api/grpc/churner/churner.pb.go | 15 ++++++++------- api/grpc/disperser/disperser.pb.go | 2 +- api/proto/disperser/disperser.proto | 2 +- core/data.go | 2 +- disperser/apiserver/server.go | 6 +++--- node/grpc/server.go | 4 ++-- node/grpc/utils.go | 2 +- retriever/eth/chain_client.go | 2 +- 9 files changed, 19 insertions(+), 18 deletions(-) diff --git a/api/docs/disperser.md b/api/docs/disperser.md index fac70433e0..2ea6d9526d 100644 --- a/api/docs/disperser.md +++ b/api/docs/disperser.md @@ -160,7 +160,7 @@ AuthenticationData contains the signature of the BlobAuthHeader. ### BlobAuthHeader BlobAuthHeader contains information about the blob for the client to verify and sign. -- Once payments are enabled, the BlobAuthHeader the KZG commitment to the blob, which the client +- Once payments are enabled, the BlobAuthHeader will contain the KZG commitment to the blob, which the client will verify and sign. Having the client verify the KZG commitment instead of calculating it avoids the need for the client to have the KZG structured reference string (SRS), which can be large. The signed KZG commitment prevents the disperser from sending a different blob to the DA Nodes diff --git a/api/grpc/churner/churner.pb.go b/api/grpc/churner/churner.pb.go index d5b3517038..3cf597b918 100644 --- a/api/grpc/churner/churner.pb.go +++ b/api/grpc/churner/churner.pb.go @@ -131,15 +131,16 @@ type ChurnReply struct { // The signature signed by the Churner. SignatureWithSaltAndExpiry *SignatureWithSaltAndExpiry `protobuf:"bytes,1,opt,name=signature_with_salt_and_expiry,json=signatureWithSaltAndExpiry,proto3" json:"signature_with_salt_and_expiry,omitempty"` // A list of existing operators that get churned out. - // This list will contain the target operators to be churned out for all quorums specified - // in the ChurnRequest even if some quorums may not have any churned out operators. - // It is smart contract's responsibility to determine whether it needs to churn out - // these target operators based on whether the quorums have available space. + // This list will contain all quorums specified in the ChurnRequest even if some quorums + // may not have any churned out operators. If a quorum has available space, OperatorToChurn + // object will contain the quorum ID and empty operator and pubkey. The smart contract should + // only churn out the operators for quorums that are full. // // For example, if the ChurnRequest specifies quorums 0 and 1 where quorum 0 is full - // and quorum 1 has available space, the ChurnReply will contain the operators to be - // churned out for both quorums 0 and 1 (operators with lowest stake). However, - // smart contract should only churn out the operators for quorum 0 because quorum 1 + // and quorum 1 has available space, the ChurnReply will contain two OperatorToChurn objects + // with the respective quorums. OperatorToChurn for quorum 0 will contain the operator to churn + // out and OperatorToChurn for quorum 1 will contain empty operator (zero address) and pubkey. + // The smart contract should only churn out the operators for quorum 0 because quorum 1 // has available space without having any operators churned. // Note: it's possible an operator gets churned out just for one or more quorums // (rather than entirely churned out for all quorums). diff --git a/api/grpc/disperser/disperser.pb.go b/api/grpc/disperser/disperser.pb.go index 41a5ce440b..4a94490a67 100644 --- a/api/grpc/disperser/disperser.pb.go +++ b/api/grpc/disperser/disperser.pb.go @@ -250,7 +250,7 @@ func (*AuthenticatedReply_BlobAuthHeader) isAuthenticatedReply_Payload() {} func (*AuthenticatedReply_DisperseReply) isAuthenticatedReply_Payload() {} // BlobAuthHeader contains information about the blob for the client to verify and sign. -// - Once payments are enabled, the BlobAuthHeader the KZG commitment to the blob, which the client +// - Once payments are enabled, the BlobAuthHeader will contain the KZG commitment to the blob, which the client // will verify and sign. Having the client verify the KZG commitment instead of calculating it avoids // the need for the client to have the KZG structured reference string (SRS), which can be large. // The signed KZG commitment prevents the disperser from sending a different blob to the DA Nodes diff --git a/api/proto/disperser/disperser.proto b/api/proto/disperser/disperser.proto index 4355dfb775..e4cd7c0f66 100644 --- a/api/proto/disperser/disperser.proto +++ b/api/proto/disperser/disperser.proto @@ -53,7 +53,7 @@ message AuthenticatedReply { } // BlobAuthHeader contains information about the blob for the client to verify and sign. -// - Once payments are enabled, the BlobAuthHeader the KZG commitment to the blob, which the client +// - Once payments are enabled, the BlobAuthHeader will contain the KZG commitment to the blob, which the client // will verify and sign. Having the client verify the KZG commitment instead of calculating it avoids // the need for the client to have the KZG structured reference string (SRS), which can be large. // The signed KZG commitment prevents the disperser from sending a different blob to the DA Nodes diff --git a/core/data.go b/core/data.go index b25b058ac7..10b8a90345 100644 --- a/core/data.go +++ b/core/data.go @@ -104,7 +104,7 @@ type BlobHeader struct { QuorumInfos []*BlobQuorumInfo // AccountID is the account that is paying for the blob to be stored - AccountID AccountID `json:"account_id"` + AccountID AccountID } func (b *BlobHeader) GetQuorumInfo(quorum QuorumID) *BlobQuorumInfo { diff --git a/disperser/apiserver/server.go b/disperser/apiserver/server.go index ebe0263ae3..0e64a3e417 100644 --- a/disperser/apiserver/server.go +++ b/disperser/apiserver/server.go @@ -104,7 +104,7 @@ func (s *DispersalServer) DisperseBlobAuthenticated(stream pb.Disperser_Disperse return api.NewInvalidArgError(fmt.Sprintf("error receiving next message: %v", err)) } - request, ok := in.Payload.(*pb.AuthenticatedRequest_DisperseRequest) + request, ok := in.GetPayload().(*pb.AuthenticatedRequest_DisperseRequest) if !ok { return api.NewInvalidArgError("missing DisperseBlobRequest") } @@ -148,7 +148,7 @@ func (s *DispersalServer) DisperseBlobAuthenticated(stream pb.Disperser_Disperse return api.NewInvalidArgError(fmt.Sprintf("error receiving next message: %v", err)) } - challengeReply, ok := in.Payload.(*pb.AuthenticatedRequest_AuthenticationData) + challengeReply, ok := in.GetPayload().(*pb.AuthenticatedRequest_AuthenticationData) if !ok { return api.NewInvalidArgError("expected AuthenticationData") } @@ -223,7 +223,7 @@ func (s *DispersalServer) disperseBlob(ctx context.Context, blob *core.Blob, aut return nil, api.NewInvalidArgError(err.Error()) } - s.logger.Debug("received a new blob request", "origin", origin, "securityParams", strings.Join(securityParamsStrings, ", ")) + s.logger.Debug("received a new blob dispersal request", "origin", origin, "securityParams", strings.Join(securityParamsStrings, ", ")) if s.ratelimiter != nil { err := s.checkRateLimitsAndAddRates(ctx, blob, origin, authenticatedAddress) diff --git a/node/grpc/server.go b/node/grpc/server.go index 3d6e3dc353..45d16e6909 100644 --- a/node/grpc/server.go +++ b/node/grpc/server.go @@ -83,7 +83,7 @@ func (s *Server) serveDispersal() error { addr := fmt.Sprintf("%s:%s", localhost, s.config.InternalDispersalPort) listener, err := net.Listen("tcp", addr) if err != nil { - s.logger.Fatalf("Could not start tcp listener: %w", err) + s.logger.Fatalf("Could not start tcp listener: %v", err) } opt := grpc.MaxRecvMsgSize(1024 * 1024 * 1024) // 1 GiB @@ -107,7 +107,7 @@ func (s *Server) serveRetrieval() error { addr := fmt.Sprintf("%s:%s", localhost, s.config.InternalRetrievalPort) listener, err := net.Listen("tcp", addr) if err != nil { - s.logger.Fatalf("Could not start tcp listener: %w", err) + s.logger.Fatalf("Could not start tcp listener: %v", err) } opt := grpc.MaxRecvMsgSize(1024 * 1024 * 300) // 300 MiB diff --git a/node/grpc/utils.go b/node/grpc/utils.go index 91552a9edd..212cc59277 100644 --- a/node/grpc/utils.go +++ b/node/grpc/utils.go @@ -21,7 +21,7 @@ func GetBatchHeader(in *pb.StoreChunksRequest) (*core.BatchHeader, error) { var batchRoot [32]byte copy(batchRoot[:], in.GetBatchHeader().GetBatchRoot()) batchHeader := core.BatchHeader{ - ReferenceBlockNumber: uint(in.BatchHeader.ReferenceBlockNumber), + ReferenceBlockNumber: uint(in.GetBatchHeader().GetReferenceBlockNumber()), BatchRoot: batchRoot, } return &batchHeader, nil diff --git a/retriever/eth/chain_client.go b/retriever/eth/chain_client.go index a0cea4bfe9..92c88d6206 100644 --- a/retriever/eth/chain_client.go +++ b/retriever/eth/chain_client.go @@ -22,7 +22,7 @@ type chainClient struct { logger logging.Logger } -func NewChainClient(ethClient common.EthClient, logger logging.Logger) *chainClient { +func NewChainClient(ethClient common.EthClient, logger logging.Logger) ChainClient { return &chainClient{ ethClient: ethClient, logger: logger,