You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.
volodya - minAcceptablePortionLF is not being enforced on the partial opening positions which leads to liquidators receiving fewer funds than protocol promised to the liquidator
#111
Closed
sherlock-admin opened this issue
Jul 3, 2023
· 0 comments
sherlock-admin opened this issue
Jul 3, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
minAcceptablePortionLF is not being enforced on the partial opening positions which leads to liquidators receiving fewer funds than protocol promised to the liquidator
Summary
minAcceptablePortionLF is not being enforced on the partial opening positions which leads to liquidators receiving fewer funds than protocol promised to the liquidator
Vulnerability Detail
The same thing in all of those function requestToClosePosition, openPosition, closeQuote where check for minAcceptableQuoteValue exist should be a check for minAcceptablePortionLF
There is no validation in openPosition like its done in sendQuote on minAcceptablePortionLF.
Liquidation for partyA is successful when quoteLayout.partyAPositionsCount[partyA] == 0
);
LockedValues memory appliedFilledLockedValues = filledLockedValues;
appliedFilledLockedValues = appliedFilledLockedValues.mulMem(openedPrice);
appliedFilledLockedValues = appliedFilledLockedValues.divMem(quote.requestedOpenPrice);
// check that opened position is not minor positionrequire(
appliedFilledLockedValues.total() >=
SymbolStorage.layout().symbols[quote.symbolId].minAcceptableQuoteValue,
"PartyBFacet: Quote value is low"
);
// check that new pending position is not minor positionrequire(
(quote.lockedValues.total() - filledLockedValues.total()) >=
SymbolStorage.layout().symbols[quote.symbolId].minAcceptableQuoteValue,
"PartyBFacet: Quote value is low"
);
minAcceptablePortionLF is not being enforced on the partial opening positions which leads to liquidators receiving fewer funds than protocol promised to the liquidator
Code Snippet
Tool used
Manual Review
Recommendation
Add minAcceptablePortionLF check
require(
appliedFilledLockedValues.total() >=
SymbolStorage.layout().symbols[quote.symbolId].minAcceptableQuoteValue,
"PartyBFacet: Quote value is low"
);
// check that new pending position is not minor position
require(
(quote.lockedValues.total() - filledLockedValues.total()) >=
SymbolStorage.layout().symbols[quote.symbolId].minAcceptableQuoteValue,
"PartyBFacet: Quote value is low"
);
+ require(+ appliedFilledLockedValues.lf >=+ (symbolLayout.symbols[quote.symbolId].minAcceptablePortionLF * appliedFilledLockedValues.total()) /+ 1e18,+ "PartyAFacet: LF is not enough"+ );+ require(+ quote.lockedValues.lf - filledLockedValues.lf >=+ (symbolLayout.symbols[quote.symbolId].minAcceptablePortionLF * (quote.lockedValues.total() - filledLockedValues.total())) /+ 1e18,+ "PartyAFacet: LF is not enough"+ );
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
volodya
medium
minAcceptablePortionLF is not being enforced on the partial opening positions which leads to liquidators receiving fewer funds than protocol promised to the liquidator
Summary
minAcceptablePortionLF is not being enforced on the partial opening positions which leads to liquidators receiving fewer funds than protocol promised to the liquidator
Vulnerability Detail
The same thing in all of those function
requestToClosePosition
,openPosition
,closeQuote
where check forminAcceptableQuoteValue
exist should be a check forminAcceptablePortionLF
There is no validation in
openPosition
like its done insendQuote
on minAcceptablePortionLF.Liquidation for partyA is successful when
quoteLayout.partyAPositionsCount[partyA] == 0
facets/PartyB/PartyBFacetImpl.sol#L189
facets/PartyA/PartyAFacetImpl.sol#L57
Impact
minAcceptablePortionLF is not being enforced on the partial opening positions which leads to liquidators receiving fewer funds than protocol promised to the liquidator
Code Snippet
Tool used
Manual Review
Recommendation
Add minAcceptablePortionLF check
Duplicate of #248
The text was updated successfully, but these errors were encountered: