Skip to content

Commit

Permalink
work with additional key values (paritytech#1757)
Browse files Browse the repository at this point in the history
Add the possibility to inject additional key-values in the
sproof-builder that generates the relay root that gets stored in
parachain-system.

Rationale: pallets that verify additional storage items (not those
verified by parachain-system) from the relay should be able to proof
against the relay root that gets stored in parachain-system. This PR
allows to create provide additional nibles that can later be used for
verifiability in other pallets
  • Loading branch information
girazoki authored and AurevoirXavier committed May 23, 2024
1 parent c8d2251 commit f3a165c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cumulus/primitives/parachain-inherent/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ pub struct MockValidationDataInherentDataProvider<R = ()> {
pub raw_downward_messages: Vec<Vec<u8>>,
// Inbound Horizontal messages sorted by channel
pub raw_horizontal_messages: Vec<(ParaId, Vec<u8>)>,
// Additional key-value pairs that should be injected.
pub additional_key_values: Option<Vec<(Vec<u8>, Vec<u8>)>>,
}

pub trait GenerateRandomness<I> {
Expand Down Expand Up @@ -210,6 +212,10 @@ impl<R: Send + Sync + GenerateRandomness<u64>> InherentDataProvider
sproof_builder.randomness =
self.relay_randomness_config.generate_randomness(self.current_para_block.into());

if let Some(key_values) = &self.additional_key_values {
sproof_builder.additional_key_values = key_values.clone()
}

let (relay_parent_storage_root, proof) = sproof_builder.into_state_root_and_proof();

inherent_data.put_data(
Expand Down

0 comments on commit f3a165c

Please sign in to comment.