-
Notifications
You must be signed in to change notification settings - Fork 17
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
fees: ux for multi-asset fees #1268
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the comments have to do with the fact that we don't use registry in many places
packages/services/src/view-service/transaction-planner/index.ts
Outdated
Show resolved
Hide resolved
Another thing that confuses me, you may have a small UM balance which may not be enough to pay the transaction fee. I assume that it is not enough to check just the balance, we need to make sure that this balance is more than necessary for the transaction |
If the user has an insufficient UM balance, the transaction will rightly fail. Rather than doing something more sophisticated, it's fine to let the transaction fail and prompt the user to fetch more UM. Multi-asset fees are intended primarily for IBC-in transfers where new users don't have UM, and they can perform a swap or price discovery via the auction mechanism with their native bridged assets. There's really no way to know in advance if the balance will cover the transaction until the planner attempts to balance the transaction with the user's notes and perform fee estimations. |
yes, this should be displaying |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't finished reviewing, but I want to pause first and make sure I'm understanding the approach here:
- Are we replacing the staking token with any of the other tokens being used in the transaction, based on the assumption that the user has a balance in that token if it's being used in the transaction? If so, what if the user is already using up their entire balance of that token in the transaction, and thus has none left over for the fee? Shouldn't we instead be looking at the user's balances of other tokens to determine which token to use?
- This may be my ignorance of how multi-asset fees work, but don't we need some guarantee of the value of another asset to be able to use it as a fee? i.e., don't we need to e.g., do a swap first into UM and then use it as the fee?
- If we are truly using another asset type as the fee, we shouldn't hard-code
"UM"
in various places in the UI where fees are displayed, right?
packages/services/src/view-service/transaction-planner/index.test.ts
Outdated
Show resolved
Hide resolved
I think the simplest approach to get the desired behavior (users can deposit over IBC and immediately start using Penumbra) is to do the following:
We already don't have a way to handle the "send max" use case in the UI, so there's no regression here. To fix that problem properly, we'd want to have a "MAX" button, and when it's set, the way the planner is invoked should change: rather than specifying outputs and filling in spends to balance, it should specify spends (spend every note available) and set the change address for the outputs to the destination address. This way fees are deducted from outputs rather than inputs. The broken behavior you're describing that would prevent that is already the case for the UM token, and most of the plumbing for a fix is in place. (This UX is not even possible on a chain like Ethereum, where there's no way to statically determine the exact fee ahead of time).
No, the initial multi-asset fee mechanism has independent prices for each token. The idea is that the prices in alternative tokens should be set higher (say 10x higher) so that the resource pricing is protected from price fluctuations. This also means that as training wheels, there's no dependence on the DEX prices being accurate, and no possibility that someone could manipulate prices on the DEX and turn that into a DoS attack on the chain. The intended design is that the fee component swaps the alternative fee token to the native token but this happens on the backend, internal to the fee component, and isn't implemented yet.
Yes, that seems right. We might need to adjust the proto definitions for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some ui tests are broken, need to fix them
{showNonNativeFeeWarning && ( | ||
<div className='rounded border border-yellow-500 bg-gray-800 p-4 text-yellow-500'> | ||
<strong>Privacy Warning:</strong> | ||
<span className='block'> | ||
Using non-native tokens for transaction fees may pose a privacy risk. It is recommended | ||
to use the native token (UM) for better privacy and security. | ||
</span> | ||
</div> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes sense to make this a separate component to avoid duplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will cleanup the remaining suggestions in separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TalDerei Great work!
References #1165 and #1265.
Multi-asset fees were implemented, allowing transactions to use an alternative token for fees if the user does not have UM tokens.
IndexedDB was modified to add an index on the asset ID of the note's value in the
SPENDABLE_NOTES
table. Indexes can improve query performance at the cost of additional disk space for storage.Following the resolution of penumbra-zone/penumbra#4306, the fee rendering in the transaction approval dialogue and transaction view page displayed values that appeared significantly higher than the actual fees being deducted in transactions. The values were divided by 10^6 to display the correct decimal fee amount.
before:
after:
alternative asset fees if the user doesn't have UM:
privacy warning for non-native alt fees
Screen.Recording.2024-06-12.at.11.47.22.PM.mov