Skip to content

Commit 7f7c8ce

Browse files
committed
tapgarden+universe: improve logging/error messages for uni proof insert
Enhanced clarity and detail in log and error messages during the insertion of proofs into the universe. This aids in debugging and provides better feedback during failures or unexpected states.
1 parent a93ff2a commit 7f7c8ce

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

tapgarden/caretaker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ func (b *BatchCaretaker) batchStreamUniverseItems(ctx context.Context,
13111311
err := uni.UpsertProofLeafBatch(ctx, batch)
13121312
if err != nil {
13131313
return fmt.Errorf("unable to register "+
1314-
"issuance batch: %w", err)
1314+
"proof leaf batch: %w", err)
13151315
}
13161316

13171317
log.Infof("Inserted %d new leaves (%d of %d) into "+

universe/archive.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ func extractBatchDeps(batch []*Item) map[UniverseKey]*asset.Asset {
428428
func (a *Archive) UpsertProofLeafBatch(ctx context.Context,
429429
items []*Item) error {
430430

431-
log.Infof("Verifying %d new proofs for insertion into Universe",
432-
len(items))
431+
log.InfoS(ctx, "Verifying new proofs for insertion into Universe",
432+
"count", len(items))
433433

434434
// Issuance proofs that also create an asset group (a.k.a. group
435435
// anchors) must be verified and stored before any issuance proofs that
@@ -529,25 +529,25 @@ func (a *Archive) UpsertProofLeafBatch(ctx context.Context,
529529
return err
530530
}
531531

532-
log.Infof("Inserting %d verified group anchor proofs into Universe",
533-
len(anchorItems))
532+
log.InfoS(ctx, "Inserting verified group anchor proofs into Universe",
533+
"count", len(anchorItems))
534534
err = a.cfg.Multiverse.UpsertProofLeafBatch(ctx, anchorItems)
535535
if err != nil {
536-
return fmt.Errorf("unable to register new group anchor "+
537-
"issuance proofs: %w", err)
536+
return fmt.Errorf("upsert group anchor proof leaf batch "+
537+
"(count=%d): %w", len(anchorItems), err)
538538
}
539539

540540
err = verifyBatch(nonAnchorItems)
541541
if err != nil {
542542
return err
543543
}
544544

545-
log.Infof("Inserting %d verified proofs into Universe",
546-
len(nonAnchorItems))
545+
log.InfoS(ctx, "Inserting verified proofs into Universe",
546+
"count", len(nonAnchorItems))
547547
err = a.cfg.Multiverse.UpsertProofLeafBatch(ctx, nonAnchorItems)
548548
if err != nil {
549-
return fmt.Errorf("unable to register new issuance proofs: %w",
550-
err)
549+
return fmt.Errorf("upsert proof leaf batch (count=%d): %w",
550+
len(nonAnchorItems), err)
551551
}
552552

553553
// Log a sync event for the newly inserted leaf in the background as an

0 commit comments

Comments
 (0)