-
Notifications
You must be signed in to change notification settings - Fork 451
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
Make chainspec extendable by plugins #7540
Changes from 4 commits
2ada5d8
d9d4f2a
d61acc3
6ea1a10
33f8a6c
f7b8e32
32cbfa4
70d2227
da4313b
3c39505
c44f8e8
7f8ae03
be56036
b6f1a53
bed5240
4b5d291
777c49a
4261b1e
2946160
6d0ece3
ddbcc2d
15cb899
a9dd55e
c3d296f
67d89e1
7705a5c
0a7f661
dde5690
18ce8a2
931b4ac
8e9ab40
300dd01
d488037
5c40e24
24c91c1
afef052
407de4f
e39085b
728ee3a
7e3e146
3a004be
5030e93
92d7253
c7b4d63
fed3fdd
bbff932
27de2f5
d0b5b08
9ea7527
c9c38bf
69d8c21
98c8178
18a3619
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,16 @@ | |
|
||
namespace Nethermind.Optimism; | ||
|
||
public class OptimismSpecHelper(OptimismParameters parameters) : IOptimismSpecHelper | ||
public class OptimismSpecHelper(OptimismChainSpecEngineParameters parameters) : IOptimismSpecHelper | ||
{ | ||
private readonly long _bedrockBlockNumber = parameters.BedrockBlockNumber; | ||
private readonly ulong _regolithTimestamp = parameters.RegolithTimestamp; | ||
private readonly long? _bedrockBlockNumber = parameters.BedrockBlockNumber; | ||
private readonly ulong? _regolithTimestamp = parameters.RegolithTimestamp; | ||
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we have to make stuff nullable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There might be no value in config, so better to make it nullable imo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @deffrian shouldn't we always have a value for these hardforks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On op-sepolia which actually does not have a bedrock block we're using I'm in favor of letting it default to |
||
private readonly ulong? _canyonTimestamp = parameters.CanyonTimestamp; | ||
private readonly ulong? _ecotoneTimestamp = parameters.EcotoneTimestamp; | ||
private readonly ulong? _fjordTimestamp = parameters.FjordTimestamp; | ||
private readonly ulong? _graniteTimestamp = parameters.GraniteTimestamp; | ||
|
||
public Address L1FeeReceiver { get; init; } = parameters.L1FeeRecipient; | ||
public Address? L1FeeReceiver { get; init; } = parameters.L1FeeRecipient; | ||
|
||
public bool IsRegolith(BlockHeader header) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Nethermind.Core; | ||
using Nethermind.Int256; | ||
using Nethermind.Specs; | ||
using Nethermind.Specs.ChainSpecStyle; | ||
|
||
namespace Nethermind.Optimism; | ||
|
||
public class OptimismChainSpecEngineParameters : IChainSpecEngineParameters | ||
{ | ||
public string? SealEngineType => "Optimism"; | ||
|
||
public ulong? RegolithTimestamp { get; set; } | ||
|
||
public long? BedrockBlockNumber { get; set; } | ||
|
||
public ulong? CanyonTimestamp { get; set; } | ||
|
||
public ulong? EcotoneTimestamp { get; set; } | ||
|
||
public ulong? FjordTimestamp { get; set; } | ||
|
||
public ulong? GraniteTimestamp { get; set; } | ||
|
||
public Address? L1FeeRecipient { get; set; } | ||
|
||
public Address? L1BlockAddress { get; set; } | ||
|
||
public UInt256? CanyonBaseFeeChangeDenominator { get; set; } | ||
|
||
public Address? Create2DeployerAddress { get; set; } | ||
|
||
public byte[]? Create2DeployerCode { get; set; } | ||
|
||
public void AddTransitions(SortedSet<long> blockNumbers, SortedSet<ulong> timestamps) | ||
{ | ||
ArgumentNullException.ThrowIfNull(RegolithTimestamp); | ||
ArgumentNullException.ThrowIfNull(BedrockBlockNumber); | ||
ArgumentNullException.ThrowIfNull(CanyonTimestamp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some of these fields (like |
||
ArgumentNullException.ThrowIfNull(EcotoneTimestamp); | ||
ArgumentNullException.ThrowIfNull(FjordTimestamp); | ||
ArgumentNullException.ThrowIfNull(GraniteTimestamp); | ||
ArgumentNullException.ThrowIfNull(L1FeeRecipient); | ||
ArgumentNullException.ThrowIfNull(L1BlockAddress); | ||
ArgumentNullException.ThrowIfNull(CanyonBaseFeeChangeDenominator); | ||
ArgumentNullException.ThrowIfNull(Create2DeployerAddress); | ||
ArgumentNullException.ThrowIfNull(Create2DeployerCode); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it have some sort of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot to remove. Was for debug purposes |
||
} | ||
|
||
public void AdjustReleaseSpec(ReleaseSpec spec, long startBlock, ulong? startTimestamp) | ||
{ | ||
if (CanyonTimestamp <= startTimestamp) | ||
{ | ||
// TODO: check | ||
spec.BaseFeeMaxChangeDenominator = CanyonBaseFeeChangeDenominator!.Value; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possible risk of null dereference? |
||
} | ||
} | ||
} |
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.
Bytes.FromHexString
AsSpan().Trim() if needed