Polimec / polimec-node

Decentralized community-driven funding protocol for Web3
https://www.polimec.org/
GNU General Public License v3.0
14 stars 6 forks source link

🐛 Promote async-backing feature to production #292

Closed lrazovic closed 6 months ago

lrazovic commented 6 months ago

What

Promote the code behind the async-backing feature to production. More context in the wiki.

Why?

After async-backing was enabled on Polkadot (Referendum 688), collators began reporting a few instances of panics while collating:

polimec-node[739]: ====================
polimec-node[739]: Version: 0.6.0-ced567ba1bb
polimec-node[739]:    0: sp_panic_handler::set::{{closure}}
polimec-node[739]:    1: std::panicking::rust_panic_with_hook
polimec-node[739]:    2: std::panicking::begin_panic_handler::{{closure}}
polimec-node[739]:    3: std::sys_common::backtrace::__rust_end_short_backtrace
polimec-node[739]:    4: rust_begin_unwind
polimec-node[739]:    5: core::panicking::panic_fmt
polimec-node[739]:    6: cumulus_pallet_parachain_system::pallet::Pallet<T>::set_validation_data::{{closure}}
polimec-node[739]:    7: <cumulus_pallet_parachain_system::pallet::Call<T> as frame_support::traits::dispatch::UnfilteredDispatchable>::dispatch_bypass_filter::{{closure}}
polimec-node[739]:    8: <polimec_runtime::RuntimeCall as frame_support::traits::dispatch::UnfilteredDispatchable>::dispatch_bypass_filter
polimec-node[739]:    9: <polimec_runtime::RuntimeCall as sp_runtime::traits::Dispatchable>::dispatch
polimec-node[739]:   10: frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::apply_extrinsic
polimec-node[739]:   11: sc_executor::executor::WasmExecutor<H>::with_instance::{{closure}}
polimec-node[739]:   12: <sc_executor::executor::NativeElseWasmExecutor<D> as sp_core::traits::CodeExecutor>::call
polimec-node[739]:   13: sp_state_machine::execution::StateMachine<B,H,Exec>::execute
polimec-node[739]:   14: <sc_service::client::client::Client<B,E,Block,RA> as sp_api::CallApiAt<Block>>::call_api_at
polimec-node[739]:   15: <polimec_runtime::RuntimeApiImpl<__SrApiBlock__,RuntimeApiImplCall> as sp_api::Core<__SrApiBlock__>>::__runtime_api_internal_call_api_at
polimec-node[739]:   16: sp_block_builder::BlockBuilder::apply_extrinsic
polimec-node[739]:   17: sc_block_builder::BlockBuilder<Block,C>::push
polimec-node[739]:   18: sc_basic_authorship::basic_authorship::Proposer<Block,C,A,PR>::propose_with::{{closure}}
polimec-node[739]:   19: <sc_basic_authorship::basic_authorship::Proposer<Block,C,A,PR> as sp_consensus::Proposer<Block>>::propose::{{closure}}
polimec-node[739]:   20: <tracing_futures::Instrumented<T> as core::future::future::Future>::poll
polimec-node[739]:   21: tokio::runtime::task::raw::poll
polimec-node[739]:   22: std::sys_common::backtrace::__rust_begin_short_backtrace
polimec-node[739]:   23: core::ops::function::FnOnce::call_once{{vtable.shim}}
polimec-node[739]:   24: std::sys::unix::thread::Thread::new::thread_start
polimec-node[739]:   25: <unknown>
polimec-node[739]:   26: <unknown>
polimec-node[739]: Thread 'tokio-runtime-worker' panicked at 'no space left for the block in the unincluded segment', /home/admin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cumulus-pallet-parachain-system-0.7.0/src/lib.rs:1339
polimec-node[739]: This is a bug. Please report it at:
polimec-node[739]:         https://github.com/Polimec/polimec-node/issues/new
polimec-node[739]: ====================
polimec-node[739]: Version: 0.6.0-ced567ba1bb
polimec-node[739]:    0: sp_panic_handler::set::{{closure}}
polimec-node[739]:    1: std::panicking::rust_panic_with_hook
polimec-node[739]:    2: std::panicking::begin_panic_handler::{{closure}}
polimec-node[739]:    3: std::sys_common::backtrace::__rust_end_short_backtrace
polimec-node[739]:    4: rust_begin_unwind
polimec-node[739]:    5: core::panicking::panic_fmt
polimec-node[739]:    6: core::option::expect_failed
polimec-node[739]:    7: <cumulus_pallet_parachain_system::pallet::Pallet<T> as frame_support::traits::hooks::Hooks<<<<T as frame_system::pallet::Config>::Block as sp_runtime::traits::HeaderProvider>::HeaderT as sp_runtime::traits::Header>::Number>>::on_finalize
polimec-node[739]:    8: <(TupleElement0,TupleElement1,TupleElement2,TupleElement3,TupleElement4,TupleElement5,TupleElement6,TupleElement7,TupleElement8,TupleElement9,TupleElement10,TupleElement11,TupleElement12,TupleElement13,TupleElement14,TupleElement15,TupleElement16,TupleElement17,TupleElement18,TupleElement19,TupleElement20,TupleElement21,TupleElement22,TupleElement23,TupleElement24,TupleElement25,TupleElement26,TupleElemeTupleElement28,TupleElement29,TupleElement30,TupleElement31) as frame_support::traits::hooks::OnFinalize<BlockNumber>>::on_finalize
polimec-node[739]:    9: <polimec_runtime::Runtime as sp_block_builder::runtime_decl_for_block_builder::BlockBuilderV6<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u32,sp_runtime::traits::BlakeTwo256>,sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic<sp_runtime::multiaddress::MultiAddress<<<sp_runtime::MultiSignature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccountcountId,()>,polimec_runtime::RuntimeCall,sp_runtime::MultiSignature,(frame_system::extensions::check_non_zero_sender::CheckNonZeroSender<polimec_runtime::Runtime>,frame_system::extensions::check_spec_version::CheckSpecVersion<polimec_runtime::Runtime>,frame_system::extensions::check_tx_version::CheckTxVersion<polimec_runtime::Runtime>,frame_system::extensions::check_genesis::CheckGenesis<polimec_runtime::Runtime>,frame_system::extensions::check_mortality::CheckMortalolimec_runtime::Runtime>,frame_system::extensions::check_nonce::CheckNonce<polimec_runtime::Runtime>,frame_system::extensions::check_weight::CheckWeight<polimec_runtime::Runtime>,pallet_transaction_payment::ChargeTransactionPayment<polimec_runtime::Runtime>)>>>>::finalize_block
polimec-node[739]:   10: sc_executor::executor::WasmExecutor<H>::with_instance::{{closure}}
polimec-node[739]:   11: <sc_executor::executor::NativeElseWasmExecutor<D> as sp_core::traits::CodeExecutor>::call
polimec-node[739]:   12: sp_state_machine::execution::StateMachine<B,H,Exec>::execute
polimec-node[739]:   13: <sc_service::client::client::Client<B,E,Block,RA> as sp_api::CallApiAt<Block>>::call_api_at
polimec-node[739]:   14: <polimec_runtime::RuntimeApiImpl<__SrApiBlock__,RuntimeApiImplCall> as sp_api::Core<__SrApiBlock__>>::__runtime_api_internal_call_api_at
polimec-node[739]:   15: sc_basic_authorship::basic_authorship::Proposer<Block,C,A,PR>::propose_with::{{closure}}
polimec-node[739]:   16: <sc_basic_authorship::basic_authorship::Proposer<Block,C,A,PR> as sp_consensus::Proposer<Block>>::propose::{{closure}}
polimec-node[739]:   17: <tracing_futures::Instrumented<T> as core::future::future::Future>::poll
polimec-node[739]:   18: tokio::runtime::task::raw::poll
polimec-node[739]:   19: std::sys_common::backtrace::__rust_begin_short_backtrace
polimec-node[739]:   20: core::ops::function::FnOnce::call_once{{vtable.shim}}
polimec-node[739]:   21: std::sys::unix::thread::Thread::new::thread_start
polimec-node[739]:   22: <unknown>
polimec-node[739]:   23: <unknown>
polimec-node[739]: Thread 'tokio-runtime-worker' panicked at 'set_validation_data inherent needs to be present in every block!', /home/admin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cumulus-pallet-parachain-system-0.7.0/src/lib.rs:265
polimec-node[739]: This is a bug. Please report it at:
polimec-node[739]:         https://github.com/Polimec/polimec-node/issues/new
polimec-node[739]: 2024-05-10 11:22:48 [Relaychain] ✨ Imported #20711607 (0x6b15…9036)
polimec-node[739]: 2024-05-10 11:22:48 [Parachain] 🙌 Starting consensus session on top of parent 0xb5968f4b49e642d8459a23b7eb9ca059d9c7e166e1cda35400b3e4a1da4a2749
polimec-node[739]: 2024-05-10 11:22:48 [Parachain] Evicting failed runtime instance error=Runtime panicked: no space left for the block in the unincluded segment
polimec-node[739]: 2024-05-10 11:22:48 [Parachain] 1 storage transactions are left open by the runtime. Those will be rolled back.
polimec-node[739]: 2024-05-10 11:22:48 [Parachain] 1 storage transactions are left open by the runtime. Those will be rolled back.
polimec-node[739]: 2024-05-10 11:22:48 [Parachain] ❗️ Inherent extrinsic returned unexpected error: Error at calling runtime api: Execution failed: Runtime panicked: no space left for the block in the unincluded segment. Dropping.

Testing

When we released version 0.6.0, we included an "experimental" version of the node compiled with the async-backing feature. Several collators have already used it to produce blocks after the activation of async-backing, and they reported no issues. Additionally, our RPC and the two collators have been compiled with this branch, and they no longer experience any panic after we started using this new version.