Skip to content

Commit bdf5a0e

Browse files
committed
supplyverifier: assert initial supply commits spend pre-commit outputs
Now that supply pre-commitments are stored for remotely issued assets, we can assert in the supply verifier that if a supply commitment is the initial one (i.e., the spent commitment field is None), then the corresponding transaction must spend some pre-commitment outputs. This enforces a link between the initial supply commitment transaction and a mint anchor transaction.
1 parent 423306a commit bdf5a0e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

universe/supplyverifier/verifier.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,12 @@ func (v *Verifier) ensurePrecommitsSpent(ctx context.Context,
104104
err)
105105
}
106106

107-
// TODO(ffranr): If commitment.SpentCommitment is none, then we
108-
// should ensure that at least one pre-commitment is spent.
109-
// Before implementing this check, we need to ensure that
110-
// remote issued supply pre-commitments are correctly populated and
111-
// retrieved from the db.
107+
// If no supply-commitment spend is recorded, require at least one
108+
// unspent mint pre-commitment output for the initial supply commitment.
109+
if commitment.SpentCommitment.IsNone() && len(allPreCommits) == 0 {
110+
return fmt.Errorf("no unspent supply pre-commitment outputs " +
111+
"for the initial supply commitment")
112+
}
112113

113114
// Filter pre-commits to only include those that are at block heights
114115
// less than or equal to the commitment's anchor block height. All

0 commit comments

Comments
 (0)