Skip to content
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

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open

Add OP Holocene fork #7761

wants to merge 32 commits into from

Conversation

emlautarom1
Copy link
Contributor

@emlautarom1 emlautarom1 commented Nov 14, 2024

Resolves #7760

Changes

  • Support OP Holocene

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Added tests that cover all new LOCs. Manual testing is still required.

Documentation

Requires documentation update

  • Yes
  • No

I don't think it's a requirement to update the docs.

Requires explanation in Release Notes

  • Yes
  • No

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)

@@ -22,4 +22,26 @@ public interface IEip1559Spec
public UInt256 BaseFeeMaxChangeDenominator { get; }
public long ElasticityMultiplier { get; }
}

public sealed class Eip1559Spec : IEip1559Spec
Copy link
Contributor Author

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
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 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
Copy link
Contributor Author

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.

Comment on lines +66 to +73
/// <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
Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

@emlautarom1 emlautarom1 Nov 15, 2024

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.

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.

Add support for OP Holocene fork
2 participants