-
Notifications
You must be signed in to change notification settings - Fork 784
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
Impl Ord on ForkName for ChainSpec usage #5531
Conversation
#[derive(Debug, Clone, Copy, Decode, Encode, PartialEq, Eq, Hash, Serialize, Deserialize)] | ||
#[derive( | ||
Debug, Clone, Copy, Decode, Encode, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, | ||
)] |
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.
would be good to add a test that checks agreement between ForkName::list_all
and Ord
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 one here c34b26e
I agree that for Lighthouse's current design, this change makes a lot of sense. However, I think being able to support arbitrary fork ordering would be really useful for a variety of reasons. Consider the following set of forks and their associated features and dependencies:
The natural fork ordering A -> B -> C -> D is valid since B comes after A and D comes after B and thus the dependency requirements are satisfied. However, the fork ordering A -> C -> B -> D is also valid since the dependency requirements are also met. Splitting out For example, two devs could simultaneously be working on different features on the same Fork and their code would be completely discrete. We could even test them separately from the same binary. We want to test a new fork without a certain feature? Just remove it from the Fork/Feature ordering. Or, a dev could be working on a far-future feature, and simply add it to the latest fork for testing. Then when the feature is confirmed for a new hard fork, it is trivial to move it over to the latest fork. The work I've been doing in Verkle would massively benefit from this change, since the current testnet is running Capella -> Verge, which means maintaining it involves stripping out the Deneb related code. If I could simply reorder Deneb to go after Verge, it would solve that issue. In short, I think there would be massive developer experience benefits to moving towards a This is something @michaelsproul and I have been experimenting with in sigp/superstruct#33, but it's not trivial and will likely require a large rework of With all that said, I would support this PR in the short term, and in fact it might be a good stepping stone to what I think our future should be, which is a Fork/Feature/Dependency paradigm. |
Maybe a first version of sigp/superstruct#33 could just include the fork ordering aspect (not features themselves). So leaning on |
@Mergifyio queue |
🛑 The pull request has been removed from the queue
|
@Mergifyio requeue |
✅ This pull request will be re-embarked automaticallyThe followup |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at ced6538 |
Issue Addressed
When having fork-dependant logic there's a trade-off between exhaustive match pattern and ordering. LH maintainers should consider that this client is used quite a bit to develop future features, which may also need to implement a fork.
Can't ignore the fact that there still quite a bit of fork boiler-plate out there, but hopefully this PR is the first step into a less boiled future :)
Original discussion in #5507 (comment)
Proposed Changes
Impl Ord on ForkName for ChainSpec usage