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

Share length validation #478

Merged
merged 9 commits into from
Aug 20, 2024

Conversation

MatheusFranco99
Copy link
Contributor

Overview

This PR adds a validation to the runners' construction function (except by CommitteeRunner) to assert that the share argument has only one entry (only one share).

ssv/aggregator.go Outdated Show resolved Hide resolved
@GalRogozinski GalRogozinski added Networking P2P networking specs spec and removed Networking P2P networking specs labels Aug 14, 2024
Copy link
Contributor

@y0sher y0sher left a comment

Choose a reason for hiding this comment

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

Approving this but with an *.

  • @GalRogozinski @MatheusFranco99
    I think if this check is required maybe its time to think of separating the base for committee and other runners. Since other runners will never recv more than one share, it looks weird that their func signature can recv a map of shares.

@MatheusFranco99
Copy link
Contributor Author

@y0sher I agree.
I have opened an issue for that to be done later on

ks := testingutils.KeySetMapForValidators(10)
shares := testingutils.ShareMapFromKeySetMap(ks)

// No errors since one share must be valid for all runners

Choose a reason for hiding this comment

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

Is this comment right for this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed not. Updating. Thanks for the catch!


shares := map[phase0.ValidatorIndex]*types.Share{}

// No errors since one share must be valid for all runners

Choose a reason for hiding this comment

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

and here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating, thanks!

@MatheusFranco99 MatheusFranco99 merged commit 02beeb9 into ssvlabs:dev Aug 20, 2024
2 checks passed
@MatheusFranco99 MatheusFranco99 deleted the share-length-validation branch August 20, 2024 10:43
GalRogozinski pushed a commit that referenced this pull request Sep 12, 2024
* Add share length validation in runner construction

* Align to error handling in runners constructions

* Add validation to committee runner

* Add runner construction tests

* Refactor runner construction in testingutil to deal with creation errors

* Generate JSON tests

* Fix lint issue

* Fix comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants