Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion foundry.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"rev": "67b81b417e3f2311f71058d526e4c16518b393cc"
},
"lib/rain.vats": {
"rev": "cad9ca4c9f230c97d481c58f635a33c774e22c07"
"rev": "f52c8b471c557d672c1f0ecec5e39b8ae8f337fe"
}
}
9 changes: 9 additions & 0 deletions test/src/lib/LibProdTokensBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {IReceiptVaultV3} from "rain.vats/interface/IReceiptVaultV3.sol";
import {
IOffchainAssetReceiptVaultBeaconSetDeployerV1
} from "rain.vats/interface/IOffchainAssetReceiptVaultBeaconSetDeployerV1.sol";
import {IAuthorizableV1} from "rain.vats/interface/IAuthorizableV1.sol";
import {
ERC1967_BEACON_SLOT,
LibExtrospectERC1967BeaconProxy
Expand Down Expand Up @@ -89,6 +90,14 @@ contract LibProdTokensBaseTest is Test {
LibExtrospectERC1967BeaconProxy.isBeaconOwner(wrappedVaultBeacon, LibProdDeployV1.BEACON_INITIAL_OWNER),
"wrapped vault beacon owner mismatch"
);

// Every prod receipt vault must report a non-zero authorizer,
// and all 13 prod token sets must share the same authorizer
// contract. Inconsistency would mean one vault is configured
// against a different permission boundary than its siblings.
address mstrAuthorizer = address(IAuthorizableV1(LibProdTokensBase.MSTR_RECEIPT_VAULT).authorizer());
assertTrue(mstrAuthorizer != address(0), "mstr authorizer is zero");
assertEq(address(IAuthorizableV1(receiptVault).authorizer()), mstrAuthorizer, "authorizer differs from mstr's");
Comment on lines +98 to +100
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Make per-vault non-zero explicit for clearer drift diagnostics.

Current equality to a non-zero MSTR authorizer is functionally sufficient, but an explicit per-vault non-zero assert gives a direct failure reason for accidental zeroing (separate from mismatch).

Suggested diff
-        address mstrAuthorizer = address(IAuthorizableV1(LibProdTokensBase.MSTR_RECEIPT_VAULT).authorizer());
+        address mstrAuthorizer = IAuthorizableV1(LibProdTokensBase.MSTR_RECEIPT_VAULT).authorizer();
         assertTrue(mstrAuthorizer != address(0), "mstr authorizer is zero");
-        assertEq(address(IAuthorizableV1(receiptVault).authorizer()), mstrAuthorizer, "authorizer differs from mstr's");
+        address tokenAuthorizer = IAuthorizableV1(receiptVault).authorizer();
+        assertTrue(tokenAuthorizer != address(0), "receipt vault authorizer is zero");
+        assertEq(tokenAuthorizer, mstrAuthorizer, "authorizer differs from mstr's");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
address mstrAuthorizer = address(IAuthorizableV1(LibProdTokensBase.MSTR_RECEIPT_VAULT).authorizer());
assertTrue(mstrAuthorizer != address(0), "mstr authorizer is zero");
assertEq(address(IAuthorizableV1(receiptVault).authorizer()), mstrAuthorizer, "authorizer differs from mstr's");
address mstrAuthorizer = IAuthorizableV1(LibProdTokensBase.MSTR_RECEIPT_VAULT).authorizer();
assertTrue(mstrAuthorizer != address(0), "mstr authorizer is zero");
address tokenAuthorizer = IAuthorizableV1(receiptVault).authorizer();
assertTrue(tokenAuthorizer != address(0), "receipt vault authorizer is zero");
assertEq(tokenAuthorizer, mstrAuthorizer, "authorizer differs from mstr's");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/src/lib/LibProdTokensBase.t.sol` around lines 98 - 100, Add an explicit
non-zero check for the per-vault authorizer before asserting equality: call
IAuthorizableV1(receiptVault).authorizer() and assertTrue(it != address(0))
(with a message like "receiptVault authorizer is zero") prior to the existing
comparison against mstrAuthorizer; keep the existing mstrAuthorizer retrieval
(address(IAuthorizableV1(LibProdTokensBase.MSTR_RECEIPT_VAULT).authorizer()))
and the final assertEq against mstrAuthorizer unchanged.

}

function testMstrTokenSetOnBase() external {
Expand Down
Loading