diff --git a/pallets/parachain-system/src/relay_state_snapshot.rs b/pallets/parachain-system/src/relay_state_snapshot.rs index b85f960af92..df49c73c80f 100644 --- a/pallets/parachain-system/src/relay_state_snapshot.rs +++ b/pallets/parachain-system/src/relay_state_snapshot.rs @@ -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. @@ -273,4 +277,18 @@ impl RelayChainStateProof { ) .map_err(Error::UpgradeRestriction) } + + pub fn read_entry(&self, key: &[u8], fallback: Option) -> Result + where + T: Decode, + { + read_entry(&self.trie_backend, key, fallback).map_err(Error::ReadEntry) + } + + pub fn read_optional_entry(&self, key: &[u8]) -> Result, Error> + where + T: Decode, + { + read_optional_entry(&self.trie_backend, key).map_err(Error::ReadOptionalEntry) + } }