paritytech / extended-parachain-template

Node template to build parachains with all the required pallets. Slightly opinionated based on what majority of parachain teams are using.
The Unlicense
27 stars 19 forks source link

Thread 'main' panicked at 'Expected Ok(_). #63

Closed ganesh1997oli closed 10 months ago

ganesh1997oli commented 10 months ago

I am implementing pallet-staking in extend-parachain-template. Everything works fine while building chain but while running in dev mode using ./target/release/parachain-template-node --dev this command, I got below error even though I have implemented stake inside GenesisConfig. Someone please help what I am doing wrong?

ganesholi@Ganeshs-MacBook-Air xcav-parachain % ./target/release/parachain-template-node --dev
2023-09-04 15:29:15 Parachain Collator Template    
2023-09-04 15:29:15 ✌️  version 0.9.420-df8ee1315d3    
2023-09-04 15:29:15 ❤️  by Anonymous, 2020-2023    
2023-09-04 15:29:15 📋 Chain specification: Development    
2023-09-04 15:29:15 🏷  Node name: tough-nose-3849    
2023-09-04 15:29:15 👤 Role: AUTHORITY    
2023-09-04 15:29:15 💾 Database: RocksDb at /var/folders/q3/d699hkpx49xfy236ph7sltr40000gn/T/substratejW2MvL/chains/dev/db/full    
2023-09-04 15:29:15 ⛓  Native runtime: devnet-1000 (devnet-0.tx1.au1)    
2023-09-04 15:29:16 assembling new collators for new session 0 at #0    
2023-09-04 15:29:16 assembling new collators for new session 1 at #0    

====================

Version: 0.9.420-df8ee1315d3

   0: backtrace::capture::Backtrace::new
   1: sp_panic_handler::set::{{closure}}
   2: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/boxed.rs:2007:9
      std::panicking::rust_panic_with_hook
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:709:13
   3: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:597:13
   4: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:151:18
   5: rust_begin_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
   6: core::panicking::panic_fmt
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
   7: <pallet_staking::pallet::pallet::GenesisConfig<T> as frame_support::traits::hooks::GenesisBuild<T>>::build
   8: environmental::using
   9: sp_state_machine::basic::BasicExternalities::execute_with_storage
  10: <devnet_runtime::GenesisConfig as sp_runtime::BuildStorage>::assimilate_storage
  11: <sc_chain_spec::chain_spec::ChainSpec<G,E> as sp_runtime::BuildStorage>::assimilate_storage
  12: sp_runtime::BuildStorage::build_storage
  13: cumulus_client_cli::generate_genesis_block
  14: tokio::runtime::park::CachedParkThread::block_on
  15: tokio::runtime::context::runtime::enter_runtime
  16: tokio::runtime::runtime::Runtime::block_on
  17: sc_cli::runner::Runner<C>::run_node_until_exit
  18: parachain_template_node::command::run
  19: std::sys_common::backtrace::__rust_begin_short_backtrace
  20: std::rt::lang_start::{{closure}}
  21: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:284:13
      std::panicking::try::do_call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500:40
      std::panicking::try
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464:19
      std::panic::catch_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:148:48
      std::panicking::try::do_call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500:40
      std::panicking::try
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464:19
      std::panic::catch_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142:14
      std::rt::lang_start_internal
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:148:20
  22: _main

Thread 'main' panicked at 'Expected Ok(_). Got Err(
    Module(
        ModuleError {
            index: 47,
            error: [
                4,
                0,
                0,
                0,
            ],
            message: Some(
                "EmptyTargets",
            ),
        },
    ),
)', /Users/ganesholi/.cargo/git/checkouts/substrate-7e08433d4c370a21/ff24c60/frame/staking/src/pallet/mod.rs:652

This is a bug. Please report it at:

        https://github.com/paritytech/cumulus/issues/new

ganesholi@Ganeshs-MacBook-Air xcav-parachain % 
weezy20 commented 10 months ago

From the error logs I can see that the GenesisConfig for the staking pallet is panicking which is really not related to extended-parachain-template. In this line:

7: <pallet_staking::pallet::pallet::GenesisConfig<T> as frame_support::traits::hooks::GenesisBuild<T>>::build

Please check your implementation details and make sure you are instantiating the pallet properly. Also a point to note here is that this is a parachain and thus you should use something like zombienet if you are testing it as parachains require a relay chain network to provide it consensus or it will not produce blocks. Please checkout the docs for running a network using zombienet