Skip to content

Commit

Permalink
fuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
skrrb committed Dec 26, 2023
1 parent 37077bc commit fe6cf44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions programs/openbook-v2/fuzz/fuzz_targets/multiple_orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl FuzzData {
FuzzInstruction::PlaceOrder { .. }
| FuzzInstruction::PlaceOrderPegged { .. }
| FuzzInstruction::PlaceTakeOrder { .. }
| FuzzInstruction::CancelAndPlaceOrders { .. }
| FuzzInstruction::CancelAllAndPlaceOrders { .. }
)
})
}
Expand Down Expand Up @@ -73,9 +73,9 @@ enum FuzzInstruction {
data: openbook_v2::instruction::EditOrderPegged,
makers: Option<HashSet<UserId>>,
},
CancelAndPlaceOrders {
CancelAllAndPlaceOrders {
user_id: UserId,
data: openbook_v2::instruction::CancelAndPlaceOrders,
data: openbook_v2::instruction::CancelAllAndPlaceOrders,
makers: Option<HashSet<UserId>>,
},
CancelOrder {
Expand Down Expand Up @@ -171,13 +171,13 @@ impl FuzzRunner for FuzzContext {
.edit_order_pegged(user_id, data, makers.as_ref())
.map_or_else(error_parser::edit_order_pegged, keep),

FuzzInstruction::CancelAndPlaceOrders {
FuzzInstruction::CancelAllAndPlaceOrders {
user_id,
data,
makers,
} => self
.cancel_and_place_orders(user_id, data, makers.as_ref())
.map_or_else(error_parser::cancel_and_place_orders, keep),
.cancel_all_and_place_orders(user_id, data, makers.as_ref())
.map_or_else(error_parser::cancel_all_and_place_orders, keep),

FuzzInstruction::CancelOrder { user_id, data } => self
.cancel_order(user_id, data)
Expand Down Expand Up @@ -534,7 +534,7 @@ mod error_parser {
}
}

pub fn cancel_and_place_orders(err: ProgramError) -> Corpus {
pub fn cancel_all_and_place_orders(err: ProgramError) -> Corpus {
match err {
e if e == OpenBookError::InvalidInputLots.into() => Corpus::Reject,
e if e == OpenBookError::InvalidInputLotsSize.into() => Corpus::Reject,
Expand Down
6 changes: 3 additions & 3 deletions programs/openbook-v2/fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,15 +603,15 @@ impl FuzzContext {
process_instruction(&mut self.state, data, &accounts, &remaining)
}

pub fn cancel_and_place_orders(
pub fn cancel_all_and_place_orders(
&mut self,
user_id: &UserId,
data: &openbook_v2::instruction::CancelAndPlaceOrders,
data: &openbook_v2::instruction::CancelAllAndPlaceOrders,
makers: Option<&HashSet<UserId>>,
) -> ProgramResult {
let user = self.get_or_create_new_user(user_id);

let accounts = openbook_v2::accounts::CancelAndPlaceOrders {
let accounts = openbook_v2::accounts::CancelAllAndPlaceOrders {
open_orders_account: user.open_orders,
signer: user.owner,
user_base_account: user.base_vault,
Expand Down

0 comments on commit fe6cf44

Please sign in to comment.