Skip to content

Commit 624f647

Browse files
committed
tapcfg: wire delegation checker to garden and freighter subsystems
This commit completes the integration by wiring the address book's DelegationKeyChecker implementation to both the GardenKit and ChainPorterConfig. With this configuration, both minting and burning operations now properly verify delegation key ownership before submitting supply commitment events. The address book serves as the central authority for key ownership verification, leveraging its existing access to the key ring and asset metadata storage. This ensures consistent delegation checking across all supply commitment operations.
1 parent 45210dc commit 624f647

File tree

1 file changed

+55
-50
lines changed

1 file changed

+55
-50
lines changed

tapcfg/server.go

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,57 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
476476
return nil, err
477477
}
478478

479+
auxLeafSigner := tapchannel.NewAuxLeafSigner(
480+
&tapchannel.LeafSignerConfig{
481+
ChainParams: &tapChainParams,
482+
Signer: assetWallet,
483+
},
484+
)
485+
channelFunder := tap.NewLndPbstChannelFunder(lndServices)
486+
487+
// Parse the universe public access status.
488+
universePublicAccess, err := tap.ParseUniversePublicAccessStatus(
489+
cfg.Universe.PublicAccess,
490+
)
491+
if err != nil {
492+
return nil, fmt.Errorf("unable to parse universe public "+
493+
"access status: %w", err)
494+
}
495+
496+
// Construct the supply commit manager, which is used to
497+
// formulate universe supply commitment transactions.
498+
//
499+
// Construct database backends for the supply commitment state machines.
500+
supplyCommitDb := tapdb.NewTransactionExecutor(
501+
db, func(tx *sql.Tx) tapdb.SupplyCommitStore {
502+
return db.WithTx(tx)
503+
},
504+
)
505+
supplyCommitStore := tapdb.NewSupplyCommitMachine(supplyCommitDb)
506+
507+
// Construct the supply tree database backend.
508+
supplyTreeDb := tapdb.NewTransactionExecutor(
509+
db, func(tx *sql.Tx) tapdb.BaseUniverseStore {
510+
return db.WithTx(tx)
511+
},
512+
)
513+
supplyTreeStore := tapdb.NewSupplyTreeStore(supplyTreeDb)
514+
515+
// Create the supply commitment state machine manager, which is used to
516+
// manage the supply commitment state machines for each asset group.
517+
supplyCommitManager := supplycommit.NewMultiStateMachineManager(
518+
supplycommit.MultiStateMachineManagerCfg{
519+
TreeView: supplyTreeStore,
520+
Commitments: supplyCommitStore,
521+
Wallet: walletAnchor,
522+
KeyRing: keyRing,
523+
Chain: chainBridge,
524+
DaemonAdapters: lndFsmDaemonAdapters,
525+
StateLog: supplyCommitStore,
526+
ChainParams: *tapChainParams.Params,
527+
},
528+
)
529+
479530
// For the porter, we'll make a multi-notifier comprised of all the
480531
// possible proof file sources to ensure it can always fetch input
481532
// proofs.
@@ -499,16 +550,11 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
499550
ProofCourierDispatcher: proofCourierDispatcher,
500551
ProofWatcher: reOrgWatcher,
501552
ErrChan: mainErrChan,
553+
BurnCommitter: supplyCommitManager,
554+
DelegationKeyChecker: addrBook,
502555
},
503556
)
504557

505-
auxLeafSigner := tapchannel.NewAuxLeafSigner(
506-
&tapchannel.LeafSignerConfig{
507-
ChainParams: &tapChainParams,
508-
Signer: assetWallet,
509-
},
510-
)
511-
channelFunder := lndservices.NewLndPbstChannelFunder(lndServices)
512558
auxFundingController := tapchannel.NewFundingController(
513559
tapchannel.FundingControllerCfg{
514560
HeaderVerifier: headerVerifier,
@@ -580,49 +626,6 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
580626
},
581627
)
582628

583-
// Parse the universe public access status.
584-
universePublicAccess, err := tap.ParseUniversePublicAccessStatus(
585-
cfg.Universe.PublicAccess,
586-
)
587-
if err != nil {
588-
return nil, fmt.Errorf("unable to parse universe public "+
589-
"access status: %w", err)
590-
}
591-
592-
// Construct the supply commit manager, which is used to
593-
// formulate universe supply commitment transactions.
594-
//
595-
// Construct database backends for the supply commitment state machines.
596-
supplyCommitDb := tapdb.NewTransactionExecutor(
597-
db, func(tx *sql.Tx) tapdb.SupplyCommitStore {
598-
return db.WithTx(tx)
599-
},
600-
)
601-
supplyCommitStore := tapdb.NewSupplyCommitMachine(supplyCommitDb)
602-
603-
// Construct the supply tree database backend.
604-
supplyTreeDb := tapdb.NewTransactionExecutor(
605-
db, func(tx *sql.Tx) tapdb.BaseUniverseStore {
606-
return db.WithTx(tx)
607-
},
608-
)
609-
supplyTreeStore := tapdb.NewSupplyTreeStore(supplyTreeDb)
610-
611-
// Create the supply commitment state machine manager, which is used to
612-
// manage the supply commitment state machines for each asset group.
613-
supplyCommitManager := supplycommit.NewMultiStateMachineManager(
614-
supplycommit.MultiStateMachineManagerCfg{
615-
TreeView: supplyTreeStore,
616-
Commitments: supplyCommitStore,
617-
Wallet: walletAnchor,
618-
KeyRing: keyRing,
619-
Chain: chainBridge,
620-
DaemonAdapters: lndFsmDaemonAdapters,
621-
StateLog: supplyCommitStore,
622-
ChainParams: *tapChainParams.Params,
623-
},
624-
)
625-
626629
return &tap.Config{
627630
DebugLevel: cfg.DebugLevel,
628631
RuntimeID: runtimeID,
@@ -644,6 +647,8 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
644647
Universe: universeFederation,
645648
ProofWatcher: reOrgWatcher,
646649
UniversePushBatchSize: defaultUniverseSyncBatchSize,
650+
MintCommitter: supplyCommitManager,
651+
DelegationKeyChecker: addrBook,
647652
},
648653
ChainParams: tapChainParams,
649654
ProofUpdates: proofArchive,

0 commit comments

Comments
 (0)