substrate-api-client icon indicating copy to clipboard operation
substrate-api-client copied to clipboard

Error while subscribing transfer event

Open shanithkk opened this issue 1 year ago • 6 comments

Description

When trying to subscribe the transfer events from rococo local chain, getting deserialise error

Codec(Error { cause: Some(Error { cause: None, desc: "Could not decode `RuntimeEvent`, variant doesn't exist" }), desc: "Could not decode `EventRecord::event`" })

Code Examle

 let event_records = subscription
            .next_events::<RuntimeEvent, Hash>()
            .await
            .unwrap()
            .unwrap();
        for event_record in &event_records {
            println!("decoded: {:?} {:?}", event_record.phase, event_record.event);
            match &event_record.event {
                RuntimeEvent::Balances(balances_event) => {
                    println!(">>>>>>>>>> balances event: {:?}", balances_event);
                    match &balances_event {
                        pallet_balances::Event::Transfer { from, to, amount } => {
                            println!("Transactor: {:?}", from);
                            println!("Destination: {:?}", to);
                            println!("Value: {:?}", amount);
                            // return;
                        }
                        _ => {
                            debug!("ignoring unsupported balances event");
                        }
                    }
                }
                RuntimeEvent::System(system_event) => {
                    println!(">>>>>>>>>> system event: {:?}", system_event);
                    match &system_event {
                        frame_system::Event::ExtrinsicSuccess { dispatch_info } => {
                            println!("DispatchInfo: {:?}", dispatch_info);
                            // return;
                        }
                        _ => {
                            debug!("ignoring unsupported system event");
                        }
                    }
                }
                _ => debug!(
                    "ignoring unsupported module event: {:?}",
                    event_record.event
                ),
            }
        }

Running chain

docker run -p 9944:9944 parity/polkadot:latest --dev  --rpc-external

shanithkk avatar Apr 15 '24 10:04 shanithkk

I tried to reproduce your issue, but so far without success. Can you try the following:

  • We use a different docker image for our tests: paritypr/substrate:latest. Can you try with this one?
  • Can you try to pull a fresh version of parity/polkadot:latest? Docker does not pull a new version if you have already one on your system
  • Can you specify which image/version you are using exactly?

Niederb avatar Apr 16 '24 11:04 Niederb

@Niederb sure, i will try these images, i tried latest version of polkadot image. i will update and try it again and get back to you, Thank you

shanithkk avatar Apr 24 '24 06:04 shanithkk

@shanithkk Does it work with the other images? Then I would close this issue

Niederb avatar May 13 '24 07:05 Niederb

@Niederb still i'm getting error while using parity/polkadot latest image

image

shanithkk avatar May 13 '24 17:05 shanithkk

@Niederb tested with provided image "paritypr/substrate:latest". works fine for me but parity/polkadot image is not working as expected

shanithkk avatar May 13 '24 17:05 shanithkk

Glad to hear that it works with paritypr/substrate:latest. Do you know what kind of event causes the crash?

Niederb avatar May 16 '24 07:05 Niederb

@shanithkk Is this still a problem for you? Otherwise I will close this issue

Niederb avatar Sep 02 '24 09:09 Niederb

This issue should be fixed with #802, therefore I close this

Niederb avatar Sep 19 '24 13:09 Niederb