Skip to content

refactor(test): cleanup /cannon test structure and documentation #16211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

aliersh
Copy link
Contributor

@aliersh aliersh commented May 30, 2025

This PR refactors part of the test suite within the /cannon folder as part of a broader effort to standardize structure, documentation, and formatting across the codebase.

The goal of this PR is to land the straightforward refactors first. More complex files, due to custom setup logic, heavy internal dependencies, or unclear structure, will be handled in a follow-up PR to avoid blocking progress and reduce review scope.

Common changes applied where applicable:

  • Consolidated shared test initialization into dedicated *_TestInit contracts
  • Organized test functions into logically separated contracts inheriting from TestInit
  • Added @title and @notice tags to all test contracts
  • Added function-level @notice comments describing expected behavior under test
  • Replaced @dev tags with @notice where appropriate
  • Enforced a 100-character limit for inline comments

Progress

Refactored 2 of 3 test files (66.6% complete)

  • MIPS64.t.sol
  • MIPS64Memory.t.sol
  • PreimageOracle.t.sol (deferred)

This remaining file will be refactored in a future PR.

aliersh added 2 commits May 30, 2025 17:00
- consolidate test initialization into MIPS64_TestInit contract
- group tests not directly tied to a base contract function or are testing multiple functions into MIPS64_Unclassified_Test
- add @title and @notice tags to test contracts
- consolidate test initialization into MIPS64Memory_TestInit contract
- organize individual test functions into separate contracts inheriting from TestInit
- refactor test function names to follow naming convention
- add @title and @notice tags to test contracts
- convert @dev tags to @notice where appropriate
- ensure comment stay within 100 character limit
Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.55%. Comparing base (03d70f8) to head (9f24091).
Report is 40 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #16211      +/-   ##
===========================================
- Coverage    82.49%   81.55%   -0.94%     
===========================================
  Files          161      161              
  Lines         8866     8866              
===========================================
- Hits          7314     7231      -83     
- Misses        1412     1502      +90     
+ Partials       140      133       -7     
Flag Coverage Δ
cannon-go-tests-64 65.84% <ø> (-1.94%) ⬇️
contracts-bedrock-tests 96.24% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aliersh aliersh marked this pull request as ready for review June 3, 2025 19:26
@aliersh aliersh requested a review from a team as a code owner June 3, 2025 19:26
@aliersh aliersh requested review from tynes and smartcontracts June 3, 2025 19:26
@smartcontracts smartcontracts enabled auto-merge June 4, 2025 14:36
@smartcontracts smartcontracts added this pull request to the merge queue Jun 4, 2025
Merged via the queue into develop with commit 88816e9 Jun 4, 2025
60 checks passed
@smartcontracts smartcontracts deleted the ari/cannon-tests-cleanup branch June 4, 2025 14:53
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.

3 participants