-
Notifications
You must be signed in to change notification settings - Fork 194
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
Create a blob verification utility #1066
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
gethcommon "github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
// BlobVerifier is responsible for making eth calls to verify blobs that have been received by the client |
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.
knit
// BlobVerifier is responsible for making eth calls to verify blobs that have been received by the client | |
// BlobVerifier is responsible for making eth calls against the BlobVerifier contract to ensure cryptographic and structural integrity of V2 certificates |
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.
|
||
// BlobVerifier is responsible for making eth calls to verify blobs that have been received by the client | ||
type BlobVerifier struct { | ||
// go binding around the verifyBlobV2FromSignedBatch ethereum contract |
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.
isn't the contract name BlobVerifier
?
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.
It's EigenDABlobVerifier. Fixed in ca8d9d74
// NewBlobVerifier constructs a BlobVerifier | ||
func NewBlobVerifier( | ||
ethClient *common.EthClient, // the eth client, which should already be set up | ||
verifyBlobV2FromSignedBatchAddress string, // the hex address of the verifyBlobV2FromSignedBatch contract |
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.
knit - why not just blobVerifierAddress
?
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.
} | ||
|
||
err = v.blobVerifierCaller.VerifyBlobV2FromSignedBatch( | ||
&bind.CallOpts{Context: ctx}, |
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.
knit - is there any utility in allowing a configurable user timeout for simulation calls?
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.
if there's not a default timeout used by the binding wrapper then we may wanna instate given this could result in the connection infinitely hanging
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.
Added a comment clarifying that the caller is responsible for any timeout c752e5b1
}, nil | ||
} | ||
|
||
// VerifyBlobV2FromSignedBatch makes a call to the verifyBlobV2FromSignedBatch contract |
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.
verifyBlobV2FromSignedBatch contract?
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.
Fixed terminology ca8d9d74
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
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.
@litt3 you must be a masochist asking for so many people to review your PR. As the saying goes: 10 line PR = 10 comments. 1000 line PR = LGTM. So here's my 2 comments :D
gethcommon "github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
// BlobVerifier is responsible for making eth calls against the BlobVerifier contract to ensure cryptographic and |
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.
add link to BlobVerifier contract?
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 you mean like this? I don't like that this sort of link is instantly out of date, but I don't know of a better way to link here
function verifyBlobV2FromSignedBatch( |
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 did mean like this. We can also just link to the contract itself, in the master branch, so that it doesn't get out of date instantly.
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.
Added 8bba429a
|
||
func bytesToBN254G2Point(bytes []byte) (*BN254G2Point, error) { | ||
var g2Point bn254.G2Affine | ||
_, err := g2Point.SetBytes(bytes) |
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.
maybe add a comment to say, this makes sure bytes is in the subgroup
https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254#G2Affine.SetBytes
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.
Done f31e4a6b
One thing that looks missing to me is the test. Though it looks difficult to test, unless we can mock the eth call, and prepare all the consistent data |
@bxue-l2 I considered mocking the eth call, but it would be a lot of boilerplate to really only test the simple logic of whether errors are returned. This seems to fall into the "99% coverage" bucket. I wouldn't have a problem with a 99% coverage policy, if that's what we want to go for across the board. Thoughts? |
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Got it, I am not trying to impose a high coverage policy, The code looks good to me. |
} | ||
|
||
var x, y [2]*big.Int | ||
x[0] = g2Point.X.A0.BigInt(new(big.Int)) |
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.
Has this been tested?
I'm pretty sure the ordering should be reversed, i.e. X = {X.A1, X.A0}
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.
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
Why are these changes needed?
Notes
reader.go
, since doing so would cause a cascade of changes in unrelated filesChecks