WIP: Migrate SafeGuard tests to 3-of-5 and expand coverage#582
Draft
duncancmt wants to merge 1 commit into
Draft
WIP: Migrate SafeGuard tests to 3-of-5 and expand coverage#582duncancmt wants to merge 1 commit into
duncancmt wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is entirely written by @claude . I still need to actually read the code.