-
Notifications
You must be signed in to change notification settings - Fork 1
refactor(safe): collapse LibProd{Safes,TokensBase} into invariant libs + LibInvariants orchestrator #199
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
Merged
thedavidmeister
merged 7 commits into
main
from
feat/2026-05-29-pin-authoriser-uniformity
Jun 25, 2026
Merged
refactor(safe): collapse LibProd{Safes,TokensBase} into invariant libs + LibInvariants orchestrator #199
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b53a327
test(failing): pin uniform authoriser across prod receipt vaults
dd3ca93
feat(safe): fold uniform-authoriser invariant into assertAll
2dfe631
refactor(safe): extract LibTokenInvariants from LibSafeInvariants
a2861dd
refactor(safe): split LibSafeInvariants.assertAll into LibInvariants
b3086fe
refactor(safe): merge LibProdSafes + LibProdTokensBase into their inv…
8549d8d
refactor(token-invariants): lift IOwnable/IAuthorisable into dedicate…
thedavidmeister 5bd85f2
fix(safe-invariants): pin STOX_TOKEN_OWNER_SAFE threshold to 3 (post-…
thedavidmeister File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // SPDX-License-Identifier: LicenseRef-DCL-1.0 | ||
| // SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd | ||
| pragma solidity ^0.8.25; | ||
|
|
||
| /// @title IAuthorisable | ||
| /// @notice Minimal authoriser-getter surface exposed by ST0x receipt vaults. | ||
| /// Returns `address` rather than reusing the upstream `IAuthorizableV1` so | ||
| /// the token-invariant checks carry a narrow surface and not the upstream's | ||
| /// richer return type. | ||
| interface IAuthorisable { | ||
| /// @notice The authoriser contract gating restricted vault operations. | ||
| /// @return The authoriser address. | ||
| function authorizer() external view returns (address); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // SPDX-License-Identifier: LicenseRef-DCL-1.0 | ||
| // SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd | ||
| pragma solidity ^0.8.25; | ||
|
|
||
| /// @title IOwnable | ||
| /// @notice Minimal `Ownable`-like surface used by ST0x receipt vaults. | ||
| /// Every production receipt vault exposes `owner()`; the token-invariant | ||
| /// checks only need the getter, not the transfer/renounce mutators. This | ||
| /// narrow surface avoids depending on a richer token-side interface that | ||
| /// could drift. | ||
| interface IOwnable { | ||
| /// @notice The current owner of the contract. | ||
| /// @return The owner address. | ||
| function owner() external view returns (address); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // SPDX-License-Identifier: LicenseRef-DCL-1.0 | ||
| // SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd | ||
| pragma solidity ^0.8.25; | ||
|
|
||
| import {IGnosisSafe} from "../interface/IGnosisSafe.sol"; | ||
| import {LibSafeInvariants} from "./LibSafeInvariants.sol"; | ||
| import {LibTokenInvariants} from "./LibTokenInvariants.sol"; | ||
|
|
||
| /// @title LibInvariants | ||
| /// @notice Orchestrator that composes every per-facet `assertAll` into a | ||
| /// single bundle. Each facet lib (`LibSafeInvariants`, `LibTokenInvariants`, | ||
| /// any future `Lib<Subject>Invariants`) owns its own `assertAll`; this lib | ||
| /// chains them so a consumer asserting the full production state has a | ||
| /// single call site without any facet lib having to know about other | ||
| /// facets. | ||
| /// @dev Lives separately from `LibSafeInvariants` so the file name doesn't | ||
| /// lie about scope: cross-facet composition belongs in a cross-facet lib, | ||
| /// not inside a Safe-named lib. Per-facet libs stay focused on their | ||
| /// subject and reachable standalone for scripts / fork tests that don't | ||
| /// need the full bundle. | ||
| library LibInvariants { | ||
| /// @notice Full production-state invariant bundle. Composes every | ||
| /// per-facet `assertAll`: Safe identity / config + token-side | ||
| /// owner/authoriser uniformity. Pre-flight at the start of every | ||
| /// migration script and prod-state fork test; if this passes silently | ||
| /// the live system is in its current expected state across every | ||
| /// pinned facet. | ||
| /// @dev The full-args overload is the right call site only when a | ||
| /// caller is *deliberately* asserting a state that diverges from the | ||
| /// pinned current truth (e.g. a migration script's post-state re-check | ||
| /// after it has simulated `changeThreshold`); the no-arg overload | ||
| /// fills in the `LibSafeInvariants`-pinned defaults. | ||
| /// @param safe The Safe to validate against the pinned current truth. | ||
| function assertAll(IGnosisSafe safe) internal view { | ||
| LibSafeInvariants.assertAll(safe); | ||
| LibTokenInvariants.assertAll(address(safe), LibTokenInvariants.STOX_PROD_AUTHORISER); | ||
| } | ||
|
|
||
| /// @notice Full-args bundle. Use when overriding the Safe-side | ||
| /// threshold or owner set from `LibSafeInvariants`' current-truth pins — | ||
| /// typically only when running a script that intentionally changes | ||
| /// one of those (post-state assertion). The token-side leg uses the | ||
| /// pinned defaults (vault ownership against the Safe, authoriser | ||
| /// against `LibTokenInvariants.STOX_PROD_AUTHORISER`). | ||
| /// @param safe The Safe to validate. | ||
| /// @param expectedThreshold The expected signature threshold. | ||
| /// @param expectedOwners The expected owner set in `getOwners()` order. | ||
| function assertAll(IGnosisSafe safe, uint256 expectedThreshold, address[] memory expectedOwners) internal view { | ||
| LibSafeInvariants.assertAll(safe, expectedThreshold, expectedOwners); | ||
| LibTokenInvariants.assertAll(address(safe), LibTokenInvariants.STOX_PROD_AUTHORISER); | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.