-
Notifications
You must be signed in to change notification settings - Fork 711
feat(engine): implement Engine API v2 REST+SSZ surface per spec #11887
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
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
2ecf266
feat(engine): implement Engine API v2 REST+SSZ surface per spec
Dyslex7c 78c78d7
fix build errors
Dyslex7c aba2a6a
fix benchmarks build error
Dyslex7c 7e93834
fix stateless build and AuRa test
Dyslex7c 0eadda1
address claude review
Dyslex7c 73c3019
address deep review comments
Dyslex7c 60915b3
Merge branch 'master' into update-ssz-spec
LukaszRozmej 43309fe
fix consensus test
Dyslex7c 2447394
centralize fork names
Dyslex7c 4b93d02
address other review comments by @flcl42
Dyslex7c 00b4b6d
address claude review comments
Dyslex7c 7610306
clean fcu handler and remove `custodyColumns`, add v2 to urls
Dyslex7c ac868b2
remove `TargetGasLimit` from `PayloadAttributes`
Dyslex7c a8e5611
Merge remote-tracking branch 'upstream/master' into update-ssz-spec
Dyslex7c 0f80d56
fix AuRa merge tests
Dyslex7c 3894b82
use modern transport during startup
Dyslex7c efbb6da
address review: simplifications, pooling, no-alloc
LukaszRozmej 486fbc0
SszRestPaths: ForkVersionKey record + cached span lookup
LukaszRozmej 3ca5b97
address review: cache capabilities, inline-array cell, dedup
LukaszRozmej e30f3c7
refactor: implement memory pooling for `engine_getBlobs` REST/RPC end…
Dyslex7c 4439b5f
simplify FCU URL-fork match to a single spec.Name comparison
LukaszRozmej e4aa948
move engine-api versions onto NamedReleaseSpec
LukaszRozmej 17908e3
GetBlobsHandlerV4: clear pool-rented arrays to avoid stale-slot corru…
LukaszRozmej 2476760
SszRestPaths: build fork→spec map by walking from Forks.Amsterdam
LukaszRozmej b2935ab
EngineApiVersions: move to Nethermind.Core namespace; SszRestPaths: d…
LukaszRozmej 8b35d68
GetBlobsV4 SSZ encode: fix cell length + slice rented buffers
LukaszRozmej cfac389
SszMiddlewareTests: drop s_ prefix; use EngineApiVersions for version…
LukaszRozmej 4aff0b2
Merge branch 'master' of github.com:NethermindEth/nethermind into wor…
LukaszRozmej fa17686
test: cover unscoped-endpoint extra-segment rejection in TryRoute
LukaszRozmej d57b6eb
Merge commit '8b35d68dca' into worktree-pr-11887-review
LukaszRozmej 74a9d52
Merge branch 'update-ssz-spec' of github.com:Dyslex7c/nethermind into…
LukaszRozmej e96869b
address two-reviewer findings on SSZ-REST surface
LukaszRozmej d6d3e66
style: remove unused using directives flagged by IDE0005
LukaszRozmej 7ca8a97
align SSZ-REST surface with execution-apis #793 spec
LukaszRozmej e0b8f48
Apply suggestion from @LukaszRozmej
LukaszRozmej f9d3081
fix disposal leak on SSZ-REST bodies path + align V4 wire to spec
LukaszRozmej 0d43291
fix SszExecutionPayloadV4.BlockAccessList limit to match spec MAX_BAL…
LukaszRozmej dfa8e83
revert SszExecutionPayloadV4.BlockAccessList limit to 16 MiB
LukaszRozmej 0c8cccb
Merge branch 'master' into update-ssz-spec
LukaszRozmej dad6790
address deep-review nits on SSZ-REST surface
LukaszRozmej 1551536
Merge remote-tracking branch 'Dyslex7c/update-ssz-spec' into pr-11887…
LukaszRozmej 13e7ea9
map ErrorCodes.ParseError to /engine-api/errors/parse-error
LukaszRozmej File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
src/Nethermind/Nethermind.Consensus.Test/PayloadAttributesValidateTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited | ||
| // SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| using Nethermind.Consensus.Producers; | ||
| using Nethermind.Core; | ||
| using Nethermind.Core.Crypto; | ||
| using Nethermind.Core.Specs; | ||
| using NSubstitute; | ||
| using NUnit.Framework; | ||
|
|
||
| namespace Nethermind.Consensus.Test; | ||
|
|
||
| public class PayloadAttributesValidateTests | ||
| { | ||
| private static PayloadAttributes BuildAttrs(bool withSlotNumber, ulong timestamp = 1_000UL) => new() | ||
| { | ||
| Timestamp = timestamp, | ||
| PrevRandao = Keccak.Zero, | ||
| SuggestedFeeRecipient = Address.Zero, | ||
| Withdrawals = [], | ||
| ParentBeaconBlockRoot = Keccak.Zero, | ||
| SlotNumber = withSlotNumber ? 42UL : null, | ||
| }; | ||
|
|
||
| private static ISpecProvider MakeSpecProvider(bool isAmsterdam) | ||
| { | ||
| ISpecProvider sp = Substitute.For<ISpecProvider>(); | ||
| IReleaseSpec spec = Substitute.For<IReleaseSpec>(); | ||
| spec.IsEip7843Enabled.Returns(isAmsterdam); | ||
| spec.IsEip4844Enabled.Returns(true); | ||
| spec.WithdrawalsEnabled.Returns(true); | ||
| sp.GetSpec(Arg.Any<ForkActivation>()).Returns(spec); | ||
| return sp; | ||
| } | ||
|
|
||
| // Each case asserts a distinct branch of PayloadAttributes.Validate against the spec. | ||
| // mustContain/mustNotContain are checked when non-null. | ||
| private static readonly object[] ValidateCases = | ||
| [ | ||
| new object[] { /* isAmsterdam */ true, /* withSlot */ false, /* fcu */ PayloadAttributesVersions.V4, | ||
| PayloadAttributesValidationResult.InvalidPayloadAttributes, "must be provided", "expected" }, | ||
| new object[] { /* isAmsterdam */ true, /* withSlot */ true, /* fcu */ PayloadAttributesVersions.V4, | ||
| PayloadAttributesValidationResult.Success, null!, null! }, | ||
| new object[] { /* isAmsterdam */ false, /* withSlot */ true, /* fcu */ PayloadAttributesVersions.V3, | ||
| PayloadAttributesValidationResult.UnsupportedFork, null!, null! }, | ||
| ]; | ||
|
|
||
| [TestCaseSource(nameof(ValidateCases))] | ||
| public void Validate_returns_expected_result( | ||
| bool isAmsterdam, bool withSlotNumber, int fcuVersion, | ||
| PayloadAttributesValidationResult expected, string errorMustContain, string errorMustNotContain) | ||
| { | ||
| ISpecProvider sp = MakeSpecProvider(isAmsterdam); | ||
| PayloadAttributes attrs = BuildAttrs(withSlotNumber); | ||
|
|
||
| PayloadAttributesValidationResult result = attrs.Validate(sp, fcuVersion, out string error); | ||
|
|
||
| Assert.That(result, Is.EqualTo(expected)); | ||
| if (expected == PayloadAttributesValidationResult.Success) | ||
| { | ||
| Assert.That(error, Is.Null); | ||
| } | ||
| else | ||
| { | ||
| Assert.That(error, Is.Not.Null); | ||
| if (errorMustContain is not null) Assert.That(error, Does.Contain(errorMustContain)); | ||
| if (errorMustNotContain is not null) Assert.That(error, Does.Not.Contain(errorMustNotContain)); | ||
| } | ||
| } | ||
|
|
||
| [TestCase(false, PayloadAttributesVersions.V1)] | ||
| [TestCase(true, PayloadAttributesVersions.V4)] | ||
| public void GetVersion_infers_correct_version_from_present_fields( | ||
| bool hasSlotNumber, int expectedVersion) | ||
| { | ||
| PayloadAttributes attrs = new() | ||
| { | ||
| Timestamp = 1_000UL, | ||
| SlotNumber = hasSlotNumber ? 1UL : null, | ||
| }; | ||
|
|
||
| Assert.That(attrs.GetVersion(), Is.EqualTo(expectedVersion)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.