Skip to content

contracts: add keystone forwarder report unit tests#364

Open
Fletch153 wants to merge 1 commit intodevelopfrom
NONEVM-98/add-forwarder-report-unit-tests
Open

contracts: add keystone forwarder report unit tests#364
Fletch153 wants to merge 1 commit intodevelopfrom
NONEVM-98/add-forwarder-report-unit-tests

Conversation

@Fletch153
Copy link
Contributor

Summary

Port EVM KeystoneForwarder_ReportTest.t.sol to Move unit tests for both platform and platform_secondary forwarder contracts (NONEVM-98).

  • Add 14 report validation tests per module (28 total) covering: incorrect DON, inexistent config version, malformed reports/signatures, signature count bounds, invalid/duplicate signers, replay detection, invalid report version, config clear, and multi-version lifecycle
  • Extract build_report/sign_report_n test helpers to eliminate duplication
  • Enhance test_happy_path with pre/post-condition assertions for transmission state and transmitter verification

EVM Tests Ported (9)

EVM Test Move Test Abort Code
test_RevertWhen_ReportHasIncorrectDON test_report_incorrect_don 15
test_RevertWhen_ReportHasInexistentConfigVersion test_report_inexistent_config_version 15
test_RevertWhen_ReportIsMalformed test_report_malformed vector OOB
test_RevertWhen_TooFewSignatures test_report_too_few_signatures 65540
test_RevertWhen_TooManySignatures test_report_too_many_signatures 65540
test_RevertWhen_AnySignatureIsInvalid test_report_invalid_signature 65541
test_RevertWhen_AnySignerIsInvalid test_report_invalid_signer 65538
test_RevertWhen_ReportHasDuplicateSignatures test_report_duplicate_signatures 65539
test_RevertWhen_RetryingSuccessfulTransmission test_report_already_processed 6

Move-Specific Tests (5)

Move Test Description
test_report_invalid_version Report version != 1
test_report_malformed_signature Signature bytes != 96
test_report_after_clear_config Report after config cleared
test_report_config_version_lifecycle Multi-config v1+v2 lifecycle with clear
test_happy_path (enhanced) Added transmission state + transmitter assertions

Skipped EVM Tests (7 — not applicable to Move)

Gas limit, receiver contract model, and retry-with-more-gas tests have no Move equivalent.

Test plan

  • aptos move test --skip-fetch-latest-git-deps --package-dir contracts/platform — 20 tests pass
  • aptos move test --skip-fetch-latest-git-deps --package-dir contracts/platform_secondary — 20 tests pass
  • make move-test — full CI-equivalent check passes

@Fletch153 Fletch153 requested a review from a team as a code owner March 3, 2026 20:06
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

👋 Fletch153, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@Fletch153 Fletch153 force-pushed the NONEVM-98/add-forwarder-report-unit-tests branch from 1953495 to cdd2d11 Compare March 3, 2026 20:12
Port EVM KeystoneForwarder_ReportTest.t.sol to Move unit tests for both
platform and platform_secondary forwarder contracts.

Add 14 report validation tests per module covering:
- Incorrect DON ID and inexistent config version
- Malformed reports and signatures
- Too few/too many signatures
- Invalid signatures, invalid signers, duplicate signers
- Already-processed report replay detection
- Invalid report version
- Config clear and multi-version lifecycle

Extract test helpers (build_report, sign_report_n) to eliminate
duplication and enable flexible test construction.

Enhance test_happy_path with pre/post-condition assertions for
transmission state and transmitter verification.
@Fletch153 Fletch153 force-pushed the NONEVM-98/add-forwarder-report-unit-tests branch from cdd2d11 to 798c09c Compare March 3, 2026 20:22
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.

2 participants