Skip to content

Error when parsing assethub block event - "polkadotxcm (FeesPaid)" #2074

@OfirModai

Description

@OfirModai

Hi folks,
I run into some issues when trying to parse assethub block 9520865 (and some other ones as well),
When iterating the block events, to figure out fee paid for example, the crate subxt fails to parse some events and stop parsing when fails at one.

async fn get_block_events() {
    let client = OnlineClient::<AssetHubConfig>::from_url("wss://polkadot-asset-hub-rpc.polkadot.io")
        .await
        .expect("Failed to connect to node");
    let bytes = hex::decode(&"8cec6507f89ccb7e156075f167b979d69d79ed6f2cd453f8f221319484da8960").unwrap();
    let hash = <<SubstrateConfig as Config>::Hasher as Hasher>::Output::decode(&mut &bytes[..]).unwrap();
    let events = client.events().at(hash).await.unwrap();
    for (index, event) in events.iter().enumerate() {
        println!("parsing event #{}", index);
        if let Ok(details) = event.as_ref() {
            println!("Event {}: {:?}", details.pallet_name(), details.variant_name());
        }
        else {
            print!("Error parsing event");
        }
    }
}

I built repository to demonstrate what I done: https://github.com/OfirModai/Parsing-assethub-events/blob/example/src/main.rs
Also attached image of the event of the block found in the explorer, there it has 14 events, during my execution it parse only 8 - as it fails the 9th.
The block in Subscan: https://assethub-polkadot.subscan.io/event?block=9520865

parsing event #0
Event Balances: "Transfer"
parsing event #1
Event System: "ExtrinsicSuccess"
parsing event #2
Event System: "ExtrinsicSuccess"
parsing event #3
Event Balances: "Withdraw"
parsing event #4
Event Balances: "Transfer"
parsing event #5
Event PolkadotXcm: "Attempted"
parsing event #6
Event Balances: "Burned"
parsing event #7
Event Balances: "Minted"
parsing event #8
Error parsing event

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions