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

Misleading status message when AMM offer is rejected #4809

Open
turadg opened this issue Mar 10, 2022 · 10 comments
Open

Misleading status message when AMM offer is rejected #4809

turadg opened this issue Mar 10, 2022 · 10 comments
Assignees
Labels
AMM audit-restival Purple Team review of RUN Protocol bug Something isn't working UI vaults_triage DO NOT USE Zoe package: Zoe

Comments

@turadg
Copy link
Member

turadg commented Mar 10, 2022

Describe the bug

If the AMM offer is processed it returns "Swap successfully completed." even if the offer was rejected. For example, due to making an offer that's not on the AMM curve.

Expected behavior

Some response that informs the user of the new state.

Additional context

The REPL is part of the UI, though not GUI.

See also #3056

@turadg turadg added bug Something isn't working UI Inter-protocol Overarching Inter Protocol audit-restival Purple Team review of RUN Protocol labels Mar 10, 2022
@Tartuffo Tartuffo added Zoe package: Zoe wallet and removed Inter-protocol Overarching Inter Protocol labels Mar 16, 2022
@Tartuffo Tartuffo assigned michaelfig and turadg and unassigned michaelfig Mar 23, 2022
@Tartuffo
Copy link
Contributor

Need to properly surface the outcome of the offer.
Should it throw or politely return the "give"?
Can handle entirely in the wallet, but will be seen in the REPL.

@Tartuffo Tartuffo added this to the Mainnet 1 milestone Mar 24, 2022
@dckc
Copy link
Member

dckc commented May 24, 2022

another awkward consequence of not throwing is a notifier update with no change in state: https://github.com/Agoric/agoric-sdk/pull/5420/files#r879991457

@Tartuffo Tartuffo removed this from the Mainnet 1 milestone Jul 19, 2022
@turadg
Copy link
Member Author

turadg commented Jul 20, 2022

Either this or #3056 needs to be done for MN-1.

Need to discuss with @erights which. When determined then update both tickets.

@erights
Copy link
Member

erights commented Jul 25, 2022

Yes, let's discuss. @dtribble and I discussed a method that could easily be added to UserSeat that would help. But I am not sure I understand the problem and why the wallet could not easily do the equivalent of that method for itself.

I am not that oriented in the wallet, so I may be missing something obvious. It seems the problem is that the wallet is paying looking at the offerResult when it should be looking at the payout. The question it seems to want to ask is "Is this offer's proposal's want satisfied?" The UserSeat method @dtribble and I discussed, that @dtribble thinks would help, is an isSatisfied method that returns a promise that eventually resolved only to true or false. Even with that convenience, a returned promise will not survive an upgrade, so the wallet would need to cope with the normal upgrade-invalidated promise pattern, where it asks for a new promise in that case.

@dckc
Copy link
Member

dckc commented Jul 25, 2022

The misleading "Swap successfully completed." is shown in the dapp (amm.agoric.net), not the wallet.

Are you suggesting that every dApp developer should inspect the payouts rather than the offer result to get... um... the result of the offer?

Wouldn't it be much more straightforward for the AMM contract to throw in this case? I use the AMM API quite a bit, and remembering that "Swap successfully completed." actually means "swap may or may not have successfully completed; you better look more closely" is a royal pain.

At least we should change the message to "Swap order processed. Check payouts for results."

@Tartuffo
Copy link
Contributor

As discussed in Eng Sync today, we need to have the correct feedback to the user, to be implemented between the UI and the AMM contract (not a fundamental change to Zoe).

@dckc
Copy link
Member

dckc commented Jul 25, 2022

regarding my suggestion to have the AMM contract throw, @erights pointed out a risk of relying on the contract for this info: it could lie by reporting one thing in the offer result and another in the payouts. So the client has to check the payouts, one way or another.

@Tartuffo Tartuffo added this to the Mainnet 1 RC0 milestone Aug 10, 2022
@dckc dckc changed the title Misleading status message when AMM offer is rejected Misleading status message when AMM , PSM offer is rejected Aug 31, 2022
@dckc
Copy link
Member

dckc commented Aug 31, 2022

I got bit by this again, this time with the PSM, when I tried to trade 30 IST for USDC but the PSM only had 20 USDC in its piggy bank.

@dckc
Copy link
Member

dckc commented Aug 31, 2022

@erights points out:

UserSeat numWantsSatisfied gives a promise that settles once the seat has exited. It settles to 0 if the wants are not satisfied, and it settles to > 0 if the wants are satisfied. Currently (pre multiples) the wants are either not satisfied (0) or satisfied exactly once (1). But to be future compat better to test for 0 vs > 0.
Offer safety guarantees that if the wants are not satisfied (0) then all the escrowed assets are refunded. But note that even if the wants are satisfied, you may still receive a full refund anyway. That’s why the relevant UI question is usually whether the wants are satisfied.

@dckc dckc mentioned this issue Aug 31, 2022
@Tartuffo Tartuffo removed this from the Mainnet 1 RC0 milestone Sep 21, 2022
@dckc
Copy link
Member

dckc commented Jan 12, 2023

This has been addressed for the purpose of the PSM / wallet release.

@dckc dckc changed the title Misleading status message when AMM , PSM offer is rejected Misleading status message when AMM offer is rejected Jan 12, 2023
@dckc dckc removed the wallet label Jan 12, 2023
@ivanlei ivanlei removed the MUST-HAVE label Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AMM audit-restival Purple Team review of RUN Protocol bug Something isn't working UI vaults_triage DO NOT USE Zoe package: Zoe
Projects
None yet
Development

No branches or pull requests

7 participants