mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Staking and nomination pools runtime API improvements (#13119)
* Adds StakingAPI_nominations_quota and NominationPoolsApi_balanceToPoint and NominationPoolsApi_pointsToBalance runtime APIs * Adds balance param to api_nominations_quota * Update frame/nomination-pools/src/lib.rs Co-authored-by: Anton <anton.kalyaev@gmail.com> * Update frame/nomination-pools/src/lib.rs Co-authored-by: Anton <anton.kalyaev@gmail.com> * Addresses comments - returns zero instead of error in runtime api * Update frame/staking/runtime-api/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/staking/runtime-api/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Addresses PR comments * Update frame/nomination-pools/runtime-api/Cargo.toml Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Fixes points_to_balance logic; adds tests * test comment fix * Update frame/nomination-pools/runtime-api/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/nomination-pools/runtime-api/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Fix block pruning (#13323) * Referendum proposal's metadata (#12568) * referenda metadata * todo comment * remove TODO, update rustdocs * referenda clear_metadata origin signed or root * referenda metadata unit tests * drop schema type for referenda metadata * remove metadata type * referenda metadata benches * note different preimages * metadata for democracy pallet * metadata democracy pallet tests and benches * fix cargo clippy * update docs * ".git/.scripts/bench-bot.sh" pallet dev pallet_democracy * ".git/.scripts/bench-bot.sh" pallet dev pallet_referenda * Update the doc frame/democracy/src/lib.rs Co-authored-by: Roman Useinov <roman.useinov@gmail.com> * Update the doc frame/democracy/src/lib.rs Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com> * reference instead clone for take Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com> * error rename BadMetadata to PreimageNotExist * clear metadata within internal_cancel_referendum fn * remove redundant clone * collapse metadata api into one set_metadata method * fmt * review fixes * not request preimage on set_metadata * rename events and update docs * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_democracy * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_referenda * rename reset_metadata to transfer_metadata --------- Co-authored-by: command-bot <> Co-authored-by: Roman Useinov <roman.useinov@gmail.com> Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com> * Improve test coverage of the `Notifications` protocol (#13033) * Add handler and upgrade tests * Add tests for `behaviour.rs` * Apply review comments * Update dependencies * Apply suggestions from code review Co-authored-by: Dmitry Markin <dmitry@markin.tech> * Apply review comments * Fix clippy * Update mockall * Apply review comment --------- Co-authored-by: Dmitry Markin <dmitry@markin.tech> * refactors runtime API logic to own pallet impl block * removes unrelated changes * Fixes cargo doc comments lint * fixes node cargo * fixes comment * restart ci * restart ci * restart ci --------- Co-authored-by: Anton <anton.kalyaev@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: parity-processbot <> Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> Co-authored-by: Roman Useinov <roman.useinov@gmail.com> Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com> Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com> Co-authored-by: Dmitry Markin <dmitry@markin.tech>
This commit is contained in:
@@ -97,6 +97,7 @@ pallet-session = { version = "4.0.0-dev", features = [ "historical" ], path = ".
|
||||
pallet-session-benchmarking = { version = "4.0.0-dev", path = "../../../frame/session/benchmarking", default-features = false, optional = true }
|
||||
pallet-staking = { version = "4.0.0-dev", default-features = false, path = "../../../frame/staking" }
|
||||
pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false, path = "../../../frame/staking/reward-curve" }
|
||||
pallet-staking-runtime-api = { version = "4.0.0-dev", default-features = false, path = "../../../frame/staking/runtime-api" }
|
||||
pallet-state-trie-migration = { version = "4.0.0-dev", default-features = false, path = "../../../frame/state-trie-migration" }
|
||||
pallet-scheduler = { version = "4.0.0-dev", default-features = false, path = "../../../frame/scheduler" }
|
||||
pallet-society = { version = "4.0.0-dev", default-features = false, path = "../../../frame/society" }
|
||||
@@ -175,6 +176,7 @@ std = [
|
||||
"sp-runtime/std",
|
||||
"sp-staking/std",
|
||||
"pallet-staking/std",
|
||||
"pallet-staking-runtime-api/std",
|
||||
"pallet-state-trie-migration/std",
|
||||
"sp-session/std",
|
||||
"pallet-sudo/std",
|
||||
|
||||
@@ -1986,8 +1986,22 @@ impl_runtime_apis! {
|
||||
}
|
||||
|
||||
impl pallet_nomination_pools_runtime_api::NominationPoolsApi<Block, AccountId, Balance> for Runtime {
|
||||
fn pending_rewards(member_account: AccountId) -> Balance {
|
||||
NominationPools::pending_rewards(member_account).unwrap_or_default()
|
||||
fn pending_rewards(who: AccountId) -> Balance {
|
||||
NominationPools::api_pending_rewards(who).unwrap_or_default()
|
||||
}
|
||||
|
||||
fn points_to_balance(pool_id: pallet_nomination_pools::PoolId, points: Balance) -> Balance {
|
||||
NominationPools::api_points_to_balance(pool_id, points)
|
||||
}
|
||||
|
||||
fn balance_to_points(pool_id: pallet_nomination_pools::PoolId, new_funds: Balance) -> Balance {
|
||||
NominationPools::api_balance_to_points(pool_id, new_funds)
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_staking_runtime_api::StakingApi<Block, Balance> for Runtime {
|
||||
fn nominations_quota(balance: Balance) -> u32 {
|
||||
Staking::api_nominations_quota(balance)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user