test(failing): pin prod receipt vault authorizer consistency#116
test(failing): pin prod receipt vault authorizer consistency#116thedavidmeister wants to merge 1 commit intomainfrom
Conversation
Adds the test #34 asks for: every prod receipt vault on Base must report a non-zero authorizer AND all 13 prod token sets must share the same authorizer contract. Currently fails on two tokens — fork run on Base shows drift: - 11 of 13 vaults: authorizer 0x35f9fA9d80aAF2B0fB27f0FF015641B3408d7456 - IBHG: authorizer 0x6E0F1c31Fca4Ff07cD0C3e8658b1e3a473f3393a - SGOV: authorizer 0xED3A1Ab65a25dfc82F4A7B89203EEc9BCb2D4f01 None of these match the V2 authorizer constants in `LibProdDeployV2` (`STOX_OFFCHAIN_ASSET_RECEIPT_VAULT_AUTHORIZER_V1`, `STOX_OFFCHAIN_ASSET_RECEIPT_VAULT_PAYMENT_MINT_AUTHORIZER_V1`) — these are V1-era authorizers without prod constants. Also bumps `lib/rain.vats` to f52c8b4 (PR rainlanguage/rain.vats#293, issue rainlanguage/rain.vats#292) which adds the `IAuthorizableV1` interface used here. Without the bump there is no typed way to read `OffchainAssetReceiptVault.authorizer()` without importing the concrete contract. Test landed deliberately failing as a forcing function for the team to investigate the IBHG/SGOV drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR updates the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/src/lib/LibProdTokensBase.t.sol`:
- Around line 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.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4282ee5f-6216-477b-a0d4-1b90f2be4ecf
⛔ Files ignored due to path filters (1)
foundry.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
lib/rain.vatstest/src/lib/LibProdTokensBase.t.sol
| 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"); |
There was a problem hiding this comment.
🧹 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.
| 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.
Summary
Implements the test from #34: every prod receipt vault on Base must report a non-zero authorizer AND all 13 prod token sets must share the same authorizer contract.
This PR ships a deliberately failing test as a forcing function. Two prod tokens diverge from the rest. The test landing as red is the point — it surfaces the drift to anyone who touches the prod-token suite.
Drift observed (fork against Base)
0x35f9fA9d80aAF2B0fB27f0FF015641B3408d74560x6E0F1c31Fca4Ff07cD0C3e8658b1e3a473f3393a0xED3A1Ab65a25dfc82F4A7B89203EEc9BCb2D4f01None of these match the V2 constants in
LibProdDeployV2(STOX_OFFCHAIN_ASSET_RECEIPT_VAULT_AUTHORIZER_V1=0x667d2Ab…,STOX_OFFCHAIN_ASSET_RECEIPT_VAULT_PAYMENT_MINT_AUTHORIZER_V1=0x72b2a39…). The prod vaults are V1-era and use authorizers that don't appear as constants anywhere in the repo.Three reads, one needs picking
0x35f9fA9d80…. Test stays as-is.LibProdTokensBase.Whoever picks this up needs to (a) talk to whoever signed the IBHG/SGOV deployments to confirm intent, (b) look up the three authorizer addresses on basescan to identify what they actually are, (c) decide which read above applies and act on it.
Mechanical changes
lib/rain.vatstof52c8b4(PR feat: IAuthorizableV1 interface for OffchainAssetReceiptVault.authorizer() rainlanguage/rain.vats#293, issue Expose OffchainAssetReceiptVault.authorizer() through an interface rainlanguage/rain.vats#292) — addsIAuthorizableV1, the typed read-only interface forOffchainAssetReceiptVault.authorizer(). Without this, the test would have to pull the concrete contract or use a low-level call.LibProdTokensBaseTest.checkTokenSetreads each vault's authorizer viaIAuthorizableV1, asserts non-zero and equality againstMSTR_RECEIPT_VAULT's authorizer.Closes #34 only after the drift question above is resolved (do not merge while red).
🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
Tests