From e34e94c63c6a9ca44ed200f8b4da93019fb6adda Mon Sep 17 00:00:00 2001 From: Ian Shim Date: Sun, 17 Mar 2024 22:40:48 -0700 Subject: [PATCH] minor fixes --- 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 632ff8c8b3..2bdfabf686 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 d6e0d6e768..50834cf6bd 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 46fbfedd5a..b80933f64e 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 0c296ca532..fc9f2e3366 100644 --- a/disperser/apiserver/server.go +++ b/disperser/apiserver/server.go @@ -98,7 +98,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") } @@ -136,7 +136,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") } @@ -252,7 +252,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, ", ")) err = s.validateBlobRequest(ctx, blob) if err != nil { diff --git a/node/grpc/server.go b/node/grpc/server.go index 2502cd0142..a28c57314d 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 c4a89eadf3..b0f369249e 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 75cb8d2655..af6524c6a2 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,