Commit ec6bf5d
Use dynamic aura slot duration in lookahead collator (#3211)
It's a follow-up of #2949. It enables the lookahead collator to
dynamically adjust the aura slot size, which may change during the
runtime upgrade. It also addressed a couple of issues with time
constants I missed in the original PR.
Good news: it works. The parachain successfully switches from sync
backing with 12s slots to async backing with 6s slots.
Bad news: during the transitional period of a single block in which the
actual runtime upgrade is performed, it still gets the old slot duration
of 12s (as it gets it from the best block), resulting in a runtime panic
(logs follow). That doesn't affect the following block production of the
parachain. Ideas on how to improve the situation are appreciated.
<details>
```
2024-02-05 12:59:36.373 INFO tokio-runtime-worker sc_basic_authorship::basic_authorship: [Parachain] 🙌 Starting consensus session on top of parent 0x6fd2d8f904f12c22531bfabf77b16dc84a6a29e45d9ae358aa6547fbf3f0438b
2024-02-05 12:59:36.373 ERROR tokio-runtime-worker runtime: [Parachain] panicked at /home/s0me0ne/wrk/parity/polkadot-sdk/cumulus/pallets/aura-ext/src/consensus_hook.rs:69:9:
assertion `left == right` failed: slot number mismatch
left: Slot(142261198)
right: Slot(284522396)
2024-02-05 12:59:36.373 WARN tokio-runtime-worker sp_state_machine::overlayed_changes::changeset: [Parachain] 1 storage transactions are left open by the runtime. Those will be rolled back.
2024-02-05 12:59:36.373 WARN tokio-runtime-worker sp_state_machine::overlayed_changes::changeset: [Parachain] 1 storage transactions are left open by the runtime. Those will be rolled back.
2024-02-05 12:59:36.373 WARN tokio-runtime-worker basic-authorship: [Parachain] ❗ 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: 0x4e4a3b - <unknown>!rust_begin_unwind
1: 0x46cf57 - <unknown>!core::panicking::panic_fmt::h3c280dba88683724
2: 0x46d238 - <unknown>!core::panicking::assert_failed_inner::hebac5970933beb4d
3: 0x3d00fc - <unknown>!core::panicking::assert_failed::h640a47e2fb5dfb4b
4: 0xd0db3 - <unknown>!frame_support::storage::transactional::with_transaction::hcbc31515f81b2ee1
5: 0x34d654 - <unknown>!<cumulus_pallet_parachain_system::pallet::Call<T> as frame_support::traits::dispatch::UnfilteredDispatchable>::dispatch_bypass_filter::{{closure}}::hb7c2c9a11fa88301
6: 0x3547db - <unknown>!environmental::local_key::LocalKey<T>::with::h783f2605ae27d6d3
7: 0x7f454 - <unknown>!<asset_hub_rococo_runtime::RuntimeCall as frame_support::traits::dispatch::UnfilteredDispatchable>::dispatch_bypass_filter::h5e11a01ab97c06c7
8: 0x7f237 - <unknown>!<asset_hub_rococo_runtime::RuntimeCall as sp_runtime::traits::Dispatchable>::dispatch::h7f8ae4a8fede71ca
9: 0x26a0f3 - <unknown>!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::apply_extrinsic::h75e524ff34738391
10: 0x282211 - <unknown>!BlockBuilder_apply_extrinsic. Dropping.
2024-02-05 12:59:36.374 ERROR tokio-runtime-worker runtime: [Parachain] panicked at /home/s0me0ne/wrk/parity/polkadot-sdk/substrate/frame/aura/src/lib.rs:416:9:
assertion `left == right` failed: Timestamp slot must match `CurrentSlot`
left: Slot(142261198)
right: Slot(284522396)
2024-02-05 12:59:36.374 WARN tokio-runtime-worker sp_state_machine::overlayed_changes::changeset: [Parachain] 1 storage transactions are left open by the runtime. Those will be rolled back.
2024-02-05 12:59:36.374 WARN tokio-runtime-worker sp_state_machine::overlayed_changes::changeset: [Parachain] 1 storage transactions are left open by the runtime. Those will be rolled back.
2024-02-05 12:59:36.374 WARN tokio-runtime-worker basic-authorship: [Parachain] ❗ 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: 0x4e4a3b - <unknown>!rust_begin_unwind
1: 0x46cf57 - <unknown>!core::panicking::panic_fmt::h3c280dba88683724
2: 0x46d238 - <unknown>!core::panicking::assert_failed_inner::hebac5970933beb4d
3: 0x3d00fc - <unknown>!core::panicking::assert_failed::h640a47e2fb5dfb4b
4: 0x9ece6 - <unknown>!frame_support::storage::transactional::with_transaction::h26f75cb9f9462088
5: 0x356d7e - <unknown>!environmental::local_key::LocalKey<T>::with::hbcf2d4e17b48fdb5
6: 0x7f507 - <unknown>!<asset_hub_rococo_runtime::RuntimeCall as frame_support::traits::dispatch::UnfilteredDispatchable>::dispatch_bypass_filter::h5e11a01ab97c06c7
7: 0x7f237 - <unknown>!<asset_hub_rococo_runtime::RuntimeCall as sp_runtime::traits::Dispatchable>::dispatch::h7f8ae4a8fede71ca
8: 0x26a0f3 - <unknown>!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::apply_extrinsic::h75e524ff34738391
9: 0x282211 - <unknown>!BlockBuilder_apply_extrinsic. Dropping.
2024-02-05 12:59:36.374 DEBUG tokio-runtime-worker runtime::xcmp-queue-migration: [Parachain] Lazy migration finished: item gone
2024-02-05 12:59:36.374 ERROR tokio-runtime-worker runtime: [Parachain] panicked at /home/s0me0ne/wrk/parity/polkadot-sdk/cumulus/pallets/parachain-system/src/lib.rs:265:18:
set_validation_data inherent needs to be present in every block!
2024-02-05 12:59:36.374 ERROR tokio-runtime-worker aura::cumulus: [Parachain] err=Error { inner: Proposing
Caused by:
0: 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: 0x4e4a3b - <unknown>!rust_begin_unwind
1: 0x46cf57 - <unknown>!core::panicking::panic_fmt::h3c280dba88683724
2: 0x46da8b - <unknown>!core::option::expect_failed::hdf18d99c3adabca7
3: 0x2134cb - <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::hf98aac39802896ba
4: 0x26a9d6 - <unknown>!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::idle_and_finalize_hook::h32775c0df0749d92
5: 0x26ad9f - <unknown>!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::finalize_block::h15e5a1a6b9ca8032
6: 0x2822bd - <unknown>!BlockBuilder_finalize_block
1: Execution failed: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed
WASM backtrace:
error while executing at wasm backtrace:
0: 0x4e4a3b - <unknown>!rust_begin_unwind
1: 0x46cf57 - <unknown>!core::panicking::panic_fmt::h3c280dba88683724
2: 0x46da8b - <unknown>!core::option::expect_failed::hdf18d99c3adabca7
3: 0x2134cb - <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::hf98aac39802896ba
4: 0x26a9d6 - <unknown>!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::idle_and_finalize_hook::h32775c0df0749d92
5: 0x26ad9f - <unknown>!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::finalize_block::h15e5a1a6b9ca8032
6: 0x2822bd - <unknown>!BlockBuilder_finalize_block }
```
</details>
---------
Co-authored-by: Bastian Köcher <git@kchr.de>1 parent 349132f commit ec6bf5d
File tree
4 files changed
+37
-52
lines changed- cumulus
- client/consensus/aura/src/collators
- parachains/runtimes
- contracts/contracts-rococo/src
- people/people-rococo/src
- polkadot-parachain/src
4 files changed
+37
-52
lines changedLines changed: 33 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | 98 | | |
101 | 99 | | |
102 | 100 | | |
| |||
214 | 212 | | |
215 | 213 | | |
216 | 214 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | 215 | | |
238 | 216 | | |
239 | 217 | | |
| |||
272 | 250 | | |
273 | 251 | | |
274 | 252 | | |
275 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
276 | 279 | | |
277 | 280 | | |
278 | 281 | | |
279 | 282 | | |
280 | 283 | | |
281 | 284 | | |
282 | | - | |
| 285 | + | |
283 | 286 | | |
284 | 287 | | |
285 | 288 | | |
| |||
301 | 304 | | |
302 | 305 | | |
303 | 306 | | |
304 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
305 | 312 | | |
306 | | - | |
307 | 313 | | |
308 | 314 | | |
309 | 315 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
939 | 939 | | |
940 | 940 | | |
941 | 941 | | |
942 | | - | |
943 | | - | |
944 | 942 | | |
945 | 943 | | |
946 | 944 | | |
| |||
971 | 969 | | |
972 | 970 | | |
973 | 971 | | |
974 | | - | |
975 | 972 | | |
976 | 973 | | |
977 | 974 | | |
| |||
1435 | 1432 | | |
1436 | 1433 | | |
1437 | 1434 | | |
1438 | | - | |
1439 | | - | |
1440 | 1435 | | |
1441 | 1436 | | |
1442 | 1437 | | |
| |||
1467 | 1462 | | |
1468 | 1463 | | |
1469 | 1464 | | |
1470 | | - | |
1471 | 1465 | | |
1472 | 1466 | | |
1473 | 1467 | | |
| |||
1737 | 1731 | | |
1738 | 1732 | | |
1739 | 1733 | | |
1740 | | - | |
1741 | | - | |
1742 | | - | |
1743 | | - | |
1744 | | - | |
1745 | | - | |
1746 | | - | |
1747 | | - | |
1748 | 1734 | | |
1749 | 1735 | | |
1750 | 1736 | | |
| |||
1761 | 1747 | | |
1762 | 1748 | | |
1763 | 1749 | | |
1764 | | - | |
1765 | 1750 | | |
1766 | 1751 | | |
1767 | 1752 | | |
| |||
1832 | 1817 | | |
1833 | 1818 | | |
1834 | 1819 | | |
1835 | | - | |
1836 | | - | |
1837 | 1820 | | |
1838 | 1821 | | |
1839 | 1822 | | |
| |||
1864 | 1847 | | |
1865 | 1848 | | |
1866 | 1849 | | |
1867 | | - | |
1868 | 1850 | | |
1869 | 1851 | | |
1870 | 1852 | | |
| |||
2141 | 2123 | | |
2142 | 2124 | | |
2143 | 2125 | | |
2144 | | - | |
2145 | | - | |
2146 | 2126 | | |
2147 | 2127 | | |
2148 | 2128 | | |
| |||
2173 | 2153 | | |
2174 | 2154 | | |
2175 | 2155 | | |
2176 | | - | |
2177 | 2156 | | |
2178 | 2157 | | |
2179 | 2158 | | |
| |||
0 commit comments