Skip to content

Commit c530892

Browse files
author
Seulgi Kim
committed
Make ShardLevelState::from_existing return trie::Result
TrieError has H256, so Result<..., TrieError> takes large space even when there is no error. trie::Result is defined as Result<..., Box<TrieError>> to prevent the space waste.
1 parent b62a7e6 commit c530892

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/state/shard_level.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ impl<B: Backend + ShardBackend> ShardLevelState<B> {
6666
}
6767

6868
/// Creates new state with existing state root
69-
pub fn from_existing(db: B, root: H256, trie_factory: TrieFactory) -> Result<ShardLevelState<B>, TrieError> {
69+
pub fn from_existing(db: B, root: H256, trie_factory: TrieFactory) -> trie::Result<ShardLevelState<B>> {
7070
if !db.as_hashdb().contains(&root) {
71-
return Err(TrieError::InvalidStateRoot(root))
71+
return Err(TrieError::InvalidStateRoot(root).into())
7272
}
7373

7474
Ok(ShardLevelState {

0 commit comments

Comments
 (0)