From 9330fa969376eece51b9f305dacee6b469cc5c53 Mon Sep 17 00:00:00 2001 From: ptrus Date: Tue, 21 Nov 2023 12:50:31 +0100 Subject: [PATCH] runtime/consensus/roothash: update error type in round results --- .changelog/5460.trivial.md | 0 runtime/src/consensus/state/roothash.rs | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 .changelog/5460.trivial.md diff --git a/.changelog/5460.trivial.md b/.changelog/5460.trivial.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/runtime/src/consensus/state/roothash.rs b/runtime/src/consensus/state/roothash.rs index 2a212b8736d..26dd7f5329b 100644 --- a/runtime/src/consensus/state/roothash.rs +++ b/runtime/src/consensus/state/roothash.rs @@ -63,21 +63,21 @@ impl<'a, T: ImmutableMKVS> ImmutableState<'a, T> { } // Returns the state and I/O roots for the given runtime and round. - pub fn round_roots(&self, id: Namespace, round: u64) -> Result, Error> { + pub fn round_roots(&self, id: Namespace, round: u64) -> Result, StateError> { match self .mkvs .get(&PastRootsKeyFmt((Hash::digest_bytes(id.as_ref()), round)).encode()) { Ok(Some(b)) => { - cbor::from_slice(&b).map_err(|err| StateError::Unavailable(anyhow!(err)).into()) + cbor::from_slice(&b).map_err(|err| StateError::Unavailable(anyhow!(err))) } Ok(None) => Ok(None), - Err(err) => Err(StateError::Unavailable(anyhow!(err)).into()), + Err(err) => Err(StateError::Unavailable(anyhow!(err))), } } // Returns all past round roots for the given runtime. - pub fn past_round_roots(&self, id: Namespace) -> Result, Error> { + pub fn past_round_roots(&self, id: Namespace) -> Result, StateError> { let h = Hash::digest_bytes(id.as_ref()); let mut it = self.mkvs.iter(); it.seek(&PastRootsKeyFmt((h, Default::default())).encode_partial(1));