Skip to content

Conversation

pakim249CAL
Copy link
Contributor

@pakim249CAL pakim249CAL commented Apr 30, 2025

Why are these changes needed?

  • Moves around the types to a versioned format.
  • Moves version specific hashing from EigenDAHasher to the respective verification libraries
  • does away with the combined CertVerifier to prep the groundwork for a new CertVerifierRouter to take its place.

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 :(

@pakim249CAL pakim249CAL force-pushed the refactor/version-contract-types branch from ef44028 to 74387b2 Compare April 30, 2025 22:03
@pakim249CAL pakim249CAL changed the base branch from refactor/remove-operator-state-retriever to master April 30, 2025 22:03
@pakim249CAL pakim249CAL changed the title Refactor/version contract types refactor: version contract types Apr 30, 2025
@pakim249CAL pakim249CAL marked this pull request as ready for review April 30, 2025 22:27
@pakim249CAL pakim249CAL marked this pull request as draft April 30, 2025 22:28
fix: remove operator state retriever change

fix: readd v1 test
@pakim249CAL pakim249CAL force-pushed the refactor/version-contract-types branch from 9b31539 to d93e21e Compare April 30, 2025 22:56
@samlaf samlaf mentioned this pull request May 1, 2025
5 tasks
feat: remove old files

refactor: file layout
@pakim249CAL pakim249CAL marked this pull request as ready for review May 2, 2025 02:19
@pakim249CAL pakim249CAL changed the title refactor: version contract types refactor!: version contract types May 2, 2025
uint8 codingRate;
}

struct SecurityThresholds {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should types used by both v1 and v2 live in this v1 specific file?

Maybe it would make sense to have a common package?

Copy link
Contributor Author

@pakim249CAL pakim249CAL May 2, 2025

Choose a reason for hiding this comment

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

My idea was simply to separate out WHEN types are introduced. And future code can reference the same types from old versions, but anytime new types are introduced there should be a new version of types.

I don't like common because common needs to be regularly maintained/culled, and it would be hard to name things if we ever needed to modify a struct, but keep the old one for backwards compatibility. I think it is better to just namespace the types as we add them by eigenDA version so that we don't have to worry about this scenario.

@@ -64,7 +63,7 @@ library EigenDACertVerificationV2Lib {
IEigenDASignatureVerifier signatureVerifier,
DATypesV2.BatchHeaderV2 memory batchHeader,
DATypesV2.BlobInclusionInfo memory blobInclusionInfo,
NonSignerStakesAndSignature memory nonSignerStakesAndSignature,
DATypesV1.NonSignerStakesAndSignature memory nonSignerStakesAndSignature,
Copy link
Collaborator

@samlaf samlaf May 2, 2025

Choose a reason for hiding this comment

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

feels weird that we're using v1 types in a v2 lib no? Perhaps the main core types should be in a DATypesShared lib or something? Especially since these types are eigenlayer related afaiu and not eigenda v1/v2 related right?

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 am trying to move AWAY from "shared" files because it is very confusing and it is hard to figure out which structs are needed for V1, and which are needed for V2! I understand that this might seem a little strange, but I would argue that piquing your curiosity here is good. Because otherwise you might not ever have understood that that particular type has been used since EigenDA V1.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But it shouldn't matter that that type has been introduced since EigenDA V1. The plan is to anyways get rid of EigenDA V1 soon, and many have proposed we will literally delete everything related to V1 from the repo once we do that. So what will you do with these structs at that point?

I think if anything, I would prefer we duplicate all the structs in V2. I think a little copying is not that bad. I prefer to completely segregate v1 from v2 personally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem with copying is that they end up being separate types in solidity though. We already have some duplicate structs that cause some problems in this repo, like NonSignerStakesAndSignatures which is duplicated in this repo from BLSSignatureChecker.

Comment on lines +57 to +78
struct NonSignerStakesAndSignature {
uint32[] nonSignerQuorumBitmapIndices;
BN254.G1Point[] nonSignerPubkeys;
BN254.G1Point[] quorumApks;
BN254.G2Point apkG2;
BN254.G1Point sigma;
uint32[] quorumApkIndices;
uint32[] totalStakeIndices;
uint32[][] nonSignerStakeIndices;
}

struct QuorumStakeTotals {
uint96[] signedStakeForQuorum;
uint96[] totalStakeForQuorum;
}

struct CheckSignaturesIndices {
uint32[] nonSignerQuorumBitmapIndices;
uint32[] quorumApkIndices;
uint32[] totalStakeIndices;
uint32[][] nonSignerStakeIndices;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these really v1 types? See my other comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My intention in this organizational structure is not to specify that certain types only belong to V1 and which belong to V2. It is to create a logical history of when types are introduced, and make it easier in future PRs to add namespaced types in case we ever need to modify structs, since the current situation is very confusing.

This problem is evident when you look at the fact that previously, in IEigenDAStructs, you had structs named "BlobHeader" and "BlobHeaderV2" all in a common file. I want to avoid that situation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's an interesting, but idiosyncratic way of versioning things. I personally prefer namespaces to be self-contained. See #1516 (comment)

@pakim249CAL pakim249CAL requested review from samlaf and litt3 May 5, 2025 11:53
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.

Sorry forgot to get back to this PR! I'll approve because we need to get things unblocked and PR stalemates are bad. But I still find the namespacing based on historical introduction to be weird. I've never seen this used, so it would require lots of documentation in many places to get people used to this architecture.

Also as I've noted, once we delete V1 then there will be a big impact and artificialy-induced refactor of V2 needed which shouldn't be the case. If you disagree I'm happy to merge now and keep discussing though. Refactors can always be done later.

@pakim249CAL
Copy link
Contributor Author

pakim249CAL commented May 6, 2025

Sorry forgot to get back to this PR! I'll approve because we need to get things unblocked and PR stalemates are bad. But I still find the namespacing based on historical introduction to be weird. I've never seen this used, so it would require lots of documentation in many places to get people used to this architecture.

Also as I've noted, once we delete V1 then there will be a big impact and artificialy-induced refactor of V2 needed which shouldn't be the case. If you disagree I'm happy to merge now and keep discussing though. Refactors can always be done later.

I will concede that it's very weird. The design arises from my personal need to separate them somehow though, because having them all in one file ended up creating a tangled mess in other files, where you could very easily be confused by type names that are introduced over time.

I think I need to come up with a better name or something, but I maintain that this kind of separation is useful when writing the actual contracts so that developers can understand more easily what is only needed for V1 interactions vs V2 interactions, and I think duplicating types leads to very confusing scenarios

Ultimately these types are schematics for many upgradeable contracts all at once, so I think it is important to structure them in a way that they can be kept around forever. In a sense, I am basically adding "epochs" that divide up when certain features were introduced. So versioning is probably a pretty bad name for this. But I think it is the least worst name.

@pakim249CAL pakim249CAL merged commit 2a68458 into master May 6, 2025
15 checks passed
@pakim249CAL pakim249CAL deleted the refactor/version-contract-types branch May 6, 2025 19:36
ethenotethan pushed a commit that referenced this pull request May 8, 2025
* Refactor: Consolidate struct types into versioned libraries

fix: remove operator state retriever change

fix: readd v1 test

* fix: fmt

* fix: ci

* fix: ci

* fix: remove certverifier binding

* fix: ci

* fix: ci

* feat: new file structure

feat: remove old files

refactor: file layout

* fix: ci

* fix: ci

* fix: bindings

* chore: address comments
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