Skip to content

fix(escrow): replace crate-level clippy allows with targeted exceptions (#332)#356

Merged
mikewheeleer merged 2 commits into
Talenttrust:mainfrom
Topmatrixmor2014:fix/issue-332-targeted-clippy-allows
May 27, 2026
Merged

fix(escrow): replace crate-level clippy allows with targeted exceptions (#332)#356
mikewheeleer merged 2 commits into
Talenttrust:mainfrom
Topmatrixmor2014:fix/issue-332-targeted-clippy-allows

Conversation

@Topmatrixmor2014
Copy link
Copy Markdown

Summary

Closes #332.

Removes the three permissive crate-level lint suppressions from contracts/escrow/src/lib.rs:

  • #![allow(dead_code)]
  • #![allow(unused_imports)]
  • #![allow(unused_variables)]

These blanket allows were masking real dead code (e.g. proptest.rs, fuzz_test.rs, TTL helpers) and preventing CI from catching future regressions.

Changes

contracts/escrow/src/lib.rs

  • Removed the three crate-wide allows
  • Prefixed unused contract_id parameter in check_accounting_invariant with _
  • Added item-level #[allow(dead_code)] to require_admin (retained for future admin-gated operations)

contracts/escrow/src/amount_validation.rs

  • Added item-level #[allow(dead_code)] with justification comments to the 3 public constants (STROOP_PRECISION, MAX_SINGLE_AMOUNT_STROOPS, MIN_POSITIVE_AMOUNT) and 5 public validation functions that are part of the module's public API but not yet called by the contract itself

contracts/escrow/src/test/mod.rs

  • Added item-level #[allow(dead_code)] to all shared test fixture helpers and constants
  • Prefixed unused other match-arm binding with _

Testing

All CI checks pass locally:

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo build
  • cargo test — 53/53 tests pass ✅

Add property-based and deterministic tests that prove the escrow
accounting invariant never breaks across deposit/release/refund sequences.

Changes:
- contracts/escrow/src/proptest.rs: 6 proptest properties (256 cases each)
  covering random op sequences, full release, double-release rejection,
  incremental deposits, cancel, and over-deposit rejection
- contracts/escrow/src/test/accounting_invariants.rs: 16 deterministic tests
  covering happy-path sequences, cancel sequences, adversarial inputs
  (double release, release without funds, over-deposit, out-of-range index,
  zero/negative deposit), multi-contract isolation, and ExactTotal mode
- contracts/escrow/src/test/mod.rs: register accounting_invariants submodule
- contracts/escrow/src/lib.rs: minor cleanup
- docs/escrow/FUNDING_ACCOUNTING.md: document property test suite

All 53 tests pass (cargo +1.88.0 test -p escrow).
…ns (Talenttrust#332)

Remove the three permissive crate-level lint suppressions:
  - #![allow(dead_code)]
  - #![allow(unused_imports)]
  - #![allow(unused_variables)]

These blanket allows were masking real dead code (proptest.rs, fuzz_test.rs,
TTL helpers) and preventing CI from catching future regressions.

Targeted fixes applied:
- lib.rs: prefix unused  param with ; add item-level
  #[allow(dead_code)] to  (retained for future admin ops)
- amount_validation.rs: add item-level #[allow(dead_code)] to the 3
  public constants and 5 public validation functions that are part of
  the module's public API but not yet called by the contract itself
- test/mod.rs: add item-level #[allow(dead_code)] to all shared test
  fixture helpers/constants; prefix unused  match-arm binding
  with

All CI checks pass: cargo fmt, cargo clippy -D warnings, cargo build,
cargo test (53/53).
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@Topmatrixmor2014 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@mikewheeleer mikewheeleer merged commit 31dbb36 into Talenttrust:main May 27, 2026
1 check passed
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.

Replace permissive crate-level clippy allows with targeted lint exceptions

2 participants