Skip to content

Commit 5281d23

Browse files
authored
Use proper integer encoding for Union in SSZ (#4725)
From "Integers are encoded as strings", it follows that the numeric "selector" of `Union` should also be encoded like that. Note that `Union`'s JSON encoding is currently unused. Portal uses it only for binary serialization.
1 parent 079f0c6 commit 5281d23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ssz/simple-serialize.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ value. Parsers may ignore additional JSON fields.
474474
| `ProgressiveList[byte]` | hex-byte-string | `"0x1122"` |
475475
| `Bitlist[N]` | hex-byte-string | `"0x1122"` |
476476
| `ProgressiveBitlist` | hex-byte-string | `"0x1122"` |
477-
| `Union[type_0, type_1, ...]` | selector-object | `{ "selector": number, "data": type_N }` |
477+
| `Union[type_0, type_1, ...]` | selector-object | `{ "selector": string, "data": type_N }` |
478478
| `CompatibleUnion({selector: type})` | selector-object | `{ "selector": string, "data": type }` |
479479

480480
Integers are encoded as strings to avoid loss of precision in 64-bit values.

0 commit comments

Comments
 (0)