-
Notifications
You must be signed in to change notification settings - Fork 238
refactor!: version contract types #1516
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
Conversation
ef44028
to
74387b2
Compare
fix: remove operator state retriever change fix: readd v1 test
9b31539
to
d93e21e
Compare
uint8 codingRate; | ||
} | ||
|
||
struct SecurityThresholds { |
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.
Should types used by both v1 and v2 live in this v1 specific file?
Maybe it would make sense to have a common
package?
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.
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.
contracts/src/periphery/cert/interfaces/IEigenDACertVerifier.sol
Outdated
Show resolved
Hide resolved
contracts/src/periphery/cert/v2/EigenDACertVerificationV2Lib.sol
Outdated
Show resolved
Hide resolved
@@ -64,7 +63,7 @@ library EigenDACertVerificationV2Lib { | |||
IEigenDASignatureVerifier signatureVerifier, | |||
DATypesV2.BatchHeaderV2 memory batchHeader, | |||
DATypesV2.BlobInclusionInfo memory blobInclusionInfo, | |||
NonSignerStakesAndSignature memory nonSignerStakesAndSignature, | |||
DATypesV1.NonSignerStakesAndSignature memory nonSignerStakesAndSignature, |
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.
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?
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 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.
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.
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.
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.
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.
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; | ||
} |
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.
are these really v1 types? See my other comment
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.
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.
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.
That's an interesting, but idiosyncratic way of versioning things. I personally prefer namespaces to be self-contained. See #1516 (comment)
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.
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. |
* 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
Why are these changes needed?
Checks