From 2828421079880fd955b66cd6a6808e3470efc757 Mon Sep 17 00:00:00 2001 From: MariusC Date: Tue, 23 Jan 2024 11:39:55 +0200 Subject: [PATCH 1/2] FIX: Add back subscribed events for outgoing operations --- cmd/sovereignnode/config/sovereignConfig.toml | 4 ++++ config/sovereignConfig.go | 3 ++- factory/processing/blockProcessorCreator.go | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/sovereignnode/config/sovereignConfig.toml b/cmd/sovereignnode/config/sovereignConfig.toml index 3d7013cc0d6..cce1b4ba29d 100644 --- a/cmd/sovereignnode/config/sovereignConfig.toml +++ b/cmd/sovereignnode/config/sovereignConfig.toml @@ -33,6 +33,10 @@ # Time to wait in seconds for outgoing operations that need to be bridged from sovereign chain to main chain. # If no confirmation of bridged data is received after this time, next leader should retry sending data. TimeToWaitForUnconfirmedOutGoingOperationInSeconds = 30 + + SubscribedEvents = [ + { Identifier = "deposit", Addresses = ["erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th"] } + ] [OutGoingBridge] GRPCHost = "localhost" diff --git a/config/sovereignConfig.go b/config/sovereignConfig.go index 7664386ae68..889c3da76fe 100644 --- a/config/sovereignConfig.go +++ b/config/sovereignConfig.go @@ -13,7 +13,8 @@ type SovereignConfig struct { // OutgoingSubscribedEvents holds config for outgoing subscribed events type OutgoingSubscribedEvents struct { - TimeToWaitForUnconfirmedOutGoingOperationInSeconds uint32 `toml:"TimeToWaitForUnconfirmedOutGoingOperationInSeconds"` + TimeToWaitForUnconfirmedOutGoingOperationInSeconds uint32 `toml:"TimeToWaitForUnconfirmedOutGoingOperationInSeconds"` + SubscribedEvents []SubscribedEvent `toml:"SubscribedEvents"` } // MainChainNotarization defines necessary data to start main chain notarization on a sovereign shard diff --git a/factory/processing/blockProcessorCreator.go b/factory/processing/blockProcessorCreator.go index 20174f34fcb..cd4a4dd4d39 100644 --- a/factory/processing/blockProcessorCreator.go +++ b/factory/processing/blockProcessorCreator.go @@ -539,7 +539,7 @@ func (pcf *processComponentsFactory) createBlockProcessor( // TODO: Radu Chis: move this in the factory of the sovereign block processor once the refactor is completed outgoingOpFormatter, errOpFormatter := sovereign.CreateOutgoingOperationsFormatter( - pcf.config.SovereignConfig.NotifierConfig.SubscribedEvents, + pcf.config.SovereignConfig.OutgoingSubscribedEvents.SubscribedEvents, pcf.coreData.AddressPubKeyConverter(), pcf.coreData.RoundHandler(), ) From 5fbacee0a736ab12b52a34d185052f13d2b34b2f Mon Sep 17 00:00:00 2001 From: MariusC Date: Tue, 23 Jan 2024 11:53:16 +0200 Subject: [PATCH 2/2] FIX: Unit tests --- testscommon/components/configs.go | 8 ++++++++ testscommon/generalConfig.go | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/testscommon/components/configs.go b/testscommon/components/configs.go index c2a5a192c10..0c1504c43c0 100644 --- a/testscommon/components/configs.go +++ b/testscommon/components/configs.go @@ -199,6 +199,14 @@ func GetGeneralConfig() config.Config { }, }, }, + OutgoingSubscribedEvents: config.OutgoingSubscribedEvents{ + SubscribedEvents: []config.SubscribedEvent{ + { + Identifier: "bridgeOps", + Addresses: []string{"erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th"}, + }, + }, + }, }, } } diff --git a/testscommon/generalConfig.go b/testscommon/generalConfig.go index 8c113fe9001..70848f1bafe 100644 --- a/testscommon/generalConfig.go +++ b/testscommon/generalConfig.go @@ -424,6 +424,14 @@ func GetGeneralConfig() config.Config { }, }, }, + OutgoingSubscribedEvents: config.OutgoingSubscribedEvents{ + SubscribedEvents: []config.SubscribedEvent{ + { + Identifier: "bridgeOps", + Addresses: []string{"erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th"}, + }, + }, + }, }, } }