feat: add BatchSizeTooLarge error to IPolicyRegistry#69
Conversation
Document the registry membership batch limit revert so the Solidity interface matches the Rust PolicyRegistry precompile. Co-authored-by: Cursor <[email protected]>
ilikesymmetry
left a comment
There was a problem hiding this comment.
if we have the error in interface, we should also include tests against our mocks so that we can validate intended behavior against real precompiles with fork tests
Per review feedback: with the error declared on the interface, the mock should mirror the Rust precompile's behavior so the same interface-level tests pass in fork-test mode against the real PolicyRegistry. base/base#2876 sets the limit at 64 accounts per call. - MockPolicyRegistry: add `MAX_BATCH_SIZE = 64` (internal) and a pre-mutation length check in `_batchSetMembers` that reverts with `BatchSizeTooLarge(MAX_BATCH_SIZE)`. The check sits at the shared funnel so all three entry points (`createPolicyWithAccounts`, `updateAllowlist`, `updateBlocklist`) inherit it without duplication. - PolicyRegistryTest: expose `MAX_BATCH_SIZE` as a compile-time constant on the test base (kept as a literal, not pulled from the mock, so fork tests against the real precompile share it) and add `_makeAccounts(n)` for batch-bound tests that need to bypass the existing 0..5 `_boundAccounts` cap. - Tests: per affected entrypoint, add one revert test (fuzz over a size above the limit) and one inclusive-boundary success test (batch size exactly == MAX_BATCH_SIZE). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Added in
The revert tests fuzz over arbitrary over-the-limit sizes; the success tests pin the inclusive boundary at exactly 64.
|
Summary
BatchSizeTooLarge(uint256 maxBatchSize)toIPolicyRegistryto match the Rust PolicyRegistry precompile batch limit revertcreatePolicyWithAccounts,updateAllowlist, andupdateBlocklistRelated
Test plan
Made with Cursor