Re-add toString function for proper hex logs of content keys (#2508)

This commit is contained in:
Kim De Mey 2024-07-19 14:48:03 +02:00 committed by GitHub
parent 6d03acec30
commit 157fb4f1ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -7,9 +7,9 @@
{.push raises: [].} {.push raises: [].}
import results, ssz_serialization, eth/rlp, nimcrypto/hash import results, ssz_serialization, stew/byteutils, eth/rlp, nimcrypto/hash
export hash export hash, ssz_serialization
type type
Bytes2* = ByteVector[2] Bytes2* = ByteVector[2]
@ -19,6 +19,9 @@ type
ContentKeyByteList* = ByteList[2048] # The encoded content key ContentKeyByteList* = ByteList[2048] # The encoded content key
BlockHash* = MDigest[32 * 8] # Bytes32 BlockHash* = MDigest[32 * 8] # Bytes32
func `$`*(x: ByteList[2048]): string =
x.asSeq.to0xHex()
func decodeRlp*(input: openArray[byte], T: type): Result[T, string] = func decodeRlp*(input: openArray[byte], T: type): Result[T, string] =
try: try:
ok(rlp.decode(input, T)) ok(rlp.decode(input, T))