Skip to content

Commit b5a1fc2

Browse files
committed
multi: rename UniverseCommitments field in Seedling
1 parent 928e0ce commit b5a1fc2

File tree

9 files changed

+38
-38
lines changed

9 files changed

+38
-38
lines changed

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.EnableSupplyCommitments,
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {

tapdb/asset_minting_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
@@ -661,7 +661,7 @@ func TestInsertFetchUniCommitBatch(t *testing.T) {
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
}

tapgarden/batch.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func (m *MintingBatch) HasSeedlings() bool {
323323
func (m *MintingBatch) validateDelegationKey(newSeedling Seedling) error {
324324
// If the universe commitment flag is disabled, then the delegation key
325325
// should not be set.
326-
if !newSeedling.UniverseCommitments {
326+
if !newSeedling.SupplyCommitments {
327327
if newSeedling.DelegationKey.IsSome() {
328328
return fmt.Errorf("delegation key must not be set " +
329329
"for seedling without universe commitments")
@@ -395,7 +395,7 @@ func (m *MintingBatch) validateUniCommitment(newSeedling Seedling) error {
395395
// If there are no seedlings in the batch, and the first
396396
// (subject) seedling doesn't enable universe commitment, we can
397397
// accept it without further checks.
398-
if !newSeedling.UniverseCommitments {
398+
if !newSeedling.SupplyCommitments {
399399
return nil
400400
}
401401

@@ -442,14 +442,14 @@ func (m *MintingBatch) validateUniCommitment(newSeedling Seedling) error {
442442
// Therefore, when evaluating this new candidate seedling for inclusion
443443
// in the batch, we must ensure that its universe commitment flag state
444444
// matches the flag state of the batch.
445-
if m.UniverseCommitments != newSeedling.UniverseCommitments {
445+
if m.UniverseCommitments != newSeedling.SupplyCommitments {
446446
return fmt.Errorf("seedling universe commitment flag does " +
447447
"not match batch")
448448
}
449449

450450
// If the universe commitment flag is disabled for both the seedling and
451451
// the batch, no additional checks are required.
452-
if !m.UniverseCommitments && !newSeedling.UniverseCommitments {
452+
if !m.UniverseCommitments && !newSeedling.SupplyCommitments {
453453
return nil
454454
}
455455

@@ -459,7 +459,7 @@ func (m *MintingBatch) validateUniCommitment(newSeedling Seedling) error {
459459
// * the batch contains at least one seedling.
460460
//
461461
// For clarity, we will assert these conditions now.
462-
if !m.UniverseCommitments || !newSeedling.UniverseCommitments ||
462+
if !m.UniverseCommitments || !newSeedling.SupplyCommitments ||
463463
!m.HasSeedlings() {
464464

465465
return fmt.Errorf("unexpected code path reached")
@@ -520,7 +520,7 @@ func (m *MintingBatch) AddSeedling(newSeedling Seedling) error {
520520
// seedling being added to the batch, the batch universe commitment flag
521521
// can be set to match the seedling's flag state.
522522
if !m.HasSeedlings() {
523-
m.UniverseCommitments = newSeedling.UniverseCommitments
523+
m.UniverseCommitments = newSeedling.SupplyCommitments
524524
}
525525

526526
// 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{

tapgarden/mock.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ func RandGroupAnchorSeedling(t testing.TB, groupAnchorName string,
8989
Genesis: &assetGenesis,
9090
GroupKey: groupKey,
9191
},
92-
ScriptKey: asset.NewScriptKeyBip86(scriptKey),
93-
EnableEmission: true,
94-
UniverseCommitments: uniCommitments,
95-
DelegationKey: delegationKey,
92+
ScriptKey: asset.NewScriptKeyBip86(scriptKey),
93+
EnableEmission: true,
94+
SupplyCommitments: uniCommitments,
95+
DelegationKey: delegationKey,
9696
}
9797
}
9898

@@ -114,11 +114,11 @@ func RandNonAnchorGroupSeedling(t testing.TB, assetVersion asset.Version,
114114
Meta: &proof.MetaReveal{
115115
Data: metaDataBlob,
116116
},
117-
Amount: uint64(test.RandInt[uint32]()),
118-
ScriptKey: asset.NewScriptKeyBip86(scriptKey),
119-
EnableEmission: true,
120-
UniverseCommitments: uniCommitments,
121-
DelegationKey: delegationKey,
117+
Amount: uint64(test.RandInt[uint32]()),
118+
ScriptKey: asset.NewScriptKeyBip86(scriptKey),
119+
EnableEmission: true,
120+
SupplyCommitments: uniCommitments,
121+
DelegationKey: delegationKey,
122122
}
123123
return seedling
124124
}

tapgarden/planter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,7 +2220,7 @@ func matchPsbtToGroupReq(psbt psbt.Packet,
22202220
// packet.
22212221
//
22222222
// Preconditions:
2223-
// - batch.UniverseCommitments must be true – otherwise the function is a NOP.
2223+
// - batch.SupplyCommitments must be true – otherwise the function is a NOP.
22242224
// - batch.GenesisPacket must not be nil.
22252225
//
22262226
// Post‑conditions:
@@ -2711,7 +2711,7 @@ func (c *ChainPlanter) prepSeedlingDelegationKey(ctx context.Context,
27112711

27122712
// If the universe commitments feature is disabled for this seedling,
27132713
// we can skip any further delegation key considerations.
2714-
if !req.UniverseCommitments {
2714+
if !req.SupplyCommitments {
27152715
return nil
27162716
}
27172717

@@ -2794,15 +2794,15 @@ func (c *ChainPlanter) prepAssetSeedling(ctx context.Context,
27942794

27952795
// If the seedling has the universe/supply commitment feature enabled,
27962796
// finalize the delegation key.
2797-
if req.UniverseCommitments {
2797+
if req.SupplyCommitments {
27982798
err := c.prepSeedlingDelegationKey(ctx, req)
27992799
if err != nil {
28002800
return err
28012801
}
28022802
}
28032803

28042804
// Set seedling asset metadata fields.
2805-
req.Meta.UniverseCommitments = req.UniverseCommitments
2805+
req.Meta.UniverseCommitments = req.SupplyCommitments
28062806

28072807
// If a delegation key is set in the seedling, set it in the metadata.
28082808
if req.DelegationKey.IsSome() {

tapgarden/seedling.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ type Seedling struct {
9494
// for this asset meaning future assets linked to it can be created.
9595
EnableEmission bool
9696

97-
// UniverseCommitments indicates whether the minting event which
98-
// will be associated with the seedling supports universe commitments.
97+
// SupplyCommitments indicates whether the minting event which
98+
// will be associated with the seedling supports supply commitments.
9999
// If set to true, the seedling can only be included in a minting batch
100100
// where all assets share the same asset group key, which must be
101101
// specified.
102102
//
103-
// Universe commitments are minter-controlled, on-chain anchored
103+
// Supply commitments are minter-controlled, on-chain anchored
104104
// attestations regarding the state of the universe.
105-
UniverseCommitments bool
105+
SupplyCommitments bool
106106

107107
// DelegationKey is the public key that is used to verify universe
108108
// commitment related on-chain outputs and proofs.

0 commit comments

Comments
 (0)