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

Add TransactionView::summary() method #4939

Closed
3 tasks done
hdevalence opened this issue Nov 21, 2024 · 2 comments
Closed
3 tasks done

Add TransactionView::summary() method #4939

hdevalence opened this issue Nov 21, 2024 · 2 comments
Assignees
Labels
needs-refinement unclear, incomplete, or stub issue that needs work

Comments

@hdevalence
Copy link
Member

hdevalence commented Nov 21, 2024

Is your feature request related to a problem? Please describe.

There are many applications where it would be useful to display a summary of a transaction's effects on the balances of various accounts, both pre- and post-confirmation:

  • Pre-confirmation: in an approval dialog, for showing an exact preview of the effects of a transaction
  • Post-confirmation: in a frontend, for showing a summary of what a transaction did

This logic should be implemented once, in the Rust code, so that it can be standardized across the Penumbra ecosystem.

Describe the solution you'd like

  • The Balance struct improperly has a derived Serde representation. This is a bug and a violation of our serialization policy. Verify that this was never used. Define a Protobuf message for the Balance struct and use that as the serialization format.

  • Define a new Protobuf message and corresponding domain type, penumbra.core.transaction.v1.TransactionSummary, something like (sketch):

message TransactionSummary {
    message Effects {
        core.keys.v1.AddressView address = 1;
        core.asset.v1.Balance balance = 2;
    }
    repeated Effects effects = 1;
}
  • Define a new method TransactionView::summary(&self) -> TransactionSummary that produces a TransactionSummary, iterating through each visible action and collecting the effects of the transaction. This should preserve the info available in the AddressViews about the meaning of the addresses.
@github-actions github-actions bot added the needs-refinement unclear, incomplete, or stub issue that needs work label Nov 21, 2024
@TalDerei
Copy link
Collaborator

TalDerei commented Nov 21, 2024

step towards penumbra-zone/web#1394 cc @grod220

@TalDerei TalDerei self-assigned this Nov 25, 2024
@TalDerei TalDerei moved this to In progress in Penumbra Dec 10, 2024
erwanor added a commit that referenced this issue Dec 13, 2024
## Describe your changes

References #4939

## Checklist before requesting a review

- [x] I have added guiding text to explain how a reviewer should test
these changes.

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

---------

Signed-off-by: Erwan Or <[email protected]>
Co-authored-by: Lucas Meier <[email protected]>
Co-authored-by: Erwan Or <[email protected]>
Co-authored-by: Erwan Or <[email protected]>
erwanor added a commit that referenced this issue Dec 13, 2024
References #4939

- [x] I have added guiding text to explain how a reviewer should test
these changes.

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

---------

Signed-off-by: Erwan Or <[email protected]>
Co-authored-by: Lucas Meier <[email protected]>
Co-authored-by: Erwan Or <[email protected]>
Co-authored-by: Erwan Or <[email protected]>
@erwanor
Copy link
Member

erwanor commented Dec 16, 2024

This was done for Output/Spend/Swap/SwapClaim views in #4943. Adding the LP ones might enable some cool use cases, but afaict this is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-refinement unclear, incomplete, or stub issue that needs work
Projects
Archived in project
Development

No branches or pull requests

3 participants