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

cancel_order_by_client_id throws Transaction simulation failed #60

Closed
aqt01 opened this issue Dec 2, 2020 · 4 comments
Closed

cancel_order_by_client_id throws Transaction simulation failed #60

aqt01 opened this issue Dec 2, 2020 · 4 comments

Comments

@aqt01
Copy link
Contributor

aqt01 commented Dec 2, 2020

I cannot cancel my orders using cancel_order_by_client_id . Below there's a quick PoC

payer = Account()
open_orders_account = market.find_open_orders_accounts_for_owner(owner_address=PublicKey("account_address"))

market.cancel_order_by_client_id(owner=payer,open_orders_account=PublicKey(open_orders_account[0].address), client_id=0,  opts=TxOpts(skip_confirmation=True))

But it throws the following err

{'code': -32002, 'message': 'Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1000680', 'data': {'err': {'InstructionError': [0, {'Custom': 16778880}]}, 'logs': ['Program EUqojwWA2rd19FZrzeBncJsm38Jm1hEhE3zsmX3bRc2o invoke [1]', 'Program EUqojwWA2rd19FZrzeBncJsm38Jm1hEhE3zsmX3bRc2o consumed 1270 of 200000 compute units', 'Program EUqojwWA2rd19FZrzeBncJsm38Jm1hEhE3zsmX3bRc2o failed: custom program error: 0x1000680']}}
*** Exception: Failed to send transaction

I really don't know what i'm missing or if i'm introducing any invalid arg data and the err doesn't help me much to understand where is the issue

@leofisG
Copy link
Contributor

leofisG commented Dec 4, 2020

I can reproduce your error. I also tried with serum-ts but it's also not working. Will you be able to try serum-ts and confirm that it's not working either? I suspect it might be due to some change in the DEX.

@leofisG
Copy link
Contributor

leofisG commented Dec 5, 2020

Ok I think the main problem is that clientId of 0 will not work. When you place the order try to set a non-zero client id, and only then you can cancel it (at least for the time being). It's the issue on the DEX end, so there is not much that I can do unfortunately and I think it's a bit confusing...

More information can be found here.

@michaelhly
Copy link
Contributor

michaelhly commented Dec 5, 2020

@aqt01 You're failing this assertion check.

https://github.com/project-serum/serum-dex/blob/cb43d3707fef74dd59bb293475c9a74467a19d65/dex/src/state.rs#L1670

Not sure why you're providing 0 as your client_id. But the code is working as intended.

Closing this for now. Feel free to re-open if you run into more issues.

@aqt01
Copy link
Contributor Author

aqt01 commented Dec 10, 2020

@michaelhly @524119574
Thanks for the help!

I used my client_id 0 because when i find my order this was the used client_id. But anyway i solved the issue using

#61 (comment)

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

3 participants