Skip to content

Add protocol frame codec recovery tests#14

Open
fengyangxxx wants to merge 2 commits into
Peter7896:mainfrom
fengyangxxx:bounty/tot-2-frame-codec-recovery-tests
Open

Add protocol frame codec recovery tests#14
fengyangxxx wants to merge 2 commits into
Peter7896:mainfrom
fengyangxxx:bounty/tot-2-frame-codec-recovery-tests

Conversation

@fengyangxxx

Copy link
Copy Markdown

Summary

Fixes #2.

Adds deterministic protocol frame codec recovery coverage for malformed frame boundaries, and fixes the codec header-size mismatch so encoded frames can be decoded against the declared 24-byte header contract.

This PR is scoped only to the protocol frame codec recovery bounty.

Changes

  • Writes the full 8-byte reserved header field so FrameEncoder matches FRAME_HEADER_SIZE = 24.
  • Rejects non-zero reserved header bytes with ProtocolError::InvalidMessage.
  • Tracks successfully accepted frames through FrameDecoder::accepted_frames().
  • Resynchronizes the decoder to the next frame magic after malformed magic, unsupported version, and oversized payload headers so a following valid frame can still decode.
  • Preserves a following valid frame after reserved-byte and checksum failures.
  • Adds a dedicated protocol::frame_tests module for malformed wire-input and recovery fixtures.

Testing

  • cargo test --lib
    • PASS: 32 tests.
  • python3 build.py --list
    • PASS: command completed successfully.
  • python3 build.py
    • Generated and committed diagnostic/build-3ce6b853.json plus diagnostic/build-3ce6b853.logd.
    • Diagnostic summary: 10 modules total, 7 passed, 3 failed.
    • Passing modules: backend, frontend, market, compliance, v2-market-stream, nfc-scanner, openapi-tools.
  • git diff --check
    • PASS.

Diagnostic artifacts

  • diagnostic/build-3ce6b853.json
  • diagnostic/build-3ce6b853.logd

The diagnostic bundle was generated by running python3 build.py in a clean Linux container using the committed tools/encryptly/linux-x64/encryptly binary.

Notes

  • The generated diagnostic password is intentionally not copied into this PR body.
  • Maintainers may remove diagnostic artifacts before merging if desired.

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.

[$50 BOUNTY] [Rust] Add protocol frame codec recovery tests

1 participant