generated from refcell/femplate
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take underflows when full pool debt repaid (#551)
Take underflows when full pool debt repaid Scenario is exposed in testTakeAuctionRepaidAmountGreaterThanPoolDebt test: - when auction debt is fully repaid by take action then accrued pool debt value is less than repaid amount with 1 unit of WAD. When the repaid amount is subtracted from pool debt value (normally leaving no debt in pool) the operation underflows. - this happens because repaid debt is calculated using t0 value (t0 repaid debt * inflator) and then subtracted from already calculated pool debt - fix is to calculate pool debt as (t0 pool debt - t0 repaid debt) * inflator, hence preventing rounding issues The scope of this PR is extended to uniformize the t0 / accrued debt values calculation across all contracts by using pattern below: - when values relative to t0 are changed then t0 is updated first and then transformed in actual value (by multiplying it with inflator value) - all accumulations of pool or borrower debt are done on spot and not deferred to Pool contracts (which only save states)
- Loading branch information
Showing
13 changed files
with
359 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
<!--- | ||
No need to add special tag | ||
src/ & non src/ changes you need the following (that apply): | ||
--> | ||
# Description of change | ||
## High level | ||
* <DESCRIP_OF_CHANGE> | ||
* <DESCRIP_OF_SUBCHANGE> | ||
|
||
<!--- | ||
Add the `Status: Needs Auditor Approval` tags | ||
CHANGES IN /SRC DIR: | ||
- renaming (not retyping or resizing) of variables & methods | ||
- reordering and moving of functions in files | ||
- lite moving of functions accross files | ||
- comments | ||
src/ changes you need the following (that apply): | ||
--> | ||
|
||
# Description of bug or vulnerability and solution | ||
* <PARAGRAPH_EXP_OF_VULN_BUG> | ||
* <PARAGRAPH_EXP_OF_HOW_CHANGE_SOLVES_VULN_OR_BUG> | ||
|
||
# Contract size | ||
## Pre Change | ||
<PASTE_OUTPUT_HERE> | ||
## Post Change | ||
<PASTE_OUTPUT_HERE> | ||
|
||
# Gas usage | ||
## Pre Change | ||
<PASTE_OUTPUT_HERE> | ||
## Post Change | ||
<PASTE_OUTPUT_HERE> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.