Submitted by gpersoon, also found by cmichel and shw
The function _batchConfirmOutstandingPendingActions of LongShort.sol processes the variable batched_amountSyntheticToken_toShiftAwayFrom_marketSide, and sets it to 0 after processing. However, probably due to a copy/paste error, in the second instance, where batched_amountSyntheticToken_toShiftAwayFrom_marketSide[marketIndex][false] is processed, the wrong version is set to 0: batched_amountSyntheticToken_toShiftAwayFrom_marketSide[marketIndex][true] = 0
This means the next time the batched_amountSyntheticToken_toShiftAwayFrom_marketSide[marketIndex][false] is processed again. As it is never reset, it keeps increasing. The result is that the internal administration will be off and far too many tokens will be shifted tokens from SHORT to LONG.
LongShort.sol L1126
Recommend changing the second instance of the following (on line 1207)
batched_amountSyntheticToken_toShiftAwayFrom_marketSide[marketIndex][true] = 0
to
batched_amountSyntheticToken_toShiftAwayFrom_marketSide[marketIndex][false] = 0
p.s. confirmed by Jason of Floatcapital: Yes, that should definitely be false!
JasoonS (Float) commented:
moose-code (Float) confirmed:
DenhamPreen (Float) patched:
