Skip to content

Commit

Permalink
fix blob_sidecar SSE versioned_hash field to be 0x-prefixed hex (#5844)
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec authored Jan 31, 2024
1 parent 87052eb commit 8b261dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion beacon_chain/spec/datatypes/deneb.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8b261dd

Please sign in to comment.