penumbra-zone / web

Apache License 2.0
12 stars 15 forks source link

fees: support max functionality for sends with multi-asset fees #1333

Closed TalDerei closed 2 months ago

TalDerei commented 3 months ago

References https://github.com/penumbra-zone/web/issues/1313.

max functionality is only supported for general sends, and swaps / delegations were decided as out of scope for now.

changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: 58e3985ca4e0b10cb716fe79db177735ef963db2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

TalDerei commented 2 months ago

@erwanor can you review wasm changes?

jessepinho commented 2 months ago

Actually, sorry, one big-picture question: is it actually correct to set the spends instead of the outputs for a send transaction? I'm not sure what that would do... is that being handled by your code changes to planner.rs?

TalDerei commented 2 months ago

Actually, sorry, one big-picture question: is it actually correct to set the spends instead of the outputs for a send transaction? I'm not sure what that would do... is that being handled by your code changes to planner.rs?

We modified the protobuf definition to add spend actions as a special user intent to signify max functionality. In a regular send transaction, the planner constructs an output request. However, for send transactions where the user attempts to spend their entire balance, we track additional internal state to identify this intent and then branch on that logic to construct a spend request. Like you pointed out, the spend request is handled differently by the planner.