Skip to content

Commit

Permalink
Submit checkpoint aggregation on finished aggregation process (#283)
Browse files Browse the repository at this point in the history
* feat: Submit checkpoint aggregation only on finished aggregation process

* refactor: Fix typo

* fix: Apply forceFinished into errored blsagg responses
  • Loading branch information
Hyodar authored Aug 13, 2024
1 parent b74fb68 commit 26cfd46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const (
// this hardcoded here because it's also hardcoded in the contracts, but should
// ideally be fetched from the contracts
taskChallengeWindowBlock = 100
taksResponseSubmissionBufferBlock = 15
taskResponseSubmissionBufferBlock = 15
taskAggregationTimeout = 1 * time.Minute
blockTime = 12 * time.Second
avsName = "super-fast-finality-layer"
Expand Down Expand Up @@ -286,7 +286,9 @@ func (agg *Aggregator) Start(ctx context.Context) error {
return agg.Close()
case blsAggServiceResp := <-agg.taskBlsAggregationService.GetResponseChannel():
agg.logger.Info("Received response from taskBlsAggregationService", "blsAggServiceResp", blsAggServiceResp)
go agg.sendAggregatedResponseToContract(blsAggServiceResp)
if blsAggServiceResp.Finished {
go agg.sendAggregatedResponseToContract(blsAggServiceResp)
}
case blsAggServiceResp := <-agg.stateRootUpdateBlsAggregationService.GetResponseChannel():
agg.logger.Info("Received response from stateRootUpdateBlsAggregationService", "blsAggServiceResp", blsAggServiceResp)
agg.handleStateRootUpdateReachedQuorum(blsAggServiceResp)
Expand Down Expand Up @@ -411,7 +413,7 @@ func (agg *Aggregator) sendNewCheckpointTask() {
quorumThresholds[i] = types.TASK_AGGREGATION_QUORUM_THRESHOLD
}

taskTimeToExpiry := (taskChallengeWindowBlock-taksResponseSubmissionBufferBlock)*blockTime - taskAggregationTimeout
taskTimeToExpiry := (taskChallengeWindowBlock-taskResponseSubmissionBufferBlock)*blockTime - taskAggregationTimeout
err = agg.taskBlsAggregationService.InitializeMessageIfNotExists(
messages.CheckpointTaskResponse{ReferenceTaskIndex: taskIndex}.Key(),
core.ConvertBytesToQuorumNumbers(newTask.QuorumNumbers),
Expand Down
8 changes: 4 additions & 4 deletions aggregator/blsagg/message_blsagg.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func (mbas *MessageBlsAggregatorService) getMessageBlsAggregationResponse(messag
Message: message,
MessageKey: message.Key(),
Status: MessageBlsAggregationStatusNone,
Finished: false,
Finished: forceFinished,
Err: MessageNotFoundErrorFn(messageDigest),
}
}
Expand All @@ -465,7 +465,7 @@ func (mbas *MessageBlsAggregatorService) getMessageBlsAggregationResponse(messag
Message: message,
MessageKey: message.Key(),
Status: MessageBlsAggregationStatusNone,
Finished: false,
Finished: forceFinished,
Err: err,
}
}
Expand All @@ -485,7 +485,7 @@ func (mbas *MessageBlsAggregatorService) getMessageBlsAggregationResponse(messag
Message: message,
MessageKey: message.Key(),
Status: MessageBlsAggregationStatusNone,
Finished: false,
Finished: forceFinished,
Err: err,
}
}
Expand All @@ -511,7 +511,7 @@ func (mbas *MessageBlsAggregatorService) getMessageBlsAggregationResponse(messag
Message: message,
MessageKey: message.Key(),
Status: MessageBlsAggregationStatusNone,
Finished: false,
Finished: forceFinished,
Err: err,
}
}
Expand Down

0 comments on commit 26cfd46

Please sign in to comment.