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

feature: (alan) filter committee duties per slot validator duties #467

Merged
merged 6 commits into from
Jul 22, 2024

Conversation

y0sher
Copy link
Contributor

@y0sher y0sher commented Jul 17, 2024

Description

Committee struct holds all the shares for the validators of that committee, though a CommitteeRunner only lives for a certain slot and thereby only needs shares of validators that have duty for that slot.

Changes

Filter the shares of Committee to create a subset that has only shares of validators that have duties for this slot.

ssv/committee.go Outdated
dutyShares := make(map[spec.ValidatorIndex]*types.Share)
for _, bduty := range duty.ValidatorDuties {
if _, exists := c.Share[bduty.ValidatorIndex]; !exists {
return fmt.Errorf("no share for validator %d", bduty.ValidatorIndex)
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be continue simply?
are we sure we want to fail the run just because of one miss?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, from the spec perspective, I would also say continue is better. On the other hand, in ssv, it's strange that the operator doesn't the share for the duty since he requested the duty for this validator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree

Copy link
Contributor

@MatheusFranco99 MatheusFranco99 left a comment

Choose a reason for hiding this comment

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

@y0sher Approving, but it seems to me that continue makes more sense (for the above issue)

@y0sher
Copy link
Contributor Author

y0sher commented Jul 22, 2024

@y0sher Approving, but it seems to me that continue makes more sense (for the above issue)

please change as you wish and merge when you're ready.

@MatheusFranco99
Copy link
Contributor

@y0sher @GalRogozinski
Doing the change and adding tests...

)

// SharesWithFractionOfDutyValidators performs a complete duty execution for a runner that only has a fraction of the shares for the duty's validators
func SharesWithFractionOfDutyValidators() tests.SpecTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to MissingSomeShares

dutyValidators := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

multiSpecTest := &committee.MultiCommitteeSpecTest{
Name: "shares with fraction of duty validators",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Name: "shares with fraction of duty validators",
Name: "start committee duty with missing shares",

@GalRogozinski GalRogozinski changed the base branch from main to dev July 22, 2024 13:22
@GalRogozinski GalRogozinski merged commit 9f64a7b into dev Jul 22, 2024
2 checks passed
@GalRogozinski GalRogozinski deleted the feature/filter-committee-duty-shares branch July 22, 2024 13:23
GalRogozinski pushed a commit that referenced this pull request Sep 12, 2024
* Filter shares for slot `CommitteeRunner` based on validators that have duty for that slot.

* Filter duty and create share map according to owned validators

* Add test: start duty with no shares for duty's validators

* Add test: happy flow for committee with fraction of duty's validators

* Generate JSON tests

* Apply suggestions

---------

Co-authored-by: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com>
GalRogozinski pushed a commit that referenced this pull request Nov 12, 2024
* remove domaintype from committeeMember

* remove domaintype from share

* add config for ssv containing domainType

* add custom unmarshal for baserunner to avoid error in unmarshalling config

* move domainType to Network

* add testing domain in NewTestingNetwork function

* Spec - filter committee duties per slot validator duties (#467)

* Filter shares for slot `CommitteeRunner` based on validators that have duty for that slot.

* Filter duty and create share map according to owned validators

* Add test: start duty with no shares for duty's validators

* Add test: happy flow for committee with fraction of duty's validators

* Generate JSON tests

* Apply suggestions

---------

Co-authored-by: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com>

* Spec - check att and sync duties exist before submitting (#468)

* Meta - Update to go1.22 (#474)

* Update go1.20 to go1.22

* Update go.sum with mod tidy

* Meta - Update dependencies (#483)

* Update dependencies

* Fix lint issue

* Generate JSON tests to trigger actions

* Update fastssz

* Generate JSON tests and align ssz error

* Revert go-eth2-client version change

* Revert fastssz upgrade

* Generate SSZ and JSON tests

* Meta - Fix static analysis issues (#480)

* Solve potential file inclusion via variable

* Fix file permission (0644 to 0600)

* Add nosec comment for PRNG (pseudo-random number generator) used for testing

* Fix lint issue on nil check in []byte type

* Update permission from 0444 to 0600

* Update 0444 to 0400

* Meta - Drop unnecessary nolint comments (#477)

* Remove nolint comment and export timeout variables

* Drop unnecessary nolint

* Add comment

* Fix lint issue

* Spec - Share length validation (#478)

* 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

* Meta - Drop redundant error (#475)

* Spec - Drop redundant validation for decided messages (#476)

* Remove redundant validation

* Align error string

* Spec - Sort signers in decided message (#484)

* Sort signers in decided message

* Add test for sorted signers in decided msg

* Generate JSON tests

* Fix lint issue

* Spec - Stop processing after decided (#487)

* Stop processing consensus messages after instance is decided

* Align error in qbft tests

* Align errors in ssv tests

* Generate JSON tests

* Fix lint issue

* Spec - Drop leftover error check (#469)

* Remove leftover err check

* Align argument variable name to type

* Spec - Secure key storage (#481)

* Implement secure key storage using PKCS8

* Fix lint issue

* Switch back PKCS8 to PKCS1

* Meta - Remove residual DKG (#502)

* Remove DKG signature type

* Remove DKG msg type

* Remove DKGOperators field from TestKeySet

* Remove unused ecdsaKeys field from TestingKeyStorage

* Remove unused "ecdsaSKFromHex" function

* Generate JSON tests

* Spec - Add GoSec action and fix issues (#505)

* Add github action and makefile command

* Fix issues in round robin proposer function

* Fix bad PutUint32 in GetCommitteeID

* Fix issue with HasQuorum and HasPartialQuorum

* Add role sanitization in GetRoleType and NewMessageType

* Add sanitization to BeaconNetwork methods

* Add sanitization in testingutils

* Add sanitization to height usage in test files

* Fix uint64 conversion in runner/postconsensus/valid_msg test

* Sanitize ValidatorIndex conversion

* Update action name

* Fix tests to use valid RunnerRoles

* Generate SSZ

* Generate JSON tests

* Revert the change on GetCommitteeID

* Add nosec G115 to GetCommitteeID

* revert the merge because it was merged with origin main by accident

---------

Co-authored-by: rehs0y <lyosher@gmail.com>
Co-authored-by: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com>
GalRogozinski pushed a commit that referenced this pull request Nov 12, 2024
* remove domaintype from committeeMember

* remove domaintype from share

* add config for ssv containing domainType

* add custom unmarshal for baserunner to avoid error in unmarshalling config

* move domainType to Network

* add testing domain in NewTestingNetwork function

* Spec - filter committee duties per slot validator duties (#467)

* Filter shares for slot `CommitteeRunner` based on validators that have duty for that slot.

* Filter duty and create share map according to owned validators

* Add test: start duty with no shares for duty's validators

* Add test: happy flow for committee with fraction of duty's validators

* Generate JSON tests

* Apply suggestions

---------

Co-authored-by: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com>

* Spec - check att and sync duties exist before submitting (#468)

* Meta - Update to go1.22 (#474)

* Update go1.20 to go1.22

* Update go.sum with mod tidy

* Meta - Update dependencies (#483)

* Update dependencies

* Fix lint issue

* Generate JSON tests to trigger actions

* Update fastssz

* Generate JSON tests and align ssz error

* Revert go-eth2-client version change

* Revert fastssz upgrade

* Generate SSZ and JSON tests

* Meta - Fix static analysis issues (#480)

* Solve potential file inclusion via variable

* Fix file permission (0644 to 0600)

* Add nosec comment for PRNG (pseudo-random number generator) used for testing

* Fix lint issue on nil check in []byte type

* Update permission from 0444 to 0600

* Update 0444 to 0400

* Meta - Drop unnecessary nolint comments (#477)

* Remove nolint comment and export timeout variables

* Drop unnecessary nolint

* Add comment

* Fix lint issue

* Spec - Share length validation (#478)

* 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

* Meta - Drop redundant error (#475)

* Spec - Drop redundant validation for decided messages (#476)

* Remove redundant validation

* Align error string

* Spec - Sort signers in decided message (#484)

* Sort signers in decided message

* Add test for sorted signers in decided msg

* Generate JSON tests

* Fix lint issue

* Spec - Stop processing after decided (#487)

* Stop processing consensus messages after instance is decided

* Align error in qbft tests

* Align errors in ssv tests

* Generate JSON tests

* Fix lint issue

* Spec - Drop leftover error check (#469)

* Remove leftover err check

* Align argument variable name to type

* Spec - Secure key storage (#481)

* Implement secure key storage using PKCS8

* Fix lint issue

* Switch back PKCS8 to PKCS1

* Meta - Remove residual DKG (#502)

* Remove DKG signature type

* Remove DKG msg type

* Remove DKGOperators field from TestKeySet

* Remove unused ecdsaKeys field from TestingKeyStorage

* Remove unused "ecdsaSKFromHex" function

* Generate JSON tests

* Spec - Add GoSec action and fix issues (#505)

* Add github action and makefile command

* Fix issues in round robin proposer function

* Fix bad PutUint32 in GetCommitteeID

* Fix issue with HasQuorum and HasPartialQuorum

* Add role sanitization in GetRoleType and NewMessageType

* Add sanitization to BeaconNetwork methods

* Add sanitization in testingutils

* Add sanitization to height usage in test files

* Fix uint64 conversion in runner/postconsensus/valid_msg test

* Sanitize ValidatorIndex conversion

* Update action name

* Fix tests to use valid RunnerRoles

* Generate SSZ

* Generate JSON tests

* Revert the change on GetCommitteeID

* Add nosec G115 to GetCommitteeID

* revert the merge because it was merged with origin main by accident

---------

Co-authored-by: rehs0y <lyosher@gmail.com>
Co-authored-by: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com>
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.

3 participants