Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: bls_aggregation use new struct TaskMetadata #485

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from

Conversation

damiramirez
Copy link
Contributor

@damiramirez damiramirez commented Jan 29, 2025

What Changed?

This PR introduces a small refactor in task initialization by encapsulating related parameters into a new struct and simplifying function interfaces.

  • Create a new struct TaskMetadata. This struct encapsulates the parameters used by InitializeNewTask() and singleTaskAggregatorGoroutineFunc().
  • Add a constructor method for TaskMetadata
type TaskMetadata struct {
	taskIndex types.TaskIndex
	taskCreatedBlock uint32
	quorumNumbers types.QuorumNums
	quorumThresholdPercentages types.QuorumThresholdPercentages
	timeToExpiry time.Duration
	windowDuration time.Duration
}

func NewTaskMetadata(taskIndex types.TaskIndex, taskCreatedBlock uint32, quorumNumbers types.QuorumNums, quorumThresholdPercentages types.QuorumThresholdPercentages, timeToExpiry time.Duration) TaskMetadata
func (t TaskMetadata) WithWindowDuration(windowDuration time.Duration) TaskMetadata

func (a *BlsAggregatorService) InitializeNewTask(metadata TaskMetadata) error
func (a *BlsAggregatorService) singleTaskAggregatorGoroutineFunc(metadata TaskMetadata, signedTaskRespsC <-chan types.SignedTaskResponseDigest)
  • Update BlsAggregationService interface with the new signature.
  • Remove InitializeNewTaskWithWindow() since WindowDuration is now included in TaskMetadata, this function is no longer needed.
  • Adjusted test cases to align with the new function signatures.

Reviewer Checklist

  • Code is well-documented
  • Code adheres to Go naming conventions
  • Code deprecates any old functionality before removing it

@damiramirez damiramirez marked this pull request as ready for review January 29, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant