Skip to content

P2P: broadcast blob #12419

Merged
terencechain merged 6 commits intodeneb-integrationfrom
blob-broadcast
May 23, 2023
Merged

P2P: broadcast blob #12419
terencechain merged 6 commits intodeneb-integrationfrom
blob-broadcast

Conversation

@terencechain
Copy link
Collaborator

Add BroadcastBlob to enable the broadcast of blob. Similar to Broadcast sync committee and attestation design

@terencechain terencechain self-assigned this May 17, 2023
@terencechain terencechain requested a review from a team as a code owner May 17, 2023 20:02
@terencechain terencechain requested review from potuz, rauljordan and saolyn and removed request for a team May 17, 2023 20:02
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the only validation we need to do before a blob sidecar is broadcasted? do we need to validate blob with kzg?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just broadcast from p2p's perspective. Validations (if there are any) are done before this

Copy link
Contributor

@nisdas nisdas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_, span := trace.StartSpan(ctx, "p2p.broadcastBlob")
_, span := trace.StartSpan(ctx, "p2p.broadcastBlobBackground")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed the function to broadcastBlob

Comment on lines 456 to 458
if len(p1.BHost.Network().Peers()) == 0 {
t.Fatal("No peers")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed to

require.NotEqual(t, 0, len(p1.BHost.Network().Peers()), "No peers")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 515 to 516
if !proto.Equal(result, blobSidecar) {
tt.Errorf("Did not receive expected message, got %+v, wanted %+v", result, blobSidecar)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly, you merged a utility assertion function for comparing proto objects. It can be used here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 526 to 528
if util.WaitTimeout(&wg, 1*time.Second) {
t.Error("Failed to receive pubsub within 1s")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be replaced with

assert.Equal(t, false, util.WaitTimeout(&wg, 1*time.Second), "Failed to receive pubsub within 1s")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@terencechain
Copy link
Collaborator Author

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

66d1811

// 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will conflict with attestation subnets, you should change it to 110 <=

james-prysm pushed a commit that referenced this pull request May 23, 2023
terencechain added a commit that referenced this pull request May 26, 2023
terencechain added a commit that referenced this pull request May 31, 2023
terencechain added a commit that referenced this pull request Jun 7, 2023
terencechain added a commit that referenced this pull request Jun 12, 2023
terencechain added a commit that referenced this pull request Jun 12, 2023
terencechain added a commit that referenced this pull request Jun 16, 2023
terencechain added a commit that referenced this pull request Jun 27, 2023
terencechain added a commit that referenced this pull request Jul 7, 2023
terencechain added a commit that referenced this pull request Jul 9, 2023
terencechain added a commit that referenced this pull request Jul 10, 2023
kasey pushed a commit that referenced this pull request Jul 20, 2023
james-prysm pushed a commit that referenced this pull request Aug 4, 2023
terencechain added a commit that referenced this pull request Aug 16, 2023
kasey pushed a commit that referenced this pull request Aug 21, 2023
kasey pushed a commit that referenced this pull request Aug 22, 2023
kasey pushed a commit that referenced this pull request Aug 22, 2023
kasey pushed a commit that referenced this pull request Aug 22, 2023
kasey pushed a commit that referenced this pull request Aug 23, 2023
kasey pushed a commit that referenced this pull request Aug 23, 2023
kasey pushed a commit that referenced this pull request Aug 23, 2023
kasey pushed a commit that referenced this pull request Aug 24, 2023
kasey pushed a commit that referenced this pull request Aug 24, 2023
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
prestonvanloon pushed a commit that referenced this pull request Aug 24, 2023
prestonvanloon pushed a commit that referenced this pull request Aug 30, 2023
prestonvanloon pushed a commit that referenced this pull request Aug 30, 2023
prestonvanloon pushed a commit that referenced this pull request Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants