Skip to content

eth/catalyst: return -32602 for FCU V2 wrong payloadAttributes version#33918

Closed
Muzry wants to merge 1 commit into
ethereum:masterfrom
Muzry:fix-fcuv2-invalid-params-code
Closed

eth/catalyst: return -32602 for FCU V2 wrong payloadAttributes version#33918
Muzry wants to merge 1 commit into
ethereum:masterfrom
Muzry:fix-fcuv2-invalid-params-code

Conversation

@Muzry
Copy link
Copy Markdown
Contributor

@Muzry Muzry commented Mar 2, 2026

I observed the following failure while running hive:

https://hive.ethpandaops.io/#/test/generic/1772351960-ad3e3e460605c670efe1b4f4178eb422?testnumber=153

Relevant log excerpt:

>> (658f6320) {"jsonrpc":"2.0","id":1,"method":"engine_forkchoiceUpdatedV2","params":[{"headBlockHash":"0x8efd0af809ef64f159eed0717051a46a6a019783ba42657c16529ef18385dabb","safeBlockHash":"0x0000000000000000000000000000000000000000000000000000000000000000","finalizedBlockHash":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"timestamp":"0x1235","prevRandao":"0x0000000000000000000000000000000000000000000000000000000000000000","suggestedFeeRecipient":"0x0000000000000000000000000000000000000000","withdrawals":null,"parentBeaconBlockRoot":null}]}
<< (658f6320) {"jsonrpc":"2.0","id":1,"error":{"code":-38003,"message":"Invalid payload attributes","data":{"err":"missing withdrawals"}}}
DEBUG (Corrupted Block Hash Payload (INVALID)): Sent shanghai fcu using PayloadAttributesV1, error is expected
FAIL (Corrupted Block Hash Payload (INVALID)): Expected error code on EngineForkchoiceUpdatedV2: want=-32602, got=-38003

In short: geth returns -38003 for this FCU V2 invalid-structure/version case, while hive expects -32602.

Why return -32602

Per Shanghai engine_forkchoiceUpdatedV2:

  • PayloadAttributesV1 MUST be used when timestamp < Shanghai.
  • PayloadAttributesV2 MUST be used when timestamp >= Shanghai.
  • If the wrong version is used, client software MUST return -32602: Invalid params.

Reference:

https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#engine_forkchoiceupdatedv2

In this case, when timestamp >= Shanghai and withdrawals is null, we treat that as a version mismatch (i.e. not a valid PayloadAttributesV2), so it should return -32602.

This PR updates FCU V2 handling to follow that requirement.

Result

This change fixes 9 hive test cases.

Note

If my interpretation of the spec here is incorrect, please let me know and I can adjust the implementation accordingly.

@MariusVanDerWijden
Copy link
Copy Markdown
Member

You are correct, but I think the spec is bad in that case. It makes no sense to return 38003 for V3 and V4 and 32602 for V2 and V1.

Maybe @marioevz and @MysticRyuujin can weigh in here

@MysticRyuujin
Copy link
Copy Markdown
Contributor

Hmmm

Code Message
38003 "Invalid payload attributes"
32602 "Invalid params"

I would think that 38003 is the correct error code for this scenario, as it's an invalid attribute, not an invalid param?

I think I agree that the SPEC should change 🤔

@mkalinin
Copy link
Copy Markdown
Contributor

mkalinin commented Mar 6, 2026

What do you think about introducing engine_getSupportedProtocos with a specific semantics instead of introducing a new capabilities method?

@MariusVanDerWijden
Copy link
Copy Markdown
Member

@mkalinin I think your comment is not related to this PR, right?

@MysticRyuujin
Copy link
Copy Markdown
Contributor

The spec was updated

@Muzry
Copy link
Copy Markdown
Contributor Author

Muzry commented Mar 10, 2026

Thanks everyone for the clarification, and for updating the spec.
I’ll align with the updated spec, try to fix the other clients accordingly, and close this PR.

@Muzry Muzry closed this Mar 10, 2026
yperbasis pushed a commit to erigontech/erigon that referenced this pull request Mar 17, 2026
This PR updates `engine_forkchoiceUpdatedV2` to return `-38003: Invalid
payload attributes` when the wrong `payloadAttributes` version is used.

  In particular, FCUv2 payload-attribute version mismatches such as:
  - missing `withdrawals` at or after Shanghai
  - unexpected `withdrawals` before Shanghai

should be treated as `Invalid payload attributes`, not `Invalid params`.

  ## Why

This change aligns the client with the latest Engine API spec update in:
  - ethereum/execution-apis#761

It also follows the implementation discussion and prior client-side
change in:
  - ethereum/go-ethereum#33918

The spec was clarified so that FCUv2 now behaves consistently with newer
forkchoiceUpdated versions for payloadAttributes structure/version
  mismatches.

  ## What changed

- Updated FCUv2 payload attributes validation to return `-38003` for
payloadAttributes version mismatches.
  - Added/updated regression coverage for the affected FCUv2 cases.

  ## Hive impact

This fixes the Hive `engine-withdrawals` failure caused by returning the
wrong error code for FCUv2 payloadAttributes mismatches.

  Relevant Hive failure:
-
https://hive.ethpandaops.io/#/test/generic/1773130326-4e173a80b2b6f0634fd0139743cbe0de

After this change, the client returns the expected error code for the
affected FCUv2 cases.

If my understanding or interpretation of the spec change is incorrect,
please let me know and I can adjust the implementation accordingly.

---------

Co-authored-by: muzry.li <muzry.li1@ambergroup.io>
github-merge-queue Bot pushed a commit to lambdaclass/ethrex that referenced this pull request Mar 17, 2026
This PR updates `engine_forkchoiceUpdatedV2` to return `-38003: Invalid
payload attributes` when the wrong `payloadAttributes` version is used.

  In particular, FCUv2 payload-attribute version mismatches such as:
  - missing `withdrawals` at or after Shanghai
  - unexpected `withdrawals` before Shanghai

should be treated as `Invalid payload attributes`, not `Invalid params`.

  ## Why

This change aligns the client with the latest Engine API spec update in:
  - ethereum/execution-apis#761

It also follows the implementation discussion and prior client-side
change in:
  - ethereum/go-ethereum#33918

The spec was clarified so that FCUv2 now behaves consistently with newer
forkchoiceUpdated versions for payloadAttributes structure/version
  mismatches.

  ## What changed

- Updated FCUv2 payload attributes validation to return `-38003` for
payloadAttributes version mismatches.
  - Added/updated regression coverage for the affected FCUv2 cases.

  ## Hive impact

This fixes the Hive `engine-withdrawals` failure caused by returning the
wrong error code for FCUv2 payloadAttributes mismatches.

  Relevant Hive failure:
-
https://hive.ethpandaops.io/#/test/generic/1773130989-fdc508a8e36929a0f9059e686f9f65ba

After this change, the client returns the expected error code for the
affected FCUv2 cases.

If my understanding or interpretation of the spec change is incorrect,
please let me know and I can adjust the implementation accordingly.
lupin012 pushed a commit to erigontech/erigon that referenced this pull request Mar 17, 2026
This PR updates `engine_forkchoiceUpdatedV2` to return `-38003: Invalid
payload attributes` when the wrong `payloadAttributes` version is used.

  In particular, FCUv2 payload-attribute version mismatches such as:
  - missing `withdrawals` at or after Shanghai
  - unexpected `withdrawals` before Shanghai

should be treated as `Invalid payload attributes`, not `Invalid params`.

  ## Why

This change aligns the client with the latest Engine API spec update in:
  - ethereum/execution-apis#761

It also follows the implementation discussion and prior client-side
change in:
  - ethereum/go-ethereum#33918

The spec was clarified so that FCUv2 now behaves consistently with newer
forkchoiceUpdated versions for payloadAttributes structure/version
  mismatches.

  ## What changed

- Updated FCUv2 payload attributes validation to return `-38003` for
payloadAttributes version mismatches.
  - Added/updated regression coverage for the affected FCUv2 cases.

  ## Hive impact

This fixes the Hive `engine-withdrawals` failure caused by returning the
wrong error code for FCUv2 payloadAttributes mismatches.

  Relevant Hive failure:
-
https://hive.ethpandaops.io/#/test/generic/1773130326-4e173a80b2b6f0634fd0139743cbe0de

After this change, the client returns the expected error code for the
affected FCUv2 cases.

If my understanding or interpretation of the spec change is incorrect,
please let me know and I can adjust the implementation accordingly.

---------

Co-authored-by: muzry.li <muzry.li1@ambergroup.io>
AskAlexSharov pushed a commit to erigontech/erigon that referenced this pull request Apr 8, 2026
This PR updates `engine_forkchoiceUpdatedV2` to return `-38003: Invalid
payload attributes` when the wrong `payloadAttributes` version is used.

  In particular, FCUv2 payload-attribute version mismatches such as:
  - missing `withdrawals` at or after Shanghai
  - unexpected `withdrawals` before Shanghai

should be treated as `Invalid payload attributes`, not `Invalid params`.

  ## Why

This change aligns the client with the latest Engine API spec update in:
  - ethereum/execution-apis#761

It also follows the implementation discussion and prior client-side
change in:
  - ethereum/go-ethereum#33918

The spec was clarified so that FCUv2 now behaves consistently with newer
forkchoiceUpdated versions for payloadAttributes structure/version
  mismatches.

  ## What changed

- Updated FCUv2 payload attributes validation to return `-38003` for
payloadAttributes version mismatches.
  - Added/updated regression coverage for the affected FCUv2 cases.

  ## Hive impact

This fixes the Hive `engine-withdrawals` failure caused by returning the
wrong error code for FCUv2 payloadAttributes mismatches.

  Relevant Hive failure:
-
https://hive.ethpandaops.io/#/test/generic/1773130326-4e173a80b2b6f0634fd0139743cbe0de

After this change, the client returns the expected error code for the
affected FCUv2 cases.

If my understanding or interpretation of the spec change is incorrect,
please let me know and I can adjust the implementation accordingly.

---------

Co-authored-by: muzry.li <muzry.li1@ambergroup.io>
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.

4 participants