Skip to content

Commit 8abbe1e

Browse files
committed
multi: rename UniverseCommitments field in MintingBatch
1 parent b5a1fc2 commit 8abbe1e

File tree

5 files changed

+28
-27
lines changed

5 files changed

+28
-27
lines changed

tapdb/asset_minting.go

Lines changed: 4 additions & 4 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)
@@ -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: 4 additions & 4 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.
@@ -655,7 +655,7 @@ 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)
@@ -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,

tapgarden/batch.go

Lines changed: 12 additions & 11 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
}
@@ -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.SupplyCommitments {
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.SupplyCommitments {
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.SupplyCommitments ||
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.SupplyCommitments
524+
m.SupplyCommitments = newSeedling.SupplyCommitments
524525
}
525526

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

tapgarden/mock.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ func RandMintingBatch(t testing.TB, opts ...MintBatchOption) *MintingBatch {
218218
// Create an empty minting batch.
219219
batchKey, _ := test.RandKeyDesc(t)
220220
batch := &MintingBatch{
221-
BatchKey: batchKey,
222-
HeightHint: test.RandInt[uint32](),
223-
CreationTime: time.Now(),
224-
UniverseCommitments: options.universeCommitments,
221+
BatchKey: batchKey,
222+
HeightHint: test.RandInt[uint32](),
223+
CreationTime: time.Now(),
224+
SupplyCommitments: options.universeCommitments,
225225
}
226226

227227
// Generate seedlings for each asset group.

tapgarden/planter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ func fetchPreCommitGroupKey(
865865
// If universe commitments are disabled, there is no group key available
866866
// from the batch to associate with the pre-commitment. Therefore, we
867867
// return None.
868-
if !pendingBatch.UniverseCommitments {
868+
if !pendingBatch.SupplyCommitments {
869869
return zero, nil
870870
}
871871

@@ -914,7 +914,7 @@ func (c *ChainPlanter) fundGenesisPsbt(ctx context.Context,
914914
// If universe commitments are enabled, we formulate a pre-commitment
915915
// output. This output is spent by the universe commitment transaction.
916916
var delegationKey fn.Option[DelegationKey]
917-
if c.pendingBatch != nil && c.pendingBatch.UniverseCommitments {
917+
if c.pendingBatch != nil && c.pendingBatch.SupplyCommitments {
918918
delegationK, err := fetchDelegationKey(c.pendingBatch)
919919
if err != nil {
920920
return zero, fmt.Errorf("unable to create "+
@@ -2229,7 +2229,7 @@ func matchPsbtToGroupReq(psbt psbt.Packet,
22292229
// NOTE: The function mutates the supplied *MintingBatch in place.
22302230
func sealBatchPreCommit(batch *MintingBatch) error {
22312231
// Fast‑exit if Universe Commitments are disabled – nothing to update.
2232-
if !batch.UniverseCommitments {
2232+
if !batch.SupplyCommitments {
22332233
return nil
22342234
}
22352235

@@ -2520,7 +2520,7 @@ func (c *ChainPlanter) sealBatch(ctx context.Context, params SealParams,
25202520
// Persist the newly generated group-key metadata in the batch’s
25212521
// pre-commitment output—needed only when Universe Commitments are on—
25222522
// before passing the batch to the minting store.
2523-
if batchWithGroupInfo.UniverseCommitments {
2523+
if batchWithGroupInfo.SupplyCommitments {
25242524
err := sealBatchPreCommit(batchWithGroupInfo)
25252525
if err != nil {
25262526
return nil, err

0 commit comments

Comments
 (0)