keep-starknet-strange / satoru

Synthetics platform for Starknet, inspired by GMX v2 design.
https://book.satoru.run/
MIT License
110 stars 73 forks source link

fix: `u32_sub Overflow` if the index isn't found in datastore #536

Closed khaeljy closed 11 months ago

khaeljy commented 11 months ago

Pull Request type

Please add the labels corresponding to the type of changes your PR introduces:

What is the current behavior?

If the index isn't found in remove_* function, then offsetted_index == 0 and panic with u32_sub Overflow in the instruction let index = offsetted_index - 1;.

What is the new behavior?

If the index isn't found in remove_* function, then offsetted_index == 0 and panic with MarketError::MARKET_NOT_FOUND.

Does this introduce a breaking change?

No

Other information

zarboq commented 11 months ago

Nice it will make debugging easier !