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

dapp staking v3 - Oracle solution #1197

Merged
merged 28 commits into from
Apr 2, 2024

Conversation

Dinonard
Copy link
Member

@Dinonard Dinonard commented Mar 6, 2024

Pull Request Summary

Introduces oracle and price-aggregation support for Shibuya runtime.
The overall solution consists of 3 runtime parts:

  1. oracle is used to feed native currency values on-chain
  2. membership is used to control who is allowed to submit currency values
  3. price aggregator is used to aggregate and process submitted currency values

Fourth on-chain step can be considered the existing functionality in dApp staking v3 which re-calculates tier config based on the price.

Changes Overview

  • price type has been changed from FixedU64 to FixedU128 for compatibility
    • this is reflected in dapp-staking-v3 and static-price provider pallets, as well as in runtimes
  • temporary pallet oracle-benchmarks has been added to address the missing benchmarks functionality in orml-benchmarks pallet
  • price-aggregator pallet provides support for price aggregation and calculating moving average
  • Astar and Shiden migration logic for static-price-provider has been added
  • full solution integration into Shibuya has been done

Check list

  • static price provided value migration for all runtimes
  • account for weight of OnNewData observer call
  • unit tests
  • benchmark code
  • pallet rustdoc
  • revert spec-version update
  • integration tests

@Dinonard Dinonard added shibuya related to shibuya runtime This PR/Issue is related to the topic “runtime”. labels Mar 6, 2024
@Dinonard Dinonard self-assigned this Mar 6, 2024
@Dinonard
Copy link
Member Author

/bench shibuya-dev oracle_benchmark,pallet_price_aggregator

Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/8326919809.
Please wait for a while.
Branch: feat/dapp-staking-v3-oracle-solution
SHA: 1cbc702

Copy link

Benchmarks have been finished.
You can download artifacts if exists https://github.com/AstarNetwork/Astar/actions/runs/8326919809.

@Dinonard
Copy link
Member Author

/bench shibuya-dev oracle_benchmarks

Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/8328412557.
Please wait for a while.
Branch: feat/dapp-staking-v3-oracle-solution
SHA: 1cbc702

@Dinonard Dinonard added shiden related to shiden runtime astar Related to Astar labels Mar 18, 2024
Copy link

Benchmarks have been finished.
You can download artifacts if exists https://github.com/AstarNetwork/Astar/actions/runs/8328412557.

@Dinonard Dinonard marked this pull request as ready for review March 18, 2024 18:02
runtime/shibuya/src/lib.rs Show resolved Hide resolved
runtime/shibuya/src/lib.rs Outdated Show resolved Hide resolved
ashutoshvarma
ashutoshvarma previously approved these changes Mar 26, 2024
Copy link

Code Coverage

Package Line Rate Branch Rate Health
pallets/dapps-staking/src/pallet 86% 0%
pallets/dynamic-evm-base-fee/src 92% 0%
pallets/block-rewards-hybrid/src 91% 0%
pallets/astar-xcm-benchmarks/src/fungible 100% 0%
chain-extensions/types/xvm/src 0% 0%
pallets/astar-xcm-benchmarks/src 87% 0%
chain-extensions/xvm/src 0% 0%
pallets/unified-accounts/src 85% 0%
pallets/dapp-staking-v3/rpc/runtime-api/src 0% 0%
precompiles/substrate-ecdsa/src 74% 0%
precompiles/dapp-staking-v3/src 90% 0%
precompiles/dispatch-lockdrop/src 86% 0%
pallets/xc-asset-config/src 64% 0%
pallets/collator-selection/src 91% 0%
primitives/src/migrations 0% 0%
chain-extensions/types/unified-accounts/src 0% 0%
pallets/dapps-staking/src 89% 0%
pallets/ethereum-checked/src 79% 0%
precompiles/assets-erc20/src 81% 0%
precompiles/dapps-staking/src 93% 0%
precompiles/xvm/src 74% 0%
chain-extensions/unified-accounts/src 0% 0%
pallets/static-price-provider/src 52% 0%
pallets/inflation/src 83% 0%
precompiles/unified-accounts/src 100% 0%
chain-extensions/pallet-assets/src 56% 0%
chain-extensions/types/assets/src 0% 0%
pallets/dapp-staking-v3/src/test 0% 0%
pallets/oracle-benchmarks/src 0% 0%
pallets/xvm/src 51% 0%
pallets/dapp-staking-v3/src 91% 0%
pallets/astar-xcm-benchmarks/src/generic 100% 0%
pallets/dapp-staking-migration/src 0% 0%
pallets/price-aggregator/src 72% 0%
precompiles/xcm/src 73% 0%
precompiles/dapp-staking-v3/src/test 0% 0%
primitives/src 29% 0%
pallets/dapp-staking-v3/src/benchmarking 99% 0%
precompiles/sr25519/src 64% 0%
primitives/src/xcm 65% 0%
Summary 76% (4416 / 5845) 0% (0 / 0)

Minimum allowed line rate is 50%

@Dinonard
Copy link
Member Author

Dinonard commented Apr 2, 2024

@ashutoshvarma @PierreOssun can you please re-check/approve?

@Dinonard Dinonard linked an issue Apr 2, 2024 that may be closed by this pull request
@Dinonard Dinonard merged commit 4a4165c into master Apr 2, 2024
10 checks passed
@Dinonard Dinonard deleted the feat/dapp-staking-v3-oracle-solution branch April 2, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astar Related to Astar runtime This PR/Issue is related to the topic “runtime”. shibuya related to shibuya shiden related to shiden runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Oracle solution for dApp Staking v3
3 participants