Skip to content

Commit

Permalink
main: message signer factory generation is abstracted from main
Browse files Browse the repository at this point in the history
  • Loading branch information
najeal committed Jun 16, 2024
1 parent 0f647f6 commit 84df662
Showing 1 changed file with 12 additions and 27 deletions.
39 changes: 12 additions & 27 deletions main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,46 +407,31 @@ func createApplicationRelayers(
if minHeight == 0 || height < minHeight {
minHeight = height
}

signingSubnet := sourceBlockchain.GetSubnetID()
if sourceBlockchain.GetSubnetID() == constants.PrimaryNetworkID {
signingSubnet = cfg.GetSubnetID(relayerID.DestinationBlockchainID)
}
quorum, err := cfg.GetWarpQuorum(relayerID.DestinationBlockchainID)
if err != nil {
logger.Error(
"Failed to get warp quorum from config. Relayer may not be configured to deliver to the destination chain.",
zap.String("destinationBlockchainID", relayerID.DestinationBlockchainID.String()),
destBlockchain, ok := cfg.GetDestinationBlockchain(relayerID.DestinationBlockchainID)
if !ok {
logger.Error("failed to find destination blockchain config",
zap.String("relayerID", relayerID.ID.String()),
zap.Error(err),
)
return nil, 0, err
}
messageSignerFactory := func(requestID uint32) relayer.MessageSigner {
return relayer.NewAppRequestMessageSigner(
logger,
network,
sourceBlockchain.GetBlockchainID(),
sourceBlockchain.GetSubnetID(),
relayerID.DestinationBlockchainID,
messageCreator,
signingSubnet,
quorum,
requestID,
)
}
signerFactory := relayer.NewAppRequestNetworkSignerFactory(
logger,
network,
sourceBlockchain,
destBlockchain,
messageCreator,
)
applicationRelayer, err := relayer.NewApplicationRelayer(
logger,
metrics,
// network,
// messageCreator,
relayerID,
db,
ticker,
destinationClients[relayerID.DestinationBlockchainID],
sourceBlockchain,
height,
cfg,
messageSignerFactory,
signerFactory,
)
if err != nil {
logger.Error(
Expand Down

0 comments on commit 84df662

Please sign in to comment.