Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Allow arbitrary key-values in RelayStateSproofBuilder #2407

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/relay-sproof-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub struct RelayStateSproofBuilder {
pub current_slot: relay_chain::Slot,
pub current_epoch: u64,
pub randomness: relay_chain::Hash,
pub additional_key_values: Vec<(Vec<u8>, Vec<u8>)>,
}

impl Default for RelayStateSproofBuilder {
Expand All @@ -71,6 +72,7 @@ impl Default for RelayStateSproofBuilder {
current_slot: 0.into(),
current_epoch: 0u64,
randomness: relay_chain::Hash::default(),
additional_key_values: vec![],
}
}
}
Expand Down Expand Up @@ -163,6 +165,10 @@ impl RelayStateSproofBuilder {
self.randomness.encode(),
);
insert(relay_chain::well_known_keys::CURRENT_SLOT.to_vec(), self.current_slot.encode());

for (key, value) in self.additional_key_values {
insert(key, value);
}
}

let root = backend.root().clone();
Expand Down