Skip to content

Commit 06833ca

Browse files
committed
fix: disallow updating isActive for permanent subscriptions
1 parent f2989ab commit 06833ca

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

target_chains/ethereum/contracts/contracts/pulse/scheduler/Scheduler.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ abstract contract Scheduler is IScheduler, SchedulerState {
404404
revert IllegalPermanentSubscriptionModification();
405405
}
406406

407+
// Cannot deactivate a permanent subscription
408+
if (!newParams.isActive) {
409+
revert IllegalPermanentSubscriptionModification();
410+
}
411+
407412
// Cannot remove price feeds from a permanent subscription
408413
if (newParams.priceIds.length < currentParams.priceIds.length) {
409414
revert IllegalPermanentSubscriptionModification();

target_chains/ethereum/contracts/forge-test/PulseScheduler.t.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,16 @@ contract SchedulerTest is Test, SchedulerEvents, PulseTestUtils {
621621
);
622622
scheduler.updateSubscription(subscriptionId, updatedParams);
623623
}
624+
625+
// Test 10: Cannot deactivate a permanent subscription
626+
updatedParams = storedParams;
627+
updatedParams.isActive = false;
628+
vm.expectRevert(
629+
abi.encodeWithSelector(
630+
IllegalPermanentSubscriptionModification.selector
631+
)
632+
);
633+
scheduler.updateSubscription(subscriptionId, updatedParams);
624634
}
625635

626636
function testMakeExistingSubscriptionPermanent() public {

0 commit comments

Comments
 (0)