diff --git a/packages/issuance/test/unit/rewards-manager/legacySuite.t.sol b/packages/issuance/test/unit/rewards-manager/legacySuite.t.sol index a30ccbc52..078c71761 100644 --- a/packages/issuance/test/unit/rewards-manager/legacySuite.t.sol +++ b/packages/issuance/test/unit/rewards-manager/legacySuite.t.sol @@ -114,16 +114,19 @@ contract RewardsManagerLegacySuiteTest is RewardsManagerSharedTest { vm.roll(block.number + EPOCH_LENGTH); _setDenied(SUBGRAPH_DEPLOYMENT_ID_1, false); + // Close in the next block, as in Hardhat: one post-undeny block accrues on top of the frozen pre-denial value + vm.roll(block.number + 1); + uint256 expectedTotal = rewardsBefore + _expectedAllocationRewards(1, ALLOCATION, ALLOCATION); + uint256 supplyBefore = token.totalSupply(); uint256 issuerBalanceBefore = token.balanceOf(address(issuer)); - // Closed in the undeny block, so the amount is exactly the frozen pre-denial value vm.expectEmit(address(rm)); - emit HorizonRewardsAssigned(indexer, allocationID1, rewardsBefore); + emit HorizonRewardsAssigned(indexer, allocationID1, expectedTotal); uint256 rewards = _close(allocationID1); assertGt(rewards, 0); - assertEq(rewards, rewardsBefore); + assertEq(rewards, expectedTotal); assertEq(token.totalSupply(), supplyBefore + rewards); assertEq(token.balanceOf(address(issuer)), issuerBalanceBefore + rewards); } diff --git a/scripts/contracts-migration/test-mapping/t5f.md b/scripts/contracts-migration/test-mapping/t5f.md index 937d62dca..437c2e959 100644 --- a/scripts/contracts-migration/test-mapping/t5f.md +++ b/scripts/contracts-migration/test-mapping/t5f.md @@ -39,7 +39,7 @@ | packages/contracts-test/tests/unit/rewards/rewards.test.ts | Rewards › issuing rewards › takeRewards › should handle zero rewards scenario correctly | test/unit/rewards-manager/distribution.t.sol::test_TakeRewards_ZeroRewards | Duplicate; assertions match; staking balance is the issuer's balance | | packages/contracts-test/tests/unit/rewards/rewards.test.ts | Rewards › issuing rewards › takeRewards › should handle zero rewards with denylist and reclaim address | test/unit/rewards-manager/legacySuite.t.sol::test_TakeRewards_ZeroRewardsWithDenylistAndReclaimAddress | Unique. Legacy Staking closed this under-one-epoch allocation through `onSubgraphAllocationUpdate` only (no `takeRewards`); the test calls that hook, then `RMIssuerMock.close`, whose `takeRewards` returns 0 before the denial check because nothing is signalled. Same `not.emit` checks (recordLogs) across both, plus: close returns 0, total supply and reclaim wallet unchanged. Close is one block after the allocation, as the separate Hardhat txs. The allocation has 12,500 GRT, so the zero-token hook difference does not apply | | packages/contracts-test/tests/unit/rewards/rewards.test.ts | Rewards › issuing rewards › takeRewards › should handle zero rewards with eligibility oracle and reclaim address | test/unit/rewards-manager/legacySuite.t.sol::test_TakeRewards_ZeroRewardsWithEligibilityOracleAndReclaimAddress | Unique. Legacy Staking closed this under-one-epoch allocation through `onSubgraphAllocationUpdate` only (no `takeRewards`); the test calls that hook, then `RMIssuerMock.close`, whose `takeRewards` returns 0 before the denial check because nothing is signalled. Same `not.emit` checks (recordLogs) across both, plus: close returns 0, total supply and reclaim wallet unchanged. Close is one block after the allocation, as the separate Hardhat txs. The allocation has 12,500 GRT, so the zero-token hook difference does not apply. `MockRewardsEligibilityOracle(false)` is `_useEligibilityOracle(false)` | -| packages/contracts-test/tests/unit/rewards/rewards.test.ts | Rewards › issuing rewards › takeRewards › should allow collecting pre-denial rewards after undeny | test/unit/rewards-manager/legacySuite.t.sol::test_TakeRewards_CollectsPreDenialRewardsAfterUndeny | Unique. `gt(0)` checks kept; the amount is asserted exactly as the pre-denial `getRewards` (10 blocks). The close runs in the undeny block (in Hardhat it was the next block, adding one post-undeny block that the old `gt` hid), so the amount is the frozen value. `afterIndexerStake > before` (legacy Staking) becomes the mint to the issuer, per the drop rule | +| packages/contracts-test/tests/unit/rewards/rewards.test.ts | Rewards › issuing rewards › takeRewards › should allow collecting pre-denial rewards after undeny | test/unit/rewards-manager/legacySuite.t.sol::test_TakeRewards_CollectsPreDenialRewardsAfterUndeny | Unique. `gt(0)` checks kept; the amount is asserted exactly as the pre-denial `getRewards` (10 blocks) plus one post-undeny block, because the close runs in the block after the undeny, as in Hardhat (the old `gt` hid this). `afterIndexerStake > before` (legacy Staking) becomes the mint to the issuer, per the drop rule | | packages/contracts-test/tests/unit/rewards/rewards.test.ts | Rewards › issuing rewards › takeRewards › allocation created while denied should only earn post-undeny rewards | test/unit/rewards-manager/legacySuite.t.sol::test_TakeRewards_AllocationCreatedWhileDeniedEarnsOnlyPostUndenyRewards | Unique. `gt` checks kept; the amount and supply increase are asserted exactly as the one post-undeny epoch (10 blocks) | | packages/contracts-test/tests/unit/rewards/rewards.test.ts | Rewards › issuing rewards › takeRewards › should reclaim denied-period rewards via onSubgraphAllocationUpdate | test/unit/rewards-manager/legacySuite.t.sol::test_TakeRewards_ReclaimsDeniedPeriodRewardsViaOnSubgraphAllocationUpdate | Unique. Second allocation of 5,000 GRT as the old test. `gt` kept; `RewardsReclaimed(SUBGRAPH_DENIED, R(10 blocks), 0, 0, sd)` and the exact wallet increase asserted. Reclaim wallet is a `makeAddr` wallet (old: `assetHolder`) | | packages/contracts-test/tests/unit/rewards/rewards.test.ts | Rewards › edge scenarios › close allocation on a subgraph that no longer have signal | test/unit/rewards-manager/distribution.t.sol::test_EdgeScenarios_CloseAllocationOnSubgraphWithNoSignal | Duplicate; assertions match (no assertions; must not revert) |