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
feat: Add oracle module #392
Merged
Merged
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
Adds the oracle module in the `x` folder. Oracle module is responsible for: - Tally all the votes sent by the validators through the `oracle-feeder` within the voting period and calculate the median. - Select the validators who have voted within the reasonable spread. - Distribute the reward to the selected validators from the reward pool. - Slash the validator whose vote rate is less than the `minValidPerWindow`. - Funds for the reward pool will be transferred through the `fund-reward-pool` command. - Reward pool can be queried through the `reward-pool-balance` command. At the last block of the voting period, the votes of all the valid validators will be tallied and the median will be calculated. Validators who have voted within the reasonable spread will be rewarded. The reward will be decided based on the reward band and their voting power and the validator who has voted less than the minimum valid vote per window will be slashed(jailed). The reward will be distributed from the reward pool account controlled by the oracle module and the funds to the reward pool can be transferred through the `fund-reward-pool` command from any address.
1. Overview This PR improves the keeper test suite layout. It separates helper functions into x/oracle/testutil package, which can be reused (that's a canonical way to do it), also cleanups the test setup stage that runs before each step. I moved a chunk of logic from ABCI handler into keeper to make it testable (the Tally and related ballot logic). Also, implemented a unit test that checks slashing, that improves test coverage for now. 2. Implementation details Rationale for this is to have better test organisation and coverage. There is also to demonstrate a way how to test slashing.
1. Overview - Filter out the exchange rates which have votes below the vote threshold `< 50%`. - Remove the `ValidatorsPowerStoreIterator` and instead use `GetBondedValidatorsByPower`. - Refactor. --------- Co-authored-by: Max Kupriianov <max@kc.vc>
1. Overview Update oracle exchange_rate response to return the exchange rate of an asset in string. Separate exchange_rate and all_exchange_rates queries. 2. Implementation details Created two separate oracle queries exchange_rate, and all_exchange_rates. exchange_rate: Takes the asset symbol as a request and returns its exchange in string. all_exchange_rates: Doesn't take any request and returns exchange rates of all the assets stored on chain in sdk.DecCoins
1. Overview Add more tests in x/types. Change v.BaseDenom to v.SymbolDenom in tally.go. Since we are using symbol everywhere.
Coverage after merging ajeet/oracle into master
Coverage Report
|
xlab
approved these changes
Apr 14, 2023
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.
LGTM!!
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.
Check #379 for description