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

Enables non-atomic validation for peer scoring parameters #499

Merged
merged 9 commits into from
Sep 8, 2022

Conversation

yhassanzadeh13
Copy link
Contributor

In the context of peer scoring, looking at how the parameters and thresholds are currently set at GossipSub, leaving some parameters unset, yields an error upon initialization of the GossipSub. For some applications and experimentations, we need to selectively set some of the parameters, e.g., only enabling staked participation in a permission setup. However, individual configuration of the scoring parameters is not feasible at the current state of GossipSub without setting all parameters and threshold values at their valid range. Missing even one parameter with a valid configuration fails the GossipSub instantiation.

This PR enables non-atomic validation mode for the parameters and thresholds related to the peer scoring by adding a SkipAtomicValidation member field to the parameters and thresholds struct. By default, this variable is evaluated as false, i.e., zero value for bool data type. !SkipAtomicValidation indicates an atomic mode for validating thresholds and parameters which means all values must be set at their valid ranges. This is synonymous to how the validation is currently done at GossipSub. On the other hand, SkipAtomicValidation indicates a non-atomic mode for validating thresholds and parameters, which relaxes the validation criteria by allowing the application developer to selectively set some of the parameters and threshold values.

In contrast to the atomic validation mode which imposes all parameters and thresholds having a valid value, in the non-atomic mode, the parameters and thresholds can be left at their default (i.e., Golang zero) values as long as either all or none of the parameters related to the same context are set (e.g., mesh failure).

Copy link
Collaborator

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

this is a pretty good solution i would day.

@vyzo vyzo merged commit 8866ca8 into libp2p:master Sep 8, 2022
@yhassanzadeh13 yhassanzadeh13 deleted the yahya/peer-scoring-param-setters branch September 9, 2022 16:07
yhassanzadeh13 added a commit to yhassanzadeh13/go-libp2p-pubsub that referenced this pull request Oct 28, 2022
* Enables non-atomic validation for peer scoring parameters (libp2p#499)

* decouples topic scoring parameters

* adds skiping atomic validation for topic parameters

* cleans up

* adds skip atomic validation to peer score threshold

* adds skip atomic validation for peer parameters

* adds test for non-atomic validation

* adds tests for peer score

* adds tests for peer score thresholds

* refactors tests

* chore: Update .github/workflows/stale.yml [skip ci]

* adds with gossipsub tracker

Co-authored-by: libp2p-mgmt-read-write[bot] <104492852+libp2p-mgmt-read-write[bot]@users.noreply.github.com>
lthibault pushed a commit to lthibault/go-libp2p-pubsub that referenced this pull request Nov 5, 2022
* decouples topic scoring parameters

* adds skiping atomic validation for topic parameters

* cleans up

* adds skip atomic validation to peer score threshold

* adds skip atomic validation for peer parameters

* adds test for non-atomic validation

* adds tests for peer score

* adds tests for peer score thresholds

* refactors tests
vyzo pushed a commit that referenced this pull request Dec 1, 2022
* Update go.mod

* Refactor GossipSub Construction  (#1)

* Enables non-atomic validation for peer scoring parameters (#499)

* decouples topic scoring parameters

* adds skiping atomic validation for topic parameters

* cleans up

* adds skip atomic validation to peer score threshold

* adds skip atomic validation for peer parameters

* adds test for non-atomic validation

* adds tests for peer score

* adds tests for peer score thresholds

* refactors tests

* chore: Update .github/workflows/stale.yml [skip ci]

* adds with gossipsub tracker

Co-authored-by: libp2p-mgmt-read-write[bot] <104492852+libp2p-mgmt-read-write[bot]@users.noreply.github.com>

* decouples options

* fixes conflict

* reverts back module

* fixes peer score helper

* Adds send control message to gossipsub router (#2)

* adjusts libp2p version (#3)

* Update go.mod (#4)

* adds app specific rpc handler

* Create ci.yml (#5)

* Create Makefile (#7)

* Revert "Merge branch 'yahya/gossipsub-router-interface'" (#6)

This reverts commit 1c91995.

* Update ci.yml (#9)

* Revert "Merge branch 'master' into yahya/adds-rpc-inspector"

This reverts commit 352d747.

* Revert "Merge remote-tracking branch 'origin/yahya/adds-rpc-inspector' into yahya/adds-rpc-inspector"

This reverts commit 586c5cb.

* Revert "Merge branch 'master' into yahya/adds-rpc-inspector"

This reverts commit 2e13ee8.

* moves app specific inspector to pubsub

* removes option from gossipsub

* moves app specific rpc inspector up

* refactors app specific to return an error

Co-authored-by: libp2p-mgmt-read-write[bot] <104492852+libp2p-mgmt-read-write[bot]@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.

2 participants