Closed rayeaster closed 4 months ago
This update introduces enhancements to the liquidation process in a smart contract system, focusing on better handling of collateral surplus during liquidation based on the Insurance Coverage Ratio (ICR) against the Minimum Collateral Ratio (MCR). It also adds a test for liquidation scenarios where the ICR is below the MCR, ensuring no surplus is generated in such cases. Additionally, it addresses potential vulnerabilities by introducing a mechanism to prevent flash loan fee escape attacks.
File Path | Change Summary |
---|---|
.../contracts/LiquidationLibrary.sol |
Added conditional check for _collSurplus handling based on _checkICRAgainstMCR , updating _cappedColPortion accordingly. |
.../foundry_test/CdpManager.Liquidation.t.sol |
New test testSurplusInRMWhenICRBelowMCR added to simulate liquidation with ICR < MCR. |
.../foundry_test/FlashLoanAttack.t.sol |
Introduced IActivePool interface and FlashFeeEscapeBorrower contract; added testFeeEscapeAttack() function. |
🐇✨
In the realm of code where smart contracts play,
A rabbit hopped in, improvements on display.
With logic so keen, and tests all in check,
It fixed what was broken, no system to wreck.
🚀🌌
"To safer harbors, our contracts we steer,
With each line of code, the future's more clear."
🐇💻🎉
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Job ID | 4e85689a-33ca-4cb4-9684-91bb157793b7 |
Command | yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 300000 |
Instance ID | i-0ce902b6861cf0099 |
Instance Type | c5.2xlarge |
Status | Started |
Elapsed |
Job ID | 4e85689a-33ca-4cb4-9684-91bb157793b7 |
Command | yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 300000 |
Instance ID | i-0ce902b6861cf0099 |
Instance Type | c5.2xlarge |
Status | Running |
Elapsed | 43 seconds |
Job ID | 4e85689a-33ca-4cb4-9684-91bb157793b7 |
Command | yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 300000 |
Instance ID | i-0ce902b6861cf0099 |
Instance Type | c5.2xlarge |
Status | Running |
Elapsed | 44 seconds |
Job ID | 4e85689a-33ca-4cb4-9684-91bb157793b7 |
Command | yarn && git submodule init && git submodule update && solc-select use 0.8.17 && cd packages/contracts/ && yarn echidna --test-mode assertion --test-limit 300000 |
Instance ID | i-0ce902b6861cf0099 |
Instance Type | c5.2xlarge |
Status | Success |
Elapsed | 17 hours 35 minutes 4 seconds |
Summary by CodeRabbit
Summary by CodeRabbit