This repository was archived by the owner on Sep 24, 2023. It is now read-only.
This repository was archived by the owner on Sep 24, 2023. It is now read-only.
simon135 - If block range it big and adl dosnt use currentblock in the order it will cause issues #216
Open
Description
simon135
medium
If block range it big and adl dosnt use currentblock in the order it will cause issues
Summary
if block range is a big range and since adl order uses cache.minOracleBlockNumbers[0]
there can be an issue of the block not being in range because of the littlest block with max block being a lot bigger and adl wont happen and the protocol will get bad debt
Vulnerability Detail
since the adl order updateBlock is cache.minOracleBlockNumbers[0]
the block can be behind the range check and fail and the protocol can end up in bad debt with the tokens price declining
Impact
bad debt
Code Snippet
cache.key = AdlUtils.createAdlOrder(
AdlUtils.CreateAdlOrderParams(
dataStore,
eventEmitter,
account,
market,
collateralToken,
isLong,
sizeDeltaUsd,
cache.minOracleBlockNumbers[0]
)
Tool used
Manual Review
Recommendation
make it chain.currentBLock