Skip to content
Closed
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
18 changes: 18 additions & 0 deletions pallets/parachain-system/src/relay_state_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ pub struct MessagingStateSnapshot {
pub enum Error {
/// The provided proof was created against unexpected storage root.
RootMismatch,
/// The entry cannot be read.
ReadEntry(ReadEntryErr),
/// The optional entry cannot be read.
ReadOptionalEntry(ReadEntryErr),
/// The slot cannot be extracted.
Slot(ReadEntryErr),
/// The upgrade go-ahead signal cannot be read.
Expand Down Expand Up @@ -273,4 +277,18 @@ impl RelayChainStateProof {
)
.map_err(Error::UpgradeRestriction)
}

pub fn read_entry<T>(&self, key: &[u8], fallback: Option<T>) -> Result<T, Error>
where
T: Decode,
{
read_entry(&self.trie_backend, key, fallback).map_err(Error::ReadEntry)
}

pub fn read_optional_entry<T>(&self, key: &[u8]) -> Result<Option<T>, Error>
where
T: Decode,
{
read_optional_entry(&self.trie_backend, key).map_err(Error::ReadOptionalEntry)
}
}