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

C-01 DoS Due to Unrestricted Growth of poolAssets Array #1889

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,8 @@ abstract contract BaseBalancerStrategy is InitializableAbstractStrategy {
* initialized without this, would make it easier when upgrading it
*/
function cachePoolAssets() public {
require(poolAssets.length == 0, "Assets already cached");

(IERC20[] memory tokens, , ) = balancerVault.getPoolTokens(
balancerPoolId
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ describe("ForkTest: Balancer ComposableStablePool sfrxETH/wstETH/rETH Strategy",
auraRewardPool
);
});

it("Shouldn't be able to cache assets twice", async function () {
const { balancerSfrxWstRETHStrategy, josh } = fixture;

await expect(
balancerSfrxWstRETHStrategy.connect(josh).cachePoolAssets()
).to.be.revertedWith("Assets already cached");
});
});

describe("Deposit", function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ describe("ForkTest: Balancer MetaStablePool rETH/WETH Strategy", function () {
auraRewardPool
);
});

// Un-skip once we re-deploy the strategy
it.skip("Shouldn't be able to cache assets twice", async function () {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How are we going to make sure we do this?

Copy link
Member Author

Choose a reason for hiding this comment

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

How about like this :)
74fd116

const { balancerREthStrategy, josh } = fixture;

await expect(
balancerREthStrategy.connect(josh).cachePoolAssets()
).to.be.revertedWith("Assets already cached");
});
});

describe("Deposit", function () {
Expand Down
Loading