Skip to content

Commit e17797a

Browse files
committed
feat: not only IA can call beforeIssuanceAllocationChange()
1 parent 080b252 commit e17797a

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

packages/contracts/contracts/rewards/RewardsManager.sol

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,12 @@ contract RewardsManager is RewardsManagerV7Storage, GraphUpgradeable, ERC165, IR
220220
* @dev Ensures that all reward calculations are up-to-date with the current block
221221
* before any allocation changes take effect.
222222
*
223+
* This function can be called by anyone to update the rewards calculation state.
223224
* The IssuanceAllocator calls this function before changing a target's allocation to ensure
224225
* all issuance is properly accounted for with the current issuance rate before applying an
225226
* issuance allocation change.
226-
*
227-
* Only the IssuanceAllocator can call this function to ensure proper access control
228-
* for any future changes that might require this level of restriction.
229227
*/
230228
function beforeIssuanceAllocationChange() external override {
231-
require(msg.sender == address(issuanceAllocator), "Caller must be IssuanceAllocator");
232-
233229
// Update rewards calculation with the current issuance rate
234230
updateAccRewardsPerSignal();
235231
}

packages/contracts/test/tests/unit/rewards/rewards.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,10 @@ describe('Rewards', () => {
326326
await mockIssuanceAllocator.deployed()
327327
await rewardsManager.connect(governor).setIssuanceAllocator(mockIssuanceAllocator.address)
328328

329-
// Only the allocator should be able to call this function
330-
const tx1 = rewardsManager.connect(governor).beforeIssuanceAllocationChange()
331-
await expect(tx1).revertedWith('Caller must be IssuanceAllocator')
329+
// Anyone should be able to call this function
330+
await rewardsManager.connect(governor).beforeIssuanceAllocationChange()
332331

333-
// Should succeed when called by the allocator
332+
// Should also succeed when called by the allocator
334333
await mockIssuanceAllocator.callBeforeIssuanceAllocationChange(rewardsManager.address)
335334
})
336335

0 commit comments

Comments
 (0)