Skip to content

Commit

Permalink
fix & enable pectra
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchhill committed Jan 23, 2025
1 parent 8639d9e commit 885b6bf
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 22 deletions.
11 changes: 11 additions & 0 deletions src/Nethermind/Chains/chiado.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@
"eip4844MaxBlobGasPerBlock": "0x40000",
"eip4844MinBlobGasPrice": "0x3b9aca00",
"eip4844TargetBlobGasPerBlock": "0x20000",
"eip4844FeeCollectorTransitionTimestamp": "0x56343EE4C",
"eip2537TransitionTimestamp": "0x56343EE4C",
"eip2935TransitionTimestamp": "0x56343EE4C",
"eip6110TransitionTimestamp": "0x56343EE4C",
"eip7002TransitionTimestamp": "0x56343EE4C",
"eip7251TransitionTimestamp": "0x56343EE4C",
"eip7549TransitionTimestamp": "0x56343EE4C",
"eip7594TransitionTimestamp": "0x56343EE4C",
"eip7623TransitionTimestamp": "0x56343EE4C",
"eip7685TransitionTimestamp": "0x56343EE4C",
"eip7702TransitionTimestamp": "0x56343EE4C",
"registrar": "0x6000000000000000000000000000000000000000",
"transactionPermissionContract": "0x4000000000000000000000000000000000000001",
"transactionPermissionContractTransition": "0x0",
Expand Down
11 changes: 11 additions & 0 deletions src/Nethermind/Chains/gnosis.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@
"eip4844MaxBlobGasPerBlock": "0x40000",
"eip4844MinBlobGasPrice": "0x3b9aca00",
"eip4844TargetBlobGasPerBlock": "0x20000",
"eip4844FeeCollectorTransitionTimestamp": "0x561B10DBC",
"eip2537TransitionTimestamp": "0x561B10DBC",
"eip2935TransitionTimestamp": "0x561B10DBC",
"eip6110TransitionTimestamp": "0x561B10DBC",
"eip7002TransitionTimestamp": "0x561B10DBC",
"eip7251TransitionTimestamp": "0x561B10DBC",
"eip7549TransitionTimestamp": "0x561B10DBC",
"eip7594TransitionTimestamp": "0x561B10DBC",
"eip7623TransitionTimestamp": "0x561B10DBC",
"eip7685TransitionTimestamp": "0x561B10DBC",
"eip7702TransitionTimestamp": "0x561B10DBC",
"registrar": "0x6B53721D4f2Fb9514B85f5C49b197D857e36Cf03",
"transactionPermissionContract": "0x7Dd7032AA75A37ea0b150f57F899119C7379A78b",
"transactionPermissionContractTransition": 9186425,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,9 @@ public static IEnumerable<TestCaseData> ChiadoActivations
yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.ShanghaiTimestamp)) { TestName = "Shanghai" };
yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.CancunTimestamp - 1)) { TestName = "Before Cancun" };
yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.CancunTimestamp)) { TestName = "Cancun" };
yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.CancunTimestamp + 100000000)) { TestName = "Future" };
// yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.PragueTimestamp - 1)) { TestName = "Before Prague" };
// yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.PragueTimestamp)) { TestName = "Prague" };
// yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.PragueTimestamp + 100000000)) { TestName = "Future" };
yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.PragueTimestamp - 1)) { TestName = "Before Prague" };
yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.PragueTimestamp)) { TestName = "Prague" };
yield return new TestCaseData((ForkActivation)(1, ChiadoSpecProvider.PragueTimestamp + 100000000)) { TestName = "Future" };
}
}

Expand Down Expand Up @@ -226,7 +225,7 @@ public void Chiado_loads_properly(ForkActivation forkActivation)

VerifyGnosisShanghaiSpecifics(preShanghaiSpec, postShanghaiSpec);
VerifyGnosisCancunSpecifics();
// VerifyGnosisPragueSpecifics(prePragueSpec, postPragueSpec, ChiadoSpecProvider.FeeCollector);
VerifyGnosisPragueSpecifics(prePragueSpec, postPragueSpec, ChiadoSpecProvider.FeeCollector);
GetTransitionTimestamps(chainSpec.Parameters).Should().AllSatisfy(
static t => ValidateSlotByTimestamp(t, ChiadoSpecProvider.BeaconChainGenesisTimestampConst, GnosisBlockTime).Should().BeTrue());
}
Expand Down Expand Up @@ -255,14 +254,12 @@ public static IEnumerable<TestCaseData> GnosisActivations
{ TestName = "Before Cancun" };
yield return new TestCaseData((ForkActivation)(GnosisSpecProvider.LondonBlockNumber + 2, GnosisSpecProvider.CancunTimestamp))
{ TestName = "Cancun" };
yield return new TestCaseData((ForkActivation)(GnosisSpecProvider.LondonBlockNumber + 2, GnosisSpecProvider.CancunTimestamp + 100000000))
yield return new TestCaseData((ForkActivation)(GnosisSpecProvider.LondonBlockNumber + 2, GnosisSpecProvider.PragueTimestamp - 1))
{ TestName = "Before Prague" };
yield return new TestCaseData((ForkActivation)(GnosisSpecProvider.LondonBlockNumber + 2, GnosisSpecProvider.PragueTimestamp))
{ TestName = "Prague" };
yield return new TestCaseData((ForkActivation)(GnosisSpecProvider.LondonBlockNumber + 2, GnosisSpecProvider.PragueTimestamp + 100000000))
{ TestName = "Future" };
// yield return new TestCaseData((ForkActivation)(GnosisSpecProvider.LondonBlockNumber + 2, GnosisSpecProvider.PragueTimestamp - 1))
// { TestName = "Before Prague" };
// yield return new TestCaseData((ForkActivation)(GnosisSpecProvider.LondonBlockNumber + 2, GnosisSpecProvider.PragueTimestamp))
// { TestName = "Prague" };
// yield return new TestCaseData((ForkActivation)(GnosisSpecProvider.LondonBlockNumber + 2, GnosisSpecProvider.PragueTimestamp + 100000000))
// { TestName = "Future" };
}
}

Expand Down Expand Up @@ -290,7 +287,7 @@ public void Gnosis_loads_properly(ForkActivation forkActivation)

VerifyGnosisShanghaiSpecifics(preShanghaiSpec, postShanghaiSpec);
VerifyGnosisCancunSpecifics();
// VerifyGnosisPragueSpecifics(prePragueSpec, postPragueSpec, GnosisSpecProvider.FeeCollector);
VerifyGnosisPragueSpecifics(prePragueSpec, postPragueSpec, GnosisSpecProvider.FeeCollector);
GetTransitionTimestamps(chainSpec.Parameters).Should().AllSatisfy(
static t => ValidateSlotByTimestamp(t, GnosisSpecProvider.BeaconChainGenesisTimestampConst, GnosisBlockTime).Should().BeTrue());
}
Expand Down Expand Up @@ -350,7 +347,6 @@ public static IEnumerable<TestCaseData> MainnetActivations
get
{
yield return new TestCaseData((ForkActivation)0) { TestName = "Genesis" };
yield return new TestCaseData((ForkActivation)(0, null)) { TestName = "Genesis null" };
yield return new TestCaseData((ForkActivation)(0, 0)) { TestName = "Genesis timestamp" };
yield return new TestCaseData((ForkActivation)1) { TestName = "Genesis + 1" };
yield return new TestCaseData((ForkActivation)(MainnetSpecProvider.HomesteadBlockNumber - 1)) { TestName = "Before Homestead" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ private ReleaseSpec CreateReleaseSpec(ChainSpec chainSpec, long releaseStartBloc
releaseSpec.ValidateChainId = (chainSpec.Parameters.ValidateChainIdTransition ?? 0) <= releaseStartBlock;
releaseSpec.ValidateReceipts = ((chainSpec.Parameters.ValidateReceiptsTransition > 0) ? Math.Max(chainSpec.Parameters.ValidateReceiptsTransition ?? 0, chainSpec.Parameters.Eip658Transition ?? 0) : 0) <= releaseStartBlock;

bool eip1559FeeCollector = releaseSpec.IsEip1559Enabled && (chainSpec.Parameters.Eip1559FeeCollectorTransition ?? long.MaxValue) <= releaseStartBlock;
bool eip4844FeeCollector = releaseSpec.IsEip4844Enabled && (chainSpec.Parameters.Eip4844FeeCollectorTransitionTimestamp ?? long.MaxValue) <= releaseStartTimestamp;
releaseSpec.FeeCollector = (eip1559FeeCollector || eip4844FeeCollector) ? chainSpec.Parameters.FeeCollector : null;

releaseSpec.Eip1559BaseFeeMinValue = releaseSpec.IsEip1559Enabled && (chainSpec.Parameters.Eip1559BaseFeeMinValueTransition ?? long.MaxValue) <= releaseStartBlock ? chainSpec.Parameters.Eip1559BaseFeeMinValue : null;
releaseSpec.ElasticityMultiplier = chainSpec.Parameters.Eip1559ElasticityMultiplier ?? Eip1559Constants.DefaultElasticityMultiplier;
releaseSpec.ForkBaseFee = chainSpec.Parameters.Eip1559BaseFeeInitialValue ?? Eip1559Constants.DefaultForkBaseFee;
Expand Down Expand Up @@ -237,6 +233,11 @@ private ReleaseSpec CreateReleaseSpec(ChainSpec chainSpec, long releaseStartBloc

releaseSpec.IsOntakeEnabled = (chainSpec.Parameters.OntakeTransition ?? long.MaxValue) <= releaseStartBlock;

bool eip1559FeeCollector = releaseSpec.IsEip1559Enabled && (chainSpec.Parameters.Eip1559FeeCollectorTransition ?? long.MaxValue) <= releaseStartBlock;
bool eip4844FeeCollector = releaseSpec.IsEip4844Enabled && (chainSpec.Parameters.Eip4844FeeCollectorTransitionTimestamp ?? long.MaxValue) <= releaseStartTimestamp;
releaseSpec.FeeCollector = (eip1559FeeCollector || eip4844FeeCollector) ? chainSpec.Parameters.FeeCollector : null;
releaseSpec.IsEip4844FeeCollectorEnabled = eip4844FeeCollector;

foreach (IChainSpecEngineParameters item in _chainSpec.EngineChainSpecParametersProvider
.AllChainSpecParameters)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Nethermind/Nethermind.Specs/ChiadoSpecProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public class ChiadoSpecProvider : ISpecProvider
public const ulong BeaconChainGenesisTimestampConst = 0x6343ee4c;
public const ulong ShanghaiTimestamp = 0x646e0e4c;
public const ulong CancunTimestamp = 0x65ba8e4c;
//TODO correct this timestamp!
public const ulong PragueTimestamp = ulong.MaxValue - 2;
public const ulong PragueTimestamp = 0x56343EE4C;
public static readonly Address FeeCollector = new("0x1559000000000000000000000000000000000000");

private ChiadoSpecProvider() { }
Expand Down
3 changes: 1 addition & 2 deletions src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public class GnosisSpecProvider : ISpecProvider
public const ulong BeaconChainGenesisTimestampConst = 0x61b10dbc;
public const ulong ShanghaiTimestamp = 0x64c8edbc;
public const ulong CancunTimestamp = 0x65ef4dbc;
//TODO correct this timestamp!
public const ulong PragueTimestamp = ulong.MaxValue - 2;
public const ulong PragueTimestamp = 0x561B10DBC;
public static readonly Address FeeCollector = new("0x6BBe78ee9e474842Dbd4AB4987b3CeFE88426A92");

private GnosisSpecProvider() { }
Expand Down

0 comments on commit 885b6bf

Please sign in to comment.