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

L-01 Duplicate Strategy Assets Can Be Passed to _withdraw #1913

Conversation

sparrowDom
Copy link
Member

This PR adds a check so withdrawal with duplicate assets can not be called. Currently, the deposit with duplicate assets can not be called (contract API doesn't support it) but a future proof check is still added (with a test) to validate duplicate asset deposit calls can also not be made.

Audit comments:
The array arguments passed to _withdraw are not validated to ensure that they contain
unique assets. If, in a future extension, it becomes possible to pass duplicates (either due to
user or strategist input), the following impacts may occur:

  • The calculated expected BPT from _getBPTExpected may be double-counted.
  • Duplicate transfers may be executed, transferring too many tokens to the recipient.

Consider enforcing that poolAssetsAmountsOut[..] is 0 before setting its value.

Copy link

github-actions bot commented Nov 6, 2023

Warnings
⚠️ 👀 This PR needs at least 2 reviewers

Generated by 🚫 dangerJS against 3e63b85

@@ -157,6 +158,14 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy {
strategyAmount
);

/* This check is triggered when the _deposit is unexpectedly
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably don't need the word "unexpectedly" here.

@@ -300,6 +309,14 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy {
if (poolAssetAmount > 0) {
strategyAssetsToPoolAssetsAmounts[i] = poolAssetAmount;

/* This check is triggered when the _withdrawal is unexpectedly
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same, don't need "unexpectedly"

Copy link
Collaborator

@DanielVF DanielVF left a comment

Choose a reason for hiding this comment

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

Can merge, will verify when integrated.

@sparrowDom sparrowDom requested a deployment to preview-ousd-sparrowdom-rdsj33 November 8, 2023 20:03 Abandoned
@sparrowDom sparrowDom temporarily deployed to preview-ousd-sparrowdom-rdsj33 November 8, 2023 20:04 Inactive
@sparrowDom sparrowDom merged commit e0005ec into sparrowDom/balancer-composable-st-pool Nov 8, 2023
1 check passed
@sparrowDom sparrowDom deleted the sparrowDom/L-01-duplicate-assets branch November 8, 2023 20:04
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