-
Notifications
You must be signed in to change notification settings - Fork 80
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
Merit Based Sortition / Permeability of Inferer, Forecaster, Reputer Active Set #548
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…e-hard-actor-limit-permeable-by-updating-emas-of
…he-hard-actor-limit-permeable-by-updating-emas-of
…e-hard-actor-limit-permeable-by-updating-emas-of
…ment-merit-based-sortition
…Inference.Inferer and msg.Sender == MsgInsertWorkerPayload.WorkerDataBundle.Forecast.Forecaster
…o TestMsgInsertWorkerActiveSetBounds
…-based-sortition' into tyler/proto-2204-implement-merit-based-sortition
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺ v ✰ Thanks for creating a PR! You're awesome! ✰ v Please note that maintainers will only review those PRs with a completed PR template. ☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --> ## Purpose of Changes and their Description * Add migration to migrate topics to new v3 emissions structure * Add migration handler that also clears out any data that may have been witnessed NaNs due to insufficient validation bug (already addressed in `dev` branch. ## Link(s) to Ticket(s) or Issue(s) resolved by this PR ## Are these changes tested and documented? - [x] If tested, please describe how. If not, why tests are not needed. - Unit tests provided - [ ] If documented, please describe where. If not, describe why docs are not needed. - [ ] Added to `Unreleased` section of `CHANGELOG.md`? ## Still Left Todo Still need to move new global param to inside the topic + cascade change to migration + throughout.
…ncreaseRewardShareIfMoreParticipants
…thub:allora-network/allora-chain into tyler/proto-2204-implement-merit-based-sortition
…k reward alpha failing test
…s on task reward alpha failing test" This reverts commit 75df6b5.
This was referenced Aug 29, 2024
Merged
relyt29
added a commit
that referenced
this pull request
Aug 30, 2024
closing in favor of #556 |
kpeluso
added a commit
that referenced
this pull request
Aug 30, 2024
…er/Reputer inside Bundle (#554) ## Purpose of Changes and their Description This PR prevents an attack where someone uploading a WorkerPayload or ReputerPayload could upload a payload that has a valid signature upon a bundle, but the inferer, forecaster, or reputer listed as responsible for the data of the bundle, was not actually the person who signed the bundle. E.g. Alice uploads a WorkerPayload that has a signature from alice that is valid. But inside the signed Bundle, the bundle says that Bob said that the inference was 400 - even though Bob didn't sign the actual payload. ## Link(s) to Ticket(s) or Issue(s) resolved by this PR This was discovered independently by me while working on #548 and does not have a ticket. ## Are these changes tested and documented? Our existing test suite at least covers the happy path, when actors are well behaved. This PR adds the following four tests to cover authorization checks: * `TestMsgInsertWorkerPayloadWorkerNotMatchSignature` * `TestMsgInsertWorkerPayloadInfererNotMatchSignature` * `TestMsgInsertWorkerPayloadForecasterNotMatchSignature` * `TestMsgInsertReputerPayloadReputerNotMatchSignature` No documentation changes. This PR has been added to the `Unreleased` section of `CHANGELOG.md`? --------- Co-authored-by: michael <[email protected]> Co-authored-by: Kenny P <[email protected]> Co-authored-by: RedBird96 <[email protected]> Co-authored-by: Kenny <[email protected]>
kpeluso
pushed a commit
that referenced
this pull request
Aug 30, 2024
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose of Changes and their Description
Due to the scaling constraints of running a blockchain, we can't process all of the inferences, forecasts, and reputation bundles given to us for rewards.
At the time of payload acceptance (both worker and reputer), we only accept up to
MaxTopXToReward
inferences, forecasts, and reputations to process and store on chain. We use a skimming the top algorithm: we accept everything up until we hit the max amount permissible, and then any subsequent payloads replace the payload of the actor with the lowest Exponential Moving Average (EMA) score in the existing set we have already accepted. We do not filter at this point who is allowed to submit payloads other than only "top N by score" accepted.We also avoid caculating EMA scores for every actor. Because the calculation of scores requires complete knowledge of the network loss for the epoch, EMA score calculation happens at time of reputer nonce closure (in endblock), upon the final set of payloads submitted at that point.
We order EMA scores into "active" and "passive" sets of inferers, forecasters, and reputers using score EMAs and quantiles.
FindTopNByScoreDesc
sorts the set of actors based on their scores (roughly, their distance from the combined network loss) and only keeps themoduleParams.MaxTopXToReward
actors (whereX
is one of inferers, forecasters, or reputers). In order to smooth out the effect of any particular epoch in the scores of actors, we use Exponential Moving Averages of scores with a new alpha parametermoduleParams.MeritSortitionAlpha
- this replaces the latest scores data structures in the keeper, solatestXScoresByX
becomesxScoreEma
in the keeper.In order to allow for permeability in the active set, i.e. to allow new players without established reputation to get a chance to upload payloads, we take the
topic.ActiveXQuantile
quantile of all the scores (e.g. the 20th percentile), and assign everyone in the passive set the quantile score as their score. This introduces churn in the bottom quantile of the active set, allowing players without established reputation to break into the active set and submit payloads if they are decently good.Bullet point list of changes follows:
active_inferer/forecaster/reputer_quantile
parameter between 0 and 1 for permeability.Reviewers: The most important changes to focus on in this PR occur in:
x/emissions/keeper/actor_utils/losses.go
x/emissions/keeper/msgserver/msg_server_worker_payload.go
x/emissions/keeper/msgserver/msg_server_reputer_payload.go
Link(s) to Ticket(s) or Issue(s) resolved by this PR
PROTO-2204, PROTO-1813, RES-297
This is built upon / replaces #421
Are these changes tested and documented?
In progress:
Unreleased
section ofCHANGELOG.md
?Still Left Todo