-
Notifications
You must be signed in to change notification settings - Fork 822
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
Adding try_state
hook for Treasury
pallet
#1820
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.
Looks very clean, thanks!
Should probably try this before merging on Polkadot and Kusama states, so we know that it all works.
bot fmt |
cargo fmt seems to break markdown lists in comments. I guess I should fix these manually before merging too. |
Yea... lines should wrap at exactly 100 chars - also comments. |
bot fmt |
It works on rococo state ( |
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.
looking good, thanks!
I have added tests for all As for the tests: I really don't like catching errors based on a string value. An enum would be much cleaner, but I guess there's no other way for now? |
Thanks, tests look great 👌
|
* master: (54 commits) Publish `xcm-emulator` crate (#1881) Adding migrations to clean Rococo Gov 1 storage & reserved funds (#1849) Arkworks Elliptic Curve utils overhaul (#1870) Fix typos (#1878) fix: GoAhead signal only set when runtime upgrade is enacted from parachain side (#1176) Refactor staking ledger (#1484) Paired-key Crypto Scheme (#1705) Include polkadot version in artifact path (#1828) add link to rfc-0001 in broker README (#1862) Discard `Executor` (#1855) Macros to use path instead of ident (#1474) Remove clippy clone-double-ref lint noise (#1860) Refactor alliance benchmarks to v2 (#1868) Check executor params coherence (#1774) frame: use derive-impl for beefy and mmr pallets (#1867) sc-consensus-beefy: improve gossip logic (#1852) Adds instance support for composite enums (#1857) Fix links to implementers' guide (#1865) Disabled validators runtime API (#1257) Adding `try_state` hook for `Treasury` pallet (#1820) ...
…ribution * tsv-disabling-backing: (54 commits) Publish `xcm-emulator` crate (#1881) Adding migrations to clean Rococo Gov 1 storage & reserved funds (#1849) Arkworks Elliptic Curve utils overhaul (#1870) Fix typos (#1878) fix: GoAhead signal only set when runtime upgrade is enacted from parachain side (#1176) Refactor staking ledger (#1484) Paired-key Crypto Scheme (#1705) Include polkadot version in artifact path (#1828) add link to rfc-0001 in broker README (#1862) Discard `Executor` (#1855) Macros to use path instead of ident (#1474) Remove clippy clone-double-ref lint noise (#1860) Refactor alliance benchmarks to v2 (#1868) Check executor params coherence (#1774) frame: use derive-impl for beefy and mmr pallets (#1867) sc-consensus-beefy: improve gossip logic (#1852) Adds instance support for composite enums (#1857) Fix links to implementers' guide (#1865) Disabled validators runtime API (#1257) Adding `try_state` hook for `Treasury` pallet (#1820) ...
This PR adds a `try_state` hook for the `Treasury` pallet. Part of paritytech#239.
This PR adds a
try_state
hook for theTreasury
pallet.Part of #239.
The invariants checked are:
ProposalCount
must beProposals
. TheProposalCount
storage value is only increased, but never decreased, whereas individual proposals can be removed from theProposals
storage map.T::ProposalBondMinimum
* Number of proposals with non-zero bondSince the introduction of the dispatchable$\textrm{p.bond} \neq 0 $ .
spend
, a bond is no longer required (bond is set to zero in these cases). However, the old way of proposing using a bond is still available and we can filter for these by looking at proposals withT::ProposalBondMaximum
* Number of proposals with non-zero bondAnalogous to 2., but only relevant when
T::ProposalBondMaximum
is notNone
.ProposalIndex
contained inApprovals
should exist inProposals
. Note, that thisautomatically implies
Approvals.count() <= Proposals.count()
.SpendCount
must beSpends
. Follows the same reasoning as invariant 1.Spends
we should havespend.expire_at > spend.valid_from
.