The problem here is that Market can invalidate some pending position and currentPosition will change, thus liquidation will happen with the new (invalidated) currentPosition, but MultiInvoker._liquidate takes currentPosition unadjusted. Moreover, it should be adjusted to settledlatestPosition, not to latestPosition which is available right away (which is not yet settled to latest oracle), so it should be adjusted to MultiInvoker._latest()
MultiInvoker._liquidate
: https://github.com/sherlock-audit/2023-09-perennial/blob/e518bbd77bd06ae9c663a31c67d9530a87d2dabb/perennial-v2/packages/perennial-extensions/contracts/MultiInvoker.sol#L229The problem here is that
Market
can invalidate some pending position and currentPosition will change, thus liquidation will happen with the new (invalidated) currentPosition, butMultiInvoker._liquidate
takescurrentPosition
unadjusted. Moreover, it should be adjusted to settledlatestPosition
, not tolatestPosition
which is available right away (which is not yet settled to latest oracle), so it should be adjusted toMultiInvoker._latest()