diff --git a/pkg/innerring/bindings.go b/pkg/innerring/bindings.go index 57ddb3ef0..1c930cdf3 100644 --- a/pkg/innerring/bindings.go +++ b/pkg/innerring/bindings.go @@ -12,6 +12,17 @@ type ( ListenerNotificationHandlers() []event.NotificationHandlerInfo TimersHandlers() []event.NotificationHandlerInfo } + + // NotaryContractProcessor interface defines function for binding notary event + // producers such as event.Listener with contract processor. + // + // This interface is optional for contract processor. If contract processor + // supports notary event handling, it should implement both ContractProcessor + // and NotaryContractProcessor interfaces. + NotaryContractProcessor interface { + ListenerNotaryParsers() []event.NotaryParserInfo + ListenerNotaryHandlers() []event.NotaryHandlerInfo + } ) func connectListenerWithProcessor(l event.Listener, p ContractProcessor) { @@ -24,6 +35,17 @@ func connectListenerWithProcessor(l event.Listener, p ContractProcessor) { for _, handler := range p.ListenerNotificationHandlers() { l.RegisterNotificationHandler(handler) } + + // add notary handlers if processor supports it + if notaryProcessor, ok := p.(NotaryContractProcessor); ok { + for _, notaryParser := range notaryProcessor.ListenerNotaryParsers() { + l.SetNotaryParser(notaryParser) + } + + for _, notaryHandler := range notaryProcessor.ListenerNotaryHandlers() { + l.RegisterNotaryHandler(notaryHandler) + } + } } // bindMorphProcessor connects morph chain listener handlers. diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index d4a497308..369f47c99 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -392,6 +392,8 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error if err != nil { return nil, fmt.Errorf("could not enable side chain notary support: %w", err) } + + server.morphListener.EnableNotarySupport(server.contracts.proxy, server.morphClient.Committee, server.morphClient) } if !server.mainNotaryConfig.disabled { @@ -643,6 +645,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error ContainerClient: cnrClient, NeoFSIDClient: neofsIDClient, NetworkState: server.netmapClient, + NotaryDisabled: server.sideNotaryConfig.disabled, }) if err != nil { return nil, err