Skip to content

Conversation

litt3
Copy link
Contributor

@litt3 litt3 commented Feb 19, 2025

Why are these changes needed?

  • As discussed here, we have come to agreement that we shouldn't check that what a retrieving client receives is greater than 0 length
  • This PR removes the 0 length check, and since the remaining method contents were only a single comparison, I removed the helper method and class entirely, in favor of simply doing the comparison

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@litt3 litt3 self-assigned this Feb 19, 2025
@litt3 litt3 marked this pull request as ready for review February 19, 2025 21:42
@litt3 litt3 requested review from anupsv, samlaf and bxue-l2 February 19, 2025 21:42
err = verification.CheckBlobLength(blob, blobCommitments.Length)
if err != nil {
pr.log.Warn("check blob length", "blobKey", blobKey.Hex(), "relayKey", relayKey, "error", err)
if uint(len(blob)) > blobCommitments.Length*encoding.BYTES_PER_SYMBOL {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is the kind of code that I'm trying to avoid by forcing unit suffixes everywhere :
It's basically impossible for me to know whether this check is correct without an IDE, which I don't like that much.

Copy link
Collaborator

Choose a reason for hiding this comment

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

EDIT: I actually even checkout out the code on vscode and still didn't have enough context to verify this inequality. Can you add comments to BlobCommitments struct (

type BlobCommitments struct {
) and also fix the comment (BlomCommitments -> BlobCommitments)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also is it normal that blob is an array of bytes? Is this something that your new type system fixes? Aren't blobs arrays of Fr.Elements now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this something that your new type system fixes?

Correct. Now that the type system PR has merged, I will be putting up a PR which updates these clients to use the new types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the kind of code that I'm trying to avoid by forcing unit suffixes everywhere

💯 agree. I'm on board with adopting this standard, so definitely point out if you see me forgetting and generating any new code without a proper suffix

Can you add comments to BlobCommitments struct

Sure, I will add some comments there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment added to BlobCommitments about blob length ea0c0538, to resolve the issue with units.

I didn't add comments to the other fields, since I'm not equipped to provide a nuanced description of how the elements relate to each other. This could definitely use some attention from someone able to write such a description

Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome thanks for the updates. For the BlobCommitment comments, you can look at the proto comments, they should prob just match: https://github.com/Layr-Labs/eigenda/blob/master/api/proto/common/common.proto#L13-L27

The state of comment drift across proto/backend/contract is one thing that I really had a way to solve. I think CUElang has some really interesting approach to this, which I want to look deeper into. But otherwise for now, perhaps we can just add a link to proto file from the backend struct to prevent comment drift?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think it would be really good to have a way to keep comments consistent. Next time I touch this area of code, I'll add a link as suggested

@litt3 litt3 requested a review from samlaf February 20, 2025 15:00
"blobKey", blobKey.Hex(),
"relayKey", relayKey,
"receivedLengthBytes", len(blob),
"claimedLengthBytes", blobCommitments.Length*encoding.BYTES_PER_SYMBOL)
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

It's fine to skip over because the disperser returns the length which includes any "0" value elements at the end correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. If a relay returns anything > blob length in the commitment, we know reflexively that the bytes cannot be correct

Copy link
Collaborator

@samlaf samlaf left a comment

Choose a reason for hiding this comment

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

Happy with current state

@litt3 litt3 merged commit e2fc300 into master Feb 21, 2025
12 checks passed
@litt3 litt3 deleted the allow-0-len-from-relay branch February 21, 2025 17:55
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.

3 participants