From 8b261dd3e0c3dff7a38387ac0143c4cfc660d05a Mon Sep 17 00:00:00 2001 From: tersec Date: Wed, 31 Jan 2024 03:50:24 +0000 Subject: [PATCH] fix blob_sidecar SSE versioned_hash field to be 0x-prefixed hex (#5844) --- beacon_chain/nimbus_beacon_node.nim | 3 ++- beacon_chain/spec/datatypes/deneb.nim | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index a2b668d427..66d2ff8660 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -258,7 +258,8 @@ proc initFullNode( index: data.index, slot: data.signed_block_header.message.slot, kzg_commitment: data.kzg_commitment, - versioned_hash: data.kzg_commitment.kzg_commitment_to_versioned_hash)) + versioned_hash: + data.kzg_commitment.kzg_commitment_to_versioned_hash.to0xHex)) proc onBlockAdded(data: ForkedTrustedSignedBeaconBlock) = let optimistic = if node.currentSlot().epoch() >= dag.cfg.BELLATRIX_FORK_EPOCH: diff --git a/beacon_chain/spec/datatypes/deneb.nim b/beacon_chain/spec/datatypes/deneb.nim index 5d26ecdc5b..b579349827 100644 --- a/beacon_chain/spec/datatypes/deneb.nim +++ b/beacon_chain/spec/datatypes/deneb.nim @@ -40,6 +40,10 @@ type # TODO this apparently is suppposed to be SSZ-equivalent to Bytes32, but # current spec doesn't ever SSZ-serialize it or hash_tree_root it + # TODO make `distinct` then add a REST serialization for it specifically, via + # basically to0xHex, then fix BlobSidecarInfoObject to use VersionedHash, not + # string, and rely on REST serialization, rather than serialize VersionedHash + # field manually VersionedHash* = array[32, byte] # https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/deneb/beacon-chain.md#custom-types @@ -68,7 +72,7 @@ type index*: BlobIndex slot*: Slot kzg_commitment*: KzgCommitment - versioned_hash*: VersionedHash + versioned_hash*: string # TODO should be string; VersionedHash not distinct # https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/deneb/p2p-interface.md#blobidentifier BlobIdentifier* = object