-
Notifications
You must be signed in to change notification settings - Fork 198
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
Rename v2 structs #1136
Rename v2 structs #1136
Conversation
1bd911c
to
d1343c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also need to rename BlobVerificationProofV2 -> BlobInclusionInfo here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought BlobVerificationProofV2
in this context was fine. But curious if @samlaf has any takes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am ok to approve this and then have a follow up PR to make further onchain updates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please! Don't mind if its done here or in another PR but ideally all onchain names should match the onchain structs.
@@ -35,14 +35,16 @@ message DisperseBlobRequest { | |||
// significant bits. The integer must stay in the valid range to be interpreted as a field element on the bn254 curve. | |||
// The valid range is 0 <= x < 21888242871839275222246405745257275088548364400416034343698204186575808495617. | |||
// If any one of the 32 bytes elements is outside the range, the whole request is deemed as invalid, and rejected. | |||
bytes data = 1; | |||
bytes blob = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is encodedPayload
not blob
per the latest naming definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we settled on still calling this blob, correct me if im wrong @samlaf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is actually a blob
now. @jianoaix can't be an encodedPayload because encodedPayload can either be interpreted as Eval or Coeffs, whereas a blob is always evaluated as coefficients by disperser:
We mentioned we were going to add an comment explanation that as a network optimization, the blob
is allowed to be passed without suffix 0s and the disperser will pad to the next power of 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A blob has a power of 2 length, but this one doesn't have to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reread my last sentence. We agreed that the disperser endpoints accepts "conceptual blobs". Documentation has to be updated to reflect this. But basically to save network bandwidth the disperser allows you to send a blob
with the last 0s removed (as long as you don't remove more then half), and itll pad the last zeros to the next power of 2 to turn it into an actual blob.
What you're dispersing is still a blob conceptually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused at this: isn't all the effort exactly to bring it from conceptual level to actual semantics level?
If we are happy at conceptual level, there isn't even a need for payload/encodedPayload etc, they are all blobs conceptually anyway. The "what is a blob" confusion is exactly due to that conceptual blob is too vague.
@@ -25,8 +25,6 @@ message BlobHeader { | |||
// reserved payments when the same blob is submitted multiple times within the same reservation period. On-demand | |||
// payments already have unique cumulative_payment values for intentionally unique dispersal requests. | |||
uint32 salt = 5; | |||
// signature over keccak hash of the blob_header that can be verified by blob_header.account_id | |||
bytes signature = 6; | |||
} | |||
|
|||
// BlobCertificate contains a full description of a blob and how it is dispersed. Part of the certificate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment (a full description of a blob...
) gives a good hint about a better naming for BlobCertificate, it's BlobDescriptor
. The TBSBlobCertificate
is more accurate than BlobCertificate
, but BlobDescriptor
is further better than TBSBlobCertificate
as a name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree this is not 100% accurate naming, but as we move signature
from BlobHeader
to BlobCertificate
, this was more appropriate than before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't actually see it's more accurate, this "signature" is signed by the owner of this blob (*), not the validators. A TBSCertificate becomes only after sufficient validators have signed it.
(*) Can we could name it more specifically with a qualification so it's clear and not be confused with validators' signature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's settle this one as a follow up and not let it block this PR.
Simple renaming can be done after audit starts, but want to get this structure change in before that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go ahead for the separation of PRs.
Isn't the renaming "simple" as well?
I don't know what specific discussion you are talking about, but I don't think it's too late to have discussion.
9563b92
to
7cdfa8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, thanks for making these changes!
2 last things I care about getting right that I don't see in this PR (perhaps they belong in a follow-up PR?) are:
- renaming EigenDABlobVerifier.verifyBlobV2 function to verifyCertV2 (because its verifying a cert, not a blob!) cc @0x0aa0
blobKey
vsblobHeaderHash
. I think I would still prefer we get rid ofblobKey
and use the more precise and self-documentingblobHeaderHash
everywhere.
@@ -25,8 +25,6 @@ message BlobHeader { | |||
// reserved payments when the same blob is submitted multiple times within the same reservation period. On-demand | |||
// payments already have unique cumulative_payment values for intentionally unique dispersal requests. | |||
uint32 salt = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does salt have to always be the last field in the struct?
Is this suggestion just to make the diagram prettier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't have to be, was asking if that's what you were trying to achieve.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well not just the diagram. I feel everything that gets hashed together should be next to each other. Just easier to not have bugs by forgetting one field that was far, for eg when replicating the new hashing structure onchain.
// The header contains metadata about the blob. | ||
// | ||
// This header can be thought of as an "eigenDA tx", in that it plays a purpose similar to an eth_tx to disperse a | ||
// 4844 blob. Note that a call to DisperseBlob requires the blob and the blobHeader, which is similar to how | ||
// dispersing a blob to ethereum requires sending a tx whose data contains the hash of the kzg commit of the blob, | ||
// which is dispersed separately. | ||
common.v2.BlobHeader blob_header = 2; | ||
// signature over keccak hash of the blob_header that can be verified by blob_header.payment_header.account_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fussy about this but I think it would be good to be super precise about the exact thing we are signing over. "keccak hash of blob_header" is not precise as it doesn't describe the serialization procedure (nor the fact that we use multi-level hashing).
Perhaps this is one reason to keep BlobKey
around, and be super precise in its documentation that it refers to a very specific hashing/serialization combination of the BlobHeader? Then we can just use BlobKey
everywhere and refer people to its documentation comment.
core/v2/types.go
Outdated
@@ -170,6 +164,10 @@ type RelayKey = uint32 | |||
type BlobCertificate struct { | |||
BlobHeader *BlobHeader | |||
|
|||
// Signature is an ECDSA signature signed by the blob request signer's account ID over the BlobHeader's blobKey, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Signature is an ECDSA signature signed by the blob request signer's account ID over the BlobHeader's blobKey, | |
// Signature is an ECDSA signature signed by the blob request signer's account ID over the blobKey, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blobheader's blobkey sounds like blobkey is a field of blobheader
Why are these changes needed?
Changes:
Data
->Blob
from disperser gRPC serviceBlobVerificationInfo
->BlobInclusionInfo
BlobHeader
toBlobCertificate
Relays
->RelayKeys
(in BlobCertificate)BlobCertificate
hashing method (both offchain and onchain) includesSignature
Checks