-
Notifications
You must be signed in to change notification settings - Fork 116
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 AltLeaf support to tapfreighter #1233
base: main
Are you sure you want to change the base?
Conversation
From some offline review, there are a few clear TODOs:
|
The test vectors for |
6fa4a2a
to
f49820f
Compare
Pull Request Test Coverage Report for Build 12381816079Details
💛 - Coveralls |
f49820f
to
1fa5353
Compare
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.
Very clean! Did a first pass but will want to take another one to take a closer look at backward compatibility, with some manual testing.
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.
Nice work with this change! Lots of little nooks and crannies to identify+update. Will sit with it for a bit to try and identify any missing areas or deficiencies in the tests
1fa5353
to
9f4e6a5
Compare
Added a new itest to check that the tapfreighter and the vPSBT RPCs are rejecting invalid combinations of |
a7e34d5
to
f4b1bc0
Compare
@jharveyb, remember to re-request review from reviewers when ready |
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.
Why did we choose to trim alt leaves from passive vPkts? I tried to think of a scenario where we would want those alt leaves to persist. I couldn't really think of one, but I could see a future where we would find a use case for that.
f4b1bc0
to
538cf21
Compare
By changing the generic signature of the AltLeaf type we can get rid of some of the weirdness and helper methods surrounding the type.
In this commit, we add an AltLeaves field to Proof, and update Proof en/decode to support this optional field. With a small test change, we also check that Proof.Verify() functions for Proofs that accounted for any present AltLeaves correctly.
In this commit, we add logic to handle adding and removing altLeaves from a TapCommitment. Unlike normal Assets, we never want to update an AltLeaf once inserted into the AltCommitment. This means we need to assert that AltLeaves being added to a TapCommitment don't collide with already committed AltLeaves.
In this commit, we update the passive asset handling to not consider altLeaves as assets. Specifically, any altLeaf in an input Tap commitment should be set in the vInput for a passive asset vPkt, but should not have its own vPkt where it is an input. Overall, input altLeaves do not need to be re-anchored.
538cf21
to
17f4e95
Compare
We don't trim the alt leaves from passive assets. The two places where we use 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.
As far as I can tell this gives us everything we need to be forward compatible with alt leaves, so giving my LGTM.
LGTM 🎉 |
This continues the work from #1180 .
Specifically:
AltLeaves
field toProof
.Proof
withAltLeaves
populated.AltLeaves
fromvOutputs
, to anchor outputs for a transfer, and the corresponding transition proof.AltLeaves
for asset inputs during coin selection, and uses theseAltLeaves
when verifying the input anchor pubkey.Test-wise, the added unit tests cover the new validation methods around
[]AltLeaves
, and the new funcs that act on Tap commitments. The changes in later commits intapsend
andtapfrieghter
are mostly only exercised via the PSBT itest.