Skip to content
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

Jolly Umber Cormorant - submitOffchainDelayedOrder() is called wrong with wrong paramters #1043

Open
sherlock-admin2 opened this issue Dec 30, 2024 · 0 comments

Comments

@sherlock-admin2
Copy link
Contributor

Jolly Umber Cormorant

Medium

submitOffchainDelayedOrder() is called wrong with wrong paramters

Summary

At the end of the liquidation function, the protocol submits an offchain delayed order in sythetix with a 1X leverage

File: borrowLiquidation.sol
361:         // Submit an offchain delayed order in synthetix for short position with 1X leverage
362:         synthetixPerpsV2.submitOffchainDelayedOrder(
363:  @>         -int((uint(margin * 1 ether * 1e16) / currentEthPrice)),
364:             currentEthPrice * 1e16
365:         );

The problem is that the leverage is over estimated.

Using 1 ether instead of 1 overestimates the sizeDelta

Root Cause

No response

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

This can lead to opening position with an overblown leverage or better yet reverting in the synthetix contract itself

PoC

No response

Mitigation

modify as shown below

File: borrowLiquidation.sol
361:         // Submit an offchain delayed order in synthetix for short position with 1X leverage
362:         synthetixPerpsV2.submitOffchainDelayedOrder(
-363:            -int((uint(margin * 1 ether * 1e16) / currentEthPrice)),
+363:            -int((uint(margin * 1 * 1e16) / currentEthPrice)),
364:             currentEthPrice * 1e16
365:         );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant