File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,8 +49,7 @@ func aggregatorMain(ctx *cli.Context) error {
4949 return err
5050 }
5151
52- // Listen for new task created in the ServiceManager contract in a separate goroutine
53- // Both V1 and V2 subscriptions:
52+ // Listen for new task created in the ServiceManager contract in a separate goroutine, both V1 and V2 subscriptions:
5453 go func () {
5554 listenErr := aggregator .SubscribeToNewTasks ()
5655 if listenErr != nil {
Original file line number Diff line number Diff line change @@ -10,31 +10,34 @@ func (agg *Aggregator) SubscribeToNewTasks() error {
1010 return err
1111 }
1212
13- V2 := false
13+ // V2 := false
14+ var redeployBlockNumber = uint32 (150 )
15+
1416
1517 for {
1618 select {
1719 case err := <- agg .taskSubscriber :
1820 agg .AggregatorConfig .BaseConfig .Logger .Info ("Failed to subscribe to new tasks" , "err" , err )
1921
20- if ! V2 {
21- err = agg .subscribeToNewTasks ()
22- if err != nil {
23- return err
24- }
25- } else {
26- err = agg .subscribeToNewTasksV2 ()
27- if err != nil {
28- return err
29- }
22+ // if !V2 {
23+ // TODO not sure if this is the best way, but no way to calculate blocknumber from here
24+ err = agg .subscribeToNewTasks ()
25+ errV2 := agg .subscribeToNewTasksV2 ()
26+ if err != nil {
27+ return err
28+ }
29+ if errV2 != nil {
30+ return err
3031 }
3132 case newBatch := <- agg .NewBatchChan :
32- if ! V2 {
33+ if newBatch .TaskCreatedBlock < redeployBlockNumber {
34+ // if !V2 {
3335 agg .AggregatorConfig .BaseConfig .Logger .Info ("Adding new task, V1" )
3436 agg .AddNewTask (newBatch .BatchMerkleRoot , newBatch .TaskCreatedBlock )
3537 }
3638 case newBatchV2 := <- agg .NewBatchChanV2 :
37- if V2 {
39+ if newBatchV2 .TaskCreatedBlock > redeployBlockNumber {
40+ // if V2 {
3841 agg .AggregatorConfig .BaseConfig .Logger .Info ("Adding new task, V2" )
3942 agg .AddNewTaskV2 (newBatchV2 .BatchMerkleRoot , newBatchV2 .SenderAddress , newBatchV2 .TaskCreatedBlock )
4043 }
Original file line number Diff line number Diff line change @@ -149,7 +149,10 @@ func (o *Operator) Start(ctx context.Context) error {
149149 metricsErrChan = make (chan error , 1 )
150150 }
151151
152- var V2 = false
152+ var redeployBlockNumber = uint32 (150 )
153+
154+ // var V2 = false
155+
153156
154157 for {
155158 select {
@@ -171,7 +174,8 @@ func (o *Operator) Start(ctx context.Context) error {
171174 o .Logger .Fatal ("Could not subscribe to new tasks" )
172175 }
173176 case newBatchLog := <- o .NewTaskCreatedChan :
174- if ! V2 {
177+ if newBatchLog .TaskCreatedBlock < redeployBlockNumber {
178+ // if !V2 {
175179 o .Logger .Infof ("Received new batch log: V1" )
176180 err := o .ProcessNewBatchLog (newBatchLog )
177181 if err != nil {
@@ -194,7 +198,8 @@ func (o *Operator) Start(ctx context.Context) error {
194198 }
195199
196200 case newBatchLogV2 := <- o .NewTaskCreatedChanV2 :
197- if V2 {
201+ if newBatchLogV2 .TaskCreatedBlock > redeployBlockNumber {
202+ // if V2 {
198203 o .Logger .Infof ("Received new batch log: V2" )
199204 err := o .ProcessNewBatchLogV2 (newBatchLogV2 )
200205 if err != nil {
You can’t perform that action at this time.
0 commit comments