subspace_fake_runtime_api/
lib.rs1use domain_runtime_primitives::opaque::Header as DomainHeader;
4use domain_runtime_primitives::{
5 BlockNumber as DomainNumber, EthereumAccountId, Hash as DomainHash,
6};
7use frame_support::weights::Weight;
8use sp_consensus_subspace::{ChainConstants, PotParameters, SignedVote, SolutionRanges};
9use sp_core::crypto::KeyTypeId;
10use sp_core::{H256, OpaqueMetadata};
11use sp_domains::bundle_producer_election::BundleProducerElectionParams;
12use sp_domains::{
13 DomainAllowlistUpdates, DomainId, DomainInstanceData, ExecutionReceiptFor, OperatorId,
14 OperatorPublicKey, PermissionedActionAllowedBy,
15};
16use sp_domains_fraud_proof::fraud_proof::FraudProof;
17use sp_domains_fraud_proof::storage_proof::FraudProofStorageKeyRequest;
18use sp_messenger::messages::{
19 BlockMessagesQuery, BlockMessagesWithStorageKey, ChainId, ChannelId, ChannelStateWithNonce,
20 CrossDomainMessage, MessageId, MessageKey, MessagesWithStorageKey, Nonce as XdmNonce,
21};
22use sp_messenger::{ChannelNonce, XdmId};
23use sp_runtime::traits::NumberFor;
24use sp_runtime::transaction_validity::{TransactionSource, TransactionValidity};
25use sp_runtime::{ApplyExtrinsicResult, ExtrinsicInclusionMode};
26use sp_subspace_mmr::ConsensusChainMmrLeafProof;
27use sp_version::RuntimeVersion;
28use std::collections::btree_map::BTreeMap;
29use std::collections::btree_set::BTreeSet;
30use subspace_core_primitives::objects::BlockObjectMapping;
31use subspace_core_primitives::segments::{
32 HistorySize, SegmentCommitment, SegmentHeader, SegmentIndex,
33};
34use subspace_core_primitives::{PublicKey, Randomness, U256};
35use subspace_runtime_primitives::opaque::Block;
36use subspace_runtime_primitives::{
37 AccountId, Balance, BlockHashFor, BlockNumber, ExtrinsicFor, HeaderFor, Moment, Nonce,
38};
39
40mod mmr {
41 pub use pallet_mmr::primitives::*;
42 use sp_core::H256;
43 pub type Hash = H256;
46}
47
48struct Runtime;
49
50sp_api::impl_runtime_apis! {
51 impl sp_api::Core<Block> for Runtime {
52 fn version() -> RuntimeVersion {
53 unreachable!()
54 }
55
56 fn execute_block(_block: Block) {
57 unreachable!()
58 }
59
60 fn initialize_block(_header: &HeaderFor<Block>) -> ExtrinsicInclusionMode {
61 unreachable!()
62 }
63 }
64
65 impl sp_api::Metadata<Block> for Runtime {
66 fn metadata() -> OpaqueMetadata {
67 unreachable!()
68 }
69
70 fn metadata_at_version(_version: u32) -> Option<OpaqueMetadata> {
71 unreachable!()
72 }
73
74 fn metadata_versions() -> Vec<u32> {
75 unreachable!()
76 }
77 }
78
79 impl sp_block_builder::BlockBuilder<Block> for Runtime {
80 fn apply_extrinsic(_extrinsic: ExtrinsicFor<Block>) -> ApplyExtrinsicResult {
81 unreachable!()
82 }
83
84 fn finalize_block() -> HeaderFor<Block> {
85 unreachable!()
86 }
87
88 fn inherent_extrinsics(_data: sp_inherents::InherentData) -> Vec<ExtrinsicFor<Block>> {
89 unreachable!()
90 }
91
92 fn check_inherents(
93 _block: Block,
94 _data: sp_inherents::InherentData,
95 ) -> sp_inherents::CheckInherentsResult {
96 unreachable!()
97 }
98 }
99
100 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
101 fn validate_transaction(
102 _source: TransactionSource,
103 _tx: ExtrinsicFor<Block>,
104 _block_hash: BlockHashFor<Block>,
105 ) -> TransactionValidity {
106 unreachable!()
107 }
108 }
109
110 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
111 fn offchain_worker(_header: &HeaderFor<Block>) {
112 unreachable!()
113 }
114 }
115
116 impl sp_objects::ObjectsApi<Block> for Runtime {
117 fn extract_block_object_mapping(_block: Block) -> BlockObjectMapping {
118 unreachable!()
119 }
120 }
121
122 impl sp_consensus_subspace::SubspaceApi<Block, PublicKey> for Runtime {
123 fn pot_parameters() -> PotParameters {
124 unreachable!()
125 }
126
127 fn solution_ranges() -> SolutionRanges {
128 unreachable!()
129 }
130
131 fn submit_vote_extrinsic(
132 _signed_vote: SignedVote<NumberFor<Block>, BlockHashFor<Block>, PublicKey>,
133 ) {
134 unreachable!()
135 }
136
137 fn history_size() -> HistorySize {
138 unreachable!()
139 }
140
141 fn max_pieces_in_sector() -> u16 {
142 unreachable!()
143 }
144
145 fn segment_commitment(_segment_index: SegmentIndex) -> Option<SegmentCommitment> {
146 unreachable!()
147 }
148
149 fn extract_segment_headers(_ext: &ExtrinsicFor<Block>) -> Option<Vec<SegmentHeader >> {
150 unreachable!()
151 }
152
153 fn is_inherent(_ext: &ExtrinsicFor<Block>) -> bool {
154 unreachable!()
155 }
156
157 fn root_plot_public_key() -> Option<PublicKey> {
158 unreachable!()
159 }
160
161 fn should_adjust_solution_range() -> bool {
162 unreachable!()
163 }
164
165 fn chain_constants() -> ChainConstants {
166 unreachable!()
167 }
168 }
169
170 impl sp_domains::DomainsApi<Block, DomainHeader> for Runtime {
171 fn submit_bundle_unsigned(
172 _opaque_bundle: sp_domains::OpaqueBundle<NumberFor<Block>, BlockHashFor<Block>, DomainHeader, Balance>,
173 ) {
174 unreachable!()
175 }
176
177 fn submit_receipt_unsigned(
178 _singleton_receipt: sp_domains::SealedSingletonReceipt<NumberFor<Block>, BlockHashFor<Block>, DomainHeader, Balance>,
179 ) {
180 unreachable!()
181 }
182
183 fn extract_successful_bundles(
184 _domain_id: DomainId,
185 _extrinsics: Vec<ExtrinsicFor<Block>>,
186 ) -> sp_domains::OpaqueBundles<Block, DomainHeader, Balance> {
187 unreachable!()
188 }
189
190 fn extrinsics_shuffling_seed() -> Randomness {
191 unreachable!()
192 }
193
194 fn domain_runtime_code(_domain_id: DomainId) -> Option<Vec<u8>> {
195 unreachable!()
196 }
197
198 fn runtime_id(_domain_id: DomainId) -> Option<sp_domains::RuntimeId> {
199 unreachable!()
200 }
201
202 fn runtime_upgrades() -> Vec<sp_domains::RuntimeId> {
203 unreachable!()
204 }
205
206 fn domain_instance_data(_domain_id: DomainId) -> Option<(DomainInstanceData, NumberFor<Block>)> {
207 unreachable!()
208 }
209
210 fn domain_timestamp() -> Moment {
211 unreachable!()
212 }
213
214 fn timestamp() -> Moment {
215 unreachable!()
216 }
217
218 fn consensus_transaction_byte_fee() -> Balance {
219 unreachable!()
220 }
221
222 fn consensus_chain_byte_fee() -> Balance {
223 unreachable!()
224 }
225
226 fn domain_tx_range(_domain_id: DomainId) -> U256 {
227 unreachable!()
228 }
229
230 fn genesis_state_root(_domain_id: DomainId) -> Option<H256> {
231 unreachable!()
232 }
233
234 fn head_receipt_number(_domain_id: DomainId) -> DomainNumber {
235 unreachable!()
236 }
237
238 fn oldest_unconfirmed_receipt_number(_domain_id: DomainId) -> Option<DomainNumber> {
239 unreachable!()
240 }
241
242 fn domain_bundle_limit(_domain_id: DomainId) -> Option<sp_domains::DomainBundleLimit> {
243 unreachable!()
244 }
245
246 fn non_empty_er_exists(_domain_id: DomainId) -> bool {
247 unreachable!()
248 }
249
250 fn domain_best_number(_domain_id: DomainId) -> Option<DomainNumber> {
251 unreachable!()
252 }
253
254 fn execution_receipt(_receipt_hash: DomainHash) -> Option<ExecutionReceiptFor<DomainHeader, Block, Balance>> {
255 unreachable!()
256 }
257
258 fn domain_operators(_domain_id: DomainId) -> Option<(BTreeMap<OperatorId, Balance>, Vec<OperatorId>)> {
259 unreachable!()
260 }
261
262 fn receipt_hash(_domain_id: DomainId, _domain_number: DomainNumber) -> Option<DomainHash> {
263 unreachable!()
264 }
265
266 fn latest_confirmed_domain_block(_domain_id: DomainId) -> Option<(DomainNumber, DomainHash)>{
267 unreachable!()
268 }
269
270 fn is_bad_er_pending_to_prune(_domain_id: DomainId, _receipt_hash: DomainHash) -> bool {
271 unreachable!()
272 }
273
274 fn storage_fund_account_balance(_operator_id: OperatorId) -> Balance {
275 unreachable!()
276 }
277
278 fn is_domain_runtime_upgraded_since(_domain_id: DomainId, _at: NumberFor<Block>) -> Option<bool> {
279 unreachable!()
280 }
281
282 fn domain_sudo_call(_domain_id: DomainId) -> Option<Vec<u8>> {
283 unreachable!()
284 }
285
286 fn evm_domain_contract_creation_allowed_by_call(_domain_id: DomainId) -> Option<PermissionedActionAllowedBy<EthereumAccountId>>{
287 unreachable!()
288 }
289
290 fn last_confirmed_domain_block_receipt(_domain_id: DomainId) -> Option<ExecutionReceiptFor<DomainHeader, Block, Balance>> {
291 unreachable!()
292 }
293 }
294
295 impl sp_domains::BundleProducerElectionApi<Block, Balance> for Runtime {
296 fn bundle_producer_election_params(_domain_id: DomainId) -> Option<BundleProducerElectionParams<Balance>> {
297 unreachable!()
298 }
299
300 fn operator(_operator_id: OperatorId) -> Option<(OperatorPublicKey, Balance)> {
301 unreachable!()
302 }
303 }
304
305 impl sp_session::SessionKeys<Block> for Runtime {
306 fn generate_session_keys(_seed: Option<Vec<u8>>) -> Vec<u8> {
307 unreachable!()
308 }
309
310 fn decode_session_keys(
311 _encoded: Vec<u8>,
312 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
313 unreachable!()
314 }
315 }
316
317 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
318 fn account_nonce(_account: AccountId) -> Nonce {
319 unreachable!()
320 }
321 }
322
323 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
324 fn query_info(
325 _uxt: ExtrinsicFor<Block>,
326 _len: u32,
327 ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
328 unreachable!()
329 }
330 fn query_fee_details(
331 _uxt: ExtrinsicFor<Block>,
332 _len: u32,
333 ) -> pallet_transaction_payment::FeeDetails<Balance> {
334 unreachable!()
335 }
336 fn query_weight_to_fee(_weight: Weight) -> Balance {
337 unreachable!()
338 }
339 fn query_length_to_fee(_length: u32) -> Balance {
340 unreachable!()
341 }
342 }
343
344 impl sp_messenger::MessengerApi<Block, BlockNumber, BlockHashFor<Block>> for Runtime {
345 fn is_xdm_mmr_proof_valid(
346 _ext: &ExtrinsicFor<Block>
347 ) -> Option<bool> {
348 unreachable!()
349 }
350
351 fn extract_xdm_mmr_proof(_ext: &ExtrinsicFor<Block>) -> Option<ConsensusChainMmrLeafProof<BlockNumber, BlockHashFor<Block>, sp_core::H256>> {
352 unreachable!()
353 }
354
355 fn batch_extract_xdm_mmr_proof(_extrinsics: &Vec<ExtrinsicFor<Block>>) -> BTreeMap<u32, ConsensusChainMmrLeafProof<BlockNumber, BlockHashFor<Block>, sp_core::H256>> {
356 unreachable!()
357 }
358
359 fn confirmed_domain_block_storage_key(_domain_id: DomainId) -> Vec<u8> {
360 unreachable!()
361 }
362
363 fn outbox_storage_key(_message_key: MessageKey) -> Vec<u8> {
364 unreachable!()
365 }
366
367 fn inbox_response_storage_key(_message_key: MessageKey) -> Vec<u8> {
368 unreachable!()
369 }
370
371 fn domain_chains_allowlist_update(_domain_id: DomainId) -> Option<DomainAllowlistUpdates>{
372 unreachable!()
373 }
374
375 fn xdm_id(_ext: &ExtrinsicFor<Block>) -> Option<XdmId> {
376 unreachable!()
377 }
378
379 fn channel_nonce(_chain_id: ChainId, _channel_id: ChannelId) -> Option<ChannelNonce> {
380 unreachable!()
381 }
382 }
383
384 impl sp_messenger::RelayerApi<Block, BlockNumber, BlockNumber, BlockHashFor<Block>> for Runtime {
385 fn block_messages() -> BlockMessagesWithStorageKey {
386 unreachable!()
387 }
388
389 fn outbox_message_unsigned(_msg: CrossDomainMessage<NumberFor<Block>, BlockHashFor<Block>, BlockHashFor<Block>>) -> Option<ExtrinsicFor<Block>> {
390 unreachable!()
391 }
392
393 fn inbox_response_message_unsigned(_msg: CrossDomainMessage<NumberFor<Block>, BlockHashFor<Block>, BlockHashFor<Block>>) -> Option<ExtrinsicFor<Block>> {
394 unreachable!()
395 }
396
397 fn should_relay_outbox_message(_dst_chain_id: ChainId, _msg_id: MessageId) -> bool {
398 unreachable!()
399 }
400
401 fn should_relay_inbox_message_response(_dst_chain_id: ChainId, _msg_id: MessageId) -> bool {
402 unreachable!()
403 }
404
405 fn updated_channels() -> BTreeSet<(ChainId, ChannelId)> {
406 unreachable!()
407 }
408
409 fn channel_storage_key(_chain_id: ChainId, _channel_id: ChannelId) -> Vec<u8> {
410 unreachable!()
411 }
412
413 fn open_channels() -> BTreeSet<(ChainId, ChannelId)> {
414 unreachable!()
415 }
416
417 fn block_messages_with_query(_: BlockMessagesQuery) -> MessagesWithStorageKey {
418 unreachable!()
419 }
420
421 fn channels_and_state() -> Vec<(ChainId, ChannelId, ChannelStateWithNonce)> {
422 unreachable!()
423 }
424
425 fn first_outbox_message_nonce_to_relay(_: ChainId, _: ChannelId, _: XdmNonce) -> Option<XdmNonce> {
426 unreachable!()
427 }
428
429 fn first_inbox_message_response_nonce_to_relay(_: ChainId, _: ChannelId, _: XdmNonce) -> Option<XdmNonce> {
430 unreachable!()
431 }
432 }
433
434 impl sp_domains_fraud_proof::FraudProofApi<Block, DomainHeader> for Runtime {
435 fn submit_fraud_proof_unsigned(_fraud_proof: FraudProof<NumberFor<Block>, BlockHashFor<Block>, DomainHeader, H256>) {
436 unreachable!()
437 }
438
439 fn fraud_proof_storage_key(_req: FraudProofStorageKeyRequest<NumberFor<Block>>) -> Vec<u8> {
440 unreachable!()
441 }
442 }
443
444 impl mmr::MmrApi<Block, mmr::Hash, BlockNumber> for Runtime {
445 fn mmr_root() -> Result<mmr::Hash, mmr::Error> {
446 unreachable!()
447 }
448
449 fn mmr_leaf_count() -> Result<mmr::LeafIndex, mmr::Error> {
450 unreachable!()
451 }
452
453 fn generate_proof(
454 _block_numbers: Vec<BlockNumber>,
455 _best_known_block_number: Option<BlockNumber>,
456 ) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::LeafProof<mmr::Hash>), mmr::Error> {
457 unreachable!()
458 }
459
460 fn verify_proof(_leaves: Vec<mmr::EncodableOpaqueLeaf>, _proof: mmr::LeafProof<mmr::Hash>)
461 -> Result<(), mmr::Error>
462 {
463 unreachable!()
464 }
465
466 fn verify_proof_stateless(
467 _root: mmr::Hash,
468 _leaves: Vec<mmr::EncodableOpaqueLeaf>,
469 _proof: mmr::LeafProof<mmr::Hash>
470 ) -> Result<(), mmr::Error> {
471 unreachable!()
472 }
473 }
474
475 impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
476 fn build_state(_config: Vec<u8>) -> sp_genesis_builder::Result {
477 unreachable!()
478 }
479
480 fn get_preset(_id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
481 unreachable!()
482 }
483
484 fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
485 unreachable!()
486 }
487 }
488}