3

I am getting this error on the block explorer "Extrinsics" tab the moment I add a debug related code into a Hello pallet into the node-template repo.

E.g:

#[pallet::call_index(0)]
#[pallet::weight(10_000 + T::DbWeight::get().writes(1).ref_time())]
pub fn say_hello(origin: OriginFor<T>) -> DispatchResult {
    // Ensure that the caller is a regular keypair account
    let who = ensure_signed(origin)?;

    print("Hello world");

    frame_support::log::info!("{:?} said hello", who);

    // Emit an event
    Self::deposit_event(Event::SomeoneSaysHello { who });

    // Return a successful DispatchResult
    Ok(())
}

After generating the runtime via $ cargo build --release, I run the binary using $ RUST_LOG=runtime=debug ./target/release/node-template --dev. And then I get this error.

Please note that I am not getting this error when there is no debug related code in the pallet. Also, when I am using sp_runtime::print(), it works fine, but not in case of log::info, log::debug.

Any help would be really appreciated. Thanks!

3 Answers 3

2

This might help someone who is working between AccountId32 and AccountId20 networks.

I found this myself. You need to go the PolkadotApps's setting page and update the extension metadata when you switch between those networks. Otherwise, you will get this error.

0

I was able to call this extrinsic successfully without errors:

#[pallet::call_index(3)]
#[pallet::weight(10_000 + T::DbWeight::get().writes(1).ref_time())]
pub fn say_hello(origin: OriginFor<T>) -> DispatchResult {
    let who = ensure_signed(origin)?;
    frame_support::print("Hello world");
    frame_support::log::info!("{:?} said hello", who);
    Self::deposit_event(Event::SomeoneSaysHello { who });
    Ok(())
}
RUST_LOG=runtime=debug ./target/release/node-template --dev

Make sure you have the latest metadata update in the PolkadotJS Apps.

Go to Settings > Metadata > It will say if there is an update there.

Try reloading the PolkadotJS Apps browser page and trying again. Make sure you have the PolkadotJS Extension properly installed.

Try with a dev account i.e. Alice

0

Just pointing via screenshot

Not clear from the above answers.

Just need to reload the page. Often during development, we just view the explorer results shown in the page, but there is a requirement for reloading the page.

And the same is applicable for Polkadot JS Apps.

enter image description here

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.