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-03 Abstraction of Pool Exit Kinds Is Error-Prone #1916

Conversation

sparrowDom
Copy link
Member

Audit notes:
The use of different enum indices, namely balancerBptInExactTokensOutIndex and
balancerExactBptInTokensOutIndex , to be passed to Balancer for different pool types
is achieved by passing constructor input arguments and storing immutable variables.

However, this approach is error-prone. It reduces readability and makes it difficult for off-chain
tooling and governance to correctly test and pass the arguments during deployment, and verify
the result. As such, any mistake in setting these values could have severe consequences.

Consider creating and overriding internal functions in each class. This will not increase the gas
usage but will ensure that the correct value is always used for each concrete contract. A
simplified example is shown below:

contract A {
    function _someValue() internal pure virtual returns(uint) { return 1; }
}

contract B is A {
    function _someValue() internal pure override returns(uint) { return 2; }
}

Copy link

github-actions bot commented Nov 7, 2023

Warnings
⚠️ 👀 This PR needs at least 2 reviewers

Generated by 🚫 dangerJS against ea7fb8b

@sparrowDom sparrowDom temporarily deployed to preview-ousd-sparrowdom-fvmx9k November 7, 2023 00:54 Inactive
@sparrowDom sparrowDom temporarily deployed to preview-ousd-sparrowdom-fvmx9k November 7, 2023 00:56 Inactive
@sparrowDom sparrowDom temporarily deployed to preview-ousd-sparrowdom-fvmx9k November 7, 2023 00:57 Inactive
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

❗ No coverage uploaded for pull request base (sparrowDom/L-04-exit-kind-enum@0623822). Click here to learn what that means.
The diff coverage is n/a.

@@                        Coverage Diff                        @@
##             sparrowDom/L-04-exit-kind-enum    #1916   +/-   ##
=================================================================
  Coverage                                  ?   57.28%           
=================================================================
  Files                                     ?       51           
  Lines                                     ?     2730           
  Branches                                  ?      703           
=================================================================
  Hits                                      ?     1564           
  Misses                                    ?     1163           
  Partials                                  ?        3           

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

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.

Way better.

Can merge, will verify when integrated.

@sparrowDom sparrowDom mentioned this pull request Nov 8, 2023
@sparrowDom sparrowDom merged commit ed8a545 into sparrowDom/L-04-exit-kind-enum Nov 8, 2023
14 of 18 checks passed
@sparrowDom sparrowDom deleted the sparrowDom/L-03-abstraction-error-prone branch November 8, 2023 20:08
sparrowDom added a commit that referenced this pull request Nov 9, 2023
* rename enum variables

* L-03 Abstraction of Pool Exit Kinds Is Error-Prone (#1916)

* turn config vars into functions

* clean up deployment files

* clean up comments

* prettier

* prettier
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