Skip to content

v1.1.0

Latest

Choose a tag to compare

@x88 x88 released this 04 Jul 10:06
75a15da

mhda v1.1.0

URN grammar 1.1 — a behavioral mirror of the go-mhda 1.1.0 reference. The URN
format stays bit-for-bit compatible between the two implementations; parity
was verified with a differential harness (hand-crafted corpus, ~50k random
was verified with a differential harness (hand-crafted corpus, ~50k random
mutations, targeted coin-type fuzz) comparing accept/reject decisions and
canonical output byte for byte.

Breaking changes

Breaking changes

  • Chain identity is the (nt, ci) pair. chain::str() / chain::key()
    return nt:<network>:ci:<chain_id>; operator== compares the identity
    only. The constructor is chain(network_type, chain_id) — the
    three-argument form is gone.
  • The coin type is optional metadata. chain::coin() returns
    std::optional<coin_type>; set_coin() / clear_coin() manage it. When
    set, it is emitted after ci in decimal; it never appears in the key.
    error_code::missing_coin_type is removed.
  • chain::from_key is strict. A chain key must be the canonical identity
    string. A key carrying ct (the pre-1.1 format) throws
    parse_error with the new error_code::coin_type_in_chain_key; any other
    residue — non-identity components, unknown tokens, reordering,
    non-canonical case — throws error_code::invalid_chain_key.
    chain::from_nss stays lenient.
  • Network type values renamed to the accepted lowercase network names:
    bitcoin, tron, avalanche, solana, xrpl, stellar, aptos,
    cardano, algorand; evm, cosmos, near, sui, ton unchanged. No
    aliases; the constant identifiers in the C++ API are unchanged.
  • The address constructor validates its optional string params through
    the same setters as parsed input and throws on an invalid value.
  • coins::atom is 118 per the SLIP-44 registry (168 belongs to
    Helleniccoin).

New

`set_wallet_type()` / `set_wallet_id()`.
  • Coin type registry extended with 34 modern SLIP-44 registrations,
    values verified against the registry.
  • New error_code::invalid_value for rejected free-form setter values.

Parser hardening (in lockstep with the reference)

  • NSS values are enforced to printable ASCII; trimming is ASCII-only and
    locale-independent. Free-form values are case-preserving.
  • Free-form setters reject :, ?, #, whitespace and non-ASCII bytes —
    a client-supplied wallet id can no longer inject foreign components into
    the serialised URN.
  • The SLIP-44 numeric grammar is pinned to plain decimal and 0x hex.

Versioning note

The previous release shipped as tag v1.0.0 while its in-tree version markers
still read 0.1.0. This release restores consistency: the CMake project
version, the changelog and the README all say 1.1.0.

Testing

139 test cases, 100% green under the full warning set (-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wsign-conversion -Werror) and again under
AddressSanitizer/UBSan/LeakSanitizer with halt_on_error=1 — zero
diagnostics. New suites mirror the Go reference: wallet domain, strict chain
keys, and the hardening pack (duplicates, canonical-only keys, setter
injection attempts, coin-type spellings, non-ASCII rejection, case
preservation, registry spot checks). The hash reference vectors were
recomputed for the new canonical strings.