|112||Fix Block Headers
||Peilun Li (@peilun-conflux)||Draft||Spec Breaking||2023-05-08|
Fix the incorrect encoding and decoding implementation of the
custom field of block headers.
Currently, in the block header RLP encoding, each element in the
custom list is appended to the RLP list as raw bytes, where its RLP-encoded data should be appended instead. Decoding such an field as raw bytes may result in a different
custom field from the encoded data.
We should encode and decode the
custom field as expected so that the correct data can be extracted.
Each element of the
custom field would be appended to the block header RLP list normally, which means its RLP-encoded data are appended. And decoding will also treat each element as RLP-encoded bytes.
Nothing needs to explain.
This changes the block header encoding and decoding in P2P transmission, so it’s protocol breaking.
This fix will be enabled with a hardfork, so all upgraded nodes should encode/decode the block headers with the same rule.
Copyright and related rights waived via CC0.