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

Merged
merged 46 commits into from
Nov 21, 2024
Merged

Add OP Holocene fork #7761

merged 46 commits into from
Nov 21, 2024

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.

Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't like the hidden dependency and side effect with BaseFeeCalculator.
I would change exceptions handling.

src/Nethermind/Chains/base-mainnet.json Outdated Show resolved Hide resolved
src/Nethermind/Nethermind.Core/BaseFeeCalculator.cs Outdated Show resolved Hide resolved
src/Nethermind/Nethermind.Core/Specs/IEip1559Spec.cs Outdated Show resolved Hide resolved
var spec = _specProvider.GetSpec(currentBestBlock.Header);
if (spec.IsOpHoloceneEnabled)
{
EIP1559Parameters eip1559Parameters = optimismPayload.DecodeEIP1559Parameters();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could fail and throw exception

Copy link
Contributor Author

@emlautarom1 emlautarom1 Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that at that point we've already validated the attributes so there should not be a risk of exceptions (unless I'm missing something):

  1. We validate attributes in

public async Task<ResultWrapper<ForkchoiceUpdatedV1Result>> Handle(ForkchoiceStateV1 forkchoiceState, PayloadAttributes? payloadAttributes, int version)
{
Block? newHeadBlock = GetBlock(forkchoiceState.HeadBlockHash);
return await ApplyForkchoiceUpdate(newHeadBlock, forkchoiceState, payloadAttributes)
?? ValidateAttributes(payloadAttributes, version)
?? StartBuildingPayload(newHeadBlock!, forkchoiceState, payloadAttributes);
}

  1. Then we use the IPreparationService in StartBuildingPayload

payloadId = _payloadPreparationService.StartPreparingPayload(newHeadBlock.Header, payloadAttributes);

  1. Eventually, OptimismPayloadPreparationService.ImproveBlock is called:

public string StartPreparingPayload(BlockHeader parentHeader, PayloadAttributes payloadAttributes)
{
string payloadId = payloadAttributes.GetPayloadId(parentHeader);
if (!_payloadStorage.ContainsKey(payloadId))
{
Block emptyBlock = ProduceEmptyBlock(payloadId, parentHeader, payloadAttributes);
ImproveBlock(payloadId, parentHeader, payloadAttributes, emptyBlock, DateTimeOffset.UtcNow);
}
else if (_logger.IsInfo) _logger.Info($"Payload with the same parameters has already started. PayloadId: {payloadId}");
return payloadId;
}

protected override void ImproveBlock(string payloadId, BlockHeader parentHeader,
PayloadAttributes payloadAttributes, Block currentBestBlock, DateTimeOffset startDateTime)

}
}

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.

I think we could remove this static class altogether by leveraging extension methods but for now I'll leave it as it is to avoid more diffs.

@emlautarom1 emlautarom1 merged commit cc96168 into master Nov 21, 2024
79 checks passed
@emlautarom1 emlautarom1 deleted the feat/optimism-holocene branch November 21, 2024 20:20
kamilchodola added a commit that referenced this pull request Nov 22, 2024
@emlautarom1 emlautarom1 restored the feat/optimism-holocene branch November 22, 2024 16:12
@emlautarom1 emlautarom1 mentioned this pull request Nov 22, 2024
16 tasks
asdacap added a commit that referenced this pull request Nov 22, 2024
barnabasbusa added a commit to ethpandaops/optimism-package that referenced this pull request Dec 2, 2024
Recently we've added support for the upcoming Optimism hard-fork
Holocene in Nethermind
(NethermindEth/nethermind#7761) and the OP team
suggested us to use OP's kurtosis package to test it.

We found a couple of issues when trying to set up an enclave due to
certain changes to other fork's timestamps which would trigger an error
in Nethermind. To fix that, one of our developers (@flcl42) updated the
`gen2spec.jq` script which fixes the above mentioned issue.

Co-authored-by: Barnabas Busa <barnabas.busa@ethereum.org>
@LukaszRozmej LukaszRozmej mentioned this pull request Dec 3, 2024
16 tasks
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
3 participants