@@ -64,19 +64,21 @@ abstract contract Scheduler is IScheduler, SchedulerState {
64
64
uint256 subscriptionId ,
65
65
SubscriptionParams memory newParams
66
66
) external override onlyManager (subscriptionId) {
67
- SchedulerState. SubscriptionStatus storage currentStatus = _state
68
- .subscriptionStatuses[ subscriptionId];
69
- SchedulerState.SubscriptionParams storage currentParams = _state
70
- .subscriptionParams[subscriptionId];
71
- bool wasActive = currentParams.isActive;
72
- bool willBeActive = newParams.isActive ;
67
+ SubscriptionStatus storage currentStatus = _state.subscriptionStatuses[
68
+ subscriptionId
69
+ ];
70
+ SubscriptionParams storage currentParams = _state .subscriptionParams[
71
+ subscriptionId
72
+ ] ;
73
73
74
- // Check for permanent subscription restrictions
74
+ // Updates to permanent subscriptions are not allowed
75
75
if (currentParams.isPermanent) {
76
- _validatePermanentSubscriptionUpdate (currentParams, newParams );
76
+ revert CannotUpdatePermanentSubscription ( );
77
77
}
78
78
79
79
// If subscription is inactive and will remain inactive, no need to validate parameters
80
+ bool wasActive = currentParams.isActive;
81
+ bool willBeActive = newParams.isActive;
80
82
if (! wasActive && ! willBeActive) {
81
83
// Update subscription parameters
82
84
_state.subscriptionParams[subscriptionId] = newParams;
@@ -182,19 +184,6 @@ abstract contract Scheduler is IScheduler, SchedulerState {
182
184
) {
183
185
revert InvalidUpdateCriteria ();
184
186
}
185
-
186
- // If gas config is unset, set it to the default (100x multipliers)
187
- if (
188
- params.gasConfig.maxBaseFeeMultiplierCapPct == 0 ||
189
- params.gasConfig.maxPriorityFeeMultiplierCapPct == 0
190
- ) {
191
- params
192
- .gasConfig
193
- .maxPriorityFeeMultiplierCapPct = DEFAULT_MAX_PRIORITY_FEE_MULTIPLIER_CAP_PCT;
194
- params
195
- .gasConfig
196
- .maxBaseFeeMultiplierCapPct = DEFAULT_MAX_BASE_FEE_MULTIPLIER_CAP_PCT;
197
- }
198
187
}
199
188
200
189
/**
@@ -415,103 +404,6 @@ abstract contract Scheduler is IScheduler, SchedulerState {
415
404
revert UpdateConditionsNotMet ();
416
405
}
417
406
418
- /**
419
- * @notice Internal helper to validate modifications to a permanent subscription.
420
- * @param currentParams The current subscription parameters (storage).
421
- * @param newParams The proposed new subscription parameters (memory).
422
- */
423
- function _validatePermanentSubscriptionUpdate (
424
- SubscriptionParams storage currentParams ,
425
- SubscriptionParams memory newParams
426
- ) internal view {
427
- // Cannot disable isPermanent flag once set
428
- if (! newParams.isPermanent) {
429
- revert IllegalPermanentSubscriptionModification ();
430
- }
431
-
432
- // Cannot deactivate a permanent subscription
433
- if (! newParams.isActive) {
434
- revert IllegalPermanentSubscriptionModification ();
435
- }
436
-
437
- // Cannot remove price feeds from a permanent subscription
438
- if (newParams.priceIds.length < currentParams.priceIds.length ) {
439
- revert IllegalPermanentSubscriptionModification ();
440
- }
441
-
442
- // Check that all existing price IDs are preserved (adding is allowed, not removing)
443
- for (uint i = 0 ; i < currentParams.priceIds.length ; i++ ) {
444
- bool found = false ;
445
- for (uint j = 0 ; j < newParams.priceIds.length ; j++ ) {
446
- if (currentParams.priceIds[i] == newParams.priceIds[j]) {
447
- found = true ;
448
- break ;
449
- }
450
- }
451
- if (! found) {
452
- revert IllegalPermanentSubscriptionModification ();
453
- }
454
- }
455
-
456
- // Cannot change reader whitelist settings for permanent subscriptions
457
- if (newParams.whitelistEnabled != currentParams.whitelistEnabled) {
458
- revert IllegalPermanentSubscriptionModification ();
459
- }
460
-
461
- // Check if the set of addresses in the whitelist is the same
462
- if (
463
- newParams.readerWhitelist.length !=
464
- currentParams.readerWhitelist.length
465
- ) {
466
- revert IllegalPermanentSubscriptionModification ();
467
- }
468
- uint256 n = newParams.readerWhitelist.length ;
469
- bool [] memory currentVisited = new bool [](n);
470
- uint256 matchesFound = 0 ;
471
- for (uint256 i = 0 ; i < n; i++ ) {
472
- bool foundInCurrent = false ;
473
- for (uint256 j = 0 ; j < n; j++ ) {
474
- if (
475
- ! currentVisited[j] &&
476
- newParams.readerWhitelist[i] ==
477
- currentParams.readerWhitelist[j]
478
- ) {
479
- currentVisited[j] = true ;
480
- foundInCurrent = true ;
481
- matchesFound++ ;
482
- break ;
483
- }
484
- }
485
- if (! foundInCurrent) {
486
- revert IllegalPermanentSubscriptionModification ();
487
- }
488
- }
489
-
490
- // Cannot change update criteria for permanent subscriptions
491
- if (
492
- newParams.updateCriteria.updateOnHeartbeat !=
493
- currentParams.updateCriteria.updateOnHeartbeat ||
494
- newParams.updateCriteria.heartbeatSeconds !=
495
- currentParams.updateCriteria.heartbeatSeconds ||
496
- newParams.updateCriteria.updateOnDeviation !=
497
- currentParams.updateCriteria.updateOnDeviation ||
498
- newParams.updateCriteria.deviationThresholdBps !=
499
- currentParams.updateCriteria.deviationThresholdBps
500
- ) {
501
- revert IllegalPermanentSubscriptionModification ();
502
- }
503
-
504
- // Cannot change gas config for permanent subscriptions
505
- if (
506
- newParams.gasConfig.maxBaseFeeMultiplierCapPct !=
507
- currentParams.gasConfig.maxBaseFeeMultiplierCapPct ||
508
- newParams.gasConfig.maxPriorityFeeMultiplierCapPct !=
509
- currentParams.gasConfig.maxPriorityFeeMultiplierCapPct
510
- ) {
511
- revert IllegalPermanentSubscriptionModification ();
512
- }
513
- }
514
-
515
407
/// FETCH PRICES
516
408
517
409
/**
@@ -635,7 +527,7 @@ abstract contract Scheduler is IScheduler, SchedulerState {
635
527
636
528
// Prevent withdrawals from permanent subscriptions
637
529
if (params.isPermanent) {
638
- revert IllegalPermanentSubscriptionModification ();
530
+ revert CannotUpdatePermanentSubscription ();
639
531
}
640
532
641
533
if (status.balanceInWei < amount) {
0 commit comments