-
Notifications
You must be signed in to change notification settings - Fork 61
test: add comprehensive test coverage for AccessControl contracts #132
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
test: add comprehensive test coverage for AccessControl contracts #132
Conversation
Coverage Report
Last updated: Mon, 27 Oct 2025 03:56:15 GMT for commit |
3b71b42 to
31323f0
Compare
| uint256 gasUsed = gasBefore - gasleft(); | ||
|
|
||
| console2.log("Gas used for hasRole:", gasUsed); | ||
| assertEq(gasUsed, 1377, "hasRole gas cost should be exactly 1377"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using fix gas assumption, in test, break the coverage.
This gas value is based on the assumption of optimizer runs which the coverage action disable. The optimizer_runs value is set to 20_000, but this value can also be change. This will also break the tests.
Upper limit seems a good way to test gas usage within a appropriate range while i agree that it's not the most accurate way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best way IMO is to rip out these "gas tests" entirely, and utilize forge snapshot for tracking gas costs between commits / code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
will fix these broken actions |
55ee4c5 to
90106c4
Compare
…rfect-Abstractions#131) Implement complete test suites for LibAccessControl and AccessControlFacet with test harnesses to expose internal library functions for thorough testing. New files added: - test/access/AccessControl/LibAccessControl.t.sol (454 lines, 37 tests) - test/access/AccessControl/AccessControlFacet.t.sol (611 lines, 45 tests) - test/access/AccessControl/harnesses/LibAccessControlHarness.sol - test/access/AccessControl/harnesses/AccessControlFacetHarness.sol Test coverage includes: - Core RBAC functionality (grant, revoke, renounce, hasRole) - Role admin hierarchies and custom role admins - Access control enforcement with requireRole - Storage slot verification and collision prevention - Event emission for all role operations - Edge cases (circular hierarchies, self-admin roles, zero addresses) - Comprehensive fuzz tests for all operations - Complex multi-level role hierarchy scenarios Total: 82 new tests ensuring robust access control implementation following patterns established by Owner and OwnerTwoSteps test suites. Closes Perfect-Abstractions#131
90106c4 to
61d0e0d
Compare
…rol-tests test: add comprehensive test coverage for AccessControl contracts
test: add comprehensive test coverage for AccessControl contracts (#131)
Implement complete test suites for LibAccessControl and AccessControlFacet
with test harnesses to expose internal library functions for thorough testing.
New files added:
Test coverage includes:
Total: 82 new tests ensuring robust access control implementation
following patterns established by Owner and OwnerTwoSteps test suites.
Closes #131