Skip to content

Commit a1585cc

Browse files
committed
refactor(wallet-registry): remove stale NOT MIGRATED withdrawRewards test
The "NOT MIGRATED Touchpoints" describe block in WalletRegistry.Authorization.test.ts asserted that withdrawRewards retained TokenStaking beneficiary lookup post-initializeV2. With withdrawRewards now routed through _currentAuthorizationSource(), that invariant no longer holds. The test still passed because it never invoked withdrawRewards -- it only read staking.rolesOf and walletRegistry.allowlist() -- but its name, rationale comment, and block-level documentation advertised behavior the code no longer exhibits and would mislead future maintainers. Positive coverage for post-upgrade Allowlist routing lives in WalletRegistry.Rewards.test.ts ("withdrawRewards when allowlist != address(0)"). The top-of-file coverage summary is updated so the remaining "NOT MIGRATED touchpoints" line continues to reflect the still-valid slashing path (challengeDkgResult) without the removed beneficiary claim.
1 parent 0c6f839 commit a1585cc

1 file changed

Lines changed: 1 addition & 69 deletions

File tree

solidity/ecdsa/test/WalletRegistry.Authorization.test.ts

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3714,7 +3714,7 @@ describe("WalletRegistry - Authorization", () => {
37143714
* Test Coverage:
37153715
* - Pre-upgrade mode: Authorization routes to TokenStaking (allowlist = address(0))
37163716
* - Post-upgrade mode: Authorization routes to Allowlist (allowlist != address(0))
3717-
* - NOT MIGRATED touchpoints: Slashing and beneficiary queries stay on TokenStaking
3717+
* - NOT MIGRATED touchpoints: Slashing stays on TokenStaking
37183718
* - Upgrade flow: Transition from TokenStaking to Allowlist via initializeV2()
37193719
* - Edge cases: Zero address validation, re-initialization prevention
37203720
*
@@ -3975,74 +3975,6 @@ describe("WalletRegistry - Migration Scenario Tests (TIP-092)", () => {
39753975
})
39763976
})
39773977

3978-
/**
3979-
* NOT MIGRATED Touchpoint Tests
3980-
*
3981-
* Context: Some functions do NOT use _currentAuthorizationSource().
3982-
* Expected: These functions always use staking contract, even after initializeV2().
3983-
*
3984-
* Rationale:
3985-
* - withdrawRewards: Beneficiary roles remain in TokenStaking (WalletRegistry.sol:440-452)
3986-
* - challengeDkgResult: Stake custody and slashing remain in TokenStaking (WalletRegistry.sol:950-966)
3987-
*/
3988-
describe("NOT MIGRATED Touchpoints", () => {
3989-
let allowlist: FakeContract<IStaking>
3990-
3991-
before(async () => {
3992-
await createSnapshot()
3993-
3994-
// Setup: Use real TokenStaking for beneficiary roles (NOT migrated to Allowlist)
3995-
await setupRealStaking(
3996-
t,
3997-
staking,
3998-
walletRegistry,
3999-
deployer,
4000-
stakingProvider,
4001-
beneficiary,
4002-
minimumAuthorization
4003-
)
4004-
4005-
// Setup: Create allowlist fake and upgrade (but beneficiary still in TokenStaking)
4006-
allowlist = await smock.fake<IStaking>("IStaking")
4007-
allowlist.authorizedStake.returns(minimumAuthorization)
4008-
await walletRegistry.initializeV2(allowlist.address)
4009-
4010-
// Setup: Trigger authorization callback from allowlist (post-upgrade)
4011-
await triggerAuthorizationCallback(
4012-
walletRegistry,
4013-
allowlist.address,
4014-
stakingProvider.address,
4015-
ethers.BigNumber.from(0),
4016-
minimumAuthorization
4017-
)
4018-
4019-
// Setup: Register operator with allowlist authorization
4020-
await walletRegistry
4021-
.connect(stakingProvider)
4022-
.registerOperator(operator.address)
4023-
})
4024-
4025-
after(async () => {
4026-
await restoreSnapshot()
4027-
})
4028-
4029-
/**
4030-
* Test: withdrawRewards always uses staking.rolesOf() for beneficiary lookup
4031-
* NOT using _currentAuthorizationSource()
4032-
* Direct call: staking.rolesOf() at line 456
4033-
*/
4034-
it("should query TokenStaking for beneficiary in withdrawRewards (post-upgrade)", async () => {
4035-
// This test verifies that even after initializeV2, beneficiary lookup
4036-
// goes to TokenStaking, not Allowlist
4037-
expect(await walletRegistry.allowlist()).to.equal(allowlist.address)
4038-
4039-
// Note: withdrawRewards requires actual rewards to test fully
4040-
// This test validates the pattern - beneficiary lookup stays on TokenStaking
4041-
const roles = await staking.rolesOf(stakingProvider.address)
4042-
expect(roles.beneficiary).to.equal(beneficiary.address)
4043-
})
4044-
})
4045-
40463978
/**
40473979
* Upgrade Flow Tests
40483980
*

0 commit comments

Comments
 (0)