Skip to content

devp2p enrdump: 1 extra prefix byte added for hex representation. #29252

@nalepae

Description

@nalepae

System information

./devp2p --version
devp2p version 1.14.0-unstable-d8e0807d-20240306

OS & Version: OSX
Commit hash : d8e0807

Expected behaviour

Test vector: https://eips.ethereum.org/EIPS/eip-778#test-vectors

./devp2p enrdump enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8

should produce

...
  "secp256k1" 03ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd3138
...

Actual behaviour

...
  "secp256k1" a103ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd3138
...

Notice the extra a1 at the beginning.
The produced secp256k1 is 34 bytes long, whereas 33 bytes are expected - Source

It seems all hex data are displayed with 1 extra prefix byte.

Example with:

./devp2p enrdump "enr:-Ku4QImhMc1z8yCiNJ1TyUxdcfNucje3BGwEHzodEZUan8PherEo4sF7pPHPSIB1NNuSg5fZy7qFsjmUKs2ea1Whi0EBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQOVphkDqal4QzPMksc5wnpuC3gvSC8AfbFOnZY_On34wIN1ZHCCIyg"
Node ID: 191bbf49632da5393590a33d54421e79e8e5c96ade72f0ba69e1803095de6b04
URLv4:   enode://95a61903a9a9784333cc92c739c27a6e0b782f482f007db14e9d963f3a7df8c01ad6a387e8021f13e684e576ca9e5d8759b3116df521b280a887a0bdc72e457f@18.223.219.100:0?discport=9000
Record has sequence number 1 and 6 key/value pairs.
  "attnets"   880000000000000000
  "eth2"      90f5a5fd4200000000ffffffffffffffff
  "id"        "v4"
  "ip"        18.223.219.100
  "secp256k1" a10395a61903a9a9784333cc92c739c27a6e0b782f482f007db14e9d963f3a7df8c0
  "udp"       9000
  • secp256k1 has 1 extra bytes (expected: 33 - actual 34) - Source
  • eth2 has 1 extra bytes (expected: 16 - actual 17) - Source
  • attnets seems to have extra prefix 88

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions