Expand description
Off-chain construction of the CapacityBond.registerNode signing inputs
(ADR 019 § Step 2.3).
Two byte-exact encodings the on-chain CapacityBond depends on:
ownership_message_digestreproducesCapacityBond._verifyEd25519OwnershipSignature’s message hashkeccak256(abi.encodePacked(nodeId, msg.sender, block.chainid, registrationNonce)). The operator signs this 32-byte digest with the iroh node key; the contract’sEd25519Verifiertreats the digest as the ed25519 message. A drift here makesregisterNoderevertInvalidEd25519Signature.pack_multiaddrsbuilds the on-chainmultiaddrsbytesfield: a sequence of(uint16 length, bytes data)entries (ADR 019 § Multiaddr encoding). The length prefix is big-endian, matching theuint16reading of the ADR. Nodes learn addresses viacdn/dht/v1discovery (ADR 022) rather than from this field, so the ADR — not a consumer — is the authority for the format.unpack_multiaddrsis its inverse, read back only bydecdn node rotate-key --key ethwhen it re-registers an operator’s existing addresses from a new Ethereum address.
The EIP-712 BindNodeId half of registration lives in crate::bind_sig
and is reused as-is — binding_signing_hash produces the digest the
operator signs with the Ethereum key.
Functions§
- decode_
dial_ addrs - Decode the on-chain
multiaddrsfield into dialable UDP socket addresses, for use as iroh direct-address hints (ADR 001 § Node Discovery). Leniency is per entry: a non-UTF8 entry, or one that is not a/ip4|ip6/<addr>/udp/<port>/quic-v1QUIC multiaddr, is skipped on its own while the valid entries around it survive. This walks thepack_multiaddrsframing directly rather than throughunpack_multiaddrs, whose all-or- nothing contract would drop every entry on the first bad one. Only a length prefix that overruns the buffer stops the walk — past that point the next entry’s position is unknowable — so the entries decoded before it still count. A self-attested address is only ever one dial path among several, so a malformed or partial record can only fail to add a direct path, never remove a peer from the candidate set, leaving iroh discovery and the relay fallback intact. - ownership_
message_ digest - On-chain ownership-proof digest signed by the iroh node key during
registerNode(ADR 019 § Step 2.3). - pack_
multiaddrs - Pack QUIC multiaddr strings into the on-chain
multiaddrsbytesfield: a sequence of(uint16 length, bytes data)entries with big-endian length prefixes (ADR 019 § Multiaddr encoding). An empty slice yields empty bytes, which the contract accepts (a node may rely on the iroh relay /cdn/dht/v1discovery for reachability until it promotes direct addresses viaupdateMultiaddrs). - unpack_
multiaddrs - Inverse of
pack_multiaddrs: decode the on-chainmultiaddrsbytesfield back into the strings that produced it.