Electric-Coin-Company / zashi

Issue Tracking and common resources for the Zashi Zcash Wallets
MIT License
3 stars 3 forks source link

Cannot spend Sapling balance while there is Transparent balance #11

Open Edicksonjga opened 11 months ago

Edicksonjga commented 11 months ago

After performing several tests by sending part of my available balance to other wallets, I was left with a balance of 0.000189 ZEC.

I send a transaction to the transparent address of my Zashi wallet for a total of 0.10005 ZEC, I try to spend the available balance that according to Zashi is 0.000189 ZEC and in no attempt it was possible to spend.

In order to manage to spend, I had to shield the balance that was in transparent, in this way the available balance was updated and I managed to spend the balance.

  1. Why is it not possible to spend the available balance in Sapling while there is a balance in transparent?
  2. Why isn't there a button to shield balance?

Video where I try to spend the available balance in sapling while there is balance in Transparent:

https://github.com/Electric-Coin-Company/zashi/assets/37910384/7bff5800-bfd3-4313-9b57-2ad08f2c0c43

Video where I manage to spend available balance in sapling after transparent balance shielding is confirmed (shielding was performed from another app):

https://github.com/Electric-Coin-Company/zashi/assets/37910384/bf24ac29-b16e-4510-8a70-c870254c2900

The same publication can be used in Discord:

https://discord.com/channels/1133829162591846461/1133829407295942666/1184564080346939492

nuttycom commented 7 months ago

This problem was likely related to the guardrails that prevent the creation of "dust" notes. There are a few possibilities for how to address this problem, so this example should be considered when evaluating #39. #40 is also related.

nuttycom commented 7 months ago

After further consideration, this is more likely a UX problem. If the wallet contains 0.000189 ZEC, after accounting for fees required to spend, the maximum value that can actually be spent is either 0.000089 ZEC (if sending within the same pool, with only one or two source notes) or no spend may be possible at all, due to the fees required for pool-crossing.

We've had ideas for some time about accounting for fees in the balance display, but have hesitated because there's a tradeoff: if the balance accurately reflects the actual spendable value, given fees, then the balance will likely disagree with what is displayed by other wallets that do not take this approach.

One possibility is to display a separate "fee escrow" value, such that the top-line balance plus the fee escrow is equal to the total value of coins in the wallet. @Edicksonjga if you have feedback on this topic, please post it here.

Edicksonjga commented 7 months ago

Hi @nuttycom, I am trying to understand what you are saying.

I have to test with the new version, I consider that it is not a UX problem, but a bug since as you can see in the video I try to spend much less (0.00001 ZEC) than the maximum balance you comment (0.000085 ZEC), also, by the time I reported the error the ZIP 317 was not yet implemented so the rate was the same.

Maybe you are talking from a more general way and not about the specific error taking into account the progress that Zashi has already had and how the behavior may be at this moment.

About the fee, I consider that showing the available balance to spend without deducting the fee is fine, since after completing the data there is a Confirmation screen where the fee is shown.

Deducting the fee before making any transaction and showing it that way in the available balance can be confusing, yes, no other Zcash wallet does it that way, they all apply the actual total balance and a confirmation screen where the fee is deducted.

What maybe needs to be improved is the error message when trying to spend the total balance without considering the fee, make it more understandable for the common user and not so complicated with those figures in zatoshis.

Screenshot_20240422-190359.jpg

(This was translated with DeepL, sorry if the translation is not so good 😁)

nuttycom commented 7 months ago

Hi @nuttycom, I am trying to understand what you are saying.

I have to test with the new version, I consider that it is not a UX problem, but a bug since as you can see in the video I try to spend much less (0.00001 ZEC) than the maximum balance you comment (0.000085 ZEC), also, by the time I reported the error the ZIP 317 was not yet implemented so the rate was the same.

Ah, I had not noticed that this was reported using a wallet that was prior to ZIP 317 support. In that case, then I agree with you that this was a bug at the time, likely the one that was fixed in https://github.com/zcash/librustzcash/pull/1312

About the fee, I consider that showing the available balance to spend without deducting the fee is fine, since after completing the data there is a Confirmation screen where the fee is shown.

Deducting the fee before making any transaction and showing it that way in the available balance can be confusing, yes, no other Zcash wallet does it that way, they all apply the actual total balance and a confirmation screen where the fee is deducted.

The one problem that arises here is, when the user wants to send close to their full balance out of the wallet, they cannot correctly predict the fee that is required by ZIP 317. In particular, this is a problem because the fee may vary depending upon whether or not the transaction results in funds crossing pool boundaries.

If, on the send screen we report the minimum amount that the user can successfully send, then I think that would be a better experience for the user. We would want the "spendable value" and the amount of fees reserved for spending to be clearly identified in the UI.

What maybe needs to be improved is the error message when trying to spend the total balance without considering the fee, make it more understandable for the common user and not so complicated with those figures in zatoshis.

I think that this is separately also a good idea.

true-jared commented 7 months ago

Based on my understanding and the last communication iwth @str4d. This is going to be a spike task for @nuttycom, is that right?