Skip to content

ms-codec v0.2.0 — bch module + decode_with_correction

Choose a tag to compare

@bg002h bg002h released this 18 May 01:00

Tranche B Phase B.3 + B.4 of the v0.22.x follow-ups cycle. Vendors BCH primitives + full-decode-semantic decode_with_correction for ms1 single-chunk inputs.

What's new

  • bch module (NEW) — vendored from md-codec's structure, all-public surface, parameterized on `MS_REGULAR_CONST = 0x962958058f2c192a` (byte-exact with toolkit's pre-existing vendored constant).
  • bch_decode module (NEW) — ~480 LOC mirror of md-codec's BM+Chien+Forney port. Parity-smoke verified GREEN against mnemonic-toolkit-v0.22.1's vendored decoder.
  • decode_with_correction(s: &str) -> Result<(Tag, Payload, Vec<CorrectionDetail>), Error> — full-decode semantics (Q1 lock): BCH-corrects then runs the existing decoder.
  • New Error::TooManyErrors { bound: u8 } variant (no chunk_index; ms1 is single-chunk).

Closes FOLLOWUPs

  • ms-codec-decode-with-correction-public-api (toolkit + this repo)

12-word ms1 anchor constraint

ms-codec's BCH model targets the 12-word abandon vector. Non-12-word ms1 variants (15/18/21/24-word) hit pre-existing toolkit limitations (their polymod ≠ MS_REGULAR_CONST) — documented in bch_decode.rs module doc.

Lockstep

🤖 Released as part of the v0.22.x follow-ups cycle (Tranche B close).