Skip to content

Commit ee76708

Browse files
authored
Merge pull request #1682 from lightninglabs/wip/supplycommit/align-mint-interface-terminology
mint: rename universe commit terminology to supply commit for consistency
2 parents 0e736bb + 43fa602 commit ee76708

File tree

16 files changed

+279
-268
lines changed

16 files changed

+279
-268
lines changed

cmd/commands/assets.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ var (
9999
groupByGroupName = "by_group"
100100
assetIDName = "asset_id"
101101
shortResponseName = "short"
102-
universeCommitmentsName = "universe_commitments"
102+
enableSupplyCommitmentsName = "enable_supply_commitments"
103103
feeRateName = "sat_per_vbyte"
104104
skipProofCourierPingCheckName = "skip-proof-courier-ping-check"
105105
assetAmountName = "amount"
@@ -198,9 +198,9 @@ var mintAssetCommand = cli.Command{
198198
"was derived from",
199199
},
200200
cli.BoolFlag{
201-
Name: universeCommitmentsName,
201+
Name: enableSupplyCommitmentsName,
202202
Usage: "if set, the asset group will be minted with " +
203-
"universe commitments enabled " +
203+
"universe supply commitments enabled " +
204204
"(minter-controlled, on-chain attestations " +
205205
"that anchor and verify the state of an " +
206206
"asset group); this option restricts the " +
@@ -434,8 +434,10 @@ func mintAsset(ctx *cli.Context) error {
434434
AssetVersion: taprpc.AssetVersion(
435435
ctx.Uint64(assetVersionName),
436436
),
437-
ExternalGroupKey: externalKey,
438-
UniverseCommitments: ctx.Bool(universeCommitmentsName),
437+
ExternalGroupKey: externalKey,
438+
EnableSupplyCommitments: ctx.Bool(
439+
enableSupplyCommitmentsName,
440+
),
439441
},
440442
ShortResponse: ctx.Bool(shortResponseName),
441443
})

docs/release-notes/release-notes-0.7.0.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,16 @@
6565
when requesting quotes. The field can contain optional user or authentication
6666
information that helps the price oracle to decide on the optimal price rate to
6767
return.
68+
- [Rename](https://github.com/lightninglabs/taproot-assets/pull/1682) the
69+
`MintAsset` RPC message field from `universe_commitments` to
70+
`enable_supply_commitments`.
6871

6972
## tapcli Additions
7073

74+
- [Rename](https://github.com/lightninglabs/taproot-assets/pull/1682) the mint
75+
asset command flag from `--universe_commitments` to
76+
`--enable_supply_commitments` for consistency with the updated terminology.
77+
7178
# Improvements
7279

7380
## Functional Updates

itest/supply_commit_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func assertAnchorTxPreCommitOut(
8989
// universe/supply commitments enabled.
9090
func testPreCommitOutput(t *harnessTest) {
9191
mintReq := CopyRequest(issuableAssets[0])
92-
mintReq.Asset.UniverseCommitments = true
92+
mintReq.Asset.EnableSupplyCommitments = true
9393
rpcAssets := MintAssetsConfirmBatch(
9494
t.t, t.lndHarness.Miner().Client, t.tapd,
9595
[]*mintrpc.MintAssetRequest{mintReq},
@@ -119,7 +119,7 @@ func testPreCommitOutput(t *harnessTest) {
119119
GroupedAsset: true,
120120
GroupKey: tweakedGroupKey,
121121

122-
UniverseCommitments: true,
122+
EnableSupplyCommitments: true,
123123
},
124124
}
125125
rpcAssets = MintAssetsConfirmBatch(
@@ -156,7 +156,7 @@ func testSupplyCommitIgnoreAsset(t *harnessTest) {
156156
t.Log("Minting asset group with a single normal asset and " +
157157
"universe/supply commitments enabled")
158158
mintReq := issuableAssets[0]
159-
mintReq.Asset.UniverseCommitments = true
159+
mintReq.Asset.EnableSupplyCommitments = true
160160
rpcAssets := MintAssetsConfirmBatch(
161161
t.t, t.lndHarness.Miner().Client, t.tapd,
162162
[]*mintrpc.MintAssetRequest{mintReq},

proof/meta_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func TestMetaDataRevealEncoding(t *testing.T) {
333333
0x4f, 0x4e,
334334
// DecDisplay:
335335
0x05, 0x04, 0x00, 0x00, 0x00, 0x08,
336-
// UniverseCommitments:
336+
// SupplyCommitments:
337337
0x07, 0x01, 0x01,
338338
// CanonicalUniverses:
339339
0x09, 0x1e, 0x01, 0x1c, 0x75, 0x6e, 0x69, 0x76,

rpcserver.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -615,13 +615,13 @@ func (r *rpcServer) MintAsset(ctx context.Context,
615615
}
616616

617617
seedling := &tapgarden.Seedling{
618-
AssetVersion: assetVersion,
619-
AssetType: asset.Type(req.Asset.AssetType),
620-
AssetName: req.Asset.Name,
621-
Amount: req.Asset.Amount,
622-
EnableEmission: req.Asset.NewGroupedAsset,
623-
Meta: &seedlingMeta,
624-
UniverseCommitments: req.Asset.UniverseCommitments,
618+
AssetVersion: assetVersion,
619+
AssetType: asset.Type(req.Asset.AssetType),
620+
AssetName: req.Asset.Name,
621+
Amount: req.Asset.Amount,
622+
EnableEmission: req.Asset.NewGroupedAsset,
623+
Meta: &seedlingMeta,
624+
SupplyCommitments: req.Asset.EnableSupplyCommitments,
625625
}
626626

627627
rpcsLog.Infof("[MintAsset]: version=%v, type=%v, name=%v, amt=%v, "+

tapdb/asset_minting.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ func (a *AssetMintingStore) CommitMintingBatch(ctx context.Context,
484484
BatchID: batchID,
485485
HeightHint: int32(newBatch.HeightHint),
486486
CreationTimeUnix: newBatch.CreationTime.UTC(),
487-
UniverseCommitments: newBatch.UniverseCommitments,
487+
UniverseCommitments: newBatch.SupplyCommitments,
488488
}); err != nil {
489489
return fmt.Errorf("unable to insert minting "+
490490
"batch: %w", err)
@@ -552,7 +552,7 @@ func (a *AssetMintingStore) CommitMintingBatch(ctx context.Context,
552552
EmissionEnabled: seedling.EnableEmission,
553553

554554
// nolint: lll
555-
UniverseCommitments: seedling.UniverseCommitments,
555+
UniverseCommitments: seedling.SupplyCommitments,
556556
}
557557

558558
scriptKeyID, err := upsertScriptKey(
@@ -697,7 +697,7 @@ func (a *AssetMintingStore) AddSeedlingsToBatch(ctx context.Context,
697697
EmissionEnabled: seedling.EnableEmission,
698698

699699
// nolint: lll
700-
UniverseCommitments: seedling.UniverseCommitments,
700+
UniverseCommitments: seedling.SupplyCommitments,
701701
}
702702

703703
scriptKeyID, err := upsertScriptKey(
@@ -793,8 +793,8 @@ func fetchAssetSeedlings(ctx context.Context, q PendingAssetStore,
793793
Amount: uint64(
794794
dbSeedling.AssetSupply,
795795
),
796-
EnableEmission: dbSeedling.EmissionEnabled,
797-
UniverseCommitments: dbSeedling.UniverseCommitments,
796+
EnableEmission: dbSeedling.EmissionEnabled,
797+
SupplyCommitments: dbSeedling.UniverseCommitments,
798798
}
799799

800800
if dbSeedling.TweakedScriptKey != nil {
@@ -1298,9 +1298,9 @@ func marshalMintingBatch(ctx context.Context, q PendingAssetStore,
12981298
},
12991299
PubKey: batchKey,
13001300
},
1301-
HeightHint: uint32(dbBatch.HeightHint),
1302-
CreationTime: dbBatch.CreationTimeUnix.UTC(),
1303-
UniverseCommitments: dbBatch.UniverseCommitments,
1301+
HeightHint: uint32(dbBatch.HeightHint),
1302+
CreationTime: dbBatch.CreationTimeUnix.UTC(),
1303+
SupplyCommitments: dbBatch.UniverseCommitments,
13041304
}
13051305

13061306
batchState, err := tapgarden.NewBatchState(uint8(dbBatch.BatchState))

tapdb/asset_minting_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func assertBatchEqual(t *testing.T, a, b *tapgarden.MintingBatch) {
9494
t, &a.GenesisPacket.FundedPsbt, &b.GenesisPacket.FundedPsbt,
9595
)
9696
require.Equal(t, a.RootAssetCommitment, b.RootAssetCommitment)
97-
require.Equal(t, a.UniverseCommitments, b.UniverseCommitments)
97+
require.Equal(t, a.SupplyCommitments, b.SupplyCommitments)
9898
}
9999

100100
func assertSeedlingBatchLen(t *testing.T, batches []*tapgarden.MintingBatch,
@@ -624,7 +624,7 @@ func TestInsertFetchUniCommitBatch(t *testing.T) {
624624
t, tapgarden.WithTotalGroups([]int{1}),
625625
tapgarden.WithUniverseCommitments(true),
626626
)
627-
require.True(t, batch.UniverseCommitments)
627+
require.True(t, batch.SupplyCommitments)
628628

629629
// Generate the group genesis, persist it, and assign the group details
630630
// to the seedling.
@@ -641,7 +641,7 @@ func TestInsertFetchUniCommitBatch(t *testing.T) {
641641

642642
// Assert that the seedling is in the expected state.
643643
seedling := batch.Seedlings[assetName]
644-
require.True(t, seedling.UniverseCommitments)
644+
require.True(t, seedling.SupplyCommitments)
645645
require.True(t, seedling.DelegationKey.IsSome())
646646

647647
// Commit the minting batch to the database.
@@ -655,13 +655,13 @@ func TestInsertFetchUniCommitBatch(t *testing.T) {
655655
require.NoError(t, err)
656656

657657
// Assert that the batch is in the expected state.
658-
require.True(t, dbBatch.UniverseCommitments)
658+
require.True(t, dbBatch.SupplyCommitments)
659659

660660
// Assert that the seedling is in the expected state.
661661
require.Len(t, dbBatch.Seedlings, 1)
662662

663663
dbSeedling := dbBatch.Seedlings[assetName]
664-
require.True(t, dbSeedling.UniverseCommitments)
664+
require.True(t, dbSeedling.SupplyCommitments)
665665
require.True(t, dbSeedling.DelegationKey.IsSome())
666666
require.Equal(t, dbSeedling.DelegationKey, seedling.DelegationKey)
667667
}
@@ -1925,7 +1925,7 @@ func TestUpsertMintAnchorUniCommitment(t *testing.T) {
19251925

19261926
// Create a new batch with one asset group seedling.
19271927
mintingBatch := tapgarden.RandSeedlingMintingBatch(t, 1)
1928-
mintingBatch.UniverseCommitments = true
1928+
mintingBatch.SupplyCommitments = true
19291929

19301930
_, _, group := addRandGroupToBatch(
19311931
t, assetStore, ctx, mintingBatch.Seedlings,

tapdb/sqlc/migrations/000040_asset_commit.up.sql

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ CREATE TABLE supply_commit_state_machines (
7676
latest_commitment_id BIGINT REFERENCES supply_commitments(commit_id)
7777
);
7878

79-
-- Table tracking a pending state transition for a state machine.
79+
-- Table tracking an in-progress transition from one supply commitment to a
80+
-- newer one. A transition represents the process of creating a new on-chain
81+
-- supply commitment that succeeds a prior version, which remains valid as a
82+
-- historical record.
8083
CREATE TABLE supply_commit_transitions (
8184
transition_id INTEGER PRIMARY KEY,
8285

@@ -102,7 +105,11 @@ CREATE TABLE supply_commit_transitions (
102105
creation_time BIGINT NOT NULL
103106
);
104107

105-
-- Table storing individual update events associated with a pending transition.
108+
-- Table recording supply update events associated with a pending supply
109+
-- commitment transition. A transition is the process of creating a newer
110+
-- on-chain supply commitment that follows a previous one. Update events are
111+
-- asset group supply-specific events handled by the supply commitment state
112+
-- machine.
106113
CREATE TABLE supply_update_events (
107114
event_id INTEGER PRIMARY KEY,
108115

tapgarden/batch.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ type MintingBatch struct {
6363
// reveal for that asset, if it has one.
6464
AssetMetas AssetMetas
6565

66-
// UniverseCommitments is a flag that determines whether the minting
67-
// event supports universe commitments. When set to true, the batch must
68-
// include only assets that share the same asset group key.
66+
// SupplyCommitments is a flag that determines whether the minting
67+
// event supports universe supply commitments. When set to true, the
68+
// batch must include only assets that share the same asset group key.
6969
//
70-
// Universe commitments are minter-controlled, on-chain anchored
71-
// attestations regarding the state of the universe.
72-
UniverseCommitments bool
70+
// Universe supply commitments are minter-controlled, on-chain anchored
71+
// attestations regarding the state of the universe supply (issued,
72+
// ignored, burnt, etc).
73+
SupplyCommitments bool
7374

7475
// mintingPubKey is the top-level Taproot output key that will be used
7576
// to commit to the Taproot Asset commitment above.
@@ -110,7 +111,7 @@ func (m *MintingBatch) Copy() *MintingBatch {
110111
// set, so a shallow copy is sufficient.
111112
BatchKey: m.BatchKey,
112113
RootAssetCommitment: m.RootAssetCommitment,
113-
UniverseCommitments: m.UniverseCommitments,
114+
SupplyCommitments: m.SupplyCommitments,
114115
mintingPubKey: m.mintingPubKey,
115116
tapSibling: m.tapSibling,
116117
}
@@ -323,7 +324,7 @@ func (m *MintingBatch) HasSeedlings() bool {
323324
func (m *MintingBatch) validateDelegationKey(newSeedling Seedling) error {
324325
// If the universe commitment flag is disabled, then the delegation key
325326
// should not be set.
326-
if !newSeedling.UniverseCommitments {
327+
if !newSeedling.SupplyCommitments {
327328
if newSeedling.DelegationKey.IsSome() {
328329
return fmt.Errorf("delegation key must not be set " +
329330
"for seedling without universe commitments")
@@ -395,7 +396,7 @@ func (m *MintingBatch) validateUniCommitment(newSeedling Seedling) error {
395396
// If there are no seedlings in the batch, and the first
396397
// (subject) seedling doesn't enable universe commitment, we can
397398
// accept it without further checks.
398-
if !newSeedling.UniverseCommitments {
399+
if !newSeedling.SupplyCommitments {
399400
return nil
400401
}
401402

@@ -442,14 +443,14 @@ func (m *MintingBatch) validateUniCommitment(newSeedling Seedling) error {
442443
// Therefore, when evaluating this new candidate seedling for inclusion
443444
// in the batch, we must ensure that its universe commitment flag state
444445
// matches the flag state of the batch.
445-
if m.UniverseCommitments != newSeedling.UniverseCommitments {
446+
if m.SupplyCommitments != newSeedling.SupplyCommitments {
446447
return fmt.Errorf("seedling universe commitment flag does " +
447448
"not match batch")
448449
}
449450

450451
// If the universe commitment flag is disabled for both the seedling and
451452
// the batch, no additional checks are required.
452-
if !m.UniverseCommitments && !newSeedling.UniverseCommitments {
453+
if !m.SupplyCommitments && !newSeedling.SupplyCommitments {
453454
return nil
454455
}
455456

@@ -459,7 +460,7 @@ func (m *MintingBatch) validateUniCommitment(newSeedling Seedling) error {
459460
// * the batch contains at least one seedling.
460461
//
461462
// For clarity, we will assert these conditions now.
462-
if !m.UniverseCommitments || !newSeedling.UniverseCommitments ||
463+
if !m.SupplyCommitments || !newSeedling.SupplyCommitments ||
463464
!m.HasSeedlings() {
464465

465466
return fmt.Errorf("unexpected code path reached")
@@ -520,7 +521,7 @@ func (m *MintingBatch) AddSeedling(newSeedling Seedling) error {
520521
// seedling being added to the batch, the batch universe commitment flag
521522
// can be set to match the seedling's flag state.
522523
if !m.HasSeedlings() {
523-
m.UniverseCommitments = newSeedling.UniverseCommitments
524+
m.SupplyCommitments = newSeedling.SupplyCommitments
524525
}
525526

526527
// Ensure that the delegation key is valid for the seedling being

tapgarden/batch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func TestValidateUniCommitment(t *testing.T) {
147147
t, anchorSeedling.AssetVersion, anchorSeedling.AssetType,
148148
anchorSeedling.AssetName, anchorSeedling.Meta.Data,
149149
anchorSeedling.DelegationKey,
150-
anchorSeedling.UniverseCommitments,
150+
anchorSeedling.SupplyCommitments,
151151
)
152152

153153
testCases = append(testCases, TestCase{

0 commit comments

Comments
 (0)