Skip to content

Conversation

tejasbadadare
Copy link
Contributor

@tejasbadadare tejasbadadare commented Apr 24, 2025

Summary

  • Add governance instructions to Pulse
  • Add ability to transfer admin capability to another address using a 2-step propose & accept flow
    • Admin and Owner can execute governance instructions
    • Owner can upgrade the contract
  • Enforce minimum balance when adding feeds to a subscription
  • Minor misc updates to docs/formatting

Rationale

  • Added the following governance instructions:
    • upgradeContract
    • setMinimumBalancePerFeed
      • Minimum balance per feed a subscription needs to maintain. Enforced when adding feeds or withdrawing funds.
    • setSingleUpdateKeeperFeeInWei
      • Fee per single feed update to pay the keeper. Unenforced right now, will implement in the next PR.
  • These instructions haven't been added to other parts of the governance stack yet. We can likely do that when we want to actually change one of these values.
  • Overall the governance and admin transfer pattern follows Entropy.

How has this been tested?

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

Copy link

vercel bot commented Apr 24, 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 24, 2025 9:12pm
component-library ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 9:12pm
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 9:12pm
insights ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 9:12pm
proposals ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 9:12pm
staking ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 9:12pm

@tejasbadadare tejasbadadare changed the title feat(pulse): add governance instructions, admin transfer feat(pulse): add governance instructions, admin transfer capability Apr 24, 2025
Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Please address my comments before merging.

Also, one question. What's the difference between owner and admin here? I think we can just have one of them right?

// Check minimum balance if number of feeds increases and subscription remains active
if (
willBeActive &&
newParams.priceIds.length > currentParams.priceIds.length
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better if you do this check regardless. Otherwise I can increase feeds and deactivate, and then later activate it to bypass it right?

Copy link
Contributor Author

@tejasbadadare tejasbadadare Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeahh was debating this, but one thing i was thinking was we shouldn't enforce this for people trying to deactivate or reduce their feeds. maybe they are low on balance and trying to reduce their burn rate. ultimately the minimum balance thing serves 2 purposes: disincentivize the attack vector of flooding the system with subscriptions, and help the user maintain enough balance in their account to ensure uninterrupted operation.

also, we do enforce the check when activating, so the scenario you mentioned wouldn't be a problem.

Comment on lines 1139 to 1144
scheduler.addFunds{value: requiredFunds}(subscriptionId);

// Verification 2: Update should now succeed
vm.expectEmit();
emit SubscriptionUpdated(subscriptionId);
scheduler.updateSubscription(subscriptionId, newParams);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend you let updateSubscription be payable as well so people can update it in 1 go (now they need to add funds first, and then update it)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, had the same thought :) thought it would be too much of an related change to include in this PR, so was planning to add it in another one. but i'll add it in here now that you've brought it up.

@tejasbadadare
Copy link
Contributor Author

tejasbadadare commented Apr 24, 2025

What's the difference between owner and admin here? I think we can just have one of them right?

@ali-bahjati You know, I had the same thought on this, but I took cues from Entropy here and assumed that there is a reason :)
As it stands, the owner is the superadmin - it can run governance ixs including upgrading the contract. The admin can run governance ixs but cannot upgrade the contract.

The executor will need to be the owner to be able to upgrade the contract, which makes the admin role perhaps redundant? But i did notice in git history for Entropy that folks wanted the admin role and for it to be transferable.

I'll keep both in for now, but it's easy to remove. Let me know what you think.

@tejasbadadare
Copy link
Contributor Author

What's the difference between owner and admin here? I think we can just have one of them right?

@ali-bahjati You know, I had the same thought on this, but I took cues from Entropy here and assumed that there is a reason :) As it stands, the owner is the superadmin - it can run governance ixs including upgrading the contract. The admin can run governance ixs but cannot upgrade the contract.

The executor will need to be the owner to be able to upgrade the contract, which makes the admin role perhaps redundant? But i did notice in git history for Entropy that folks wanted the admin role and for it to be transferable.

I'll keep both in for now, but it's easy to remove. Let me know what you think.

We resolved this offline, but for posterity:

turns out we don't really remember why it was done this way in Entropy. the Owner and Admin roles are functionally the same because they are both held by Executor. Perhaps admin was intended to be some kind of "light governance" that can execute smaller administrative instructions, but not have the big hammer authority to upgrade the contract? In any case we'll leave it the same in Pulse for consistency and have Executor assume both roles (edited)

@tejasbadadare tejasbadadare merged commit e2caed9 into main Apr 24, 2025
10 checks passed
@tejasbadadare tejasbadadare deleted the tb/pulse/governance branch April 24, 2025 21:23
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.

2 participants