mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
Add babe randomness to relay state proof (#1083)
* add new babe keys to relay storage proof * persist relay state proof and make pub super to expose to runtime * use sp trie StorageProof instead of sp state machine Storage Proof * fmt
This commit is contained in:
@@ -310,7 +310,7 @@ pub mod pallet {
|
|||||||
let relay_state_proof = RelayChainStateProof::new(
|
let relay_state_proof = RelayChainStateProof::new(
|
||||||
T::SelfParaId::get(),
|
T::SelfParaId::get(),
|
||||||
vfp.relay_parent_storage_root,
|
vfp.relay_parent_storage_root,
|
||||||
relay_chain_state,
|
relay_chain_state.clone(),
|
||||||
)
|
)
|
||||||
.expect("Invalid relay chain state proof");
|
.expect("Invalid relay chain state proof");
|
||||||
|
|
||||||
@@ -352,6 +352,7 @@ pub mod pallet {
|
|||||||
.expect("Invalid messaging state in relay chain state proof");
|
.expect("Invalid messaging state in relay chain state proof");
|
||||||
|
|
||||||
<ValidationData<T>>::put(&vfp);
|
<ValidationData<T>>::put(&vfp);
|
||||||
|
<RelayStateProof<T>>::put(relay_chain_state);
|
||||||
<RelevantMessagingState<T>>::put(relevant_messaging_state.clone());
|
<RelevantMessagingState<T>>::put(relevant_messaging_state.clone());
|
||||||
<HostConfiguration<T>>::put(host_config);
|
<HostConfiguration<T>>::put(host_config);
|
||||||
|
|
||||||
@@ -484,6 +485,16 @@ pub mod pallet {
|
|||||||
pub(super) type UpgradeRestrictionSignal<T: Config> =
|
pub(super) type UpgradeRestrictionSignal<T: Config> =
|
||||||
StorageValue<_, Option<relay_chain::v2::UpgradeRestriction>, ValueQuery>;
|
StorageValue<_, Option<relay_chain::v2::UpgradeRestriction>, ValueQuery>;
|
||||||
|
|
||||||
|
/// The state proof for the last relay parent block.
|
||||||
|
///
|
||||||
|
/// This field is meant to be updated each block with the validation data inherent. Therefore,
|
||||||
|
/// before processing of the inherent, e.g. in `on_initialize` this data may be stale.
|
||||||
|
///
|
||||||
|
/// This data is also absent from the genesis.
|
||||||
|
#[pallet::storage]
|
||||||
|
#[pallet::getter(fn relay_state_proof)]
|
||||||
|
pub(super) type RelayStateProof<T: Config> = StorageValue<_, sp_trie::StorageProof>;
|
||||||
|
|
||||||
/// The snapshot of some state related to messaging relevant to the current parachain as per
|
/// The snapshot of some state related to messaging relevant to the current parachain as per
|
||||||
/// the relay parent.
|
/// the relay parent.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ async fn collect_relay_storage_proof(
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let mut relevant_keys = Vec::new();
|
let mut relevant_keys = Vec::new();
|
||||||
|
relevant_keys.push(relay_well_known_keys::CURRENT_BLOCK_RANDOMNESS.to_vec());
|
||||||
|
relevant_keys.push(relay_well_known_keys::ONE_EPOCH_AGO_RANDOMNESS.to_vec());
|
||||||
|
relevant_keys.push(relay_well_known_keys::TWO_EPOCHS_AGO_RANDOMNESS.to_vec());
|
||||||
relevant_keys.push(relay_well_known_keys::CURRENT_SLOT.to_vec());
|
relevant_keys.push(relay_well_known_keys::CURRENT_SLOT.to_vec());
|
||||||
relevant_keys.push(relay_well_known_keys::ACTIVE_CONFIG.to_vec());
|
relevant_keys.push(relay_well_known_keys::ACTIVE_CONFIG.to_vec());
|
||||||
relevant_keys.push(relay_well_known_keys::dmq_mqc_head(para_id));
|
relevant_keys.push(relay_well_known_keys::dmq_mqc_head(para_id));
|
||||||
|
|||||||
Reference in New Issue
Block a user