-
Notifications
You must be signed in to change notification settings - Fork 132
minting: fix re-issuing into existing group with external key #1517
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
Conversation
so this is ready to test? |
Yes. |
Pull Request Test Coverage Report for Build 14902741297Details
💛 - Coveralls |
1805148
to
d88ec8a
Compare
I'm able to get this PR to work. One additional thing I've now tested is the
If it is only for minting two tranches in the same batch, why do we need to do that? Seems to me like if someone is going to be minting the same asset in the same batch, they would never need two tranches? I'm just wondering if this option should be removed if that is its only purpose. If it should not be removed, I think we should change the description from
to
If it is supposed to work from a second batch, I think we should fix it. |
Yes, the group anchor (string) argument is only for tranches in the same batch.
Feel free to use this in any way to update the docs... |
This helps a lot. Linking to this comment in #1519 so that we can deal with it there. |
tapgarden/seedling.go
Outdated
if !group.GroupKey.IsLocal() { | ||
groupKeyBytes := c.GroupInfo.GroupPubKey.SerializeCompressed() | ||
return fmt.Errorf("can't sign with group key %x", groupKeyBytes) | ||
switch { |
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.
Instead of this switch you can just return early with:
if c.ExternalKey.IsNone() && !group.GroupKey.IsLocal() {
groupPubKey := c.GroupInfo.GroupPubKey
groupKeyBytes := groupPubKey.SerializeCompressed()
return fmt.Errorf("can't sign with group key %x",
groupKeyBytes)
}
And you don't need to wrap the fn.MapOptionZ
call in case c.ExternalKey.IsSome():
. Because fn.MapOptionZ
will just return err == nil
if c.ExternalKey.IsNone()
. Maybe we can save on indentation like that.
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.
Ah nice, that's actually much cleaner. Updated, thanks.
mintReq2.Asset.GroupedAsset = true | ||
mintReq2.Asset.NewGroupedAsset = false | ||
mintReq2.Asset.GroupKey = batchAssets[0].AssetGroup.TweakedGroupKey |
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 is mintReq2.Asset.GroupedAsset = true
necessary here? I would have expected setting mintReq2.Asset.ExternalGroupKey
to imply group asset sufficiently.
Is setting these fields necessary or are we just covering all possibilities here?
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.
The RPC (and by extension the CLI) interface for the minting call is not optimal and quite confusing. See #1517 (comment)
So you need to set at least one of the GroupedAsset
or NewGroupedAsset
to true
if you want to start or issue into a group, independent of the other fields.
This commit fixes two checks that prevented us to re-issue more assets into an existing group using an external group key.
Turns out we didn't really set up the group minting request properly to mint into an existing group. Before this change we'd simply mint a completely new group, using the same external key.
We renamed the RPC-level flag to NewGroupedAsset to make its use more clear. This commit adjusts some of the left-over error messages to align with the rename.
d88ec8a
to
8863f04
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.
thanks for the fix
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 good! 🌴
I have been having good results with this one. Thanks for the quick fix and so much feedback. Glad to see it merged! |
Fixes #1515.
Fixes #1516.