Skip to content

Commit e01e3cd

Browse files
authored
Merge pull request #950 from subspace/core-domain-prototype-refactoring-part-3
Core domain prototype refactoring (part 3)
2 parents a300b14 + 5682e61 commit e01e3cd

9 files changed

Lines changed: 416 additions & 823 deletions

File tree

domains/client/domain-executor/src/core_bundle_processor.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::domain_block_processor::DomainBlockProcessor;
2-
use crate::utils::translate_number_type;
2+
use crate::utils::{translate_number_type, DomainBundles};
33
use crate::TransactionFor;
44
use domain_runtime_primitives::{AccountId, DomainCoreApi};
55
use sc_client_api::{AuxStore, BlockBackend};
@@ -9,7 +9,7 @@ use sp_blockchain::HeaderBackend;
99
use sp_core::traits::{CodeExecutor, SpawnNamed};
1010
use sp_domain_digests::AsPredigest;
1111
use sp_domain_tracker::StateRootUpdate;
12-
use sp_domains::{DomainId, ExecutorApi, OpaqueBundle};
12+
use sp_domains::{DomainId, ExecutorApi};
1313
use sp_keystore::SyncCryptoStorePtr;
1414
use sp_runtime::generic::BlockId;
1515
use sp_runtime::traits::{Block as BlockT, HashFor, Header as HeaderT};
@@ -61,9 +61,6 @@ where
6161
}
6262
}
6363

64-
type CoreBundles<Block, PBlock> =
65-
Vec<OpaqueBundle<NumberFor<PBlock>, <PBlock as BlockT>::Hash, <Block as BlockT>::Hash>>;
66-
6764
impl<Block, SBlock, PBlock, Client, SClient, PClient, Backend, E>
6865
CoreBundleProcessor<Block, SBlock, PBlock, Client, SClient, PClient, Backend, E>
6966
where
@@ -126,7 +123,7 @@ where
126123
NumberFor<PBlock>,
127124
ForkChoiceStrategy,
128125
),
129-
bundles: CoreBundles<Block, PBlock>,
126+
bundles: DomainBundles<Block, PBlock>,
130127
shuffling_seed: Randomness,
131128
maybe_new_runtime: Option<Cow<'static, [u8]>>,
132129
) -> Result<(), sp_blockchain::Error> {
@@ -205,9 +202,17 @@ where
205202
fn bundles_to_extrinsics(
206203
&self,
207204
parent_hash: Block::Hash,
208-
bundles: CoreBundles<Block, PBlock>,
205+
bundles: DomainBundles<Block, PBlock>,
209206
shuffling_seed: Randomness,
210207
) -> Result<Vec<Block::Extrinsic>, sp_blockchain::Error> {
208+
let bundles = match bundles {
209+
DomainBundles::System(..) => {
210+
return Err(sp_blockchain::Error::Application(Box::from(
211+
"Core bundle processor can not process system bundles.",
212+
)))
213+
}
214+
DomainBundles::Core(bundles) => bundles,
215+
};
211216
let extrinsics = self
212217
.domain_block_processor
213218
.compile_own_domain_bundles(bundles);

0 commit comments

Comments
 (0)