From 7ff675cf97d6de239ad036ed965708ada8c76673 Mon Sep 17 00:00:00 2001 From: girazoki Date: Mon, 3 Jun 2024 10:13:26 +0200 Subject: [PATCH] make all storage items in parachain-system public (#4645) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes all storage items in parachain-system public so that these can be used by other pallets &/or runtimes. --------- Co-authored-by: Bastian Köcher Co-authored-by: command-bot <> --- cumulus/pallets/parachain-system/src/lib.rs | 51 ++++++++++----------- prdoc/pr_4645.prdoc | 16 +++++++ 2 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 prdoc/pr_4645.prdoc diff --git a/cumulus/pallets/parachain-system/src/lib.rs b/cumulus/pallets/parachain-system/src/lib.rs index 3b609a675db60..bbb74a1b05388 100644 --- a/cumulus/pallets/parachain-system/src/lib.rs +++ b/cumulus/pallets/parachain-system/src/lib.rs @@ -743,14 +743,13 @@ pub mod pallet { /// The segment length is limited by the capacity returned from the [`ConsensusHook`] configured /// in the pallet. #[pallet::storage] - pub(super) type UnincludedSegment = - StorageValue<_, Vec>, ValueQuery>; + pub type UnincludedSegment = StorageValue<_, Vec>, ValueQuery>; /// Storage field that keeps track of bandwidth used by the unincluded segment along with the /// latest HRMP watermark. Used for limiting the acceptance of new blocks with /// respect to relay chain constraints. #[pallet::storage] - pub(super) type AggregatedUnincludedSegment = + pub type AggregatedUnincludedSegment = StorageValue<_, SegmentTracker, OptionQuery>; /// In case of a scheduled upgrade, this storage field contains the validation code to be @@ -760,7 +759,7 @@ pub mod pallet { /// [`:code`][sp_core::storage::well_known_keys::CODE] which will result the next block process /// with the new validation code. This concludes the upgrade process. #[pallet::storage] - pub(super) type PendingValidationCode = StorageValue<_, Vec, ValueQuery>; + pub type PendingValidationCode = StorageValue<_, Vec, ValueQuery>; /// Validation code that is set by the parachain and is to be communicated to collator and /// consequently the relay-chain. @@ -768,23 +767,23 @@ pub mod pallet { /// This will be cleared in `on_initialize` of each new block if no other pallet already set /// the value. #[pallet::storage] - pub(super) type NewValidationCode = StorageValue<_, Vec, OptionQuery>; + pub type NewValidationCode = StorageValue<_, Vec, OptionQuery>; /// The [`PersistedValidationData`] set for this block. /// This value is expected to be set only once per block and it's never stored /// in the trie. #[pallet::storage] - pub(super) type ValidationData = StorageValue<_, PersistedValidationData>; + pub type ValidationData = StorageValue<_, PersistedValidationData>; /// Were the validation data set to notify the relay chain? #[pallet::storage] - pub(super) type DidSetValidationCode = StorageValue<_, bool, ValueQuery>; + pub type DidSetValidationCode = StorageValue<_, bool, ValueQuery>; /// The relay chain block number associated with the last parachain block. /// /// This is updated in `on_finalize`. #[pallet::storage] - pub(super) type LastRelayChainBlockNumber = + pub type LastRelayChainBlockNumber = StorageValue<_, RelayChainBlockNumber, ValueQuery>; /// An option which indicates if the relay-chain restricts signalling a validation code upgrade. @@ -795,7 +794,7 @@ pub mod pallet { /// relay-chain. This value is ephemeral which means it doesn't hit the storage. This value is /// set after the inherent. #[pallet::storage] - pub(super) type UpgradeRestrictionSignal = + pub type UpgradeRestrictionSignal = StorageValue<_, Option, ValueQuery>; /// Optional upgrade go-ahead signal from the relay-chain. @@ -804,7 +803,7 @@ pub mod pallet { /// relay-chain. This value is ephemeral which means it doesn't hit the storage. This value is /// set after the inherent. #[pallet::storage] - pub(super) type UpgradeGoAhead = + pub type UpgradeGoAhead = StorageValue<_, Option, ValueQuery>; /// The state proof for the last relay parent block. @@ -814,7 +813,7 @@ pub mod pallet { /// /// This data is also absent from the genesis. #[pallet::storage] - pub(super) type RelayStateProof = StorageValue<_, sp_trie::StorageProof>; + pub type RelayStateProof = StorageValue<_, sp_trie::StorageProof>; /// The snapshot of some state related to messaging relevant to the current parachain as per /// the relay parent. @@ -824,7 +823,7 @@ pub mod pallet { /// /// This data is also absent from the genesis. #[pallet::storage] - pub(super) type RelevantMessagingState = StorageValue<_, MessagingStateSnapshot>; + pub type RelevantMessagingState = StorageValue<_, MessagingStateSnapshot>; /// The parachain host configuration that was obtained from the relay parent. /// @@ -834,53 +833,51 @@ pub mod pallet { /// This data is also absent from the genesis. #[pallet::storage] #[pallet::disable_try_decode_storage] - pub(super) type HostConfiguration = StorageValue<_, AbridgedHostConfiguration>; + pub type HostConfiguration = StorageValue<_, AbridgedHostConfiguration>; /// The last downward message queue chain head we have observed. /// /// This value is loaded before and saved after processing inbound downward messages carried /// by the system inherent. #[pallet::storage] - pub(super) type LastDmqMqcHead = StorageValue<_, MessageQueueChain, ValueQuery>; + pub type LastDmqMqcHead = StorageValue<_, MessageQueueChain, ValueQuery>; /// The message queue chain heads we have observed per each channel incoming channel. /// /// This value is loaded before and saved after processing inbound downward messages carried /// by the system inherent. #[pallet::storage] - pub(super) type LastHrmpMqcHeads = + pub type LastHrmpMqcHeads = StorageValue<_, BTreeMap, ValueQuery>; /// Number of downward messages processed in a block. /// /// This will be cleared in `on_initialize` of each new block. #[pallet::storage] - pub(super) type ProcessedDownwardMessages = StorageValue<_, u32, ValueQuery>; + pub type ProcessedDownwardMessages = StorageValue<_, u32, ValueQuery>; /// HRMP watermark that was set in a block. /// /// This will be cleared in `on_initialize` of each new block. #[pallet::storage] - pub(super) type HrmpWatermark = - StorageValue<_, relay_chain::BlockNumber, ValueQuery>; + pub type HrmpWatermark = StorageValue<_, relay_chain::BlockNumber, ValueQuery>; /// HRMP messages that were sent in a block. /// /// This will be cleared in `on_initialize` of each new block. #[pallet::storage] - pub(super) type HrmpOutboundMessages = + pub type HrmpOutboundMessages = StorageValue<_, Vec, ValueQuery>; /// Upward messages that were sent in a block. /// /// This will be cleared in `on_initialize` of each new block. #[pallet::storage] - pub(super) type UpwardMessages = StorageValue<_, Vec, ValueQuery>; + pub type UpwardMessages = StorageValue<_, Vec, ValueQuery>; /// Upward messages that are still pending and not yet send to the relay chain. #[pallet::storage] - pub(super) type PendingUpwardMessages = - StorageValue<_, Vec, ValueQuery>; + pub type PendingUpwardMessages = StorageValue<_, Vec, ValueQuery>; /// Initialization value for the delivery fee factor for UMP. #[pallet::type_value] @@ -890,29 +887,29 @@ pub mod pallet { /// The factor to multiply the base delivery fee by for UMP. #[pallet::storage] - pub(super) type UpwardDeliveryFeeFactor = + pub type UpwardDeliveryFeeFactor = StorageValue<_, FixedU128, ValueQuery, UpwardInitialDeliveryFeeFactor>; /// The number of HRMP messages we observed in `on_initialize` and thus used that number for /// announcing the weight of `on_initialize` and `on_finalize`. #[pallet::storage] - pub(super) type AnnouncedHrmpMessagesPerCandidate = StorageValue<_, u32, ValueQuery>; + pub type AnnouncedHrmpMessagesPerCandidate = StorageValue<_, u32, ValueQuery>; /// The weight we reserve at the beginning of the block for processing XCMP messages. This /// overrides the amount set in the Config trait. #[pallet::storage] - pub(super) type ReservedXcmpWeightOverride = StorageValue<_, Weight>; + pub type ReservedXcmpWeightOverride = StorageValue<_, Weight>; /// The weight we reserve at the beginning of the block for processing DMP messages. This /// overrides the amount set in the Config trait. #[pallet::storage] - pub(super) type ReservedDmpWeightOverride = StorageValue<_, Weight>; + pub type ReservedDmpWeightOverride = StorageValue<_, Weight>; /// A custom head data that should be returned as result of `validate_block`. /// /// See `Pallet::set_custom_validation_head_data` for more information. #[pallet::storage] - pub(super) type CustomValidationHeadData = StorageValue<_, Vec, OptionQuery>; + pub type CustomValidationHeadData = StorageValue<_, Vec, OptionQuery>; #[pallet::inherent] impl ProvideInherent for Pallet { diff --git a/prdoc/pr_4645.prdoc b/prdoc/pr_4645.prdoc new file mode 100644 index 0000000000000..1bc65f02ea578 --- /dev/null +++ b/prdoc/pr_4645.prdoc @@ -0,0 +1,16 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: make all storage items in parachain-system public + +doc: + - audience: Runtime Dev + description: | + All storage items in cumulus-pallet-parachain-systemare now public. This allows + the usage of these storage items from within other runtime-pallets + or the runtime itself. For instance, it should allow to read the latests + relay state proof to read a certain well-known-key. + +crates: + - name: cumulus-pallet-parachain-system + bump: minor \ No newline at end of file