I query all events, and decode the event a known type, but maybe some write them cause error, how to parse the event

pub fn decode_event(data: &str) -> Result<String> {
    let mut vec = Vec::from_hex(data)?;
    let events = Vec::<EventRecord<Event, H256>>::decode(&mut vec.as_slice())?;
    Event::frame_system(fs) => {
            m_event.module = "System".to_string();
            match *fs {
                frame_system::RawEvent::<node_runtime::AccountId>::ExtrinsicSuccess(d) => {
                    m_event.event = "ExtrinsicSuccess".to_string();
                _ => {

there is a build error:

 match *fs {
                      --- this expression has type `frame_system::RawEvent<sp_core::crypto::AccountId32>`
                frame_system::RawEvent::<node_runtime::AccountId>::ExtrinsicSuccess(d) => {
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `frame_system::RawEvent`, found a different enum `frame_system::RawEvent`

= note: expected enum `frame_system::RawEvent<sp_core::crypto::AccountId32>` (enum `frame_system::RawEvent`)
found enum `frame_system::RawEvent<sp_core::crypto::AccountId32>` (enum `frame_system::RawEvent`)
= note: perhaps two different versions of crate `frame_system` are being used?


  • 1
    cargo tree -i frame_system will tell you why you are pulling in a crate. Ideally you should only be pulling in one version of the crate.
    – Squirrel
    Jul 15, 2022 at 10:15
  • my cargo.toml only one fram-system lib
    – Abel
    Jul 18, 2022 at 4:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.