#46989 [SC-Insight] Invalid trade side check
Description
Brief/Intro
Vulnerability Details
#[derive(Copy, Drop, Serde, Debug, PartialEq)]
pub struct OrderV2 {
pub account: ContractAddress,
pub market: felt252,
pub side: felt252,
pub orderType: felt252,
pub size: felt252,
pub price: felt252,
pub signature_timestamp: felt252,
pub is_reduce_only: bool,
}
fn settle_trade_v2(ref self: ContractState, trade: TradeRequestV2) -> felt252 {
...
assert(trade.maker_order.side != trade.taker_order.side, Errors::TRADE_SAME_SIDE);
...
}
#[inline(always)]
pub fn _get_sign_from_side(side: felt252) -> i128 {
// Implement this function based on your side definitions
if side == 1 {
1
} else {
-1
}
}
Impact Details
References
Proof of Concept
Proof of Concept
Previous#46960 [SC-Insight] trade order sizes are not validated properlyNext#46997 [SC-Medium] The vault performs an unsafe conversion on the getAccountValue result.
Was this helpful?