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

WIP: transaction report rework #3316

Draft
wants to merge 8 commits into
base: release/v5.0
Choose a base branch
from
Draft

Conversation

ryankurte
Copy link
Contributor

@ryankurte ryankurte commented Apr 19, 2023

rework of transaction reports to split outputs and totals, allowing display that matches other wallets.

  • adds an abstract report trait to decouple report const generics
  • alters report to split outputs and totals
    (double-entry style inputs - change on one side, outputs + fees on the other)
  • adds report-level tests, updates transaction/extra tests

outputs to change addresses are elided so SCI outputs MUST NOT be to the change address as these will not appear in the totals.

@cbeck88
Copy link
Contributor

cbeck88 commented May 24, 2023

So here are my thoughts:

  • This generally looks fine in terms of style syntax etc.
  • The double-entry thing makes sense to me too
  • At the lines I commented, we are changing how we collect data about funds sent to swap counterparties.

If we don't think it's interesting to display data about swap counterparties at all, my suggestion would be, lets remove anything that says swap in it before displaying.

If we do think it's interesting, then let's record both credits and debits to the swap counterparties. In this change right now, we are still recording outputs destined for swap counterparties, but dropping inputs associated to them. I don't see the logic of this right now, but I'm willing to be convinced that this is better.

I know we discussed this some weeks ago and I get that we definitely want to display every output, it just seems weird if we report credits to swap counterparties but not debits. But if you think that's exactly what we decided to do a few weeks ago, I'm okay with that, I think we should at least leave a comment saying that we are intentionally doing that, because this would be very confusing to me much later.

@cbeck88
Copy link
Contributor

cbeck88 commented May 24, 2023

Maybe we can write something in the README here about what is the structure of the report, and how it's intended to be used?

https://github.com/mobilecoinfoundation/mobilecoin/tree/master/transaction/summary

@ryankurte
Copy link
Contributor Author

If we do think it's interesting, then let's record both credits and debits to the swap counterparties. In this change right now, we are still recording outputs destined for swap counterparties, but dropping inputs associated to them. I don't see the logic of this right now, but I'm willing to be convinced that this is better.

the motivation behind this is that the report shows the values and totals spent by our account to fulfill the transaction, and avoids the whole positive vs. negative balance change thing. maybe in the case of a swap we could show both the value sent to the counterparty and the exchanged value in the same report entry, so the information is there but without impacting the totals?

@ryankurte ryankurte self-assigned this Jun 20, 2023
@ryankurte ryankurte changed the base branch from master to release/v5.0 June 21, 2023 00:05
@isis-mc isis-mc self-requested a review July 11, 2023 23:14
Copy link
Contributor

@eranrund eranrund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still wrapping my head around it, but I finished my first iteration of looking at it and made some comments/posted some questions. It overall makes sense to me but I haven't dived deep enough to notice the nuances @cbeck88 has mentioned in his comments, so I want to try and better understand that.

.github/workflows/refresh-ledger-bootstrap.yaml Outdated Show resolved Hide resolved
.internal-ci/util/wait-for-mobilecoind.sh Outdated Show resolved Hide resolved
transaction/summary/src/report.rs Outdated Show resolved Hide resolved
transaction/summary/src/report.rs Show resolved Hide resolved
transaction/summary/src/report.rs Outdated Show resolved Hide resolved
*value = value.checked_sub(*v as i64).ok_or(Error::NumericOverflow)?;
}
// If it's coming from an SCI to us, add to total balance
TotalKind::Sci if e != &TransactionEntity::Swap => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about from an SCI to someone else? (TransactionEntity::OtherAddress?)

Copy link
Contributor Author

@ryankurte ryankurte Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a test for a three way SCI in transaction/extra which is okay, but how the SCI totals should be computed is a bit ambiguous atm, definitely appreciate if you have any thoughts on how to tidy this up?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my comment is no longer relevant with the current implementation.

transaction/summary/src/report.rs Outdated Show resolved Hide resolved
transaction/summary/src/report.rs Show resolved Hide resolved
transaction/summary/src/verifier.rs Outdated Show resolved Hide resolved
transaction/summary/src/verifier.rs Outdated Show resolved Hide resolved
transaction/summary/src/report.rs Outdated Show resolved Hide resolved
transaction/summary/src/report.rs Outdated Show resolved Hide resolved
*value = value.checked_sub(*v as i64).ok_or(Error::NumericOverflow)?;
}
// If it's coming from an SCI to us, add to total balance
TotalKind::Sci if e != &TransactionEntity::Swap => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my comment is no longer relevant with the current implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants