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

UI hangs following attempt to close vault when it's really failing due to insufficient funds (no error given to user) #57

Closed
otoole-brendan opened this issue Nov 15, 2023 · 3 comments · Fixed by Agoric/dapp-inter#216
Assignees
Labels
bug Something isn't working

Comments

@otoole-brendan
Copy link

Describe the bug

During smoke-testing of upgrade 12 I was able to succeed in adjusting a vault but then unable to close a vault. The UI would sit spinning with 'Submitting' with no outcome. When I refresh - nothing happened.

Following investigation of logs - the txn was failing due to insufficient IST to repay debt. No error is given to user in UI to know this.

To Reproduce

Steps to reproduce the behavior:

  1. Go to app.inter.trade (Emerynet)
  2. Create a vault with IST.
  3. Have less IST in your wallet than would be required to pay off debt
  4. Attempt to close vault

Expected behavior

Error should be shown so clear a) txn failed and b) due to insufficient IST

@otoole-brendan otoole-brendan added the bug Something isn't working label Nov 15, 2023
@samsiegart
Copy link
Contributor

I'm seeing similar behavior sometimes in the PSM when doing a successful swap (toast keeps spinning after wallet balances update), but difficult to repro reliably

@samsiegart
Copy link
Contributor

samsiegart commented Nov 22, 2023

I'm seeing an error when casting tries to unserialize a wallet update value here

I put console.logs as such
image

And got the following console output:

follower-cosmjs.js?t=1700639988082:337 casting unserializing {body: '#{"status":{"error":"Error: cannot grab 8048108572…},"status":"rejected"}]},"updated":"offerStatus"}', slots: Array(2)}body: "#{\"status\":{\"error\":\"Error: cannot grab 8048108572uist coins: 348263093uist is smaller than 8048108572uist: insufficient funds\",\"id\":1700638965176,\"invitationSpec\":{\"invitationMakerName\":\"CloseVault\",\"previousOffer\":\"1695480430119\",\"source\":\"continuing\"},\"offerArgs\":\"#undefined\",\"proposal\":{\"give\":{\"Minted\":{\"brand\":\"$0.Alleged: IST brand\",\"value\":\"+8048108572\"}},\"want\":{\"Collateral\":{\"brand\":\"$1.Alleged: ATOM brand\",\"value\":\"+2000000000\"}}},\"result\":[{\"reason\":{\"#error\":\"cannot grab 8048108572uist coins: 348263093uist is smaller than 8048108572uist: insufficient funds\",\"errorId\":\"error:anon-marshal#10001\",\"name\":\"Error\"},\"status\":\"rejected\"}]},\"updated\":\"offerStatus\"}"slots: (2) ['board0257', 'board01547']constructor: (...)hasOwnProperty: (...)isPrototypeOf: (...)propertyIsEnumerable: (...)toLocaleString: (...)toString: (...)valueOf: (...)__defineGetter__: (...)__defineSetter__: (...)__lookupGetter__: (...)__lookupSetter__: (...)[[Prototype]]: Object
follower-cosmjs.js?t=1700639988082:343 casting error during unserialize: Error: Passed Error "stack" {"configurable":false,"enumerable":false,"get":"[Function <anon>]","set":"[Function <anon>]"} must be a string-valued data property.
  at Array.map (<anonymous>)
  at Array.map (<anonymous>)
  at Array.map (<anonymous>)
  at Array.map (<anonymous>)
followerElementFromStreamCellValue @ follower-cosmjs.js?t=1700639988082:343
await in followerElementFromStreamCellValue (async)
allValuesFromCell @ follower-cosmjs.js?t=1700639988082:356
getEachIterableAtHeight @ follower-cosmjs.js?t=1700639988082:467
localApplyMethod @ local.js:99
(anonymous) @ handled-promise.js:455

And this is the copied json output of the data:

{
    "body": "#{\"status\":{\"error\":\"Error: cannot grab 8048108572uist coins: 348263093uist is smaller than 8048108572uist: insufficient funds\",\"id\":1700638965176,\"invitationSpec\":{\"invitationMakerName\":\"CloseVault\",\"previousOffer\":\"1695480430119\",\"source\":\"continuing\"},\"offerArgs\":\"#undefined\",\"proposal\":{\"give\":{\"Minted\":{\"brand\":\"$0.Alleged: IST brand\",\"value\":\"+8048108572\"}},\"want\":{\"Collateral\":{\"brand\":\"$1.Alleged: ATOM brand\",\"value\":\"+2000000000\"}}},\"result\":[{\"reason\":{\"#error\":\"cannot grab 8048108572uist coins: 348263093uist is smaller than 8048108572uist: insufficient funds\",\"errorId\":\"error:anon-marshal#10001\",\"name\":\"Error\"},\"status\":\"rejected\"}]},\"updated\":\"offerStatus\"}",
    "slots": [
        "board0257",
        "board01547"
    ]
}

@samsiegart
Copy link
Contributor

It seems like casting is hitting this error, and then fails to keep yielding more updates, so we never see the updated offer statuses.

I tried removing the serializer arg here to use the default, and see the same error.

It seems like this is just not valid capdata being emitted? If so, it needs to be fixed on the contract side. In the meantime, perhaps we can modify casting to skip, or yield empty values if it can't unserialize, rather than getting stuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants