diff --git a/docs/api/runtime-calls.md b/docs/api/runtime-calls.md index 5adde95a843e80509d6e673d0b10f95218751734..38dcb37ccf65a78393fa4f00d38ce8506bd2c561 100644 --- a/docs/api/runtime-calls.md +++ b/docs/api/runtime-calls.md @@ -12,7 +12,7 @@ Calls are categorized according to the dispatch origin they require: We only document user calls below. -There are **63** user calls from **17** pallets. +There are **65** user calls from **17** pallets. ## Account - 1 @@ -20,7 +20,7 @@ There are **63** user calls from **17** pallets. <details><summary><code>unlink_identity()</code></summary> -Taking 0.0109 % of a block. +Taking 0.0106 % of a block. ```rust ``` @@ -36,7 +36,7 @@ Unlink the identity associated with the account. <details><summary><code>transfer_allow_death(dest, value)</code></summary> -Taking 0.0194 % of a block. +Taking 0.0186 % of a block. ```rust dest: AccountIdLookupOf<T> @@ -58,7 +58,7 @@ The dispatch origin for this call must be `Signed` by the transactor. <details><summary><code>transfer_keep_alive(dest, value)</code></summary> -Taking 0.0122 % of a block. +Taking 0.0119 % of a block. ```rust dest: AccountIdLookupOf<T> @@ -79,7 +79,7 @@ kill the origin account. <details><summary><code>transfer_all(dest, keep_alive)</code></summary> -Taking 0.0126 % of a block. +Taking 0.0122 % of a block. ```rust dest: AccountIdLookupOf<T> @@ -111,7 +111,7 @@ The dispatch origin of this call must be Signed. <details><summary><code>create_oneshot_account(dest, value)</code></summary> -Taking 0.0117 % of a block. +Taking 0.0115 % of a block. ```rust dest: <T::Lookup as StaticLookup>::Source @@ -132,7 +132,7 @@ Origin account is kept alive. <details><summary><code>consume_oneshot_account(block_height, dest)</code></summary> -Taking 0.0195 % of a block. +Taking 0.0182 % of a block. ```rust block_height: BlockNumberFor<T> @@ -152,7 +152,7 @@ Consume a oneshot account and transfer its balance to an account <details><summary><code>consume_oneshot_account_with_remaining(block_height, dest, remaining_to, balance)</code></summary> -Taking 0.0265 % of a block. +Taking 0.0246 % of a block. ```rust block_height: BlockNumberFor<T> @@ -181,7 +181,7 @@ and the remaining amount to another account. <details><summary><code>invite_smith(receiver)</code></summary> -Taking 0.024 % of a block. +Taking 0.0214 % of a block. ```rust receiver: T::IdtyIndex @@ -196,7 +196,7 @@ Invite a member of the Web of Trust to attempt becoming a Smith. <details><summary><code>accept_invitation()</code></summary> -Taking 0.0126 % of a block. +Taking 0.0119 % of a block. ```rust ``` @@ -210,7 +210,7 @@ Accept an invitation to become a Smith (must have been invited first). <details><summary><code>certify_smith(receiver)</code></summary> -Taking 0.0279 % of a block. +Taking 0.0255 % of a block. ```rust receiver: T::IdtyIndex @@ -227,7 +227,7 @@ Certify an invited Smith, which can lead the certified to become a Smith. <details><summary><code>go_offline()</code></summary> -Taking 0.0172 % of a block. +Taking 0.0152 % of a block. ```rust ``` @@ -241,7 +241,7 @@ Request to leave the set of validators two sessions later. <details><summary><code>go_online()</code></summary> -Taking 0.0199 % of a block. +Taking 0.0172 % of a block. ```rust ``` @@ -255,7 +255,7 @@ Request to join the set of validators two sessions later. <details><summary><code>set_session_keys(keys)</code></summary> -Taking 0.0256 % of a block. +Taking 0.0225 % of a block. ```rust keys: T::Keys @@ -272,7 +272,7 @@ Declare new session keys to replace current ones. <details><summary><code>note_preimage(bytes)</code></summary> -Taking 0.2845 % of a block. +Taking 0.2846 % of a block. ```rust bytes: Vec<u8> @@ -290,7 +290,7 @@ the preimage. Otherwise, a deposit is taken proportional to the size of the prei <details><summary><code>unnote_preimage(hash)</code></summary> -Taking 0.0181 % of a block. +Taking 0.0171 % of a block. ```rust hash: T::Hash @@ -310,7 +310,7 @@ If `len` is provided, then it will be a much cheaper operation. <details><summary><code>request_preimage(hash)</code></summary> -Taking 0.0128 % of a block. +Taking 0.0121 % of a block. ```rust hash: T::Hash @@ -328,7 +328,7 @@ a user may have paid, and take the control of the preimage out of their hands. <details><summary><code>unrequest_preimage(hash)</code></summary> -Taking 0.018 % of a block. +Taking 0.0171 % of a block. ```rust hash: T::Hash @@ -345,7 +345,7 @@ NOTE: THIS MUST NOT BE CALLED ON `hash` MORE TIMES THAN `request_preimage`. <details><summary><code>ensure_updated(hashes)</code></summary> -Taking 18.8992 % of a block. +Taking 17.5344 % of a block. ```rust hashes: Vec<T::Hash> @@ -364,7 +364,7 @@ The caller pays no fee if at least 90% of pre-images were successfully updated. <details><summary><code>execute(proposal, length_bound)</code></summary> -Taking 0.0061 % of a block. +Taking 0.006 % of a block. ```rust proposal: Box<<T as Config<I>>::Proposal> @@ -418,7 +418,7 @@ or put up for voting. <details><summary><code>vote(proposal, index, approve)</code></summary> -Taking 0.0128 % of a block. +Taking 0.0121 % of a block. ```rust proposal: T::Hash @@ -480,13 +480,57 @@ proposal. - `P1` is the complexity of `proposal` preimage. - `P2` is proposal-count (code-bounded) +### kill - 7 + +<details><summary><code>kill(proposal_hash)</code></summary> + +Taking 0.0229 % of a block. + +```rust +proposal_hash: T::Hash +``` +</details> + + + +Disapprove the proposal and burn the cost held for storing this proposal. + +Parameters: +- `origin`: must be the `KillOrigin`. +- `proposal_hash`: The hash of the proposal that should be killed. + +Emits `Killed` and `ProposalCostBurned` if any cost was held for a given proposal. + +### release_proposal_cost - 8 + +<details><summary><code>release_proposal_cost(proposal_hash)</code></summary> + +Taking 0.0066 % of a block. + +```rust +proposal_hash: T::Hash +``` +</details> + + + +Release the cost held for storing a proposal once the given proposal is completed. + +If there is no associated cost for the given proposal, this call will have no effect. + +Parameters: +- `origin`: must be `Signed` or `Root`. +- `proposal_hash`: The hash of the proposal. + +Emits `ProposalCostReleased` if any cost held for a given proposal. + ## UniversalDividend - 30 ### claim_uds - 0 <details><summary><code>claim_uds()</code></summary> -Taking 0.0219 % of a block. +Taking 0.02 % of a block. ```rust ``` @@ -500,7 +544,7 @@ Claim Universal Dividends. <details><summary><code>transfer_ud(dest, value)</code></summary> -Taking 0.0207 % of a block. +Taking 0.0194 % of a block. ```rust dest: <T::Lookup as StaticLookup>::Source @@ -516,7 +560,7 @@ Transfer some liquid free balance to another account, in milliUD. <details><summary><code>transfer_ud_keep_alive(dest, value)</code></summary> -Taking 0.0134 % of a block. +Taking 0.0129 % of a block. ```rust dest: <T::Lookup as StaticLookup>::Source @@ -534,7 +578,7 @@ Transfer some liquid free balance to another account in milliUD and keep the acc <details><summary><code>create_identity(owner_key)</code></summary> -Taking 0.0843 % of a block. +Taking 0.0776 % of a block. ```rust owner_key: T::AccountId @@ -553,7 +597,7 @@ The origin must be allowed to create an identity. <details><summary><code>confirm_identity(idty_name)</code></summary> -Taking 0.0322 % of a block. +Taking 0.0298 % of a block. ```rust idty_name: IdtyName @@ -572,7 +616,7 @@ The identity must have been created using `create_identity` before it can be con <details><summary><code>change_owner_key(new_key, new_key_sig)</code></summary> -Taking 0.0421 % of a block. +Taking 0.0388 % of a block. ```rust new_key: T::AccountId @@ -594,7 +638,7 @@ The origin should be the old identity owner key. <details><summary><code>revoke_identity(idty_index, revocation_key, revocation_sig)</code></summary> -Taking 0.0392 % of a block. +Taking 0.0365 % of a block. ```rust idty_index: T::IdtyIndex @@ -618,7 +662,7 @@ Any signed origin can execute this call. <details><summary><code>revoke_identity_legacy(revocation_document)</code></summary> -Taking 0.0392 % of a block. +Taking 0.04 % of a block. ```rust revocation_document: Vec<u8> @@ -637,7 +681,7 @@ Any signed origin can execute this call. <details><summary><code>link_account(account_id, payload_sig)</code></summary> -Taking 0.0155 % of a block. +Taking 0.0144 % of a block. ```rust account_id: T::AccountId @@ -662,7 +706,7 @@ identity to sign the operation. <details><summary><code>add_cert(receiver)</code></summary> -Taking 0.0357 % of a block. +Taking 0.0324 % of a block. ```rust receiver: T::IdtyIndex @@ -677,7 +721,7 @@ Add a new certification. <details><summary><code>renew_cert(receiver)</code></summary> -Taking 0.0295 % of a block. +Taking 0.0266 % of a block. ```rust receiver: T::IdtyIndex @@ -694,7 +738,7 @@ Renew an existing certification. <details><summary><code>request_distance_evaluation()</code></summary> -Taking 0.0393 % of a block. +Taking 0.0351 % of a block. ```rust ``` @@ -712,7 +756,7 @@ evaluation will result in slashing for the caller. <details><summary><code>request_distance_evaluation_for(target)</code></summary> -Taking 0.0404 % of a block. +Taking 0.036 % of a block. ```rust target: T::IdtyIndex @@ -806,7 +850,7 @@ The dispatch origin for this call must be _Signed_. <details><summary><code>as_multi_threshold_1(other_signatories, call)</code></summary> -Taking 0.0048 % of a block. +Taking 0.0051 % of a block. ```rust other_signatories: Vec<T::AccountId> @@ -938,7 +982,7 @@ NOTE: If this is the final approval, you will want to use `as_multi` instead. <details><summary><code>cancel_as_multi(threshold, other_signatories, timepoint, call_hash)</code></summary> -Taking 0.0121 % of a block. +Taking 0.0117 % of a block. ```rust threshold: u16 @@ -978,7 +1022,7 @@ transaction for this dispatch. <details><summary><code>request(randomness_type, salt)</code></summary> -Taking 0.0401 % of a block. +Taking 0.0367 % of a block. ```rust randomness_type: RandomnessType @@ -996,7 +1040,7 @@ Request randomness. <details><summary><code>proxy(real, force_proxy_type, call)</code></summary> -Taking 0.0062 % of a block. +Taking 0.0061 % of a block. ```rust real: AccountIdLookupOf<T> @@ -1021,7 +1065,7 @@ Parameters: <details><summary><code>add_proxy(delegate, proxy_type, delay)</code></summary> -Taking 0.0118 % of a block. +Taking 0.0114 % of a block. ```rust delegate: AccountIdLookupOf<T> @@ -1046,7 +1090,7 @@ zero. <details><summary><code>remove_proxy(delegate, proxy_type, delay)</code></summary> -Taking 0.0118 % of a block. +Taking 0.0114 % of a block. ```rust delegate: AccountIdLookupOf<T> @@ -1069,7 +1113,7 @@ Parameters: <details><summary><code>remove_proxies()</code></summary> -Taking 0.0117 % of a block. +Taking 0.0113 % of a block. ```rust ``` @@ -1088,7 +1132,7 @@ the unreserved fees will be inaccessible. **All access to this account will be l <details><summary><code>create_pure(proxy_type, delay, index)</code></summary> -Taking 0.0118 % of a block. +Taking 0.0114 % of a block. ```rust proxy_type: T::ProxyType @@ -1122,7 +1166,7 @@ Fails if there are insufficient funds to pay for deposit. <details><summary><code>kill_pure(spawner, proxy_type, index, height, ext_index)</code></summary> -Taking 0.0117 % of a block. +Taking 0.0114 % of a block. ```rust spawner: AccountIdLookupOf<T> @@ -1156,7 +1200,7 @@ account whose `pure` call has corresponding parameters. <details><summary><code>announce(real, call_hash)</code></summary> -Taking 0.0197 % of a block. +Taking 0.0185 % of a block. ```rust real: AccountIdLookupOf<T> @@ -1186,7 +1230,7 @@ Parameters: <details><summary><code>remove_announcement(real, call_hash)</code></summary> -Taking 0.0182 % of a block. +Taking 0.0173 % of a block. ```rust real: AccountIdLookupOf<T> @@ -1211,7 +1255,7 @@ Parameters: <details><summary><code>reject_announcement(delegate, call_hash)</code></summary> -Taking 0.0182 % of a block. +Taking 0.0173 % of a block. ```rust delegate: AccountIdLookupOf<T> @@ -1236,7 +1280,7 @@ Parameters: <details><summary><code>proxy_announced(delegate, real, force_proxy_type, call)</code></summary> -Taking 0.0198 % of a block. +Taking 0.0187 % of a block. ```rust delegate: AccountIdLookupOf<T> @@ -1266,7 +1310,7 @@ Parameters: <details><summary><code>batch(calls)</code></summary> -Taking 0.1076 % of a block. +Taking 0.1152 % of a block. ```rust calls: Vec<<T as Config>::RuntimeCall> @@ -1298,7 +1342,7 @@ event is deposited. <details><summary><code>as_derivative(index, call)</code></summary> -Taking 0.0046 % of a block. +Taking 0.0048 % of a block. ```rust index: u16 @@ -1326,7 +1370,7 @@ The dispatch origin for this call must be _Signed_. <details><summary><code>batch_all(calls)</code></summary> -Taking 0.1148 % of a block. +Taking 0.123 % of a block. ```rust calls: Vec<<T as Config>::RuntimeCall> @@ -1353,7 +1397,7 @@ includes bypassing `frame_system::Config::BaseCallFilter`). <details><summary><code>force_batch(calls)</code></summary> -Taking 0.1074 % of a block. +Taking 0.1152 % of a block. ```rust calls: Vec<<T as Config>::RuntimeCall> @@ -1382,7 +1426,7 @@ includes bypassing `frame_system::Config::BaseCallFilter`). <details><summary><code>spend_local(amount, beneficiary)</code></summary> -Taking 0.0044 % of a block. +Taking 0.0046 % of a block. ```rust amount: BalanceOf<T, I> @@ -1449,7 +1493,7 @@ The original deposit will no longer be returned. <details><summary><code>spend(asset_kind, amount, beneficiary, valid_from)</code></summary> -Taking 0.0044 % of a block. +Taking 0.0046 % of a block. ```rust asset_kind: Box<T::AssetKind> @@ -1492,7 +1536,7 @@ Emits [`Event::AssetSpendApproved`] if successful. <details><summary><code>payout(index)</code></summary> -Taking 0.0057 % of a block. +Taking 0.0056 % of a block. ```rust index: SpendIndex @@ -1525,7 +1569,7 @@ Emits [`Event::Paid`] if successful. <details><summary><code>check_status(index)</code></summary> -Taking 0.0057 % of a block. +Taking 0.0056 % of a block. ```rust index: SpendIndex diff --git a/docs/api/runtime-constants.md b/docs/api/runtime-constants.md new file mode 100644 index 0000000000000000000000000000000000000000..b7810d69b1f50157ba9825032d782592196936d6 --- /dev/null +++ b/docs/api/runtime-constants.md @@ -0,0 +1,1280 @@ +# Runtime Constant + +There are **69** constants from **35** pallets. + +<ul> + +<li>System - 0 +<ul> + +<li> +<details> +<summary> +<code>BlockWeights</code> +</summary> + Block & extrinsics weights: base values and limits. + +```rust +value: frame_system::limits::BlockWeights({ base_block: { ref_time: 431614000, proof_size: 0 }, max_block: { ref_time: 2000000000000, proof_size: 18446744073709551615 }, per_class: { normal: { base_extrinsic: { ref_time: 108157000, proof_size: 0 }, max_extrinsic: Some ({ ref_time: 1299891843000, proof_size: 11990383647911208550 }), max_total: Some ({ ref_time: 1500000000000, proof_size: 13835058055282163711 }), reserved: Some ({ ref_time: 0, proof_size: 0 }) }, operational: { base_extrinsic: { ref_time: 108157000, proof_size: 0 }, max_extrinsic: Some ({ ref_time: 1799891843000, proof_size: 16602069666338596454 }), max_total: Some ({ ref_time: 2000000000000, proof_size: 18446744073709551615 }), reserved: Some ({ ref_time: 500000000000, proof_size: 4611686018427387904 }) }, mandatory: { base_extrinsic: { ref_time: 108157000, proof_size: 0 }, max_extrinsic: None (), max_total: None (), reserved: None () } } }) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>BlockLength</code> +</summary> + The maximum length of a block (in bytes). + +```rust +value: frame_system::limits::BlockLength({ max: { normal: 3932160, operational: 5242880, mandatory: 5242880 } }) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>BlockHashCount</code> +</summary> + Maximum number of block number to block hash mappings to keep (oldest pruned first). + +```rust +value: U32(2400) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>DbWeight</code> +</summary> + The weight of runtime database operations the runtime can invoke. + +```rust +value: sp_weights::RuntimeDbWeight({ read: 14314000, write: 99642000 }) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Version</code> +</summary> + Get the chain's in-code version. + +```rust +value: sp_version::RuntimeVersion({ spec_name: ("gdev"), impl_name: ("duniter-gdev"), authoring_version: 1, spec_version: 800, impl_version: 1, apis: ((((104, 122, 212, 74, 211, 127, 3, 194), 1), ((203, 202, 37, 227, 159, 20, 35, 135), 2), ((223, 106, 203, 104, 153, 7, 96, 155), 5), ((55, 227, 151, 252, 124, 145, 245, 228), 2), ((64, 254, 58, 212, 1, 248, 149, 154), 6), ((210, 188, 152, 151, 238, 208, 143, 21), 3), ((247, 139, 39, 139, 229, 63, 69, 76), 2), ((171, 60, 5, 114, 41, 31, 235, 139), 1), ((237, 153, 197, 172, 178, 94, 237, 245), 3), ((188, 157, 137, 144, 79, 91, 146, 63), 1), ((55, 200, 187, 19, 80, 169, 162, 168), 4), ((251, 197, 119, 185, 215, 71, 239, 214), 1))), transaction_version: 1, system_version: 1 }) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>SS58Prefix</code> +</summary> + The designated SS58 prefix of this chain. + + This replaces the "ss58Format" property declared in the chain spec. Reason is + that the runtime should know about the prefix in order to make use of it as + an identifier of the chain. + +```rust +value: U16(42) +``` + +</details> +</li> + +</ul> +</li> + +<li>Account - 1 +<ul> + +</ul> +</li> + +<li>Scheduler - 2 +<ul> + +<li> +<details> +<summary> +<code>MaximumWeight</code> +</summary> + The maximum weight that may be scheduled per block for any dispatchables. + +```rust +value: sp_weights::weight_v2::Weight({ ref_time: 1600000000000, proof_size: 14757395258967641292 }) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxScheduledPerBlock</code> +</summary> + The maximum number of scheduled calls in the queue for a single block. + + NOTE: + + Dependent pallets' benchmarks might require a higher limit for the setting. Set a + higher limit under `runtime-benchmarks` feature. + +```rust +value: U32(50) +``` + +</details> +</li> + +</ul> +</li> + +<li>Babe - 3 +<ul> + +<li> +<details> +<summary> +<code>EpochDuration</code> +</summary> + The amount of time, in slots, that each epoch should last. + NOTE: Currently it is not possible to change the epoch duration after + the chain has started. Attempting to do so will brick block production. + +```rust +value: U64(30) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ExpectedBlockTime</code> +</summary> + The expected average block time at which BABE should be creating + blocks. Since BABE is probabilistic it is not trivial to figure out + what the expected average block time should be based on the slot + duration and the security parameter `c` (where `1 - c` represents + the probability of a slot being empty). + +```rust +value: U64(6000) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxAuthorities</code> +</summary> + Max number of authorities allowed + +```rust +value: U32(32) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxNominators</code> +</summary> + The maximum number of nominators for each validator. + +```rust +value: U32(64) +``` + +</details> +</li> + +</ul> +</li> + +<li>Timestamp - 4 +<ul> + +<li> +<details> +<summary> +<code>MinimumPeriod</code> +</summary> + The minimum period between blocks. + + Be aware that this is different to the *expected* period that the block production + apparatus provides. Your chosen consensus system will generally work with this to + determine a sensible block time. For example, in the Aura pallet it will be double this + period on default settings. + +```rust +value: U64(3000) +``` + +</details> +</li> + +</ul> +</li> + +<li>Parameters - 5 +<ul> + +</ul> +</li> + +<li>Balances - 6 +<ul> + +<li> +<details> +<summary> +<code>ExistentialDeposit</code> +</summary> + The minimum amount required to keep an account open. MUST BE GREATER THAN ZERO! + + If you *really* need it to be zero, you can enable the feature `insecure_zero_ed` for + this pallet. However, you do so at your own risk: this will open up a major DoS vector. + In case you have multiple sources of provider references, you may also get unexpected + behaviour if you set this to zero. + + Bottom line: Do yourself a favour and make it at least one! + +```rust +value: U64(100) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxLocks</code> +</summary> + The maximum number of locks that should exist on an account. + Not strictly enforced, but used for weight estimation. + + Use of locks is deprecated in favour of freezes. See `https://github.com/paritytech/substrate/pull/12951/` + +```rust +value: U32(50) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxReserves</code> +</summary> + The maximum number of named reserves that can exist on an account. + + Use of reserves is deprecated in favour of holds. See `https://github.com/paritytech/substrate/pull/12951/` + +```rust +value: U32(5) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxFreezes</code> +</summary> + The maximum number of individual freeze locks that can exist on an account at any time. + +```rust +value: U32(0) +``` + +</details> +</li> + +</ul> +</li> + +<li>TransactionPayment - 32 +<ul> + +<li> +<details> +<summary> +<code>OperationalFeeMultiplier</code> +</summary> + A fee multiplier for `Operational` extrinsics to compute "virtual tip" to boost their + `priority` + + This value is multiplied by the `final_fee` to obtain a "virtual tip" that is later + added to a tip component in regular `priority` calculations. + It means that a `Normal` transaction can front-run a similarly-sized `Operational` + extrinsic (with no tip), by including a tip value greater than the virtual tip. + + ```rust,ignore + // For `Normal` + let priority = priority_calc(tip); + + // For `Operational` + let virtual_tip = (inclusion_fee + tip) * OperationalFeeMultiplier; + let priority = priority_calc(tip + virtual_tip); + ``` + + Note that since we use `final_fee` the multiplier applies also to the regular `tip` + sent with the transaction. So, not only does the transaction get a priority bump based + on the `inclusion_fee`, but we also amplify the impact of tips applied to `Operational` + transactions. + +```rust +value: U8(5) +``` + +</details> +</li> + +</ul> +</li> + +<li>OneshotAccount - 7 +<ul> + +</ul> +</li> + +<li>Quota - 66 +<ul> + +<li> +<details> +<summary> +<code>RefundAccount</code> +</summary> + Account used to refund fees. + +```rust +value: sp_core::crypto::AccountId32(((109, 111, 100, 108, 112, 121, 47, 116, 114, 115, 114, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))) +``` + +</details> +</li> + +</ul> +</li> + +<li>SmithMembers - 10 +<ul> + +<li> +<details> +<summary> +<code>MaxByIssuer</code> +</summary> + Maximum number of active certifications per issuer. + +```rust +value: U32(8) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MinCertForMembership</code> +</summary> + Minimum number of certifications required to become a Smith. + +```rust +value: U32(2) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>SmithInactivityMaxDuration</code> +</summary> + Maximum duration of inactivity allowed before a Smith is removed. + +```rust +value: U32(48) +``` + +</details> +</li> + +</ul> +</li> + +<li>AuthorityMembers - 11 +<ul> + +<li> +<details> +<summary> +<code>MaxAuthorities</code> +</summary> + Maximum number of authorities allowed. + +```rust +value: U32(32) +``` + +</details> +</li> + +</ul> +</li> + +<li>Authorship - 12 +<ul> + +</ul> +</li> + +<li>Offences - 13 +<ul> + +</ul> +</li> + +<li>Historical - 14 +<ul> + +</ul> +</li> + +<li>Session - 15 +<ul> + +</ul> +</li> + +<li>Grandpa - 16 +<ul> + +<li> +<details> +<summary> +<code>MaxAuthorities</code> +</summary> + Max Authorities in use + +```rust +value: U32(32) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxNominators</code> +</summary> + The maximum number of nominators for each validator. + +```rust +value: U32(64) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxSetIdSessionEntries</code> +</summary> + The maximum number of entries to keep in the set id to session index mapping. + + Since the `SetIdSession` map is only used for validating equivocations this + value should relate to the bonding duration of whatever staking system is + being used (if any). If equivocation handling is not enabled then this value + can be zero. + +```rust +value: U64(1000) +``` + +</details> +</li> + +</ul> +</li> + +<li>ImOnline - 17 +<ul> + +<li> +<details> +<summary> +<code>UnsignedPriority</code> +</summary> + A configuration for base priority of unsigned transactions. + + This is exposed so that it can be tuned for particular runtime, when + multiple pallets send unsigned transactions. + +```rust +value: U64(18446744073709551615) +``` + +</details> +</li> + +</ul> +</li> + +<li>AuthorityDiscovery - 18 +<ul> + +</ul> +</li> + +<li>Sudo - 20 +<ul> + +</ul> +</li> + +<li>UpgradeOrigin - 21 +<ul> + +</ul> +</li> + +<li>Preimage - 22 +<ul> + +</ul> +</li> + +<li>TechnicalCommittee - 23 +<ul> + +<li> +<details> +<summary> +<code>MaxProposalWeight</code> +</summary> + The maximum weight of a dispatch call that can be proposed and executed. + +```rust +value: sp_weights::weight_v2::Weight({ ref_time: 1000000000000, proof_size: 9223372036854775807 }) +``` + +</details> +</li> + +</ul> +</li> + +<li>UniversalDividend - 30 +<ul> + +<li> +<details> +<summary> +<code>MaxPastReeval</code> +</summary> + Maximum number of past UD revaluations to keep in storage. + +```rust +value: U32(160) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>SquareMoneyGrowthRate</code> +</summary> + Square of the money growth rate per UD reevaluation period. + +```rust +value: sp_arithmetic::per_things::Perbill((2381440)) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>UdCreationPeriod</code> +</summary> + Universal dividend creation period in milliseconds. + +```rust +value: U64(60000) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>UdReevalPeriod</code> +</summary> + Universal dividend reevaluation period in milliseconds. + +```rust +value: U64(1200000) +``` + +</details> +</li> + +</ul> +</li> + +<li>Wot - 40 +<ul> + +<li> +<details> +<summary> +<code>FirstIssuableOn</code> +</summary> + The block number from which the first certification can be issued. + +```rust +value: U32(20) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MinCertForMembership</code> +</summary> + The minimum number of certifications required for membership eligibility. + +```rust +value: U32(2) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MinCertForCreateIdtyRight</code> +</summary> + The minimum number of certifications required to create an identity. + +```rust +value: U32(2) +``` + +</details> +</li> + +</ul> +</li> + +<li>Identity - 41 +<ul> + +<li> +<details> +<summary> +<code>ConfirmPeriod</code> +</summary> + The period during which the owner can confirm the new identity. + +```rust +value: U32(40) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ValidationPeriod</code> +</summary> + The period during which the identity has to be validated to become a member. + +```rust +value: U32(876600) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>AutorevocationPeriod</code> +</summary> + The period before which an identity that lost membership is automatically revoked. + +```rust +value: U32(438300) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>DeletionPeriod</code> +</summary> + The period after which a revoked identity is removed and the keys are freed. + +```rust +value: U32(438300) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ChangeOwnerKeyPeriod</code> +</summary> + The minimum duration between two owner key changes to prevent identity theft. + +```rust +value: U32(100800) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>IdtyCreationPeriod</code> +</summary> + The minimum duration between the creation of two identities by the same creator. + Should be greater than or equal to the certification period defined in the certification pallet. + +```rust +value: U32(50) +``` + +</details> +</li> + +</ul> +</li> + +<li>Membership - 42 +<ul> + +<li> +<details> +<summary> +<code>MembershipPeriod</code> +</summary> + Maximum lifespan of a single membership (in number of blocks). + +```rust +value: U32(1000) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MembershipRenewalPeriod</code> +</summary> + Minimum delay to wait before renewing membership, i.e., asking for distance evaluation. + +```rust +value: U32(1000) +``` + +</details> +</li> + +</ul> +</li> + +<li>Certification - 43 +<ul> + +<li> +<details> +<summary> +<code>CertPeriod</code> +</summary> + The minimum duration (in blocks) between two certifications issued by the same issuer. + +```rust +value: U32(15) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxByIssuer</code> +</summary> + The maximum number of active certifications that can be issued by a single issuer. + +```rust +value: U32(10) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MinReceivedCertToBeAbleToIssueCert</code> +</summary> + The minimum number of certifications received that an identity must have + to be allowed to issue a certification. + +```rust +value: U32(2) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ValidityPeriod</code> +</summary> + The duration (in blocks) for which a certification remains valid. + +```rust +value: U32(1000) +``` + +</details> +</li> + +</ul> +</li> + +<li>Distance - 44 +<ul> + +<li> +<details> +<summary> +<code>EvaluationPrice</code> +</summary> + The amount reserved during evaluation. + +```rust +value: U64(1000) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>EvaluationPeriod</code> +</summary> + The evaluation period in blocks. + Since the evaluation uses 3 pools, the total evaluation time will be 3 * EvaluationPeriod. + +```rust +value: U32(7) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxRefereeDistance</code> +</summary> + The maximum distance used to define a referee's accessibility. + This value is not used by the runtime but is needed by the client distance oracle. + +```rust +value: U32(5) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MinAccessibleReferees</code> +</summary> + The minimum ratio of accessible referees required. + +```rust +value: sp_arithmetic::per_things::Perbill((800000000)) +``` + +</details> +</li> + +</ul> +</li> + +<li>AtomicSwap - 50 +<ul> + +<li> +<details> +<summary> +<code>ProofLimit</code> +</summary> + Limit of proof size. + + Atomic swap is only atomic if once the proof is revealed, both parties can submit the + proofs on-chain. If A is the one that generates the proof, then it requires that either: + - A's blockchain has the same proof length limit as B's blockchain. + - Or A's blockchain has shorter proof length limit as B's blockchain. + + If B sees A is on a blockchain with larger proof length limit, then it should kindly + refuse to accept the atomic swap request if A generates the proof, and asks that B + generates the proof instead. + +```rust +value: U32(1024) +``` + +</details> +</li> + +</ul> +</li> + +<li>Multisig - 51 +<ul> + +<li> +<details> +<summary> +<code>DepositBase</code> +</summary> + The base amount of currency needed to reserve for creating a multisig execution or to + store a dispatch call for later. + + This is held for an additional storage item whose value size is + `4 + sizeof((BlockNumber, Balance, AccountId))` bytes and whose key size is + `32 + sizeof(AccountId)` bytes. + +```rust +value: U64(100) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>DepositFactor</code> +</summary> + The amount of currency needed per unit threshold when creating a multisig execution. + + This is held for adding 32 bytes more into a pre-existing storage value. + +```rust +value: U64(32) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxSignatories</code> +</summary> + The maximum amount of signatories allowed in the multisig. + +```rust +value: U32(10) +``` + +</details> +</li> + +</ul> +</li> + +<li>ProvideRandomness - 52 +<ul> + +<li> +<details> +<summary> +<code>MaxRequests</code> +</summary> + Maximum number of not yet filled requests. + +```rust +value: U32(100) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>RequestPrice</code> +</summary> + The price of a request. + +```rust +value: U64(2000) +``` + +</details> +</li> + +</ul> +</li> + +<li>Proxy - 53 +<ul> + +<li> +<details> +<summary> +<code>ProxyDepositBase</code> +</summary> + The base amount of currency needed to reserve for creating a proxy. + + This is held for an additional storage item whose value size is + `sizeof(Balance)` bytes and whose key size is `sizeof(AccountId)` bytes. + +```rust +value: U64(108) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ProxyDepositFactor</code> +</summary> + The amount of currency needed per proxy added. + + This is held for adding 32 bytes plus an instance of `ProxyType` more into a + pre-existing storage value. Thus, when configuring `ProxyDepositFactor` one should take + into account `32 + proxy_type.encode().len()` bytes of data. + +```rust +value: U64(33) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxProxies</code> +</summary> + The maximum amount of proxies allowed for a single account. + +```rust +value: U32(32) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxPending</code> +</summary> + The maximum amount of time-delayed announcements that are allowed to be pending. + +```rust +value: U32(32) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>AnnouncementDepositBase</code> +</summary> + The base amount of currency needed to reserve for creating an announcement. + + This is held when a new storage item holding a `Balance` is created (typically 16 + bytes). + +```rust +value: U64(108) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>AnnouncementDepositFactor</code> +</summary> + The amount of currency needed per announcement made. + + This is held for adding an `AccountId`, `Hash` and `BlockNumber` (typically 68 bytes) + into a pre-existing storage value. + +```rust +value: U64(66) +``` + +</details> +</li> + +</ul> +</li> + +<li>Utility - 54 +<ul> + +<li> +<details> +<summary> +<code>batched_calls_limit</code> +</summary> + The limit on the number of batched calls. + +```rust +value: U32(10922) +``` + +</details> +</li> + +</ul> +</li> + +<li>Treasury - 55 +<ul> + +<li> +<details> +<summary> +<code>SpendPeriod</code> +</summary> + Period between successive spends. + +```rust +value: U32(14400) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Burn</code> +</summary> + Percentage of spare funds (if any) that are burnt per spend period. + +```rust +value: sp_arithmetic::per_things::Permill((0)) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>PalletId</code> +</summary> + The treasury's pallet id, used for deriving its sovereign account ID. + +```rust +value: frame_support::PalletId(((112, 121, 47, 116, 114, 115, 114, 121))) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MaxApprovals</code> +</summary> + DEPRECATED: associated with `spend_local` call and will be removed in May 2025. + Refer to <https://github.com/paritytech/polkadot-sdk/pull/5961> for migration to `spend`. + + The maximum number of approvals that can wait in the spending queue. + + NOTE: This parameter is also used within the Bounties Pallet extension if enabled. + +```rust +value: U32(100) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>PayoutPeriod</code> +</summary> + The period during which an approved treasury spend has to be claimed. + +```rust +value: U32(10) +``` + +</details> +</li> + +</ul> +</li> + +</ul> diff --git a/docs/api/runtime-errors.md b/docs/api/runtime-errors.md index ead935a5d35710a25df4d3e3b5acf6a9118d329e..6f0de162fa6b4dbb88c05090f34c292f1bdfdaeb 100644 --- a/docs/api/runtime-errors.md +++ b/docs/api/runtime-errors.md @@ -1,6 +1,6 @@ # Runtime errors -There are **191** errors from **35** pallets. +There are **192** errors from **35** pallets. <ul> <li>System - 0 @@ -778,6 +778,13 @@ The given length bound for the proposal was too low. Prime account is not a member </details> </li> +<li> +<details> +<summary> +<code>ProposalActive</code> - 11</summary> +Proposal is still active. +</details> +</li> </ul> </li> <li>UniversalDividend - 30 diff --git a/docs/api/runtime-errors.po b/docs/api/runtime-errors.po index f16ca07c1442240f65e612a00423617d59309782..5438db6c8d8dfe82cb2c57188e06b0707533ac8f 100644 --- a/docs/api/runtime-errors.po +++ b/docs/api/runtime-errors.po @@ -198,6 +198,8 @@ msgid "TechnicalCommittee.WrongProposalLength" msgstr "The given length bound for the proposal was too low." msgid "TechnicalCommittee.PrimeAccountNotMember" msgstr "Prime account is not a member" +msgid "TechnicalCommittee.ProposalActive" +msgstr "Proposal is still active." msgid "UniversalDividend.AccountNotAllowedToClaimUds" msgstr "This account is not allowed to claim UDs." msgid "Wot.NotEnoughCerts" diff --git a/docs/api/runtime-events.md b/docs/api/runtime-events.md index d485840aea12b0d75142cc89bc7ff737f389c251..527057e9f763b3722a671c7045fc2378cefa6e90 100644 --- a/docs/api/runtime-events.md +++ b/docs/api/runtime-events.md @@ -1,6 +1,6 @@ # Runtime events -There are **136** events from **35** pallets. +There are **139** events from **35** pallets. <ul> <li>System - 0 @@ -12,7 +12,7 @@ There are **136** events from **35** pallets. An extrinsic completed successfully. ```rust -dispatch_info: DispatchInfo +dispatch_info: DispatchEventInfo ``` </details> @@ -25,7 +25,7 @@ An extrinsic failed. ```rust dispatch_error: DispatchError -dispatch_info: DispatchInfo +dispatch_info: DispatchEventInfo ``` </details> @@ -1183,6 +1183,44 @@ yes: MemberCount no: MemberCount ``` +</details> +</li> +<li> +<details> +<summary> +<code>Killed(proposal_hash)</code> - 7</summary> +A proposal was killed. + +```rust +proposal_hash: T::Hash +``` + +</details> +</li> +<li> +<details> +<summary> +<code>ProposalCostBurned(proposal_hash, who)</code> - 8</summary> +Some cost for storing a proposal was burned. + +```rust +proposal_hash: T::Hash +who: T::AccountId +``` + +</details> +</li> +<li> +<details> +<summary> +<code>ProposalCostReleased(proposal_hash, who)</code> - 9</summary> +Some cost for storing a proposal was released. + +```rust +proposal_hash: T::Hash +who: T::AccountId +``` + </details> </li> </ul> diff --git a/docs/api/runtime-storages.md b/docs/api/runtime-storages.md new file mode 100644 index 0000000000000000000000000000000000000000..20561505909477abe8ba8578db750048ae3583cd --- /dev/null +++ b/docs/api/runtime-storages.md @@ -0,0 +1,2359 @@ +# Runtime Storage + +There are **139** storages from **35** pallets. + +<ul> + +<li>System - 0 +<ul> + +<li> +<details> +<summary> +<code>Account</code> +</summary> + The full account information for a particular account ID. + +```rust +key: sp_core::crypto::AccountId32 +value: frame_system::AccountInfo<U32, pallet_duniter_account::types::AccountData<U64, U32>> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ExtrinsicCount</code> +</summary> + Total extrinsics count for the current block. + +```rust +value: Option<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>InherentsApplied</code> +</summary> + Whether all inherents have been applied. + +```rust +value: Bool +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>BlockWeight</code> +</summary> + The current weight for the block. + +```rust +value: frame_support::dispatch::PerDispatchClass<sp_weights::weight_v2::Weight> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>AllExtrinsicsLen</code> +</summary> + Total length (in bytes) for all extrinsics put together, for the current block. + +```rust +value: Option<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>BlockHash</code> +</summary> + Map of block numbers to block hashes. + +```rust +key: U32 +value: primitive_types::H256 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ExtrinsicData</code> +</summary> + Extrinsics data for the current block (maps an extrinsic's index to its data). + +```rust +key: U32 +value: Vec<U8> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Number</code> +</summary> + The current block number being processed. Set by `execute_block`. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ParentHash</code> +</summary> + Hash of the previous block. + +```rust +value: primitive_types::H256 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Digest</code> +</summary> + Digest of the current block, also part of the block header. + +```rust +value: sp_runtime::generic::digest::Digest +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Events</code> +</summary> + Events deposited for the current block. + + NOTE: The item is unbound and should therefore never be read on chain. + It could otherwise inflate the PoV size of a block. + + Events have a large in-memory size. Box the events to not go out-of-memory + just in case someone still reads them from within the runtime. + +```rust +value: Vec<frame_system::EventRecord<gdev_runtime::RuntimeEvent, primitive_types::H256>> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>EventCount</code> +</summary> + The number of events in the `Events<T>` list. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>EventTopics</code> +</summary> + Mapping between a topic (represented by T::Hash) and a vector of indexes + of events in the `<Events<T>>` list. + + All topic vectors have deterministic storage locations depending on the topic. This + allows light-clients to leverage the changes trie storage tracking mechanism and + in case of changes fetch the list of events of interest. + + The value has the type `(BlockNumberFor<T>, EventIndex)` because if we used only just + the `EventIndex` then in case if the topic has the same contents on the next block + no notification will be triggered thus the event might be lost. + +```rust +key: primitive_types::H256 +value: Vec<(U32, U32)> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>LastRuntimeUpgrade</code> +</summary> + Stores the `spec_version` and `spec_name` of when the last runtime upgrade happened. + +```rust +value: Option<frame_system::LastRuntimeUpgradeInfo> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>UpgradedToU32RefCount</code> +</summary> + True if we have upgraded so that `type RefCount` is `u32`. False (default) if not. + +```rust +value: Bool +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>UpgradedToTripleRefCount</code> +</summary> + True if we have upgraded so that AccountInfo contains three types of `RefCount`. False + (default) if not. + +```rust +value: Bool +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ExecutionPhase</code> +</summary> + The execution phase of the block. + +```rust +value: Option<frame_system::Phase> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>AuthorizedUpgrade</code> +</summary> + `Some` if a code upgrade has been authorized. + +```rust +value: Option<frame_system::CodeUpgradeAuthorization<>> +``` + +</details> +</li> + +</ul> +</li> + +<li>Account - 1 +<ul> + +</ul> +</li> + +<li>Scheduler - 2 +<ul> + +<li> +<details> +<summary> +<code>IncompleteSince</code> +</summary> + + +```rust +value: Option<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Agenda</code> +</summary> + Items to be executed, indexed by the block number that they should be executed on. + +```rust +key: U32 +value: bounded_collections::bounded_vec::BoundedVec<Option<pallet_scheduler::Scheduled<[U8; 32], frame_support::traits::preimages::Bounded<gdev_runtime::RuntimeCall, sp_runtime::traits::BlakeTwo256>, U32, gdev_runtime::OriginCaller, sp_core::crypto::AccountId32>>, > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Retries</code> +</summary> + Retry configurations for items to be executed, indexed by task address. + +```rust +key: (U32, U32) +value: pallet_scheduler::RetryConfig<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Lookup</code> +</summary> + Lookup from a name to the block number and index of the task. + + For v3 -> v4 the previously unbounded identities are Blake2-256 hashed to form the v4 + identities. + +```rust +key: [U8; 32] +value: (U32, U32) +``` + +</details> +</li> + +</ul> +</li> + +<li>Babe - 3 +<ul> + +<li> +<details> +<summary> +<code>EpochIndex</code> +</summary> + Current epoch index. + +```rust +value: U64 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Authorities</code> +</summary> + Current epoch authorities. + +```rust +value: bounded_collections::weak_bounded_vec::WeakBoundedVec<(sp_consensus_babe::app::Public, U64), > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>GenesisSlot</code> +</summary> + The slot at which the first epoch actually started. This is 0 + until the first block of the chain. + +```rust +value: sp_consensus_slots::Slot +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CurrentSlot</code> +</summary> + Current slot number. + +```rust +value: sp_consensus_slots::Slot +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Randomness</code> +</summary> + The epoch randomness for the *current* epoch. + + # Security + + This MUST NOT be used for gambling, as it can be influenced by a + malicious validator in the short term. It MAY be used in many + cryptographic protocols, however, so long as one remembers that this + (like everything else on-chain) it is public. For example, it can be + used where a number is needed that cannot have been chosen by an + adversary, for purposes such as public-coin zero-knowledge proofs. + +```rust +value: [U8; 32] +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>PendingEpochConfigChange</code> +</summary> + Pending epoch configuration change that will be applied when the next epoch is enacted. + +```rust +value: Option<sp_consensus_babe::digests::NextConfigDescriptor> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>NextRandomness</code> +</summary> + Next epoch randomness. + +```rust +value: [U8; 32] +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>NextAuthorities</code> +</summary> + Next epoch authorities. + +```rust +value: bounded_collections::weak_bounded_vec::WeakBoundedVec<(sp_consensus_babe::app::Public, U64), > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>SegmentIndex</code> +</summary> + Randomness under construction. + + We make a trade-off between storage accesses and list length. + We store the under-construction randomness in segments of up to + `UNDER_CONSTRUCTION_SEGMENT_LENGTH`. + + Once a segment reaches this length, we begin the next one. + We reset all segments and return to `0` at the beginning of every + epoch. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>UnderConstruction</code> +</summary> + TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay. + +```rust +key: U32 +value: bounded_collections::bounded_vec::BoundedVec<[U8; 32], > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Initialized</code> +</summary> + Temporary value (cleared at block finalization) which is `Some` + if per-block initialization has already been called for current block. + +```rust +value: Option<Option<sp_consensus_babe::digests::PreDigest>> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>AuthorVrfRandomness</code> +</summary> + This field should always be populated during block processing unless + secondary plain slots are enabled (which don't contain a VRF output). + + It is set in `on_finalize`, before it will contain the value from the last block. + +```rust +value: Option<[U8; 32]> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>EpochStart</code> +</summary> + The block numbers when the last and current epoch have started, respectively `N-1` and + `N`. + NOTE: We track this is in order to annotate the block number when a given pool of + entropy was fixed (i.e. it was known to chain observers). Since epochs are defined in + slots, which may be skipped, the block numbers may not line up with the slot numbers. + +```rust +value: (U32, U32) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Lateness</code> +</summary> + How late the current block is compared to its parent. + + This entry is populated as part of block execution and is cleaned up + on block finalization. Querying this storage entry outside of block + execution context should always yield zero. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>EpochConfig</code> +</summary> + The configuration for the current epoch. Should never be `None` as it is initialized in + genesis. + +```rust +value: Option<sp_consensus_babe::BabeEpochConfiguration> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>NextEpochConfig</code> +</summary> + The configuration for the next epoch, `None` if the config will not change + (you can fallback to `EpochConfig` instead in that case). + +```rust +value: Option<sp_consensus_babe::BabeEpochConfiguration> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>SkippedEpochs</code> +</summary> + A list of the last 100 skipped epochs and the corresponding session index + when the epoch was skipped. + + This is only used for validating equivocation proofs. An equivocation proof + must contains a key-ownership proof for a given session, therefore we need a + way to tie together sessions and epoch indices, i.e. we need to validate that + a validator was the owner of a given key on a given session, and what the + active epoch index was during that session. + +```rust +value: bounded_collections::bounded_vec::BoundedVec<(U64, U32), > +``` + +</details> +</li> + +</ul> +</li> + +<li>Timestamp - 4 +<ul> + +<li> +<details> +<summary> +<code>Now</code> +</summary> + The current time for the current block. + +```rust +value: U64 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>DidUpdate</code> +</summary> + Whether the timestamp has been updated in this block. + + This value is updated to `true` upon successful submission of a timestamp by a node. + It is then checked at the end of each block execution in the `on_finalize` hook. + +```rust +value: Bool +``` + +</details> +</li> + +</ul> +</li> + +<li>Parameters - 5 +<ul> + +<li> +<details> +<summary> +<code>ParametersStorage</code> +</summary> + + +```rust +value: pallet_duniter_test_parameters::types::Parameters<U32, U32, U64, U32> +``` + +</details> +</li> + +</ul> +</li> + +<li>Balances - 6 +<ul> + +<li> +<details> +<summary> +<code>TotalIssuance</code> +</summary> + The total units issued in the system. + +```rust +value: U64 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>InactiveIssuance</code> +</summary> + The total units of outstanding deactivated balance in the system. + +```rust +value: U64 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Account</code> +</summary> + The Balances pallet example of storing the balance of an account. + + # Example + + ```nocompile + impl pallet_balances::Config for Runtime { + type AccountStore = StorageMapShim<Self::Account<Runtime>, frame_system::Provider<Runtime>, AccountId, Self::AccountData<Balance>> + } + ``` + + You can also store the balance of an account in the `System` pallet. + + # Example + + ```nocompile + impl pallet_balances::Config for Runtime { + type AccountStore = System + } + ``` + + But this comes with tradeoffs, storing account balances in the system pallet stores + `frame_system` data alongside the account data contrary to storing account balances in the + `Balances` pallet, which uses a `StorageMap` to store balances data only. + NOTE: This is only used in the case that this pallet is used to store balances. + +```rust +key: sp_core::crypto::AccountId32 +value: pallet_balances::types::AccountData<U64> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Locks</code> +</summary> + Any liquidity locks on some account balances. + NOTE: Should only be accessed when setting, changing and freeing a lock. + + Use of locks is deprecated in favour of freezes. See `https://github.com/paritytech/substrate/pull/12951/` + +```rust +key: sp_core::crypto::AccountId32 +value: bounded_collections::weak_bounded_vec::WeakBoundedVec<pallet_balances::types::BalanceLock<U64>, > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Reserves</code> +</summary> + Named reserves on some account balances. + + Use of reserves is deprecated in favour of holds. See `https://github.com/paritytech/substrate/pull/12951/` + +```rust +key: sp_core::crypto::AccountId32 +value: bounded_collections::bounded_vec::BoundedVec<pallet_balances::types::ReserveData<[U8; 8], U64>, > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Holds</code> +</summary> + Holds on account balances. + +```rust +key: sp_core::crypto::AccountId32 +value: bounded_collections::bounded_vec::BoundedVec<frame_support::traits::tokens::misc::IdAmount<gdev_runtime::RuntimeHoldReason, U64>, > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Freezes</code> +</summary> + Freeze locks on account balances. + +```rust +key: sp_core::crypto::AccountId32 +value: bounded_collections::bounded_vec::BoundedVec<frame_support::traits::tokens::misc::IdAmount<(), U64>, > +``` + +</details> +</li> + +</ul> +</li> + +<li>TransactionPayment - 32 +<ul> + +<li> +<details> +<summary> +<code>NextFeeMultiplier</code> +</summary> + + +```rust +value: sp_arithmetic::fixed_point::FixedU128 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>StorageVersion</code> +</summary> + + +```rust +value: pallet_transaction_payment::Releases +``` + +</details> +</li> + +</ul> +</li> + +<li>OneshotAccount - 7 +<ul> + +<li> +<details> +<summary> +<code>OneshotAccounts</code> +</summary> + The balance for each oneshot account. + +```rust +key: sp_core::crypto::AccountId32 +value: U64 +``` + +</details> +</li> + +</ul> +</li> + +<li>Quota - 66 +<ul> + +<li> +<details> +<summary> +<code>IdtyQuota</code> +</summary> + The quota for each identity. + +```rust +key: U32 +value: pallet_quota::pallet::Quota<U32, U64> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>RefundQueue</code> +</summary> + The fees waiting to be refunded. + +```rust +value: bounded_collections::bounded_vec::BoundedVec<pallet_quota::pallet::Refund<sp_core::crypto::AccountId32, U32, U64>, > +``` + +</details> +</li> + +</ul> +</li> + +<li>SmithMembers - 10 +<ul> + +<li> +<details> +<summary> +<code>Smiths</code> +</summary> + The Smith metadata for each identity. + +```rust +key: U32 +value: pallet_smith_members::types::SmithMeta<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ExpiresOn</code> +</summary> + The indexes of Smith to remove at a given session. + +```rust +key: U32 +value: Vec<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CurrentSession</code> +</summary> + The current session index. + +```rust +value: U32 +``` + +</details> +</li> + +</ul> +</li> + +<li>AuthorityMembers - 11 +<ul> + +<li> +<details> +<summary> +<code>IncomingAuthorities</code> +</summary> + The incoming authorities. + +```rust +value: Vec<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>OnlineAuthorities</code> +</summary> + The online authorities. + +```rust +value: Vec<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>OutgoingAuthorities</code> +</summary> + The outgoing authorities. + +```rust +value: Vec<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Members</code> +</summary> + The member data. + +```rust +key: U32 +value: pallet_authority_members::types::MemberData<sp_core::crypto::AccountId32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Blacklist</code> +</summary> + The blacklisted authorities. + +```rust +value: Vec<U32> +``` + +</details> +</li> + +</ul> +</li> + +<li>Authorship - 12 +<ul> + +<li> +<details> +<summary> +<code>Author</code> +</summary> + Author of current block. + +```rust +value: Option<sp_core::crypto::AccountId32> +``` + +</details> +</li> + +</ul> +</li> + +<li>Offences - 13 +<ul> + +<li> +<details> +<summary> +<code>Reports</code> +</summary> + The primary structure that holds all offence records keyed by report identifiers. + +```rust +key: primitive_types::H256 +value: sp_staking::offence::OffenceDetails<sp_core::crypto::AccountId32, (sp_core::crypto::AccountId32, common_runtime::entities::ValidatorFullIdentification)> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ConcurrentReportsIndex</code> +</summary> + A vector of reports of the same kind that happened at the same time slot. + +```rust +key: ([U8; 16], Vec<U8>) +value: Vec<primitive_types::H256> +``` + +</details> +</li> + +</ul> +</li> + +<li>Historical - 14 +<ul> + +<li> +<details> +<summary> +<code>HistoricalSessions</code> +</summary> + Mapping from historical session indices to session-data root hash and validator count. + +```rust +key: U32 +value: (primitive_types::H256, U32) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>StoredRange</code> +</summary> + The range of historical sessions we store. [first, last) + +```rust +value: Option<(U32, U32)> +``` + +</details> +</li> + +</ul> +</li> + +<li>Session - 15 +<ul> + +<li> +<details> +<summary> +<code>Validators</code> +</summary> + The current set of validators. + +```rust +value: Vec<sp_core::crypto::AccountId32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CurrentIndex</code> +</summary> + Current index of the session. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>QueuedChanged</code> +</summary> + True if the underlying economic identities or weighting behind the validators + has changed in the queued validator set. + +```rust +value: Bool +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>QueuedKeys</code> +</summary> + The queued keys for the next session. When the next session begins, these keys + will be used to determine the validator's session keys. + +```rust +value: Vec<(sp_core::crypto::AccountId32, gdev_runtime::opaque::SessionKeys)> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>DisabledValidators</code> +</summary> + Indices of disabled validators. + + The vec is always kept sorted so that we can find whether a given validator is + disabled using binary search. It gets cleared when `on_session_ending` returns + a new set of identities. + +```rust +value: Vec<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>NextKeys</code> +</summary> + The next session keys for a validator. + +```rust +key: sp_core::crypto::AccountId32 +value: gdev_runtime::opaque::SessionKeys +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>KeyOwner</code> +</summary> + The owner of a key. The key is the `KeyTypeId` + the encoded key. + +```rust +key: (sp_core::crypto::KeyTypeId, Vec<U8>) +value: sp_core::crypto::AccountId32 +``` + +</details> +</li> + +</ul> +</li> + +<li>Grandpa - 16 +<ul> + +<li> +<details> +<summary> +<code>State</code> +</summary> + State of the current authority set. + +```rust +value: pallet_grandpa::StoredState<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>PendingChange</code> +</summary> + Pending change: (signaled at, scheduled change). + +```rust +value: Option<pallet_grandpa::StoredPendingChange<U32, >> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>NextForced</code> +</summary> + next block number where we can force a change. + +```rust +value: Option<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Stalled</code> +</summary> + `true` if we are currently stalled. + +```rust +value: Option<(U32, U32)> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CurrentSetId</code> +</summary> + The number of changes (both in terms of keys and underlying economic responsibilities) + in the "set" of Grandpa validators from genesis. + +```rust +value: U64 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>SetIdSession</code> +</summary> + A mapping from grandpa set ID to the index of the *most recent* session for which its + members were responsible. + + This is only used for validating equivocation proofs. An equivocation proof must + contains a key-ownership proof for a given session, therefore we need a way to tie + together sessions and GRANDPA set ids, i.e. we need to validate that a validator + was the owner of a given key on a given session, and what the active set ID was + during that session. + + TWOX-NOTE: `SetId` is not under user control. + +```rust +key: U64 +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Authorities</code> +</summary> + The current list of authorities. + +```rust +value: bounded_collections::weak_bounded_vec::WeakBoundedVec<(sp_consensus_grandpa::app::Public, U64), > +``` + +</details> +</li> + +</ul> +</li> + +<li>ImOnline - 17 +<ul> + +<li> +<details> +<summary> +<code>HeartbeatAfter</code> +</summary> + The block number after which it's ok to send heartbeats in the current + session. + + At the beginning of each session we set this to a value that should fall + roughly in the middle of the session duration. The idea is to first wait for + the validators to produce a block in the current session, so that the + heartbeat later on will not be necessary. + + This value will only be used as a fallback if we fail to get a proper session + progress estimate from `NextSessionRotation`, as those estimates should be + more accurate then the value we calculate for `HeartbeatAfter`. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Keys</code> +</summary> + The current set of keys that may issue a heartbeat. + +```rust +value: bounded_collections::weak_bounded_vec::WeakBoundedVec<pallet_im_online::sr25519::app_sr25519::Public, > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ReceivedHeartbeats</code> +</summary> + For each session index, we keep a mapping of `SessionIndex` and `AuthIndex`. + +```rust +key: (U32, U32) +value: Bool +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>AuthoredBlocks</code> +</summary> + For each session index, we keep a mapping of `ValidatorId<T>` to the + number of blocks authored by the given authority. + +```rust +key: (U32, sp_core::crypto::AccountId32) +value: U32 +``` + +</details> +</li> + +</ul> +</li> + +<li>AuthorityDiscovery - 18 +<ul> + +<li> +<details> +<summary> +<code>Keys</code> +</summary> + Keys of the current authority set. + +```rust +value: bounded_collections::weak_bounded_vec::WeakBoundedVec<sp_authority_discovery::app::Public, > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>NextKeys</code> +</summary> + Keys of the next authority set. + +```rust +value: bounded_collections::weak_bounded_vec::WeakBoundedVec<sp_authority_discovery::app::Public, > +``` + +</details> +</li> + +</ul> +</li> + +<li>Sudo - 20 +<ul> + +<li> +<details> +<summary> +<code>Key</code> +</summary> + The `AccountId` of the sudo key. + +```rust +value: Option<sp_core::crypto::AccountId32> +``` + +</details> +</li> + +</ul> +</li> + +<li>UpgradeOrigin - 21 +<ul> + +</ul> +</li> + +<li>Preimage - 22 +<ul> + +<li> +<details> +<summary> +<code>StatusFor</code> +</summary> + The request status of a given hash. + +```rust +key: primitive_types::H256 +value: pallet_preimage::OldRequestStatus<sp_core::crypto::AccountId32, U64> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>RequestStatusFor</code> +</summary> + The request status of a given hash. + +```rust +key: primitive_types::H256 +value: pallet_preimage::RequestStatus<sp_core::crypto::AccountId32, ()> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>PreimageFor</code> +</summary> + + +```rust +key: (primitive_types::H256, U32) +value: bounded_collections::bounded_vec::BoundedVec<U8, > +``` + +</details> +</li> + +</ul> +</li> + +<li>TechnicalCommittee - 23 +<ul> + +<li> +<details> +<summary> +<code>Proposals</code> +</summary> + The hashes of the active proposals. + +```rust +value: bounded_collections::bounded_vec::BoundedVec<primitive_types::H256, > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ProposalOf</code> +</summary> + Actual proposal for a given hash, if it's current. + +```rust +key: primitive_types::H256 +value: gdev_runtime::RuntimeCall +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CostOf</code> +</summary> + Consideration cost created for publishing and storing a proposal. + + Determined by [Config::Consideration] and may be not present for certain proposals (e.g. if + the proposal count at the time of creation was below threshold N). + +```rust +key: primitive_types::H256 +value: (sp_core::crypto::AccountId32, ()) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Voting</code> +</summary> + Votes on a given proposal, if it is ongoing. + +```rust +key: primitive_types::H256 +value: pallet_collective::Votes<sp_core::crypto::AccountId32, U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>ProposalCount</code> +</summary> + Proposals so far. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Members</code> +</summary> + The current members of the collective. This is stored sorted (just by value). + +```rust +value: Vec<sp_core::crypto::AccountId32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Prime</code> +</summary> + The prime member that helps determine the default vote behavior in case of abstentions. + +```rust +value: Option<sp_core::crypto::AccountId32> +``` + +</details> +</li> + +</ul> +</li> + +<li>UniversalDividend - 30 +<ul> + +<li> +<details> +<summary> +<code>CurrentUd</code> +</summary> + The current Universal Dividend value. + +```rust +value: U64 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CurrentUdIndex</code> +</summary> + The current Universal Dividend index. + +```rust +value: U16 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MonetaryMass</code> +</summary> + The total quantity of money created by Universal Dividend, excluding potential money destruction. + +```rust +value: U64 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>NextReeval</code> +</summary> + The next Universal Dividend re-evaluation. + +```rust +value: Option<U64> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>NextUd</code> +</summary> + The next Universal Dividend creation. + +```rust +value: Option<U64> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>PastReevals</code> +</summary> + The past Universal Dividend re-evaluations. + +```rust +value: bounded_collections::bounded_vec::BoundedVec<(U16, U64), > +``` + +</details> +</li> + +</ul> +</li> + +<li>Wot - 40 +<ul> + +</ul> +</li> + +<li>Identity - 41 +<ul> + +<li> +<details> +<summary> +<code>Identities</code> +</summary> + The identity value for each identity. + +```rust +key: U32 +value: pallet_identity::types::IdtyValue<U32, sp_core::crypto::AccountId32, common_runtime::entities::IdtyData> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CounterForIdentities</code> +</summary> +Counter for the related counted storage map + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>IdentityIndexOf</code> +</summary> + The identity associated with each account. + +```rust +key: sp_core::crypto::AccountId32 +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>IdentitiesNames</code> +</summary> + The name associated with each identity. + +```rust +key: pallet_identity::types::IdtyName +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>NextIdtyIndex</code> +</summary> + The identity index to assign to the next created identity. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>IdentityChangeSchedule</code> +</summary> + The identities to remove at a given block. + +```rust +key: U32 +value: Vec<U32> +``` + +</details> +</li> + +</ul> +</li> + +<li>Membership - 42 +<ul> + +<li> +<details> +<summary> +<code>Membership</code> +</summary> + The membership data for each identity. + +```rust +key: U32 +value: sp_membership::MembershipData<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CounterForMembership</code> +</summary> +Counter for the related counted storage map + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>MembershipsExpireOn</code> +</summary> + The identities of memberships to expire at a given block. + +```rust +key: U32 +value: Vec<U32> +``` + +</details> +</li> + +</ul> +</li> + +<li>Certification - 43 +<ul> + +<li> +<details> +<summary> +<code>StorageIdtyCertMeta</code> +</summary> + The certification metadata for each issuer. + +```rust +key: U32 +value: pallet_certification::types::IdtyCertMeta<U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CertsByReceiver</code> +</summary> + The certifications for each receiver. + +```rust +key: U32 +value: Vec<(U32, U32)> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CertsRemovableOn</code> +</summary> + The certifications that should expire at a given block. + +```rust +key: U32 +value: Vec<(U32, U32)> +``` + +</details> +</li> + +</ul> +</li> + +<li>Distance - 44 +<ul> + +<li> +<details> +<summary> +<code>EvaluationPool0</code> +</summary> + The first evaluation pool for distance evaluation queuing identities to evaluate for a given + evaluator account. + +```rust +value: pallet_distance::types::EvaluationPool<sp_core::crypto::AccountId32, U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>EvaluationPool1</code> +</summary> + The second evaluation pool for distance evaluation queuing identities to evaluate for a given + evaluator account. + +```rust +value: pallet_distance::types::EvaluationPool<sp_core::crypto::AccountId32, U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>EvaluationPool2</code> +</summary> + The third evaluation pool for distance evaluation queuing identities to evaluate for a given + evaluator account. + +```rust +value: pallet_distance::types::EvaluationPool<sp_core::crypto::AccountId32, U32> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>EvaluationBlock</code> +</summary> + The block at which the distance is evaluated. + +```rust +value: primitive_types::H256 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>PendingEvaluationRequest</code> +</summary> + The pending evaluation requesters. + +```rust +key: U32 +value: sp_core::crypto::AccountId32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>DidUpdate</code> +</summary> + Store if the evaluation was updated in this block. + +```rust +value: Bool +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CurrentPeriodIndex</code> +</summary> + The current evaluation period index. + +```rust +value: U32 +``` + +</details> +</li> + +</ul> +</li> + +<li>AtomicSwap - 50 +<ul> + +<li> +<details> +<summary> +<code>PendingSwaps</code> +</summary> + + +```rust +key: (sp_core::crypto::AccountId32, [U8; 32]) +value: pallet_atomic_swap::PendingSwap<> +``` + +</details> +</li> + +</ul> +</li> + +<li>Multisig - 51 +<ul> + +<li> +<details> +<summary> +<code>Multisigs</code> +</summary> + The set of open multisig operations. + +```rust +key: (sp_core::crypto::AccountId32, [U8; 32]) +value: pallet_multisig::Multisig<U32, U64, sp_core::crypto::AccountId32, > +``` + +</details> +</li> + +</ul> +</li> + +<li>ProvideRandomness - 52 +<ul> + +<li> +<details> +<summary> +<code>NexEpochHookIn</code> +</summary> + The number of blocks before the next epoch. + +```rust +value: U8 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>RequestIdProvider</code> +</summary> + The request ID. + +```rust +value: U64 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>RequestsReadyAtNextBlock</code> +</summary> + The requests that will be fulfilled at the next block. + +```rust +value: Vec<pallet_provide_randomness::types::Request> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>RequestsReadyAtEpoch</code> +</summary> + The requests that will be fulfilled at the next epoch. + +```rust +key: U64 +value: Vec<pallet_provide_randomness::types::Request> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>RequestsIds</code> +</summary> + The requests being processed. + +```rust +key: U64 +value: () +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>CounterForRequestsIds</code> +</summary> +Counter for the related counted storage map + +```rust +value: U32 +``` + +</details> +</li> + +</ul> +</li> + +<li>Proxy - 53 +<ul> + +<li> +<details> +<summary> +<code>Proxies</code> +</summary> + The set of account proxies. Maps the account which has delegated to the accounts + which are being delegated to, together with the amount held on deposit. + +```rust +key: sp_core::crypto::AccountId32 +value: (bounded_collections::bounded_vec::BoundedVec<pallet_proxy::ProxyDefinition<sp_core::crypto::AccountId32, gdev_runtime::ProxyType, U32>, >, U64) +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Announcements</code> +</summary> + The announcements made by the proxy (key). + +```rust +key: sp_core::crypto::AccountId32 +value: (bounded_collections::bounded_vec::BoundedVec<pallet_proxy::Announcement<sp_core::crypto::AccountId32, primitive_types::H256, U32>, >, U64) +``` + +</details> +</li> + +</ul> +</li> + +<li>Utility - 54 +<ul> + +</ul> +</li> + +<li>Treasury - 55 +<ul> + +<li> +<details> +<summary> +<code>ProposalCount</code> +</summary> + DEPRECATED: associated with `spend_local` call and will be removed in May 2025. + Refer to <https://github.com/paritytech/polkadot-sdk/pull/5961> for migration to `spend`. + + Number of proposals that have been made. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Proposals</code> +</summary> + DEPRECATED: associated with `spend_local` call and will be removed in May 2025. + Refer to <https://github.com/paritytech/polkadot-sdk/pull/5961> for migration to `spend`. + + Proposals that have been made. + +```rust +key: U32 +value: pallet_treasury::Proposal<sp_core::crypto::AccountId32, U64> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Deactivated</code> +</summary> + The amount which has been reported as inactive to Currency. + +```rust +value: U64 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Approvals</code> +</summary> + DEPRECATED: associated with `spend_local` call and will be removed in May 2025. + Refer to <https://github.com/paritytech/polkadot-sdk/pull/5961> for migration to `spend`. + + Proposal indices that have been approved but not yet awarded. + +```rust +value: bounded_collections::bounded_vec::BoundedVec<U32, > +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>SpendCount</code> +</summary> + The count of spends that have been made. + +```rust +value: U32 +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>Spends</code> +</summary> + Spends that have been approved and being processed. + +```rust +key: U32 +value: pallet_treasury::SpendStatus<(), U64, sp_core::crypto::AccountId32, U32, ()> +``` + +</details> +</li> + +<li> +<details> +<summary> +<code>LastSpendPeriod</code> +</summary> + The blocknumber for the last triggered spend period. + +```rust +value: Option<U32> +``` + +</details> +</li> + +</ul> +</li> + +</ul> diff --git a/xtask/res/templates/runtime-constants.md b/xtask/res/templates/runtime-constants.md new file mode 100644 index 0000000000000000000000000000000000000000..2b0dd53fba8f3e95df11e9479e829a1c8af671b7 --- /dev/null +++ b/xtask/res/templates/runtime-constants.md @@ -0,0 +1,27 @@ +# Runtime Constant + +There are **{{ constant_counter }}** constants from **{{ pallets | length }}** pallets. + +<ul> +{% for pallet in pallets %} +<li>{{ pallet.name }} - {{ pallet.index }} +<ul> +{% for constant in pallet.constants %} +<li> +<details> +<summary> +<code>{{ constant.name }}</code> +</summary> +{{ constant.documentation }} + +```rust +value: {{ constant.type_value }}({{ constant.value }}) +``` + +</details> +</li> +{% endfor %} +</ul> +</li> +{% endfor %} +</ul> diff --git a/xtask/res/templates/runtime-storages.md b/xtask/res/templates/runtime-storages.md new file mode 100644 index 0000000000000000000000000000000000000000..995456a6c6c3310daac8ab4082ba70c28661983e --- /dev/null +++ b/xtask/res/templates/runtime-storages.md @@ -0,0 +1,28 @@ +# Runtime Storage + +There are **{{ storage_counter }}** storages from **{{ pallets | length }}** pallets. + +<ul> +{% for pallet in pallets %} +<li>{{ pallet.name }} - {{ pallet.index }} +<ul> +{% for storage in pallet.storages %} +<li> +<details> +<summary> +<code>{{ storage.name }}</code> +</summary> +{{ storage.documentation }} + +{% if storage.type_key or storage.type_value %}```rust +{% if storage.type_key %}key: {{ storage.type_key }} +{% endif %}{% if storage.type_value %}value: {{ storage.type_value }}{% endif %} +```{% endif %} + +</details> +</li> +{% endfor %} +</ul> +</li> +{% endfor %} +</ul> diff --git a/xtask/src/gen_doc.rs b/xtask/src/gen_doc.rs index 68d77c6117c24adb7ce14e6e552b189f467d3204..a2eb94a90b90e32c0263f18f7fe24645ee15478d 100644 --- a/xtask/src/gen_doc.rs +++ b/xtask/src/gen_doc.rs @@ -17,7 +17,8 @@ use anyhow::{bail, Context, Result}; use codec::Decode; use core::hash::Hash; -use scale_info::form::PortableForm; +use frame_metadata::v15::{StorageEntryModifier, StorageEntryType}; +use scale_info::{form::PortableForm, PortableRegistry, Type, TypeDef}; use serde::Serialize; use std::{ collections::HashMap, @@ -42,6 +43,8 @@ where const CALLS_DOC_FILEPATH: &str = "docs/api/runtime-calls.md"; const EVENTS_DOC_FILEPATH: &str = "docs/api/runtime-events.md"; +const STORAGES_DOC_FILEPATH: &str = "docs/api/runtime-storages.md"; +const CONSTANTS_DOC_FILEPATH: &str = "docs/api/runtime-constants.md"; const ERRORS_DOC_FILEPATH: &str = "docs/api/runtime-errors.md"; const ERRORS_PO_FILEPATH: &str = "docs/api/runtime-errors.po"; const TEMPLATES_GLOB: &str = "xtask/res/templates/*.{md,po}"; @@ -59,6 +62,8 @@ struct Pallet { calls: Vec<Call>, events: Vec<Event>, errors: Vec<ErroR>, + storages: Vec<Storage>, + constants: Vec<Constant>, } #[derive(Clone, Serialize)] struct Call { @@ -91,8 +96,23 @@ struct ErroR { index: u8, name: String, } +#[derive(Clone, Serialize)] +struct Storage { + documentation: String, + name: String, + type_key: String, + type_value: String, +} +#[derive(Clone, Serialize)] +struct Constant { + documentation: String, + name: String, + value: String, + type_value: String, +} impl Pallet { + #![allow(clippy::too_many_arguments)] fn new( index: u8, name: String, @@ -100,6 +120,8 @@ impl Pallet { call_scale_type_def: &Option<scale_info::TypeDef<PortableForm>>, event_scale_type_def: &Option<scale_info::TypeDef<PortableForm>>, error_scale_type_def: &Option<scale_info::TypeDef<PortableForm>>, + storages: Vec<Storage>, + constants: Vec<Constant>, ) -> Result<Self> { let calls = if let Some(call_scale_type_def) = call_scale_type_def { if let scale_info::TypeDef::Variant(calls_enum) = call_scale_type_def { @@ -128,6 +150,7 @@ impl Pallet { } else { vec![] }; + Ok(Self { index, name, @@ -135,6 +158,8 @@ impl Pallet { calls, events, errors, + storages, + constants, }) } } @@ -320,7 +345,8 @@ pub(super) fn gen_doc() -> Result<()> { }) }); - let (call_doc, event_doc, error_doc, error_po) = print_runtime(runtime); + let (call_doc, event_doc, error_doc, error_po, storage_doc, constant_doc) = + print_runtime(runtime); // Generate docs from rust code Command::new("cargo") @@ -363,6 +389,14 @@ pub(super) fn gen_doc() -> Result<()> { .with_context(|| format!("Failed to create file '{}'", ERRORS_DOC_FILEPATH))?; file.write_all(error_doc.as_bytes()) .with_context(|| format!("Failed to write to file '{}'", ERRORS_DOC_FILEPATH))?; + let mut file = File::create(STORAGES_DOC_FILEPATH) + .with_context(|| format!("Failed to create file '{}'", STORAGES_DOC_FILEPATH))?; + file.write_all(storage_doc.as_bytes()) + .with_context(|| format!("Failed to write to file '{}'", STORAGES_DOC_FILEPATH))?; + let mut file = File::create(CONSTANTS_DOC_FILEPATH) + .with_context(|| format!("Failed to create file '{}'", CONSTANTS_DOC_FILEPATH))?; + file.write_all(constant_doc.as_bytes()) + .with_context(|| format!("Failed to write to file '{}'", CONSTANTS_DOC_FILEPATH))?; let mut file = File::create(ERRORS_PO_FILEPATH) .with_context(|| format!("Failed to create file '{}'", ERRORS_PO_FILEPATH))?; file.write_all(error_po.as_bytes()) @@ -406,6 +440,138 @@ fn get_max_weight_from_metadata_v15( } } +/// Converts a `Type<PortableForm>` into a human-readable string representation. +/// +/// This function is a core part of the type resolution pipeline, working together with: +/// - `resolve_type()` to obtain type definitions. +/// - `format_generics()` to correctly format generic parameters. +/// +/// It processes a `Type<PortableForm>` from the metadata registry and outputs a Rust-like string representation, +/// handling all supported type definitions (composite types, sequences, arrays, tuples, primitives, etc.). +/// +/// # Returns +/// - `Ok(String)`: A formatted type string (e.g., `"Vec<u32>"`, `"(i32, bool)"`). +/// - `Err(anyhow::Error)`: If metadata are incorrect. +/// +/// # How It Works With Other Functions: +/// - Calls `format_generics()` to handle generic type parameters. +/// - Calls `resolve_type()` when resolving inner types inside sequences, arrays, and tuples. +/// - Used by `resolve_type()` as a formatting step after retrieving a type. +/// +fn format_type(ty: &Type<PortableForm>, types: &PortableRegistry) -> Result<String> { + let path = ty.path.to_string(); + + match &ty.type_def { + TypeDef::Composite(_) => { + let generics = format_generics(&ty.type_params, types)?; + Ok(format!("{}{}", path, generics)) + } + TypeDef::Variant(_) => { + let generics = format_generics(&ty.type_params, types)?; + Ok(format!("{}{}", path, generics)) + } + TypeDef::Sequence(seq) => { + let element_type = resolve_type(seq.type_param.id, types)?; + Ok(format!("Vec<{}>", element_type)) + } + TypeDef::Array(arr) => { + let element_type = resolve_type(arr.type_param.id, types)?; + Ok(format!("[{}; {}]", element_type, arr.len)) + } + TypeDef::Tuple(tuple) => { + let elements = tuple + .fields + .iter() + .map(|f| resolve_type(f.id, types)) + .collect::<Result<Vec<String>>>()?; + Ok(format!("({})", elements.join(", "))) + } + TypeDef::Primitive(primitive) => Ok(format!("{:?}", primitive)), + TypeDef::Compact(compact) => { + let inner_type = resolve_type(compact.type_param.id, types)?; + Ok(format!("Compact<{}>", inner_type)) + } + TypeDef::BitSequence(_) => Ok(String::default()), + } +} + +/// Resolves a type ID to a formatted string representation. +/// +/// This function serves as a bridge between raw type IDs and fully formatted types. +/// It works closely with `format_type()`, ensuring that once a type is found, it is properly formatted. +/// +/// # How It Works With Other Functions: +/// - Retrieves a type from the registry using `types.resolve(type_id)`. +/// - If successful, calls `format_type()` to get a human-readable format. +/// - Used internally by `format_type()` when resolving type dependencies. +/// +fn resolve_type(type_id: u32, types: &PortableRegistry) -> Result<String> { + types + .resolve(type_id) + .map(|t| format_type(t, types)) + .unwrap_or_else(|| bail!("Invalid metadata")) +} + +/// Formats generic type parameters into a Rust-like string representation. +/// +/// This function helps `format_type()` handle generic types, ensuring that type parameters +/// are formatted correctly when they exist. If a type has generic parameters, they are enclosed +/// in angle brackets (e.g., `<T, U>`). +/// +/// # How It Works With Other Functions: +/// - Called inside `format_type()` to process generic type parameters. +/// - Uses `resolve_type()` to retrieve and format each generic type. +/// +fn format_generics( + params: &[scale_info::TypeParameter<PortableForm>], + types: &PortableRegistry, +) -> Result<String> { + if params.is_empty() { + Ok(String::default()) + } else { + let generics = params + .iter() + .map(|p| { + p.ty.map(|ty| resolve_type(ty.id, types)) + .unwrap_or_else(|| Ok(String::default())) + }) + .collect::<Result<Vec<String>>>()?; + Ok(format!("<{}>", generics.join(", "))) + } +} + +fn parse_storage_entry( + variant: &frame_metadata::v15::StorageEntryMetadata<scale_info::form::PortableForm>, + types: &PortableRegistry, +) -> Result<Storage> { + match &variant.ty { + StorageEntryType::Map { key, value, .. } => { + let type_key = resolve_type(key.id, types)?; + let type_value = resolve_type(value.id, types)?; + Ok(Storage { + documentation: variant.docs.join("\n"), + name: variant.name.clone(), + type_key, + type_value, + }) + } + StorageEntryType::Plain(v) => { + let type_value = resolve_type(v.id, types)?; + let type_value = if let StorageEntryModifier::Optional = &variant.modifier { + format!("Option<{}>", type_value) + } else { + type_value + }; + Ok(Storage { + documentation: variant.docs.join("\n"), + name: variant.name.clone(), + type_key: String::default(), + type_value, + }) + } + } +} + fn get_from_metadata_v15( metadata_v15: frame_metadata::v15::RuntimeMetadataV15, ) -> Result<RuntimePallets> { @@ -447,6 +613,40 @@ fn get_from_metadata_v15( None }; + let storages = pallet + .storage + .map(|storage| { + storage + .entries + .iter() + .map(|v| parse_storage_entry(v, &metadata_v15.types)) + .collect::<Result<Vec<Storage>>>() + }) + .unwrap_or_else(|| { + println!("{}: {} (0 storage)", pallet.index, pallet.name); + Ok(Vec::default()) + })?; + + let constants = pallet + .constants + .iter() + .map(|i| { + let type_value = resolve_type(i.ty.id, &metadata_v15.types)?; + let value = scale_value::scale::decode_as_type( + &mut &*i.value, + &i.ty.id, + &metadata_v15.types, + ) + .map_err(|e| anyhow::anyhow!("{}", e))?; + Ok(Constant { + documentation: i.docs.join("\n"), + name: i.name.clone(), + value: value.to_string(), + type_value, + }) + }) + .collect::<Result<Vec<Constant>>>()?; + let pallet = Pallet::new( pallet.index, pallet.name.clone(), @@ -454,6 +654,8 @@ fn get_from_metadata_v15( &calls_type_def, &events_type_def, &errors_type_def, + storages, + constants, )?; println!( @@ -474,6 +676,18 @@ fn get_from_metadata_v15( pallet.name, pallet.errors.len() ); + println!( + "{}: {} ({} storages)", + pallet.index, + pallet.name, + pallet.storages.len() + ); + println!( + "{}: {} ({} constants)", + pallet.index, + pallet.name, + pallet.constants.len() + ); pallets.push(pallet); } Ok(pallets) @@ -488,7 +702,7 @@ fn get_weights(max_weight: u128) -> Result<HashMap<String, HashMap<String, Weigh } /// use template to render markdown file with runtime calls documentation -fn print_runtime(pallets: RuntimePallets) -> (String, String, String, String) { +fn print_runtime(pallets: RuntimePallets) -> (String, String, String, String, String, String) { // init variables // -- user calls let mut user_calls_counter = 0; @@ -521,6 +735,18 @@ fn print_runtime(pallets: RuntimePallets) -> (String, String, String, String) { .iter() .for_each(|pallet| error_counter += pallet.errors.len()); + // storage counter + let mut storage_counter = 0; + pallets + .iter() + .for_each(|pallet| storage_counter += pallet.storages.len()); + + // constant counter + let mut constant_counter = 0; + pallets + .iter() + .for_each(|pallet| constant_counter += pallet.constants.len()); + // compile template let tera = match Tera::new(TEMPLATES_GLOB) { Ok(t) => t, @@ -556,5 +782,26 @@ fn print_runtime(pallets: RuntimePallets) -> (String, String, String, String) { .render("runtime-errors.po", &context) .expect("template error"); - (call_doc, event_doc, error_doc, error_po) + // render storages + context.insert("pallets", &pallets); + context.insert("storage_counter", &event_counter); + let storage_doc = tera + .render("runtime-storages.md", &context) + .expect("template storage"); + + // render constant + context.insert("pallets", &pallets); + context.insert("constant_counter", &constant_counter); + let constant_doc = tera + .render("runtime-constants.md", &context) + .expect("template constant"); + + ( + call_doc, + event_doc, + error_doc, + error_po, + storage_doc, + constant_doc, + ) }