-
Notifications
You must be signed in to change notification settings - Fork 438
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 OP Holocene fork #7761
base: master
Are you sure you want to change the base?
Add OP Holocene fork #7761
Conversation
- WriteTo - IsZero
- Source tests from op-geth
- Would always result in validation errors
- Base and Optimism
@@ -22,4 +22,26 @@ public interface IEip1559Spec | |||
public UInt256 BaseFeeMaxChangeDenominator { get; } | |||
public long ElasticityMultiplier { get; } | |||
} | |||
|
|||
public sealed class Eip1559Spec : IEip1559Spec |
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.
This class is used to wrap an existing IEip1559Spec
and override certain parameters.
A more elegant solution might be possible and I'm open to suggestions.
/// </remarks> | ||
public sealed class OptimismBaseFeeCalculator( | ||
IBaseFeeCalculator baseFeeCalculator, | ||
ISpecProvider specProvider) : IBaseFeeCalculator |
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 don't see much point in having IOptimismSpecHelper
for starters, but could replace this ISpecProvider
with IOptimismSpecHelper
, and replace releaseSpec.GetSpec(parent).IsOpHoloceneEnabled
with helper.IsHolocene(parent)
.
If we don't use IOptimismSpecHelper
then its additions related to Holocene are essentially dead code (no usages).
{ | ||
try | ||
{ | ||
// TODO: We might want to avoid using exceptions here |
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.
As noted, we might want to avoid exceptions. If we go that route, then we should change the API to TryParseEIP1559Parameters(..., out EIP1559Parameters)
, the conventional C# pattern.
/// <remarks> | ||
/// This class is a hack to support custom base fee calculations while still using a Singleton | ||
/// Due to the extensive use of `BaseFeeCalculator.Calculate` in the codebase, it is not feasible to pass the calculator as a parameter. | ||
/// Thus, for now we will use a Singleton pattern to allow for custom base fee calculations. | ||
/// | ||
/// When required, plugins can call <see cref="Override"/> to modify the global <see cref="IBaseFeeCalculator"/> | ||
/// </remarks> | ||
public static class BaseFeeCalculator |
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.
Pretty much what the remarks
block already describes.
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 find only 10 usages outside of test, should be amendable with injecting the calculator?
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 did go with the constructor approach but decided to backtrack due to the extent of the change: the problem is that those 10 usages are in classes that are used by so many other dependencies that it got complicated very quickly.
I might try again though.
Resolves #7760
Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Added tests that cover all new LOCs. Manual testing is still required.
Documentation
Requires documentation update
I don't think it's a requirement to update the docs.
Requires explanation in Release Notes
We should communicate that Nethermind is ready to support the new OP fork.
Remarks
Initially, only Sepolia timestamps are included for both Optimism and Base since those are the only ones currently known at this time. Due to our test suite, we also include a placeholder timestamp for mainnet on the previously mentioned chains (
0xFFFFFFFF
)