Skip to content

Refactor tests to BTT#289

Draft
maxnorm wants to merge 9 commits intoPerfect-Abstractions:mainfrom
maxnorm:refactor/access-control-test
Draft

Refactor tests to BTT#289
maxnorm wants to merge 9 commits intoPerfect-Abstractions:mainfrom
maxnorm:refactor/access-control-test

Conversation

@maxnorm
Copy link
Collaborator

@maxnorm maxnorm commented Mar 9, 2026

Summary

Refactor tests suite based on the new facet structure and the BTT approach

Changes Made

  • Refactored test suite to BTT structure: Reworked tests to follow the new facet-based layout and BTT (behavioral test tree) approach.
  • Removed legacy monolithic tests: Deleted old AccessControl and Owner test files and their associated harnesses.
  • Added BTT tree specs: Introduced AccessControl.tree and Owner.tree specifications to describe test behavior trees.
  • Added new access test harnesses: Implemented AccessControlCoreMod, AccessControlPausableMod, AccessControlTemporalMod, OwnerCoreMod, and OwnerTwoStepMod harness modules.
  • Expanded AccessControl unit tests: Added tests for admin, batch grant/revoke, data, grant, pausable, renounce, revoke, and temporal data/grant/revoke behaviors with base + facet/mod fuzzing.
  • Expanded Owner and OwnerTwoSteps unit tests: Added data, renounce, and transfer tests for both Owner and OwnerTwoSteps, again with base + facet/mod fuzzing.
  • Introduced storage utilities: Added AccessControlStorageUtils.sol and OwnerStorageUtils.sol to standardize test storage setup.
  • Adjusted ERC165 storage slot: Updated ERC165 tests and harnesses to use keccak256("erc165") as the storage slot instead of keccak256("compose.erc165").
  • Added ERC1155 BTT tests: Introduced behavior-tree-style tests for the ERC1155 implementation.
  • Completed ERC20 BTT tests: Finished converting/adding ERC20 tests to the new BTT pattern.
  • Split exportSelectors test: Moved export selector tests into a dedicated exportSelectors test file.

Checklist

Before submitting this PR, please ensure:

  • Code follows the Solidity feature ban - No inheritance, constructors, modifiers, public/private variables, external library functions, using for directives, or selfdestruct

  • Code follows Design Principles - Readable, uses diamond storage, favors composition over inheritance

  • Code matches the codebase style - Consistent formatting, documentation, and patterns (e.g. ERC20Facet.sol)

  • Code is formatted with forge fmt

  • Existing tests pass - Run tests to be sure existing tests pass.

  • New tests are optional - If you don't provide tests for new functionality or changes then please create a new issue so this can be assigned to someone.

  • All tests pass - Run forge test and ensure everything works

  • Documentation updated - If applicable, update relevant documentation

Make sure to follow the contributing guidelines.

Additional Notes

@netlify
Copy link

netlify bot commented Mar 9, 2026

👷 Deploy request for compose-diamonds pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit c036520

@maxnorm maxnorm changed the title Refactor Access tests to BTT Refactor tests to BTT Mar 9, 2026
@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Coverage Report

Coverage

Metric Coverage Details
Lines 63% 1045/1658 lines
Functions 80% 316/395 functions
Branches 48% 98/203 branches

Last updated: Tue, 10 Mar 2026 03:25:12 GMT for commit c036520

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Gas Report

No gas usage changes detected between main and refactor/access-control-test.

All functions maintain the same gas costs. ✅

Last updated: Tue, 10 Mar 2026 03:25:20 GMT for commit c036520

@maxnorm maxnorm requested a review from lumoswiz March 10, 2026 03:30
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.

1 participant