Skip to content

Commit b1abe3a

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 9402f2f commit b1abe3a

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 := lndservices.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.
@@ -500,16 +551,11 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
500551
ProofCourierDispatcher: proofCourierDispatcher,
501552
ProofWatcher: reOrgWatcher,
502553
ErrChan: mainErrChan,
554+
BurnCommitter: supplyCommitManager,
555+
DelegationKeyChecker: addrBook,
503556
},
504557
)
505558

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

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

0 commit comments

Comments
 (0)