ebtc-protocol / ebtc

GNU General Public License v3.0
48 stars 24 forks source link

revert redemption if RM is triggered #774

Closed rayeaster closed 5 months ago

rayeaster commented 5 months ago

From @dapp-whisperer

In other words:

getrecon-bot commented 5 months ago
Job ID e881a866-ee8a-4ff0-8e6a-6e249705425d
Command yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 600000
Instance ID i-0c566d81362edd8ec
Instance Type c5.2xlarge
Status Started
Elapsed
getrecon-bot commented 5 months ago
Job ID e881a866-ee8a-4ff0-8e6a-6e249705425d
Command yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 600000
Instance ID i-0c566d81362edd8ec
Instance Type c5.2xlarge
Status Running
Elapsed 37 seconds
getrecon-bot commented 5 months ago
Job ID e881a866-ee8a-4ff0-8e6a-6e249705425d
Command yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 600000
Instance ID i-0c566d81362edd8ec
Instance Type c5.2xlarge
Status Running
Elapsed 38 seconds
CodingNameKiki commented 5 months ago

Shouldn't we do a check when we are in RM as well, clearly we agree that users are allowed to redeem when the redemption increases the TCR, but what about being in RM and decreasing the TCR even further with this issue? @rayeaster

        if (!_checkRecoveryModeForTCR(totals.tcrAtStart)) {
            require(
                !_checkRecoveryMode(totals.price),
                "CdpManager: redemption should not trigger RecoveryMode"
            );
        } else {
           // we can fetch new price as well instead of using the totals one.
           require(totals.tcrAtStart <= getCachedTCR(totals.price), "Decreasing TCR"); 
        }
getrecon-bot commented 5 months ago
Job ID e881a866-ee8a-4ff0-8e6a-6e249705425d
Command yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 600000
Instance ID i-0c566d81362edd8ec
Instance Type c5.2xlarge
Status Success
Elapsed 1 day 9 hours 18 minutes