Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1da6dde25a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| b := buf[off] | ||
| off++ | ||
| ts, _ := TritUnpack243([]byte{b}) | ||
| trits = append(trits, ts...) |
There was a problem hiding this comment.
Handle TritPack243 tail markers in TLEB3DecodeLen
TLEB3EncodeLen uses TritPack243, which emits a 2‑byte tail marker (243..246 + value) whenever the trit count isn’t a multiple of 5 (e.g., any length with 1–4 base‑9 digits, including 0..6560). TLEB3DecodeLen reads one byte at a time and calls TritUnpack243([]byte{b}) while discarding the error, so if the next byte is a tail marker the decode silently drops trits and then interprets the tail value byte as a full 5‑trit group. That produces the wrong length and causes DecodeEnvelope/splitFields to mis-parse most frames.
Useful? React with 👍 / 👎.
| pack := TritPack243(trits[:used]) | ||
| usedBytes := len(pack) | ||
| return v, offset + usedBytes - 1 + (off - offset), nil |
There was a problem hiding this comment.
Fix newOff advance for multi-byte lengths
off already points past the bytes read for this length, but newOff adds usedBytes on top of that (offset + usedBytes - 1 + (off - offset)). For any length that consumes more than one byte, this advances past the actual field boundary (e.g., a two‑byte length returns offset+3 instead of offset+2), so subsequent fields are misaligned and AAD/tag slicing becomes incorrect.
Useful? React with 👍 / 👎.
Motivation
make verifyflow and CI that runs the same checks.Description
DecodeEnvelope+AADBeforeTag, a TLEB3 decode helper, Avro decoders/encoders for HGRequest/HGResponse, and repack/round-trip checks infixtures_test.go.decode -> buildequality assertions in Rust fixture tests, plus constant-time AEAD tag comparisons (subtleusage).Makefilewithmake verify, and a CI workflow that runs format + tests + fixture verification; spec/docs updated to reflect port behavior (XChaCha20-Poly1305 only, AUX opaque, explicit per-frame nonces).Testing
cargo fmt,gofmt) successfully as part of verification steps.go test ./...but it failed due to network/proxy restrictions when fetching modules (dependency download blocked).cargo testbut it failed due to crates.io index download being blocked by network/proxy restrictions.cryptographypackage (XChaCha20-Poly1305) was not installed in the environment.Codex Task