-
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
WIP Active topic management #542
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looking for migration handler, its tests, and integration tests (esp what happens when there are more topics than there is space for at a block).
The latest Buf updates on your PR. Results from workflow Buf Linter / buf (pull_request).
|
## Purpose of Changes and their Description This is a refactoring PR with no state changes. It renames testify TestSuites to match with the packages they are actually testing. ## Are these changes tested and documented? These changes are tested by running them / our existing tests This is an internal change that does not require documentation.
@@ -1995,6 +1963,59 @@ func (k Keeper) GetIdsOfActiveTopics(ctx context.Context, pagination *types.Simp | |||
}, nil | |||
} | |||
|
|||
// Returns active topic ids at block using pagination | |||
func (k Keeper) GetIdsActiveTopicAtBlock(ctx context.Context, blockHeight int64, pagination *types.SimpleCursorPaginationRequest) ([]TopicId, *types.SimpleCursorPaginationResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need pagination here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved in #557 + removed GetActiveTopics
Approved changes I have coming in: #557 |
Will also do changelog in a batch to add even more color to all recent PRs including this one |
# v0.4.0 ### Summary Implements fixes for our [June 2024](https://github.com/sherlock-audit/2024-06-allora-judging) Sherlock.xyz audit, including important fixes for determining which topics are considered active. ### Added * [#542](#542) Add scalable management of active topics with associated queries such as `GetActiveTopicsAtBlock` and `GetNextChurningBlockByTopicId` * [#556](#556) Scores now take an exponential moving average of the score rather than using the instantaneous score value from this epoch. * [#564](#564) Topic-epoch-length-aware effective revenue drip to ensure fairness of distribution between topics of longer and shorter epochs. ### Removed * [#542](#542) As part of active topic management, we removed `GetActiveTopics` and other (especially paginated) remnants of an unpartitioned store of active topics. ### Fixed * [#544](#544) Added check against zero-rewards after conversion to cosmosInt * [#547](#547) Improve error handling on InsertPayload, fixed/added tests err handling * [#550](#550) Fix reputer window upper limit * [#555](#555) Refactor: Rename TestSuite names * [#563](#563) Fix of the reputer losses length consistency in scores calculation ### Security * See our recent [June 2024](https://github.com/sherlock-audit/2024-06-allora-judging) security audit for a full description of bugs found during that audit. * [#554](#554) Check Signature on Worker or Reputer Payload Matches Inferer/Forecaster/Reputer inside Bundle --------- Signed-off-by: web3-nodeops <[email protected]> Signed-off-by: Tobi Okedeji <[email protected]> Signed-off-by: Fernando Campos <[email protected]> Signed-off-by: Guilherme Brandão <[email protected]> Co-authored-by: web3-nodeops <[email protected]> Co-authored-by: Guilherme Brandão <[email protected]> Co-authored-by: T <[email protected]> Co-authored-by: Diego C <[email protected]> Co-authored-by: Tobi Okedeji <[email protected]> Co-authored-by: RedBird96 <[email protected]> Co-authored-by: fernandofcampos <[email protected]> Co-authored-by: Elias Rad <[email protected]> Co-authored-by: Tyler <[email protected]> Co-authored-by: michael <[email protected]> Co-authored-by: Guilherme Brandão <[email protected]>
Purpose of Changes and their Description
Currently active topics are in one large keyset that must be parsed in pages in order to find topics.
This is not scalable as the number of topics increases.
Furthermore, there are some minor issues with respect to how topic weight is calculated -- and EMA is often used where the non-EMA may be more appropriate.
This PR attempts to address these concerns by segmenting the list of active topics by block height of the next epoch.
So, there is no longer 1 keyset for all active topics.
Instead, we map block height to a bounded list of topics.
When a topic is (re)activated, we append it to this list but knock off the topic of lowest weight to maintain a bounded set size.
We also introduce a cache for topic weight and lowest topic weight per "active set for a block" to minimize compute.
Link(s) to Ticket(s) or Issue(s) resolved by this PR
https://linear.app/upshot/issue/ORA-2068/patch-active-topic-parsing
Are these changes tested and documented?
Unreleased
section ofCHANGELOG.md
?Still Left Todo
Fill this out if this is a Draft PR so others can help.