Skip to content

Conversation

litt3
Copy link
Contributor

@litt3 litt3 commented Jun 6, 2025

Since v2 cert and v3 cert are identical, except for field ordering, we can easily (though verbosely) convert from v2->v3. This allows us to provide correct verification results for v2 certs, rather than reflexively treating them as valid.

Closes DAINT-550 (link)

@litt3 litt3 self-assigned this Jun 6, 2025
@litt3 litt3 requested review from samlaf, ethenotethan and bxue-l2 June 6, 2025 17:12
@litt3 litt3 marked this pull request as ready for review June 6, 2025 17:48
@litt3 litt3 requested a review from a team as a code owner June 6, 2025 17:48
ethenotethan
ethenotethan previously approved these changes Jun 6, 2025
Copy link
Contributor

@ethenotethan ethenotethan left a comment

Choose a reason for hiding this comment

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

LGTM

}

// Convert BlobInclusionInfo from V2 to V3 format
v3BlobInclusionInfo := certTypesBinding.EigenDATypesV2BlobInclusionInfo{
Copy link
Contributor

@bxue-l2 bxue-l2 Jun 6, 2025

Choose a reason for hiding this comment

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

why there are two binding?

contractEigenDACertVerifierV2 "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDACertVerifierV2"

certTypesBinding "github.com/Layr-Labs/eigenda/contracts/bindings/IEigenDACertTypeBindings"

If they are the same, then I suppose we can do assignment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

First is the actual contract, the other just contains the router cert types (>= 3) afaik

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bxue-l2 Basic assignment doesn't work, I think the only way is manual here.

bxue-l2
bxue-l2 previously approved these changes Jun 6, 2025
samlaf
samlaf previously approved these changes Jun 8, 2025
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.

LGTM. Added some philosophical comments but don't need to change anything

Comment on lines 435 to 443
NonSignerQuorumBitmapIndices: certV2.NonSignerStakesAndSignature.NonSignerQuorumBitmapIndices,
NonSignerPubkeys: convertV2PubkeysToV3(certV2.NonSignerStakesAndSignature.NonSignerPubkeys),
QuorumApks: convertV2PubkeysToV3(certV2.NonSignerStakesAndSignature.QuorumApks),
ApkG2: certTypesBinding.BN254G2Point{
X: certV2.NonSignerStakesAndSignature.ApkG2.X,
Y: certV2.NonSignerStakesAndSignature.ApkG2.Y,
},
Sigma: certTypesBinding.BN254G1Point{
X: certV2.NonSignerStakesAndSignature.Sigma.X,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I keep getting scared that we'll forget a field when doing these verbose manual conversions. Doesn't seem like go has any other good way to do this though (outside of json conversion which has runtime costs and unsafe pointer assignment whcih is.. unsafe).

Will our current set of linters catch if we forget a field? I don't think so right since we turned that off to allow for default values in a bunch of places... otherwise Claude proposed this one
image

Copy link
Contributor Author

@litt3 litt3 Jun 10, 2025

Choose a reason for hiding this comment

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

I'm not really sure this would provide any additional safety.

If we were constructing this v3 cert in multiple locations, and we wanted to just create a single implementation that are very confident in that could be reused, that would make sense.

But we are only doing this in one place. If we were to create constructors to do this work, then those functions have equivalent bug potential to the existing code, right?

Comment on lines +463 to +468
func convertUint32SliceToRelayKeys(relayKeys []uint32) []coreV2.RelayKey {
result := make([]coreV2.RelayKey, len(relayKeys))
for i, key := range relayKeys {
result[i] = coreV2.RelayKey(key)
}
return result
Copy link
Collaborator

Choose a reason for hiding this comment

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

sad that golang forces us to make an allocation for these conversions.. https://go.dev/doc/faq#convert_slice_with_same_underlying_type

It is what it is I guess

@@ -3,7 +3,7 @@
go = "1.21"

# Tooling Dependencies
"go:github.com/golangci/golangci-lint/cmd/golangci-lint" = "1.60.3"
golangci-lint = "1.60.3"
Copy link
Collaborator

Choose a reason for hiding this comment

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

good catch for this! Looking at https://mise.jdx.dev/registry.html?filter=golangci#tools, it seems like this will use one of the binary installer backends (aqua, ubi, asdf) and download the binary directly. Whereas the go tool will download the source code and then build the binary.

Honestly I don't understand why you had issues with the go build... but this way should be faster anyways.

@litt3 litt3 dismissed stale reviews from samlaf, bxue-l2, and ethenotethan via 154c482 June 10, 2025 17:08
@litt3 litt3 requested review from samlaf, ethenotethan and bxue-l2 June 10, 2025 17:08
@litt3 litt3 merged commit da8095c into master Jun 10, 2025
12 checks passed
@litt3 litt3 deleted the verify-v2-cert branch June 10, 2025 18:45
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.

4 participants