-
Notifications
You must be signed in to change notification settings - Fork 102
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
multi: support non-interactive collectible sends #176
Conversation
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.
Set of changes looks pretty minimal which is great, will attempt to dig into the test failure when an asset w/ emission enabled is used to send. Might be some edge case in key family handling in the db, or just the coin selection portion itself.
t, genesisCollectible, | ||
familyKeyCollectible, | ||
) | ||
root := &SplitLocator{ |
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.
👍
@@ -151,6 +150,18 @@ func NewSplitCommitment(input *asset.Asset, outPoint wire.OutPoint, | |||
return nil, ErrInvalidSplitLocator | |||
} | |||
|
|||
// To transfer a collectible with a split, the split root must be |
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.
👍
case vm.newAsset.Type != asset.Normal || | ||
vm.splitAsset.Type != asset.Normal: | ||
|
||
case vm.newAsset.Type != vm.splitAsset.Type: |
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.
Love how compact all these changes are, gotta love when a plan nicely falls into place 🤓*
* hidden bugs may apply
// need a split at all. In this case, we fully consume an input asset, | ||
// so the asset created is the same asset w/ the new script key in | ||
// place. | ||
case SendStatePreparedComplete: |
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.
We can remove the enum value definition above as well.
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.
Looks like SendStatePreparedComplete
still exists in parcel.go
.
err error | ||
) | ||
|
||
for i := 0; i < numSends; i++ { |
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.
I think we can somewhat easily (factoring in the optional key family param) abstract this section into a sort of pingPongAsset
helper func.
Confirmed, that the test works when using a collectible that doesn't support emission. Running the normal test I run into:
|
18649b2
to
ad64cd4
Compare
ad64cd4
to
46bd219
Compare
@Roasbeef: review reminder |
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.
LGTM 💈
Final comment is that I think we can safely drop forcing the family key to be even/odd given that we'll now always serialize the full version.
asset/asset.go
Outdated
return tweakedPrivKey.PubKey(), sig, nil | ||
// Since we'll never query lnd for a tweaked key, it doesn't matter if | ||
// we lose the parity information here. | ||
tweakedPubKey, _ := schnorr.ParsePubKey( |
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.
I don't think we need this anymore after #187 ?
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.
LGTM 💈
Final comment is that I think we can safely drop forcing the family key to be even/odd given that we'll now always serialize the full version.
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.
LGTM 💈
Final comment is that I think we can safely drop forcing the family key to be even/odd given that we'll now always serialize the full version.
Since all spends now use splits, input validation should check for full-value sends, to determine if the split must use a zero-value root.
Simplify the conditions for using an unspendable script key to match the updates to input validation.
46bd219
to
929981f
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 nice and clean, LGTM 🎉
@@ -362,6 +362,56 @@ func splitFullValueStateTransition(t *testing.T, validRootLocator, | |||
} | |||
} | |||
|
|||
func splitCollectibleStateTransition(t *testing.T, |
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.
nit: the outer t
isn't needed. But I see that it's there in the other test generator functions too, so non blocking.
// need a split at all. In this case, we fully consume an input asset, | ||
// so the asset created is the same asset w/ the new script key in | ||
// place. | ||
case SendStatePreparedComplete: |
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.
Looks like SendStatePreparedComplete
still exists in parcel.go
.
@@ -600,6 +600,16 @@ func (p *ChainPorter) stateStep(currentPkg sendPackage) (*sendPackage, error) { | |||
// to complete the send w/o merging inputs. | |||
assetInput := elgigibleCommitments[0] | |||
|
|||
// If the key found for the input UTXO is not from the Taro | |||
// keyfamily, something has gone wrong with the DB. | |||
if assetInput.InternalKey.Family != tarogarden.TaroKeyFamily { |
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.
Did we run into this somewhere? Or what's the reason for this specific check? Mostly just curious.
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.
I think was added during the debugging phase as a sort of sanity check to help track down the bug.
Depends on #159, addresses #99 and #121.
Adds support for non-interactive sends of collectibles by allowing splits bearing collectibles, iff they have an unspendable root and exactly one non-root locator.
Fixes #99
Fixes #121