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

Multipletroves #51

Merged
merged 25 commits into from
Dec 5, 2022
Merged

Multipletroves #51

merged 25 commits into from
Dec 5, 2022

Conversation

dapp-whisperer
Copy link
Contributor

@dapp-whisperer dapp-whisperer commented Nov 18, 2022

multiple troves will serve as a base to build all other features on top, as it affects more or less every test due to the widespread interface changes.

once we've merged this, all new "feature sets" (liquidations, interest rate, redemptions) should go in their own branches for easier review.

@dapp-whisperer dapp-whisperer marked this pull request as ready for review November 18, 2022 17:19
@SHAKOTN
Copy link
Contributor

SHAKOTN commented Nov 30, 2022

Let's merge latest master and see test pipeline again

@dapp-whisperer
Copy link
Contributor Author

alright sers. we're passing CI tests.

@SHAKOTN can you look into the solhint failure.

@SHAKOTN
Copy link
Contributor

SHAKOTN commented Dec 1, 2022

Codecov Report

Merging #51 (518bdba) into main (6d8ebd9) will decrease coverage by 3.07%.
The diff coverage is 95.32%.

@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
- Coverage   97.60%   94.52%   -3.08%     
==========================================
  Files          28       28              
  Lines        1918     1973      +55     
  Branches      290      293       +3     
==========================================
- Hits         1872     1865       -7     
- Misses         20       69      +49     
- Partials       26       39      +13     
Impacted Files Coverage Δ
...racts/contracts/Proxy/BorrowerOperationsScript.sol 30.00% <0.00%> (ø)
.../contracts/contracts/Proxy/StabilityPoolScript.sol 60.00% <0.00%> (ø)
...s/contracts/contracts/Proxy/TroveManagerScript.sol 100.00% <ø> (ø)
packages/contracts/contracts/StabilityPool.sol 99.65% <80.00%> (-0.35%) ⬇️
packages/contracts/contracts/HintHelpers.sol 92.45% <94.11%> (+0.45%) ⬆️
packages/contracts/contracts/SortedTroves.sol 97.27% <96.87%> (-1.84%) ⬇️
packages/contracts/contracts/TroveManager.sol 99.00% <98.52%> (-0.39%) ⬇️
...ackages/contracts/contracts/BorrowerOperations.sol 97.56% <100.00%> (-0.46%) ⬇️
...ntracts/contracts/Proxy/BorrowerWrappersScript.sol 92.18% <100.00%> (ø)
packages/contracts/contracts/Proxy/TokenScript.sol 25.00% <0.00%> (-62.50%) ⬇️
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@SHAKOTN
Copy link
Contributor

SHAKOTN commented Dec 1, 2022

alright sers. we're passing CI tests.

@SHAKOTN can you look into the solhint failure.

We can ignore solhint CI for now, since I will do a repo cleanup after this PR is merged.

Another point is to check that coverage decreased by 3% on some contracts. Is it expected or shall we add some more tests?

Copy link
Contributor

@SHAKOTN SHAKOTN left a comment

Choose a reason for hiding this comment

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

Agreed with @dapp-whisperer that coverage will be bumped from another PR.

Lgtm

return serialized;
}

function getOwnerAddress(bytes32 troveId) public pure returns (address) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the purpose of this function? I don't see it being used anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure tbh, @rayeaster did you write this one?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure tbh, @rayeaster did you write this one?

Yep, that should be added by me. Thought it is a handy function to retrieve owner address from generated bytes32 ID.

Copy link
Collaborator

@sajanrajdev sajanrajdev left a comment

Choose a reason for hiding this comment

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

Review

Notes

  • Adjusted the BorrowingOperations.sol contract and all of its dependencies accordingly to allow for multiple CDPs per user.
  • CDPs are tracked by their individual ID which is unique for the system (based on owner, creation block and the global CDPs count.
  • All global operations are performed on individual CDPs and based on their ids

Testing

  • All tests were adjusted to reflect the changes introduced
  • Coverage was maintained for all of the contracts touched (Coverage deficiencies are only seen on BorrowerOperationsScript.sol, StabilityPoolScript.sol, LQTYToken.sol, LUSDToken.sol and TokenScript.sol which will be adjusted or removed in a separate PR.
  • Testing contracts were also adjusted and a new contract to test the multiCDP functionality from a non-EOA actor was introduced. Note that this contract assumes that there are no positions opened for it as it starts the CDP count from 0. It may need to be adjusted as needed for integration tests - LG
  • Further fuzzing integration tests could be implemented to check proper handling of multiple users opening and closing multiple troves without any issues (special attention to proper handling of ID's generation, sorting and removals, CDP counts for users in extreme cases, etc) - To be developed with Foundry.

LGTM in general, just dropped a couple of nitty comments.

Copy link
Collaborator

@sajanrajdev sajanrajdev left a comment

Choose a reason for hiding this comment

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

LGTM

@sajanrajdev
Copy link
Collaborator

sajanrajdev commented Dec 5, 2022

Closes #58

Copy link
Contributor

@shuklaayush shuklaayush left a comment

Choose a reason for hiding this comment

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

I realize this is already merged but couldn't think of a better place to leave some comments

@rayeaster
Copy link
Contributor

I realize this is already merged but couldn't think of a better place to leave some comments

Thank you ser for taking time to review the change #143

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.

5 participants