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

Check that disperser uses correct blob length #1290

Merged
merged 2 commits into from
Feb 20, 2025
Merged
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions api/clients/v2/disperser_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ func (c *disperserClient) DisperseBlob(
return nil, [32]byte{}, fmt.Errorf("error deserializing blob commitments: %w", err)
}
blobCommitments = *deserialized

// We need to check that the disperser used the correct length. Even once checking the commitment from the
// disperser has been implemented, there is still an edge case where the disperser could truncate trailing 0s,
// yielding the wrong blob length, but not causing commitment verification to fail. It is important that the
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a change on the disperser side to make sure this case is handled ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so- this check is intended to protect against a disperser maliciously/incorrectly truncating 0s

// commitment doesn't report a blob length smaller than expected, since this could cause payload parsing to
// fail, if the length claimed in the encoded payload header is larger than the blob length in the commitment.
lengthFromCommitment := commitments.GetBlobCommitment().GetLength()
if lengthFromCommitment != uint32(symbolLength) {
return nil, [32]byte{}, fmt.Errorf(
"blob commitment length (%d) from disperser doesn't match expected length (%d): %w",
lengthFromCommitment, symbolLength, err)
}
} else {
// if prover is configured, get commitments from prover

Expand Down
Loading