Skip to content

Commit 27a5732

Browse files
girazokibkchr
andauthored
make all storage items in parachain-system public (#4645)
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 <[email protected]> Co-authored-by: command-bot <>
1 parent 795bc77 commit 27a5732

2 files changed

Lines changed: 40 additions & 27 deletions

File tree

cumulus/pallets/parachain-system/src/lib.rs

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -743,14 +743,13 @@ pub mod pallet {
743743
/// The segment length is limited by the capacity returned from the [`ConsensusHook`] configured
744744
/// in the pallet.
745745
#[pallet::storage]
746-
pub(super) type UnincludedSegment<T: Config> =
747-
StorageValue<_, Vec<Ancestor<T::Hash>>, ValueQuery>;
746+
pub type UnincludedSegment<T: Config> = StorageValue<_, Vec<Ancestor<T::Hash>>, ValueQuery>;
748747

749748
/// Storage field that keeps track of bandwidth used by the unincluded segment along with the
750749
/// latest HRMP watermark. Used for limiting the acceptance of new blocks with
751750
/// respect to relay chain constraints.
752751
#[pallet::storage]
753-
pub(super) type AggregatedUnincludedSegment<T: Config> =
752+
pub type AggregatedUnincludedSegment<T: Config> =
754753
StorageValue<_, SegmentTracker<T::Hash>, OptionQuery>;
755754

756755
/// In case of a scheduled upgrade, this storage field contains the validation code to be
@@ -760,31 +759,31 @@ pub mod pallet {
760759
/// [`:code`][sp_core::storage::well_known_keys::CODE] which will result the next block process
761760
/// with the new validation code. This concludes the upgrade process.
762761
#[pallet::storage]
763-
pub(super) type PendingValidationCode<T: Config> = StorageValue<_, Vec<u8>, ValueQuery>;
762+
pub type PendingValidationCode<T: Config> = StorageValue<_, Vec<u8>, ValueQuery>;
764763

765764
/// Validation code that is set by the parachain and is to be communicated to collator and
766765
/// consequently the relay-chain.
767766
///
768767
/// This will be cleared in `on_initialize` of each new block if no other pallet already set
769768
/// the value.
770769
#[pallet::storage]
771-
pub(super) type NewValidationCode<T: Config> = StorageValue<_, Vec<u8>, OptionQuery>;
770+
pub type NewValidationCode<T: Config> = StorageValue<_, Vec<u8>, OptionQuery>;
772771

773772
/// The [`PersistedValidationData`] set for this block.
774773
/// This value is expected to be set only once per block and it's never stored
775774
/// in the trie.
776775
#[pallet::storage]
777-
pub(super) type ValidationData<T: Config> = StorageValue<_, PersistedValidationData>;
776+
pub type ValidationData<T: Config> = StorageValue<_, PersistedValidationData>;
778777

779778
/// Were the validation data set to notify the relay chain?
780779
#[pallet::storage]
781-
pub(super) type DidSetValidationCode<T: Config> = StorageValue<_, bool, ValueQuery>;
780+
pub type DidSetValidationCode<T: Config> = StorageValue<_, bool, ValueQuery>;
782781

783782
/// The relay chain block number associated with the last parachain block.
784783
///
785784
/// This is updated in `on_finalize`.
786785
#[pallet::storage]
787-
pub(super) type LastRelayChainBlockNumber<T: Config> =
786+
pub type LastRelayChainBlockNumber<T: Config> =
788787
StorageValue<_, RelayChainBlockNumber, ValueQuery>;
789788

790789
/// An option which indicates if the relay-chain restricts signalling a validation code upgrade.
@@ -795,7 +794,7 @@ pub mod pallet {
795794
/// relay-chain. This value is ephemeral which means it doesn't hit the storage. This value is
796795
/// set after the inherent.
797796
#[pallet::storage]
798-
pub(super) type UpgradeRestrictionSignal<T: Config> =
797+
pub type UpgradeRestrictionSignal<T: Config> =
799798
StorageValue<_, Option<relay_chain::UpgradeRestriction>, ValueQuery>;
800799

801800
/// Optional upgrade go-ahead signal from the relay-chain.
@@ -804,7 +803,7 @@ pub mod pallet {
804803
/// relay-chain. This value is ephemeral which means it doesn't hit the storage. This value is
805804
/// set after the inherent.
806805
#[pallet::storage]
807-
pub(super) type UpgradeGoAhead<T: Config> =
806+
pub type UpgradeGoAhead<T: Config> =
808807
StorageValue<_, Option<relay_chain::UpgradeGoAhead>, ValueQuery>;
809808

810809
/// The state proof for the last relay parent block.
@@ -814,7 +813,7 @@ pub mod pallet {
814813
///
815814
/// This data is also absent from the genesis.
816815
#[pallet::storage]
817-
pub(super) type RelayStateProof<T: Config> = StorageValue<_, sp_trie::StorageProof>;
816+
pub type RelayStateProof<T: Config> = StorageValue<_, sp_trie::StorageProof>;
818817

819818
/// The snapshot of some state related to messaging relevant to the current parachain as per
820819
/// the relay parent.
@@ -824,7 +823,7 @@ pub mod pallet {
824823
///
825824
/// This data is also absent from the genesis.
826825
#[pallet::storage]
827-
pub(super) type RelevantMessagingState<T: Config> = StorageValue<_, MessagingStateSnapshot>;
826+
pub type RelevantMessagingState<T: Config> = StorageValue<_, MessagingStateSnapshot>;
828827

829828
/// The parachain host configuration that was obtained from the relay parent.
830829
///
@@ -834,53 +833,51 @@ pub mod pallet {
834833
/// This data is also absent from the genesis.
835834
#[pallet::storage]
836835
#[pallet::disable_try_decode_storage]
837-
pub(super) type HostConfiguration<T: Config> = StorageValue<_, AbridgedHostConfiguration>;
836+
pub type HostConfiguration<T: Config> = StorageValue<_, AbridgedHostConfiguration>;
838837

839838
/// The last downward message queue chain head we have observed.
840839
///
841840
/// This value is loaded before and saved after processing inbound downward messages carried
842841
/// by the system inherent.
843842
#[pallet::storage]
844-
pub(super) type LastDmqMqcHead<T: Config> = StorageValue<_, MessageQueueChain, ValueQuery>;
843+
pub type LastDmqMqcHead<T: Config> = StorageValue<_, MessageQueueChain, ValueQuery>;
845844

846845
/// The message queue chain heads we have observed per each channel incoming channel.
847846
///
848847
/// This value is loaded before and saved after processing inbound downward messages carried
849848
/// by the system inherent.
850849
#[pallet::storage]
851-
pub(super) type LastHrmpMqcHeads<T: Config> =
850+
pub type LastHrmpMqcHeads<T: Config> =
852851
StorageValue<_, BTreeMap<ParaId, MessageQueueChain>, ValueQuery>;
853852

854853
/// Number of downward messages processed in a block.
855854
///
856855
/// This will be cleared in `on_initialize` of each new block.
857856
#[pallet::storage]
858-
pub(super) type ProcessedDownwardMessages<T: Config> = StorageValue<_, u32, ValueQuery>;
857+
pub type ProcessedDownwardMessages<T: Config> = StorageValue<_, u32, ValueQuery>;
859858

860859
/// HRMP watermark that was set in a block.
861860
///
862861
/// This will be cleared in `on_initialize` of each new block.
863862
#[pallet::storage]
864-
pub(super) type HrmpWatermark<T: Config> =
865-
StorageValue<_, relay_chain::BlockNumber, ValueQuery>;
863+
pub type HrmpWatermark<T: Config> = StorageValue<_, relay_chain::BlockNumber, ValueQuery>;
866864

867865
/// HRMP messages that were sent in a block.
868866
///
869867
/// This will be cleared in `on_initialize` of each new block.
870868
#[pallet::storage]
871-
pub(super) type HrmpOutboundMessages<T: Config> =
869+
pub type HrmpOutboundMessages<T: Config> =
872870
StorageValue<_, Vec<OutboundHrmpMessage>, ValueQuery>;
873871

874872
/// Upward messages that were sent in a block.
875873
///
876874
/// This will be cleared in `on_initialize` of each new block.
877875
#[pallet::storage]
878-
pub(super) type UpwardMessages<T: Config> = StorageValue<_, Vec<UpwardMessage>, ValueQuery>;
876+
pub type UpwardMessages<T: Config> = StorageValue<_, Vec<UpwardMessage>, ValueQuery>;
879877

880878
/// Upward messages that are still pending and not yet send to the relay chain.
881879
#[pallet::storage]
882-
pub(super) type PendingUpwardMessages<T: Config> =
883-
StorageValue<_, Vec<UpwardMessage>, ValueQuery>;
880+
pub type PendingUpwardMessages<T: Config> = StorageValue<_, Vec<UpwardMessage>, ValueQuery>;
884881

885882
/// Initialization value for the delivery fee factor for UMP.
886883
#[pallet::type_value]
@@ -890,29 +887,29 @@ pub mod pallet {
890887

891888
/// The factor to multiply the base delivery fee by for UMP.
892889
#[pallet::storage]
893-
pub(super) type UpwardDeliveryFeeFactor<T: Config> =
890+
pub type UpwardDeliveryFeeFactor<T: Config> =
894891
StorageValue<_, FixedU128, ValueQuery, UpwardInitialDeliveryFeeFactor>;
895892

896893
/// The number of HRMP messages we observed in `on_initialize` and thus used that number for
897894
/// announcing the weight of `on_initialize` and `on_finalize`.
898895
#[pallet::storage]
899-
pub(super) type AnnouncedHrmpMessagesPerCandidate<T: Config> = StorageValue<_, u32, ValueQuery>;
896+
pub type AnnouncedHrmpMessagesPerCandidate<T: Config> = StorageValue<_, u32, ValueQuery>;
900897

901898
/// The weight we reserve at the beginning of the block for processing XCMP messages. This
902899
/// overrides the amount set in the Config trait.
903900
#[pallet::storage]
904-
pub(super) type ReservedXcmpWeightOverride<T: Config> = StorageValue<_, Weight>;
901+
pub type ReservedXcmpWeightOverride<T: Config> = StorageValue<_, Weight>;
905902

906903
/// The weight we reserve at the beginning of the block for processing DMP messages. This
907904
/// overrides the amount set in the Config trait.
908905
#[pallet::storage]
909-
pub(super) type ReservedDmpWeightOverride<T: Config> = StorageValue<_, Weight>;
906+
pub type ReservedDmpWeightOverride<T: Config> = StorageValue<_, Weight>;
910907

911908
/// A custom head data that should be returned as result of `validate_block`.
912909
///
913910
/// See `Pallet::set_custom_validation_head_data` for more information.
914911
#[pallet::storage]
915-
pub(super) type CustomValidationHeadData<T: Config> = StorageValue<_, Vec<u8>, OptionQuery>;
912+
pub type CustomValidationHeadData<T: Config> = StorageValue<_, Vec<u8>, OptionQuery>;
916913

917914
#[pallet::inherent]
918915
impl<T: Config> ProvideInherent for Pallet<T> {

prdoc/pr_4645.prdoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
2+
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
3+
4+
title: make all storage items in parachain-system public
5+
6+
doc:
7+
- audience: Runtime Dev
8+
description: |
9+
All storage items in cumulus-pallet-parachain-systemare now public. This allows
10+
the usage of these storage items from within other runtime-pallets
11+
or the runtime itself. For instance, it should allow to read the latests
12+
relay state proof to read a certain well-known-key.
13+
14+
crates:
15+
- name: cumulus-pallet-parachain-system
16+
bump: minor

0 commit comments

Comments
 (0)