Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(blobs): Validate Index field in BlobSidecar during processing #2289

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions da/blob/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type ConsensusSidecars interface {
}

type Sidecar interface {
GetIndex() uint64
GetBlob() eip4844.Blob
GetKzgProof() eip4844.KZGProof
GetKzgCommitment() eip4844.KZGCommitment
Expand Down
5 changes: 5 additions & 0 deletions da/blob/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func (bv *verifier) verifySidecars(
// Verifying that sidecars block headers match with header of the
// corresponding block concurrently.
for i, s := range sidecars.GetSidecars() {
// This check happens outside the goroutines so that we do not
// process the inclusion proofs before validating the index.
if s.GetIndex() >= bv.chainSpec.MaxBlobsPerBlock() {
return fmt.Errorf("invalid sidecar Index: %d", i)
}
g.Go(func() error {
var sigHeader = s.GetSignedBeaconBlockHeader()

Expand Down
4 changes: 4 additions & 0 deletions da/types/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ func (b *BlobSidecar) HasValidInclusionProof(
)
}

func (b *BlobSidecar) GetIndex() uint64 {
return b.Index
}

func (b *BlobSidecar) GetBlob() eip4844.Blob {
return b.Blob
}
Expand Down
Loading