Skip to content

Commit bbb978c

Browse files
committed
Migration recovery runtime
1 parent 1076fd3 commit bbb978c

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ homepage.workspace = true
1212
repository.workspace = true
1313

1414
[workspace.package]
15-
version = "4.0.0"
15+
version = "4.0.1"
1616
edition = "2021"
1717
authors = ["Airalab <research@robonomics.network>"]
1818
license = "Apache-2.0"

runtime/robonomics/src/lib.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
8484
spec_name: alloc::borrow::Cow::Borrowed("robonomics"),
8585
impl_name: alloc::borrow::Cow::Borrowed("robonomics-airalab"),
8686
authoring_version: 1,
87-
spec_version: 40,
87+
spec_version: 41,
8888
impl_version: 1,
8989
apis: RUNTIME_API_VERSIONS,
9090
transaction_version: 2,
@@ -204,7 +204,7 @@ impl cumulus_pallet_aura_ext::Config for Runtime {}
204204

205205
impl pallet_timestamp::Config for Runtime {
206206
type Moment = u64;
207-
type OnTimestampSet = Aura;
207+
type OnTimestampSet = ();
208208
type MinimumPeriod = ConstU64<0>;
209209
type WeightInfo = ();
210210
}
@@ -945,9 +945,27 @@ impl_runtime_apis! {
945945
}
946946
}
947947

948+
/// Recovery block executor that pass blocks when authorities list is empty.
949+
pub struct BlockExecutor<T, I>(core::marker::PhantomData<(T, I)>);
950+
951+
impl<Block, T, I> frame_support::traits::ExecuteBlock<Block> for BlockExecutor<T, I>
952+
where
953+
Block: BlockT,
954+
T: cumulus_pallet_aura_ext::Config,
955+
I: frame_support::traits::ExecuteBlock<Block>,
956+
{
957+
fn execute_block(block: Block) {
958+
if pallet_aura::Authorities::<T>::get().len() > 0 {
959+
cumulus_pallet_aura_ext::BlockExecutor::<T, I>::execute_block(block);
960+
} else {
961+
I::execute_block(block);
962+
}
963+
}
964+
}
965+
948966
cumulus_pallet_parachain_system::register_validate_block! {
949967
Runtime = Runtime,
950-
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
968+
BlockExecutor = BlockExecutor<Runtime, Executive>,
951969
}
952970

953971
parameter_types! {

0 commit comments

Comments
 (0)