Skip to content

fix(multiformats): give the byte decoders the code check of the model - #116

Open
IvanAnishchuk wants to merge 1 commit into
etheorem:hackathon26from
IvanAnishchuk:fix/109-multiformats-code-check
Open

IvanAnishchuk wants to merge 1 commit into
etheorem:hackathon26from
IvanAnishchuk:fix/109-multiformats-code-check

Conversation

@IvanAnishchuk

Copy link
Copy Markdown
Contributor

Summary

Closes #109. The ByteArray decoders of a multiaddr component, a multihash, and a CID now refuse a registry member whose own code differs from the code on the wire. The model decoders already made that check.

What changed

  • ComponentWire.decodeAtB?, Multihash.decodeAtB?, and Cid.decodeAtB? make the same comparison as their models, with the same error.
  • Before this, the two paths agreed only through a property of the generated table that nothing proves.

Test plan

  • lake build (every package, on the pinned toolchain) is green.
  • lake test passes, and passes again under +RTS -N1.
  • The import-rule lint is green (ARCHITECTURE.md §2).
  • A new codec or framing layer comes with its round-trip theorem or
    property test, and with a test for its length cap.
  • If this touches wire behavior: the captured vectors still pass,
    and the description names the spec section the change follows.
  • If this touches the go interop path: the interop matrix
    (PLAN W5.9) is green.

Run locally on Linux with lake build --wfail and every executable: 28205 checks passed, 0 failed, 4 skipped, on two threads and again with LEAN_NUM_THREADS=1. The existing property tests that pin each ByteArray decoder to its model still pass, and so do the captured vectors. No input decodes differently, so the wire box does not apply.

Risk / trust footprint

none

Notes for reviewers

No new check comes with this. The generated table maps each code by exact equality, so no input reaches the new branch today. The change makes the production path state the rule itself, so it no longer depends on how the table is built.

LICENSE (LGPL version 3)

  • I have read and accepted LICENSE (LGPL version 3), NOTICE and CLA in the root of this project.

The model decoders of a multiaddr component, a multihash, and a CID
refuse a registry member whose own code differs from the code on the
wire. The ByteArray decoders took the member and skipped that
comparison, so the two paths agreed only through a property of the
generated table that nothing proves.

ComponentWire.decodeAtB?, Multihash.decodeAtB?, and Cid.decodeAtB? now
make the same comparison, with the same error as the model. The
generated table maps each code by exact equality, so no input reaches
the new branch today, and no check can drive it.

Closes etheorem#109.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

multiformats: the byte decoders skip the code check of the model

1 participant