Conversation
kdeme
reviewed
Sep 25, 2026
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 | ||
|
|
Contributor
There was a problem hiding this comment.
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
marked this pull request as ready for review
September 25, 2026 20:00
kdeme
approved these changes
Sep 25, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Updates
POST /engine/v1/payloads/witnessto match execution-apis#885 at40924d49, which removespublic_keysfrom the response.Removes the associated key-recovery helper and updates
PayloadStatusWithWitnessto contain onlypayload_statusandwitness. 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.