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

feat: Add task index in the BlsAggregationServiceResponse when error #260

Merged

Conversation

fyInALT
Copy link
Contributor

@fyInALT fyInALT commented Jun 6, 2024

What Changed?

Add task index in the BlsAggregationServiceResponse when error

When develop aggregator by eigensdk-go, some bls sig task may failed or expired, when this happend,
the caller will got a err from blsAggServ.aggregatedResponsesC.

But this responses will just contain a err by:

	TaskExpiredErrorFn = func(taskIndex types.TaskIndex) error {
		return fmt.Errorf("task %d expired", taskIndex)
	}

if the caller should process which task is failed, only can write this code:

	var taskIndex uint32
	if blsAggServiceResp.Err != nil {
		errString := blsAggServiceResp.Err.Error()
		if strings.Contains(errString, "expired") {
			fmt.Sscanf(errString, "task %d expired", &taskIndex)
			t.logger.Debug("expired index", "index", taskIndex)
		}
	} else {
		taskIndex = blsAggServiceResp.TaskIndex
	}

       // process taskIndex ...

So we can just put the taskIndex into the resp when error, then the caller can not use Sscanf which depend by error.

Reviewer Checklist

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

Copy link
Collaborator

@samlaf samlaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree we need task index when returning error.
I would prefer we eventually move to custom errors which contain the task index instead of relying on task index being set in the return struct, because that feels error prone (some future developer will add an error somewhere and forget to set the index, and then user code will break).
But I'll accept this for now :)

@samlaf
Copy link
Collaborator

samlaf commented Jun 6, 2024

@shrimalmadhur can you check what the failing test is? Looks like its unrelated to this PR.

@shrimalmadhur
Copy link
Collaborator

@shrimalmadhur can you check what the failing test is? Looks like its unrelated to this PR.

It's passed - maybe some intermittent network issue, it is passing in unit-tests job. The only thing which is failing is the wiki thing. @samlaf feel free to merge this.

@NimaVaziri NimaVaziri merged commit 4a204d0 into Layr-Labs:master Jun 7, 2024
2 of 3 checks passed
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.

4 participants