Skip to content

WIP: Migrate SafeGuard tests to 3-of-5 and expand coverage#582

Draft
duncancmt wants to merge 1 commit into
masterfrom
dcmt/fable-safeguard-tests
Draft

WIP: Migrate SafeGuard tests to 3-of-5 and expand coverage#582
duncancmt wants to merge 1 commit into
masterfrom
dcmt/fable-safeguard-tests

Conversation

@duncancmt

Copy link
Copy Markdown
Collaborator

This PR is entirely written by @claude . I still need to actually read the code.

Migrate test/0.8.25/SafeGuard.t.sol to a 3-of-5 Safe configuration so the
suite exercises the `_getThresholdAfterResign` decrement branch (fires when
`ownerCount - threshold == _MINIMUM_THRESHOLD`), which the prior 2-of-5 suite
never reached. Rename all existing tests to the `test_Feature_Scenario_Outcome`
convention and factor the duplicated EIP-712 hashing into shared helpers
(`SafeTx`/`Call` structs, `_safeTxHash`, `_sign`, `_approveHashSig`,
`_enqueue`/`_exec`, `_buildMultiSend`/`_buildMultiSendRaw`, `_safePrevOwner`,
`_reconfigureTo`).

Fix two latent test-interface bugs: declare the contract's real
`txInfo(bytes32)` getter (the interface previously declared a non-existent
`timelockEnd(bytes32)`) and add `check()`, `changeThreshold`, and the missing
error/event declarations.

Add 29 tests covering previously-unexercised paths:
- happy: unanimous immediate bypass (INV3, incl. approveHash signer), multi-
  action interleaved-check multicall, relock after unlock, setDelay/INV2;
- reachable reverts: NotQueued, CannotEnqueuePastTransaction,
  CannotCancelOwnResignation, AlreadyQueued, TimelockElapsed, NotLockedDown,
  NoDelegateCall, EvenNumberOfMultiCalls, GuardCheckNotEnforced, ConfusedDeputy
  (direct + multisend), ERC20SponsorshipUnsafe, IncorrectFallbackHandler,
  GuardIsOwner, ThresholdTooLow/High, Reentrancy, GuardRemoved mid-batch,
  GuardNotInstalled, future-nonce non-cancellable;
- edge-config (2-of-4 via direct reconfiguration): NotEnoughOwners and the
  forced-resignation floor (audit Issue_03);
- regression: removing the lone non-signer mid-timelock makes a queued tx
  unanimous and bypasses the timelock (audit Issue_16).

45 tests total (was 16); all pass on the London build against a mainnet fork.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@duncancmt duncancmt self-assigned this Jun 10, 2026
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