This PR creates a new token contract and fee payment contract that support private refunds.
I.e. Alice pays Bob in private notes, and receives refunds in private notes within the same transaction.
This is a massive improvement over the existing PrivateFeePaymentMethod which uses an un/shield flow, which puts Alice in a never-ending loop of refunding refunds.
Note I suspect we will want to:
consolidate this token/fpc, and the other token/fpc
and/or create a more general pattern for this type of homomorphic operation
but the exact way forward there is not clear to me yet.
This PR also shows off some of the ugly things we need to do to get this working, like:
storing notes as a set to avoid mixing in the owner's address when computing the note hash
storing raw npk hashes in the contracts
needing to use to_unconstrained to get private balances
This PR also fixes two bugs:
supporting transactions that only have public teardown
validation of complete addresses that did not have public keys associated with their deployment
This PR also has the TXE charge nominal TX fees, and basic support for a teardown function.
I vote to merge the PR roughly as is and start the discussion on how to clean the stuff up that we hate, but if someone has strong negative reactions, I'm definitely open to hearing which parts we want to tease out into individual PRs.
This PR creates a new token contract and fee payment contract that support private refunds.
I.e. Alice pays Bob in private notes, and receives refunds in private notes within the same transaction.
This is a massive improvement over the existing PrivateFeePaymentMethod which uses an un/shield flow, which puts Alice in a never-ending loop of refunding refunds.
Note I suspect we will want to:
but the exact way forward there is not clear to me yet.
This PR also shows off some of the ugly things we need to do to get this working, like:
This PR also fixes two bugs:
This PR also has the TXE charge nominal TX fees, and basic support for a teardown function.
Side note, see https://hackmd.io/NUfIc2LJRlqL0-myhij3KQ for a cost analysis (in terms of TXEffects byte size) for different fee payment methods.
In conclusion
I vote to merge the PR roughly as is and start the discussion on how to clean the stuff up that we hate, but if someone has strong negative reactions, I'm definitely open to hearing which parts we want to tease out into individual PRs.