From e57c299cad1ac3817e15adbfbd9386f80495d60a Mon Sep 17 00:00:00 2001 From: Valerii Reutov Date: Tue, 29 Oct 2024 16:48:22 +0200 Subject: [PATCH] fix(iota-core): code cleanup --- crates/iota-core/src/authority.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/iota-core/src/authority.rs b/crates/iota-core/src/authority.rs index 2df56a191e9..2148444201e 100644 --- a/crates/iota-core/src/authority.rs +++ b/crates/iota-core/src/authority.rs @@ -4647,12 +4647,11 @@ impl AuthorityState { .events .data .iter() - .find(|event| event.is_system_epoch_info_event()); - let system_epoch_info_event = system_epoch_info_event.map(|event| { - bcs::from_bytes::(&event.contents).expect( - "deserialization should succeed since we asserted that the event is of this type", - ) - }); + .find(|event| event.is_system_epoch_info_event()) + .map(|event| { + bcs::from_bytes::(&event.contents) + .expect("event deserialization should succeed as type was pre-validated") + }); // The system epoch info event can be `None` in case if the `advance_epoch` // Move function call failed and was executed in the safe mode. assert!(system_epoch_info_event.is_some() || system_obj.safe_mode());