Skip to content

PolicyRegistry: drop ChildPoliciesOutsideOfRange args, add composite child-count getters - #190

Merged
rayyan224 merged 2 commits into
mainfrom
chore/policy-registry-child-limits-getters
Aug 5, 2026
Merged

PolicyRegistry: drop ChildPoliciesOutsideOfRange args, add composite child-count getters#190
rayyan224 merged 2 commits into
mainfrom
chore/policy-registry-child-limits-getters

Conversation

@rayyan224

Copy link
Copy Markdown
Collaborator

Summary

  • Removes the (min, max) args from IPolicyRegistry.ChildPoliciesOutsideOfRange; it now reverts with no args.
  • Adds two new view functions to IPolicyRegistry: MIN_COMPOSITE_CHILD_POLICIES() and MAX_COMPOSITE_CHILD_POLICIES(), so the valid composite child-count range is discoverable via a call instead of parsed from the error args.
  • MockPolicyRegistry implements the new getters as public constants aliasing the existing MIN_CHILD_POLICIES/MAX_CHILD_POLICIES internal constants (same pattern already used for ALWAYS_ALLOW_ID/ALWAYS_BLOCK_ID), and both revert sites (createCompositePolicy, updateComposite) now throw the argless error.
  • Updates existing PolicyRegistry unit tests' revert expectations/NatSpec to match, and adds compositeChildPolicyLimits.t.sol covering the two new getters.

Test plan

  • forge build — compiles clean, MockPolicyRegistry still satisfies IPolicyRegistry
  • forge test --match-path "test/unit/PolicyRegistry/*" — 135 passed, 0 failed
  • forge test (full suite) — 715 passed, 0 failed

…, add composite child-count getters

Removes the (min, max) args from ChildPoliciesOutsideOfRange and exposes the composite
child-policy bounds instead via new MIN_COMPOSITE_CHILD_POLICIES()/MAX_COMPOSITE_CHILD_POLICIES()
view functions on IPolicyRegistry, satisfied by MockPolicyRegistry.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Interface Coverage

✅ All interface functions have test coverage.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

📊 Forge Coverage (src/lib/)

🟡 ≥95% across all metrics — some metrics below 99%.

File Lines Stmts Branches Funcs
🔴 B20FactoryLib.sol 95.40% 96.00% 100.00% 90.00%
🔴 test/lib/ForceFeeder.sol 0.00% 0.00% 100.00% 0.00%
🔴 test/lib/PrecompileProbe.sol 0.00% 0.00% 0.00% 0.00%
🟢 MockActivationRegistry.sol 100.00% 100.00% 100.00% 100.00%
🟢 MockActivationRegistryStorage.sol 100.00% 100.00% 100.00% 100.00%
🟢 MockB20.sol 100.00% 100.00% 100.00% 100.00%
🟢 MockB20Asset.sol 100.00% 100.00% 100.00% 100.00%
🟡 MockB20Factory.sol 98.96% 99.10% 100.00% 100.00%
🟢 MockB20Stablecoin.sol 100.00% 100.00% 100.00% 100.00%
🟢 MockB20Storage.sol 100.00% 100.00% 100.00% 100.00%
🟡 MockPolicyRegistry.sol 100.00% 99.54% 97.67% 100.00%
🟢 MockPolicyRegistryStorage.sol 100.00% 100.00% 100.00% 100.00%
Total 96.80% 97.29% 98.14% 96.49%

Full report: download artifact. To browse locally: make coverage (runs forge coverage + genhtml + opens the HTML report).

Comment thread test/lib/mocks/MockPolicyRegistry.sol Outdated
… public getters only

MockPolicyRegistry no longer needs both an internal constant and a public alias for the
composite child-policy bounds — MIN_COMPOSITE_CHILD_POLICIES/MAX_COMPOSITE_CHILD_POLICIES
are now the single source of truth.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

⚠️ Fork tests: 12 failed, 705 passed

These failures indicate divergences where base/base needs to catch up to the base-std spec. This check is advisory and does not block merging.

Failing tests
  • test_createCompositePolicy_revertOrder(uint8): Error != expected error: custom error 0xcbdee0f6: != ChildPoliciesOutsideOfRange(); counterexample: calldata=0x5fafe4f70000000000000000000000000000000000000000000000000000000000000004 args=[4]
  • test_createCompositePolicy_revert_childPoliciesOutsideOfRange(address,address,uint8,uint8): Error != expected error: custom error 0xcbdee0f6: != ChildPoliciesOutsideOfRange(); counterexample: calldata=0xb84664360000000000000000000000005d9206854c5e4d15896063c7ad4338d3166882fe000000000000000000000000d2926c99164e654182f9f276782e464779c2671000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005 args=[0x5d9206854C5E4d15896063C7ad4338D3166882fe, 0xd2926C99164e654182f9F276782E464779c26710, 0, 5]
  • test_updateComposite_revertOrder(uint8): Error != expected error: custom error 0xcbdee0f6: != ChildPoliciesOutsideOfRange(); counterexample: calldata=0x46b240f9000000000000000000000000000000000000000000000000000000000000000d args=[13]
  • test_updateComposite_revert_childPoliciesOutsideOfRange(uint8,uint8): Error != expected error: custom error 0xcbdee0f6: != ChildPoliciesOutsideOfRange(); counterexample: calldata=0x25c4476000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001 args=[1, 1]
    [FAIL: custom error 0x54309870] test_maxCompositeChildPolicies_success() (gas: 2586)
    [FAIL: custom error 0xb3ae29f7] test_minCompositeChildPolicies_success() (gas: 2519)

@rayyan224
rayyan224 merged commit e2de08b into main Aug 5, 2026
10 checks passed
@rayyan224
rayyan224 deleted the chore/policy-registry-child-limits-getters branch August 5, 2026 01:01
@rayyan224

Copy link
Copy Markdown
Collaborator Author

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