Skip to content

Commit

Permalink
Fix columns sampling (#14118)
Browse files Browse the repository at this point in the history
  • Loading branch information
nalepae committed Jun 18, 2024
1 parent 5f8aad4 commit 8f65ff2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion beacon-chain/p2p/rpc_topic_mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ var RPCTopicMappings = map[string]interface{}{
// DataColumnSidecarsByRange v1 Message
RPCDataColumnSidecarsByRangeTopicV1: new(pb.DataColumnSidecarsByRangeRequest),
// DataColumnSidecarsByRoot v1 Message
RPCDataColumnSidecarsByRootTopicV1: new(p2ptypes.BlobSidecarsByRootReq),
RPCDataColumnSidecarsByRootTopicV1: new(p2ptypes.DataColumnSidecarsByRootReq),
}

// Maps all registered protocol prefixes.
Expand Down
10 changes: 5 additions & 5 deletions beacon-chain/sync/rpc_data_column_sidecars_by_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ func (s *Service) dataColumnSidecarByRootRPCHandler(ctx context.Context, msg int

// We use the same type as for blobs as they are the same data structure.
// TODO: Make the type naming more generic to be extensible to data columns
ref, ok := msg.(*types.BlobSidecarsByRootReq)
ref, ok := msg.(*types.DataColumnSidecarsByRootReq)
if !ok {
return errors.New("message is not type BlobSidecarsByRootReq")
return errors.New("message is not type DataColumnSidecarsByRootReq")
}

requestedColumnIdents := *ref
Expand All @@ -54,7 +54,7 @@ func (s *Service) dataColumnSidecarByRootRPCHandler(ctx context.Context, msg int

requestedColumnsList := make([]uint64, 0, len(requestedColumnIdents))
for _, ident := range requestedColumnIdents {
requestedColumnsList = append(requestedColumnsList, ident.Index)
requestedColumnsList = append(requestedColumnsList, ident.ColumnIndex)
}

// TODO: Customize data column batches too
Expand Down Expand Up @@ -127,7 +127,7 @@ func (s *Service) dataColumnSidecarByRootRPCHandler(ctx context.Context, msg int
}

s.rateLimiter.add(stream, 1)
requestedRoot, requestedIndex := bytesutil.ToBytes32(requestedColumnIdents[i].BlockRoot), requestedColumnIdents[i].Index
requestedRoot, requestedIndex := bytesutil.ToBytes32(requestedColumnIdents[i].BlockRoot), requestedColumnIdents[i].ColumnIndex

// Decrease the peer's score if it requests a column that is not custodied.
isCustodied := custodiedColumns[requestedIndex]
Expand Down Expand Up @@ -207,7 +207,7 @@ func (s *Service) dataColumnSidecarByRootRPCHandler(ctx context.Context, msg int
return nil
}

func validateDataColummnsByRootRequest(colIdents types.BlobSidecarsByRootReq) error {
func validateDataColummnsByRootRequest(colIdents types.DataColumnSidecarsByRootReq) error {
if uint64(len(colIdents)) > params.BeaconConfig().MaxRequestDataColumnSidecars {
return types.ErrMaxDataColumnReqExceeded
}
Expand Down

0 comments on commit 8f65ff2

Please sign in to comment.