-
Notifications
You must be signed in to change notification settings - Fork 449
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
Add engine_signalSuperchainV1
#7693
base: master
Are you sure you want to change the base?
Conversation
- Use abstract + sealed
- Required to synthesize Equals
src/Nethermind/Nethermind.Optimism/ProtocolVersion/OptimismProtocolVersion.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Optimism/ProtocolVersion/OptimismProtocolVersion.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Optimism/ProtocolVersion/OptimismProtocolVersion.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Optimism/ProtocolVersion/OptimismProtocolVersion.cs
Outdated
Show resolved
Hide resolved
if (currentVersion < signal.Recommended) | ||
{ | ||
await _signalSuperchainHandler.OnBehindRecommended(signal.Recommended); | ||
} | ||
if (currentVersion < signal.Required) | ||
{ | ||
await _signalSuperchainHandler.OnBehindRequired(signal.Required); | ||
} |
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.
Not sure why those are needed? Only to write a log? Seems overblown to do task and await it just for that?
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.
Wouldn't it be better to pass signal to signalSuperchainHandler and that's it? It should check the versions and do what is needed.
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.
Seems overblown to do task and await it just for that?
Logging warnings/errors is just one possible implementation and the interface is designed for possible async implementations.
As the specification says, we might want to add the option to allow the user to trigger a shutdown when the current version is behind the required one.
Wouldn't it be better to pass signal to signalSuperchainHandler and that's it?
We could but then all implementations would need to perform the <
checks so I decided to move that branching logic to the OptimismEngineRpcModule
class itself, making implementations only care about what to do when behind recommended/required.
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.
you can encapsulate those checks in some method (extension method on signal for example), and return some enum (can be flags). Then implementations would only check that enum and act on it.
OptimismProtocolVersion CurrentVersion { get; } | ||
Task OnBehindRecommended(OptimismProtocolVersion recommended); | ||
Task OnBehindRequired(OptimismProtocolVersion required); |
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.
OptimismProtocolVersion CurrentVersion { get; } | |
Task OnBehindRecommended(OptimismProtocolVersion recommended); | |
Task OnBehindRequired(OptimismProtocolVersion required); | |
OptimismProtocolVersion Signal(OptimismSuperchainSignal signal); |
src/Nethermind/Nethermind.Optimism/ProtocolVersion/OptimismSuperchainSignal.cs
Outdated
Show resolved
Hide resolved
- Has nothing to do with Nethermind client version
- Ended up not being needed at all
Fixes #7658
Changes
engine_signalSuperchainV1
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
It might require additional testing using an actual node.
Documentation
Requires documentation update
Optimism
engine
API must be updated to include the new method.Requires explanation in Release Notes
Remarks
The current implementation only performs logging in case of being behind the recommended/required versions. We should discuss if we want to add some opt-in halting mechanism as suggested by the specification.
The
build
field of theOptimismProtocolVersion.V0
is filled withNETH
since we only have 8 bytes available. While this field is ignored when determining version precedence (as the specification demands), theop-geth
implementation actually fails comparisons when builds are not the same.