Skip to content

Conversation

@tejasbadadare
Copy link
Contributor

Summary & Rationale

  • Extract duplicated SubscriptionParam validations into a _validateAndPrepareSubscriptionParams helper function.
  • Improve validations to prevent undesirable state and behavior:
    • Disallow subscriptions with zero feeds, since this will blow up later when indexing into empty arrays.
    • Disallow duplicate price IDs in a subscription, since this will pollute the mappings and make removal logic ambiguous.
    • Disallow duplicate whitelisted readers, enforce a maximum whitelist size to prevent maliciously large whitelists.
    • Ensure that heartbeatSeconds and deviationThresholdBps are non-zero when those UpdateCriteria are enabled, since those would evaluate to always-true conditions.
    • Ensure minPublishTime is clamped to zero to avoid integer underflow. This should be unlikely since block.timestamp will be a high number, but it's potentially possible in a new network.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

@vercel
Copy link

vercel bot commented Apr 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Visit Preview Apr 21, 2025 8:57pm
component-library ⬜️ Ignored (Inspect) Visit Preview Apr 21, 2025 8:57pm
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Apr 21, 2025 8:57pm
insights ⬜️ Ignored (Inspect) Visit Preview Apr 21, 2025 8:57pm
proposals ⬜️ Ignored (Inspect) Visit Preview Apr 21, 2025 8:57pm
staking ⬜️ Ignored (Inspect) Visit Preview Apr 21, 2025 8:57pm

* test(pulse-scheduler): add gas benchmark, refactor common helpers into util

* doc: test comment

* fix: import

* fix: overflow, DRY

* doc: comment

* fix: remove unused constants
Base automatically changed from tb/pulse-scheduler/permanent-subscriptions to main April 21, 2025 19:38
@tejasbadadare tejasbadadare merged commit 25a3789 into main Apr 21, 2025
10 checks passed
@tejasbadadare tejasbadadare deleted the tb/pulse-scheduler/better-subparams-validation branch April 21, 2025 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants