Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balancer pause helper #1211

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Balancer pause helper #1211

wants to merge 25 commits into from

Conversation

elshan-eth
Copy link
Contributor

@elshan-eth elshan-eth commented Jan 7, 2025

Description

A helper to stop pools. Only pools that are added to the list can be stopped. The Hypernative keeper must be added to Authentication to access the PauseHelper. The PauseHelper must be added to Authentication to access the Vault pausePool.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Dependency changes
  • Code refactor / cleanup
  • Optimization: [ ] gas / [ ] bytecode
  • Documentation or wording changes
  • Other

Checklist:

  • The diff is legible and has no extraneous changes
  • Complex code has been commented, including external interfaces
  • Tests have 100% code coverage
  • The base branch is either main, or there's a description of how to merge

Issue Resolution

Closes #1209

Copy link
Collaborator

@EndymionJkb EndymionJkb left a comment

Choose a reason for hiding this comment

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

First pass; didn't look at the tests yet.

pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/foundry.toml Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
Copy link
Collaborator

@EndymionJkb EndymionJkb left a comment

Choose a reason for hiding this comment

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

Shaping up; some naming and style suggestions. Some comments from earlier might have gotten lost.

pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
pkg/standalone-utils/contracts/PauseHelper.sol Outdated Show resolved Hide resolved
Copy link
Contributor

@joaobrunoah joaobrunoah left a comment

Choose a reason for hiding this comment

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

LGTM!

import { IVaultAdmin } from "@balancer-labs/v3-interfaces/contracts/vault/IVaultAdmin.sol";
import { SingletonAuthentication } from "@balancer-labs/v3-vault/contracts/SingletonAuthentication.sol";

contract PauseHelper is SingletonAuthentication {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have an IPauseHelper, that defines all errors, events, and document all functions? Just to make this file cleaner.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In the same vein, is this confusable with Vault pausing? (i.e., will people think you can also pause the Vault with this?) Maybe it should be called PausePoolHelper.

Copy link
Collaborator

@EndymionJkb EndymionJkb left a comment

Choose a reason for hiding this comment

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

Agree it would be good to also define an interface; we usually do for these kinds of contracts. Also had a note on potentially renaming to PausePoolHelper, and some function/comment suggestions

}

/***************************************************************************
Manage Pools
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Manage Pools
Manage Pools

ASCII art :)

}

/**
* @notice Get a range of pools.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* @notice Get a range of pools.
* @notice Get a range of pools.
* @dev Indexes are 0-based and [start, end) (i.e., inclusive of `start`; exclusive of `end`).

Still think we should clarify this.

* @param to End index
* @return pools List of pools
*/
function getPools(uint256 from, uint256 to) public view returns (address[] memory pools) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we also want a getPoolAt(uint256 index)?
Could also have a getPools() returns (address[] memory pools) that just returns them all.

That way it supports 3 ways of using it:

  1. simple getPools() if you know there isn't a pagination issue;
  2. generic iteration: for(i = 0; i < getPoolsCount(); ++i) { address pool = getPoolAt(i); }
  3. pagination if needed, using getPools(from, to);

import { IVaultAdmin } from "@balancer-labs/v3-interfaces/contracts/vault/IVaultAdmin.sol";
import { SingletonAuthentication } from "@balancer-labs/v3-vault/contracts/SingletonAuthentication.sol";

contract PauseHelper is SingletonAuthentication {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the same vein, is this confusable with Vault pausing? (i.e., will people think you can also pause the Vault with this?) Maybe it should be called PausePoolHelper.

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.

Improve pause helper
4 participants