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

Variable rate AuditFixes #547

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Variable rate AuditFixes #547

wants to merge 15 commits into from

Conversation

iamsahu
Copy link
Contributor

@iamsahu iamsahu commented May 3, 2023

This PR contains the fixes based on the reports the auditors submitted. The fixes were first implemented in the auditor-specific repos and then after their approval were aggregated and implemented in this repo. You can find the reports and PRs here:

  1. https://github.com/yieldprotocol/variable-rate-audit-DecorativePineapple
  2. https://github.com/yieldprotocol/variable-rate-audit-gogoauditor
  3. https://github.com/yieldprotocol/variable-rate-audit-parth-15
  4. https://github.com/yieldprotocol/variable-rate-audit-obheda12

We need to review if all the accepted changes in the above reports were implemented in this one.

@iamsahu iamsahu marked this pull request as ready for review May 4, 2023 13:57
@iamsahu iamsahu requested review from alcueca and Sabnock01 May 4, 2023 13:57
cache/solidity-files-cache.json Show resolved Hide resolved
@@ -3,4 +3,4 @@
forge-std/=lib/forge-std/
erc3156/=lib/ERC3156/
dss-interfaces/=lib/dss-interfaces/
openzeppelin/=lib/openzeppelin-contracts/
@openzeppelin/=lib/openzeppelin-contracts/
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need node convention here?

}

// Manage base
if (base != 0) {
IJoin baseJoin = getJoin(vault.baseId);
if (base < 0) baseJoin.join(vault.owner, uint128(-base));
if (base > 0) baseJoin.exit(to, uint128(base));
else baseJoin.exit(to, uint128(base));
Copy link
Contributor

Choose a reason for hiding this comment

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

What if base is 0? That wasn't being checked before but is now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On 325 we are checking that base != 0

@@ -297,26 +297,6 @@ contract VRLadle is UUPSUpgradeable, AccessControl() {

// ---- Asset and debt management ----

/// @dev Move collateral and debt between vaults.
function stir(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was stir moved exactly?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It doesn't update the global debt counters when ilkId != baseId. It could be fixed, but at the same time we haven't ever used it, so better to just reduce the attack surface.

@@ -259,75 +255,3 @@ contract VYTokenTest is VYTokenZeroState {
assertLe(principalAmount, vyToken.convertToPrincipal(INK));
}
}

contract FlashLoanEnabledStateTests is FlashLoanEnabledState {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove all these tests exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since, flash loan was removed the tests are removed as well.

@@ -154,18 +154,6 @@ contract VaultTests is VaultBuiltState {
ladle.give(vaultId, admin);
}

function testOnlyOwnerCouldMove() public {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove so many tests from this file? Is it because they're already tested elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests related to stir were removed.

src/variable/VRLadle.sol Outdated Show resolved Hide resolved
Copy link
Collaborator

@alcueca alcueca left a comment

Choose a reason for hiding this comment

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

Just cosmetic changes required.

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.

None yet

3 participants