-
Notifications
You must be signed in to change notification settings - Fork 1
[SOV-4416] apply reentrancy guard zero #7
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
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls sync from the target branch.
changes requested, see comments.
contracts/BorrowerOperations.sol
Outdated
/* | ||
* @notice set the user's block number for opening, and do check & reset to 0 for closing | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* | |
* @notice set the user's block number for opening, and do check & reset to 0 for closing | |
* | |
/* | |
* @notice set the user's block number for opening or increasing LoCs, and do check & reset to 0 for closing or decreasing | |
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contracts/BorrowerOperations.sol
Outdated
function notInTheSameBlockHandler(bool _isOpening) private { | ||
if(_isOpening) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function notInTheSameBlockHandler(bool _isOpening) private { | |
if(_isOpening) { | |
function notInTheSameBlockHandler(bool _openOrIncrease) private { | |
if(_openOrIncrease) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contracts/BorrowerOperations.sol
Outdated
} else { | ||
if(userBlockNumber[tx.origin] > 0) { | ||
if(userBlockNumber[tx.origin] == block.number) { | ||
revert("ZeroProtocolMutex: mutex locked"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert("ZeroProtocolMutex: mutex locked"); | |
revert("Recovery mode mutex locked. Try in another block"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* | ||
* to store the user's block number | ||
*/ | ||
mapping(address => uint256) public userBlockNumber; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* | |
* to store the user's block number | |
*/ | |
mapping(address => uint256) public userBlockNumber; | |
} | |
/* | |
* Store the LoC block number on open/increase when in the Recovery mode | |
*/ | |
mapping(address => uint256) public recoveryModeMutex; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contracts/BorrowerOperations.sol
Outdated
* | ||
* @dev This is the function will be called by the open, close, increase, decrease trove function | ||
*/ | ||
function notInTheSameBlockHandler(bool _isOpening) private { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function notInTheSameBlockHandler(bool _isOpening) private { | |
function recoveryModeMutexHandler(bool _isOpening) private { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unused test instruction
6b5079e
to
9c5e883
Compare
2 address comment review
IPriceFeedTestnet(_priceFeed).setPrice(1e8); | ||
|
||
// repayZusd will affect(decrease) the debt, should revert due to reentrancy violation | ||
borrowerOperations.repayZUSD(_ZUSDAmount, _upperHint, _lowerHint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test covers only one case: open trove - repay debt
.
but is missing increase debt - repay
.
and open trove - increase debt - repay debt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added unit test in this commit
No description provided.