Skip to content

Conversation

@chrismaree
Copy link
Member

Problem:

  • HubPool lines 718-719 explain that the whitelistedRoute function returns whitelisted
    destination tokens, but does not mention that if the token is not whitelisted then the function
    returns address(0).
  • The comments in the declaration of the PoolRebalanceLeaf struct appear to refer to a previous
    version of the struct, making them hard to follow. For example, line 17 implies there are two
    arrays above it (there is only one), and line 31 suggests there are multiple arrays below it (there
    is only one).
  • A comment about HubPool.executeRootBundle states that the function deletes the published
    root bundle, however it does not.
  • Within the LPTokenFactory contract, the comments on lines 24 and 25 should say "msg.sender"
    or "the calling contract" rather than "this contract".
    The comments above the lpFeeRatePerSecond variable suggest that LP fees are released
    linearly. In fact, they are released sublinearly, because the _getAccumulatedFees function uses
    a fraction of the undistributedLpFees (which decreases over time for any given loan), rather
    than the total funds on loan.
  • The comment in SpokePool above the definition of claimedBitmap state that there are 256x256
    leaves per root. However, due to the indexing scheme in MerkleLib, there are a maximum of
    2^248 different values of claimedWordIndex, with 256 different claimedBitIndexes. A more
    clear comment might explain that there are 256x(2^248) leaves per root.

Solution:
Comments were updated.

Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
@chrismaree
Copy link
Member Author

Note that this PR was forked from https://github.com/across-protocol/contracts-v2/pull/102/files which should be merged first to avoid merge conflicts.

@chrismaree chrismaree marked this pull request as draft March 16, 2022 06:38
@chrismaree chrismaree requested a review from nicholaspai March 16, 2022 07:16
@chrismaree chrismaree added the OZ Audit - March Resolves issue discovered in March 2022 OZ Audit label Mar 16, 2022
@mrice32 mrice32 self-requested a review March 17, 2022 12:28
@mrice32
Copy link
Contributor

mrice32 commented Mar 17, 2022

@chrismaree going to hold off on reviewing this until the whitelisted routes update and the PR this is forked from are both merged, as I think they might require changes here.

Signed-off-by: chrismaree <christopher.maree@gmail.com>
@chrismaree chrismaree marked this pull request as ready for review March 18, 2022 06:42
@nicholaspai nicholaspai changed the title fix[N06] Fix missleading comments fix[N06] Fix misleading comments Mar 18, 2022
// Interest rate payment that scales the amount of pending fees per second paid to LPs. 0.0000015e18 will pay out
// the full amount of fees entitled to LPs in ~ 7.72 days, just over the standard L2 7 day liveness.
// the full amount of fees entitled to LPs in ~ 7.72 days assuming no contract interactions. If someone interacts
// with the contract then the LP rewards are smeared sublinearly over the window.
Copy link
Member

Choose a reason for hiding this comment

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

what does "smeared sublinearly" mean? this is a bit handwavy

Copy link
Member

Choose a reason for hiding this comment

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

"because the _getAccumulatedFees function uses a fraction of the undistributedLpFees (which decreases over time for any given loan), rather than the total funds on loan."

// deposits in this bundle. If non-zero then it must be set on the SpokePool's RelayerRefundLeaf amountToReturn
// as -1 * this value to indicate if funds are being sent from or to the SpokePool.
int256[] netSendAmounts;
// This is only here to be emitted in an event to track a running unpaid balance between the L2 pool and the L1 pool.
Copy link
Member

Choose a reason for hiding this comment

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

nit: additional changes:

  • Line 17: Remove "This array is grouped with the two above"
  • Line 39: Replace "The following arrays" with "The bundleLpFees, netSendAmounts, and runningBalances"

Copy link
Member Author

Choose a reason for hiding this comment

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

o sorry. 17 was a result of a merge issue. this was taken out before but came back.
doing on 39.

Copy link
Member

@nicholaspai nicholaspai left a comment

Choose a reason for hiding this comment

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

A few more changes then LGTM

chrismaree and others added 4 commits March 18, 2022 14:26
Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
@chrismaree chrismaree merged commit 339fff7 into master Mar 18, 2022
@chrismaree chrismaree deleted the chrismaree/no6 branch March 18, 2022 16:07
nicholaspai added a commit that referenced this pull request Mar 21, 2022
* fix[N04] Add additional documentation

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* nit

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* fix[N06] Fix missleading comments

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* Apply suggestions from code review

Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>

* nit

Signed-off-by: chrismaree <christopher.maree@gmail.com>

Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>
nicholaspai added a commit that referenced this pull request Mar 22, 2022
)

* improve: Update solc version to 8.13

* feat: Changes after running 8.13 wargames

* Update Optimism_Adapter.json

* Init commit: arbitrum rinkeby

* finish arbitrum war games

* fix[N06] Fix misleading comments (#104)

* fix[N04] Add additional documentation

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* nit

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* fix[N06] Fix missleading comments

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* Apply suggestions from code review

Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>

* nit

Signed-off-by: chrismaree <christopher.maree@gmail.com>

Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>

* fix[N08] Propose fixes to some naming issues (#105)

* fix[N02} Move all structs to the same place

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* fix[N03] Fixed inconsistant token metadata versioning

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* nit

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* nit

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* fix[N08] Propose fixes to some naming issues

Signed-off-by: chrismaree <christopher.maree@gmail.com>

* fix[L04] Enforce chainId requirements in PolygonTokenBridger (#115)

* fix: Arbitrum Adapter needs to pay for L2 gas

* Add helper scripts

* Update Arbitrum_Adapter.sol

Co-authored-by: Chris Maree <christopher.maree@gmail.com>
Co-authored-by: Matt Rice <matthewcrice32@gmail.com>
This was referenced May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OZ Audit - March Resolves issue discovered in March 2022 OZ Audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants