paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.81k stars 662 forks source link

Instantly seal parachain block with async backing #4437

Closed AurevoirXavier closed 4 months ago

AurevoirXavier commented 4 months ago

I originally posted this question on https://substrate.stackexchange.com/questions/11457/how-to-instantly-seal-parachain-block-with-async-backing, but it seems I can't find help there.

alexggh commented 4 months ago

Looking into it, meanwhile can you give me some reproducing steps, what exactly are you running ?

bkchr commented 4 months ago

Yes the issue is valid, we don't have tests for this stuff.

@librelois could you port your mentioned commit to polkadot-sdk? https://substrate.stackexchange.com/a/11461/73 I left here a comment on what would need to change to make it correct.

AurevoirXavier commented 4 months ago

After applying patch #4442, I still received a slot mismatched error.

Adding this hack (https://github.com/darwinia-network/darwinia/pull/1492/files#diff-daced65c5a2c24e21e748746a2501eb6f6006d23e3d5fc15804227d84496f57aR804-R814) resolved the slot mismatch issue, but I encountered another error. Any ideas? @bkchr, I think the current_para_block_head isn't being applied to the proof correctly. (If everything works as expected, I don't think I'll need that hack.)

[node/src/service/mod.rs:822] &current_para_block = 0
[node/src/service/mod.rs:823] &current_para_block_head = Some(
    HeadData(
        [
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            87,
            229,
            159,
            236,
            242,
            254,
            1,
            175,
            162,
            82,
            180,
            17,
            157,
            138,
            34,
            85,
            56,
            114,
            226,
            13,
            95,
            20,
            102,
            137,
            69,
            161,
            24,
            100,
            240,
            198,
            83,
            54,
            3,
            23,
            10,
            46,
            117,
            151,
            183,
            183,
            227,
            216,
            76,
            5,
            57,
            29,
            19,
            154,
            98,
            177,
            87,
            231,
            135,
            134,
            216,
            192,
            130,
            242,
            157,
            207,
            76,
            17,
            19,
            20,
            0,
        ],
    ),
)
2024-05-23 13:27:54 🙌 Starting consensus session on top of parent 0x4a83030f4aba3757811d1debd705b21139ae5f5d662dfef9957dd2b88ac4ba75    
2024-05-23 13:27:54 panicked at /Users/xavier/.cargo/git/checkouts/polkadot-sdk-38f315c8db144fd3/a8cf515/cumulus/pallets/parachain-system/src/lib.rs:1232:30:
included head not present in relay storage proof    
2024-05-23 13:27:54 1 storage transactions are left open by the runtime. Those will be rolled back.    
2024-05-23 13:27:54 1 storage transactions are left open by the runtime. Those will be rolled back.    
2024-05-23 13:27:54 ❗️ Inherent extrinsic returned unexpected error: Error at calling runtime api: Execution failed: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed
WASM backtrace:
error while executing at wasm backtrace:
    0: 0x4f37fe - <unknown>!rust_begin_unwind
    1: 0x157ee - <unknown>!core::panicking::panic_fmt::h7a368385936888dc
    2: 0x42fb72 - <unknown>!cumulus_pallet_parachain_system::<impl cumulus_pallet_parachain_system::pallet::Pallet<T>>::maybe_drop_included_ancestors::h640741b418b44079
    3: 0x2115be - <unknown>!frame_support::storage::transactional::with_transaction::h458621a732ccff50
    4: 0x310c9d - <unknown>!<cumulus_pallet_parachain_system::pallet::Call<T> as frame_support::traits::dispatch::UnfilteredDispatchable>::dispatch_bypass_filter::{{closure}}::h62f75eb84ba9559e
    5: 0x3182f6 - <unknown>!frame_support::dispatch_context::run_in_context::h18e926ebed681127
    6: 0x157f6f - <unknown>!<pangolin_runtime::RuntimeCall as frame_support::traits::dispatch::UnfilteredDispatchable>::dispatch_bypass_filter::h577607987f407648
    7: 0x14d6a0 - <unknown>!<pangolin_runtime::RuntimeCall as sp_runtime::traits::Dispatchable>::dispatch::h8a5e4456e060abbf
    8: 0x3b7148 - <unknown>!<fp_self_contained::checked_extrinsic::CheckedExtrinsic<AccountId,Call,Extra,SelfContainedSignedInfo> as sp_runtime::traits::Applyable>::apply::h4ab3c6f0958c5c49
    9: 0x296503 - <unknown>!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::apply_extrinsic::hef131d48fe7740fd
   10: 0x4d1cda - <unknown>!BlockBuilder_apply_extrinsic. Dropping.    
2024-05-23 13:27:54 panicked at /Users/xavier/.cargo/git/checkouts/polkadot-sdk-38f315c8db144fd3/a8cf515/cumulus/pallets/parachain-system/src/lib.rs:248:13:
set_validation_data inherent needs to be present in every block!    
2024-05-23 13:27:54 Proposing failed: Import failed: Error at calling runtime api: Execution failed: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed
WASM backtrace:
error while executing at wasm backtrace:
    0: 0x4f37fe - <unknown>!rust_begin_unwind
    1: 0x157ee - <unknown>!core::panicking::panic_fmt::h7a368385936888dc
    2: 0x429213 - <unknown>!<cumulus_pallet_parachain_system::pallet::Pallet<T> as frame_support::traits::hooks::OnFinalize<<<<T as frame_system::pallet::Config>::Block as sp_runtime::traits::HeaderProvider>::HeaderT as sp_runtime::traits::Header>::Number>>::on_finalize::h9bc11a447bb8e170
    3: 0x1ded41 - <unknown>!<(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,TupleElement27,TupleElement28,TupleElement29,TupleElement30,TupleElement31,TupleElement32,TupleElement33,TupleElement34,TupleElement35,TupleElement36,TupleElement37) as frame_support::traits::hooks::OnFinalize<BlockNumber>>::on_finalize::h29249672646509af
    4: 0x296c01 - <unknown>!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::idle_and_finalize_hook::h408a9ae0d8bf5a1b
    5: 0x4d1e2a - <unknown>!BlockBuilder_finalize_block 
bkchr commented 4 months ago

@AurevoirXavier https://github.com/paritytech/polkadot-sdk/pull/4555 this should make it more obvious that you need to set para_id. In your case you can fix the MockXcm::new to pass the proper para_id.

AurevoirXavier commented 4 months ago

@AurevoirXavier #4555 this should make it more obvious that you need to set para_id. In your case you can fix the MockXcm::new to pass the proper para_id.

Unfortunately, I still have this problem. I checked Moonbeam's code, and they also left the paraid as the default value. Link to code