Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CancelOrderByClientIdV2 API should take NonZeroU64 and not u64. #248

Open
tommyip opened this issue Jul 18, 2022 · 0 comments
Open

CancelOrderByClientIdV2 API should take NonZeroU64 and not u64. #248

tommyip opened this issue Jul 18, 2022 · 0 comments

Comments

@tommyip
Copy link

tommyip commented Jul 18, 2022

The instruction accepts an u64:

CancelOrderByClientIdV2(u64),

despite it being casted to a NonZeroU64 internally:
let client_order_id = NonZeroU64::new(client_order_id).ok_or(assertion_error!())?;

which means that an order with client id of 0 can not be cancelled (raising an assertion error).

This is also an issue for the CancelOrdersByClientIds instruction, worst yet it silently filters away the 0 id order:

serum-dex/dex/src/state.rs

Lines 2190 to 2194 in 0c23a51

let client_order_ids = client_order_ids
.iter()
.cloned()
.filter_map(NonZeroU64::new)
.collect::<Vec<NonZeroU64>>();

Causing confusing errors like insufficient funds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant