Skip to content

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

guggero
Copy link
Member

@guggero guggero commented May 6, 2025

Fixes #1515.
Fixes #1516.

guggero added 2 commits May 6, 2025 18:30
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.
@ZZiigguurraatt
Copy link

so this is ready to test?

@guggero
Copy link
Member Author

guggero commented May 6, 2025

so this is ready to test?

Yes.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 14864958611

Details

  • 5 of 37 (13.51%) changed or added relevant lines in 2 files are covered.
  • 25 unchanged lines in 8 files lost coverage.
  • Overall coverage decreased (-0.01%) to 36.946%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tapgarden/seedling.go 0 32 0.0%
Files with Coverage Reduction New Missed Lines %
address/address.go 2 67.47%
asset/group_key.go 2 57.89%
tapgarden/planter.go 2 60.93%
tappsbt/create.go 2 26.74%
tapchannel/aux_leaf_signer.go 3 43.43%
commitment/tap.go 4 71.59%
tapgarden/caretaker.go 4 68.68%
tapchannel/aux_invoice_manager.go 6 80.51%
Totals Coverage Status
Change from base Build 14790497726: -0.01%
Covered Lines: 26472
Relevant Lines: 71650

💛 - Coveralls

}

if group.GroupKey.RawKey.PubKey == nil {
return fmt.Errorf("group raw key is " +

Choose a reason for hiding this comment

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

is this the same as

/*
The external group key is an optional field that allows specifying an
external signing key for the group virtual transaction during minting.
This key enables signing operations to be performed externally, outside
the daemon.
If this field is set then group_internal_key must be unset, and vice versa.
*/
taprpc.ExternalKey external_group_key = 14;
?

err := fn.MapOptionZ(
c.ExternalKey, func(extKey asset.ExternalKey) error {
if group.GroupKey == nil {
return fmt.Errorf("group key is nil")

Choose a reason for hiding this comment

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

is this the same as tweaked_group_key?

err)
}

// If it's not an external key, we need to check that we can actually

Choose a reason for hiding this comment

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

so this would mean

/*
The optional key that will be used as the internal key for an asset group
created with this asset.
If this field is set then external_group_key must be unset, and vice versa.
*/
taprpc.KeyDescriptor group_internal_key = 10;
?

@@ -2668,7 +2668,11 @@ func (c *ChainPlanter) prepAssetSeedling(ctx context.Context,
// If a group internal key or tapscript root is specified, emission must
// also be enabled.
if !req.EnableEmission {
if req.GroupInternalKey != nil {
// For re-issuance or regular assets, the group internal key

Choose a reason for hiding this comment

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

do you mean "of" instead of "or"?

// shouldn't be set. It is, however, set for re-issuance with
// an external key, because the internal group key is the key
// we compare the external key against.
if req.GroupInternalKey != nil && req.ExternalKey.IsNone() {
return fmt.Errorf("cannot specify group internal key " +
"without enabling emission")

Choose a reason for hiding this comment

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

https://lightning.engineering/api-docs/api/taproot-assets/mint/mint-asset/ does not really use the word "emission" except in CLI example. can we add "emission" to

/*
If true, then the asset will be created with a group key, which allows for
future asset issuance.
*/
bool new_grouped_asset = 6;
so this error message can make sense to someone?

if req.GroupInternalKey != nil {
// For re-issuance or regular assets, the group internal key
// shouldn't be set. It is, however, set for re-issuance with
// an external key, because the internal group key is the key

Choose a reason for hiding this comment

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

generally, I'm confused here what this whole comment means.

@ZZiigguurraatt
Copy link

are you able to put these commits on top of #1498 as that is what I'm currently testing with ?

is that going to work okay as long as you merge #1498 first?

@levmi levmi requested review from Roasbeef and ffranr May 6, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants