Skip to content

fix(rpc): update REST+SSZ for api_newpayload - #4855

Merged
kdeme merged 2 commits into
status-im:witness-rest-ssz-endpointfrom
jsign:jsign-update-rest-ssz-endpoint
Sep 25, 2026
Merged

kdeme merged 2 commits into
status-im:witness-rest-ssz-endpointfrom
jsign:jsign-update-rest-ssz-endpoint

Conversation

@jsign

@jsign jsign commented Sep 25, 2026

Copy link
Copy Markdown

Updates POST /engine/v1/payloads/witness to match execution-apis#885 at 40924d49, which removes public_keys from the response.

Removes the associated key-recovery helper and updates PayloadStatusWithWitness to contain only payload_status and witness. Adds byte-level tests for the two-offset SSZ encoding and updates the REST tests while retaining coverage for transaction-bearing and already-known payloads.

@kdeme kdeme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

Comment thread tests/test_engine_ssz_types.nim Outdated
Comment on lines +116 to +139
# Two variable-size fields: the fixed section is exactly 8 bytes.
check:
uint32.fromBytesLE(encoded.toOpenArray(0, 3)) == 8'u32
uint32.fromBytesLE(encoded.toOpenArray(4, 7)) == uint32(8 + statusBytes.len)
encoded == @[8'u8, 0, 0, 0, 49, 0, 0, 0] & statusBytes & witnessBytes
SSZ.decode(encoded, PayloadStatusWithWitness) == response

test "PayloadStatusWithWitness: non-VALID statuses use two offsets and no witness":
for status in [PayloadStatusCode.INVALID, PayloadStatusCode.SYNCING,
PayloadStatusCode.ACCEPTED]:
let
response = PayloadStatusWithWitness(
payload_status: PayloadStatus(status: uint8(status)))
statusBytes = SSZ.encode(response.payload_status)
witnessBytes = SSZ.encode(response.witness)
encoded = SSZ.encode(response)

check:
witnessBytes.len == 0
uint32.fromBytesLE(encoded.toOpenArray(0, 3)) == 8'u32
uint32.fromBytesLE(encoded.toOpenArray(4, 7)) == uint32(8 + statusBytes.len)
encoded == @[8'u8, 0, 0, 0, 17, 0, 0, 0] & statusBytes & witnessBytes
SSZ.decode(encoded, PayloadStatusWithWitness) == response

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This kind of testing of ssz variable / fixed parts, offsets, etc is quite SSZ general and normally covered in the libraries test. Could also just be left out here :)

@jsign
jsign marked this pull request as ready for review September 25, 2026 20:00
@jsign
jsign requested a review from kdeme September 25, 2026 20:06
@kdeme
kdeme merged commit 40f721a into status-im:witness-rest-ssz-endpoint Sep 25, 2026
28 checks passed
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.

2 participants