Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Bound staking storage items #12230

Merged
merged 39 commits into from
Sep 21, 2022

Conversation

Ank4n
Copy link
Contributor

@Ank4n Ank4n commented Sep 9, 2022

This fixes part 1 & 2 of paritytech/polkadot-sdk#255

polkadot companion: paritytech/polkadot#5996

@github-actions github-actions bot added the A3-in_progress Pull request is in progress. No review needed at this stage. label Sep 9, 2022
@@ -20,6 +20,36 @@ use super::*;
use frame_election_provider_support::SortedListProvider;
use frame_support::traits::OnRuntimeUpgrade;

pub mod v11 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruseinov given you past experience, would like your review of this :)

@@ -124,6 +125,18 @@ pub mod pallet {
#[pallet::constant]
type MaxNominations: Get<u32>;

/// `HistoryDepth` stores the number of previous eras for which
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this value is actually used for the first key of a number of double maps as well 🙈

(also, same comment about comments being 100 in width, I used this https://marketplace.visualstudio.com/items?itemName=stkb.rewrap)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see this used only in Claimed Rewards in the Staking Ledger

@Ank4n Ank4n marked this pull request as ready for review September 12, 2022 09:49
@github-actions github-actions bot added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Sep 12, 2022
@Ank4n Ank4n added B7-runtimenoteworthy C1-low PR touches the given topic and has a low impact on builders. D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Sep 12, 2022
@Ank4n Ank4n changed the title Ankan/bound staking storage trivial Bound staking storage items Sep 12, 2022
@command-bot
Copy link

command-bot bot commented Sep 12, 2022

@Ank4n Configuration ("-c" or "--configuration") should be specified exactly once

@Ank4n
Copy link
Contributor Author

Ank4n commented Sep 12, 2022

/cmd queue -c bench-bot $ 1

@command-bot
Copy link

command-bot bot commented Sep 12, 2022

@Ank4n https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1831190 was started for your command "$PIPELINE_SCRIPTS_DIR/bench-bot.sh" 1. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment /cmd cancel 3-35a7698b-8560-4f7c-96b9-9eb7ddf94d85 to cancel this command or /cmd cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Sep 12, 2022

@Ank4n Command "$PIPELINE_SCRIPTS_DIR/bench-bot.sh" 1 has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1831190 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1831190/artifacts/download.

@Ank4n
Copy link
Contributor Author

Ank4n commented Sep 12, 2022

/cmd queue -c bench-bot $ pallet dev pallet_staking

@command-bot
Copy link

command-bot bot commented Sep 12, 2022

@Ank4n https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1831235 was started for your command "$PIPELINE_SCRIPTS_DIR/bench-bot.sh" pallet dev pallet_staking. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment /cmd cancel 4-de45302c-e180-4b2d-a5ee-31552835e13d to cancel this command or /cmd cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Sep 12, 2022

@Ank4n Command "$PIPELINE_SCRIPTS_DIR/bench-bot.sh" pallet dev pallet_staking has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1831235 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1831235/artifacts/download.

@Ank4n
Copy link
Contributor Author

Ank4n commented Sep 12, 2022

/cmd queue -c bench-bot $ pallet dev pallet_staking

@command-bot
Copy link

command-bot bot commented Sep 12, 2022

@Ank4n "$PIPELINE_SCRIPTS_DIR/bench-bot.sh" pallet dev pallet_staking (https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1831648) was cancelled in #12230 (comment)

@Ank4n
Copy link
Contributor Author

Ank4n commented Sep 12, 2022

/cmd cancel 6-ab24f4ab-4142-4773-8a12-624c23b03cf9

@command-bot
Copy link

command-bot bot commented Sep 12, 2022

@Ank4n Command "$PIPELINE_SCRIPTS_DIR/bench-bot.sh" pallet dev pallet_staking has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1831648 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1831648/artifacts/download.

@kianenigma kianenigma added A8-mergeoncegreen and removed A0-please_review Pull request needs code review. labels Sep 20, 2022
@Ank4n
Copy link
Contributor Author

Ank4n commented Sep 21, 2022

bot rebase

@paritytech-processbot
Copy link

Error: Command 'Command { std: "git" "merge" "origin/master" "--no-ff" "--no-edit", kill_on_drop: false }' failed with status Some(1); output: no output

@Ank4n
Copy link
Contributor Author

Ank4n commented Sep 21, 2022

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 4e53bdc into master Sep 21, 2022
@paritytech-processbot paritytech-processbot bot deleted the ankan/bound-staking-storage-trivial branch September 21, 2022 08:57
ordian added a commit that referenced this pull request Sep 23, 2022
* master:
  [Fix] parameter_types! dead code errors (#12340)
  [Feature] Sequential migration execution for try-runtime (#12319)
  bench: Use `_` instead  of `::` in auto-generated file names (#12332)
  Fast Unstake Pallet (#12129)
  Rename anonymous to pure proxy (#12283)
  Migrate remaining old decl_* macros to the new pallet attribute macros (#12271)
  pallet-utility: Disallow none origin (#12321)
  Make automatic storage deposits resistant against changing deposit prices (#12083)
  Format templates and fix `--steps` default value (#12286)
  Bump `wasmtime` to 1.0.0 (#12317)
  Introduce 'intermediate_insert' method to hide implementation details (#12215)
  Bound staking storage items (#12230)
  Use `array-bytes` for All Array/Bytes/Hex Operations (#12190)
  BREAKING: Rename Origin (#12258)
  Use temporary db for benchmarking (#12254)
  rpc: Implement `chainSpec` RPC API (#12261)
  Import target block body during warp sync (#12300)
  Proper naming wrt expectations (#12311)
  [ci] Revert cancel-pipeline job (#12309)
@louismerlin louismerlin added D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Oct 17, 2022
.saturating_add(Weight::from_ref_time(6_687_552 as u64).saturating_mul(v as u64))
// Standard Error: 266_386
.saturating_add(Weight::from_ref_time(6_839_134 as u64).saturating_mul(n as u64))
.saturating_add(T::DbWeight::get().reads(6722 as u64))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just seeing this now 😅
It is either a bug (fixed in #12482) or expected.

vimukthi-git pushed a commit to ComposableFi/composable that referenced this pull request Jan 18, 2023
#### Intro

Upgrade polkadot from v0.9.27 to v0.9.30 as a checkpoint, then to
v0.9.33 (latest version without workspace dependencies)

Require ComposableFi/composable-ibc#176 to be merged
first.

#### Migrations
- v0.9.28
    - [x] paritytech/polkadot#5582
        - Nomination not present in our runtimes
- v0.9.29
    - [x] paritytech/substrate#12095
        - Nomination not present in our runtimes
- v0.9.30
    - [x] paritytech/substrate#12034
        - BagList/Staking not present in our runtimes
    - [x] paritytech/polkadot#5930
        - Nomination/BagList/Staking not present in our runtimes
    - [x] paritytech/substrate#12230
        - Staking not present in our runtimes
    - [x] paritytech/polkadot#5996
        - Staking not present in our runtimes
    - [x] paritytech/substrate#12083
        - Contracts not present in our runtimes

Signed-off-by: cor <[email protected]>
Co-authored-by: cor <[email protected]>
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* replace pallet level unboundedness to individual storage items

* bound structs

* bounding history depth

* defensive error

* use the era history depth from config

* clean up history depth from storage in v11

* keep the name HistoryDepth for the new configuration value

* use u32 for history depth in node runtime

* improve doc comments

* add HistoryDepth to mock runtimes with pallet-staking

* rustfmt

* refactor and doc improve

* apply re-benchmarked weight for staking

* pr feedback improvements

* test for claimed rewards following the expected bounds

* refactor test to calculate first and last reward era programmatically

* verify previous eras cannot be claimed

* add migration v12

* ".git/.scripts/bench-bot.sh" pallet dev pallet_staking

* fix compiler error

* corrupting history depth does not lead to catastrophic issue

* fix new line

* remove unused import

* fmt

* add test to document scenario where history depth is reduced without migration

* fmt

* Update frame/staking/src/lib.rs

Co-authored-by: Kian Paimani <[email protected]>

* Update frame/staking/src/migrations.rs

Co-authored-by: Kian Paimani <[email protected]>

* doc for all storage items bounded by HistoryDepth

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Kian Paimani <[email protected]>

* Update frame/staking/src/tests.rs

Co-authored-by: Kian Paimani <[email protected]>

* pr feedback fixes

* Update frame/staking/src/tests.rs

Co-authored-by: Kian Paimani <[email protected]>

* remove extra checks

* fix merge

* fmt

Co-authored-by: command-bot <>
Co-authored-by: Kian Paimani <[email protected]>
Co-authored-by: kianenigma <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C1-low PR touches the given topic and has a low impact on builders. D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants