Skip to content

Commit 24b24e6

Browse files
refactor(aggregator): move timeToExpiry task to config file (#1399)
1 parent 1cf27ce commit 24b24e6

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

aggregator/internal/pkg/aggregator.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ func (agg *Aggregator) Start(ctx context.Context) error {
215215

216216
const MaxSentTxRetries = 5
217217

218-
const BLS_AGG_SERVICE_TIMEOUT = 100 * time.Second
219-
220218
func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsAggregationServiceResponse) {
221219
agg.taskMutex.Lock()
222220
agg.AggregatorConfig.BaseConfig.Logger.Info("- Locked Resources: Fetching task data")
@@ -375,7 +373,7 @@ func (agg *Aggregator) AddNewTask(batchMerkleRoot [32]byte, senderAddress [20]by
375373
quorumNums := eigentypes.QuorumNums{eigentypes.QuorumNum(QUORUM_NUMBER)}
376374
quorumThresholdPercentages := eigentypes.QuorumThresholdPercentages{eigentypes.QuorumThresholdPercentage(QUORUM_THRESHOLD)}
377375

378-
err := agg.blsAggregationService.InitializeNewTask(batchIndex, taskCreatedBlock, quorumNums, quorumThresholdPercentages, BLS_AGG_SERVICE_TIMEOUT)
376+
err := agg.blsAggregationService.InitializeNewTask(batchIndex, taskCreatedBlock, quorumNums, quorumThresholdPercentages, agg.AggregatorConfig.Aggregator.BlsServiceTaskTimeout)
379377
// FIXME(marian): When this errors, should we retry initializing new task? Logging fatal for now.
380378
if err != nil {
381379
agg.logger.Fatalf("BLS aggregation service error when initializing new task: %s", err)

config-files/config-aggregator-docker.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ aggregator:
2929
telemetry_ip_port_address: localhost:4001
3030
garbage_collector_period: 2m #The period of the GC process. Suggested value for Prod: '168h' (7 days)
3131
garbage_collector_tasks_age: 20 #The age of tasks that will be removed by the GC, in blocks. Suggested value for prod: '216000' (30 days)
32-
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
32+
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
33+
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)

config-files/config-aggregator.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ aggregator:
3737
garbage_collector_period: 2m #The period of the GC process. Suggested value for Prod: '168h' (7 days)
3838
garbage_collector_tasks_age: 20 #The age of tasks that will be removed by the GC, in blocks. Suggested value for prod: '216000' (30 days)
3939
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
40+
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
4041

4142
## Operator Configurations
4243
# operator:

config-files/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ aggregator:
3535
avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690
3636
enable_metrics: true
3737
metrics_ip_port_address: localhost:9091
38+
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
3839

3940
## Operator Configurations
4041
operator:

core/config/aggregator.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type AggregatorConfig struct {
2424
GarbageCollectorPeriod time.Duration
2525
GarbageCollectorTasksAge uint64
2626
GarbageCollectorTasksInterval uint64
27+
BlsServiceTaskTimeout time.Duration
2728
}
2829
}
2930

@@ -38,6 +39,7 @@ type AggregatorConfigFromYaml struct {
3839
GarbageCollectorPeriod time.Duration `yaml:"garbage_collector_period"`
3940
GarbageCollectorTasksAge uint64 `yaml:"garbage_collector_tasks_age"`
4041
GarbageCollectorTasksInterval uint64 `yaml:"garbage_collector_tasks_interval"`
42+
BlsServiceTaskTimeout time.Duration `yaml:"bls_service_task_timeout"`
4143
} `yaml:"aggregator"`
4244
}
4345

@@ -82,6 +84,7 @@ func NewAggregatorConfig(configFilePath string) *AggregatorConfig {
8284
GarbageCollectorPeriod time.Duration
8385
GarbageCollectorTasksAge uint64
8486
GarbageCollectorTasksInterval uint64
87+
BlsServiceTaskTimeout time.Duration
8588
}(aggregatorConfigFromYaml.Aggregator),
8689
}
8790
}

0 commit comments

Comments
 (0)