vegaprotocol/sample-api-scripts

Pegged order not returning rejected status

tamlyn10 opened this issue · 7 comments

I just tried to do a pegged order using the sample API scripts and Gitpod. I used a Vega wallet in the credentials, that didn't have any collateral. I would expect this to return "rejected" but the code just kept waiting.. (see screenshot). I eventually ended it by doing ctrl c.

image

cdm commented

Thanks, if you have no collateral, the core will give a rejection for this (margin_check_failed). I can check what's going on, were you on testnet?

Well, if you don’t have any kind of asset deposited on vega, the transaction will be rejected on the tendermint pool, and will not even reach the core, at which point it could eventually be rejected.

I would guess your script is waiting for the order to come from the event bus which will never happen?

cdm commented

Im investigating, will confirm what's going on and update ticket.

So from what @jeremyletang says, we might now reject orders before they even hit a core for no asset, I can add an asset check to the scripts on that repo, but this problem will hit others trying to get started with Vega.

cdm commented

I can replicate this (for pub key with no assets), the signed pegged order is prepared, signed and sent successfully via the wallet service. At which point it disappears, or more accurately it does not show up when polling the orderByReference endpoint.

cdm commented

Need to switch the wallet call to use sync transaction mode when sending in to tendermint for rejection reason of kind "No assets found for pubkey", rejection reasons that are set by the core will be returned already - e.g. market closed etc. Same as #58

cdm commented

Easy fix - change samples to use call:

/api/v1/messages/sync

cdm commented

Fixed in #72