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

frame-support: Use logging for printing corrupted state #10612

Merged
merged 1 commit into from
Jan 8, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions frame/support/src/storage/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ pub fn get<T: Decode + Sized>(child_info: &ChildInfo, key: &[u8]) -> Option<T> {
sp_io::default_child_storage::get(storage_key, key).and_then(|v| {
Decode::decode(&mut &v[..]).map(Some).unwrap_or_else(|_| {
// TODO #3700: error should be handleable.
crate::runtime_print!(
"ERROR: Corrupted state in child trie at {:?}/{:?}",
log::error!(
target: "runtime::storage",
"Corrupted state in child trie at {:?}/{:?}",
storage_key,
key,
);
Expand Down
6 changes: 5 additions & 1 deletion frame/support/src/storage/unhashed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ pub fn get<T: Decode + Sized>(key: &[u8]) -> Option<T> {
sp_io::storage::get(key).and_then(|val| {
Decode::decode(&mut &val[..]).map(Some).unwrap_or_else(|_| {
// TODO #3700: error should be handleable.
crate::runtime_print!("ERROR: Corrupted state at {:?}", key);
log::error!(
target: "runtime::storage",
"Corrupted state at {:?}",
key,
);
None
})
})
Expand Down