P2P: broadcast blob #12419
Conversation
| func (s *Service) BroadcastBlob(ctx context.Context, subnet uint64, blob *ethpb.SignedBlobSidecar) error { | ||
| ctx, span := trace.StartSpan(ctx, "p2p.BroadcastBlob") | ||
| defer span.End() | ||
| if blob == nil { |
There was a problem hiding this comment.
is this the only validation we need to do before a blob sidecar is broadcasted? do we need to validate blob with kzg?
There was a problem hiding this comment.
This is just broadcast from p2p's perspective. Validations (if there are any) are done before this
nisdas
left a comment
There was a problem hiding this comment.
As a guide you can look at broadcastAttestation broadcastSyncCommittee , we do some additional checks to ensure we have peers in those particular topics. The current PR simply broadcasts the object as it is
| } | ||
|
|
||
| func (s *Service) broadcastBlobBackground(ctx context.Context, subnet uint64, blobSidecar *ethpb.SignedBlobSidecar, forkDigest [4]byte) { | ||
| _, span := trace.StartSpan(ctx, "p2p.broadcastBlob") |
There was a problem hiding this comment.
| _, span := trace.StartSpan(ctx, "p2p.broadcastBlob") | |
| _, span := trace.StartSpan(ctx, "p2p.broadcastBlobBackground") |
There was a problem hiding this comment.
renamed the function to broadcastBlob
beacon-chain/p2p/broadcaster_test.go
Outdated
| if len(p1.BHost.Network().Peers()) == 0 { | ||
| t.Fatal("No peers") | ||
| } |
There was a problem hiding this comment.
This can be changed to
require.NotEqual(t, 0, len(p1.BHost.Network().Peers()), "No peers")
beacon-chain/p2p/broadcaster_test.go
Outdated
| if !proto.Equal(result, blobSidecar) { | ||
| tt.Errorf("Did not receive expected message, got %+v, wanted %+v", result, blobSidecar) |
There was a problem hiding this comment.
If I remember correctly, you merged a utility assertion function for comparing proto objects. It can be used here.
beacon-chain/p2p/broadcaster_test.go
Outdated
| if util.WaitTimeout(&wg, 1*time.Second) { | ||
| t.Error("Failed to receive pubsub within 1s") | ||
| } |
There was a problem hiding this comment.
This can be replaced with
assert.Equal(t, false, util.WaitTimeout(&wg, 1*time.Second), "Failed to receive pubsub within 1s")
6e9f6fd to
ce4a937
Compare
b7f8ffc to
33dda46
Compare
|
beacon-chain/p2p/subnets.go
Outdated
| // the relevant lock. This is used to differentiate | ||
| // blob subnets from others. This is deliberately | ||
| // chosen as less than 4(blob subnet count). | ||
| const blobSubnetLockerVal = 4 |
There was a problem hiding this comment.
This will conflict with attestation subnets, you should change it to 110 <=
703450c to
4a9b18b
Compare
dbbd8d2 to
9568071
Compare
Add
BroadcastBlobto enable the broadcast of blob. Similar to Broadcast sync committee and attestation design