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::execution_receipt::{ExecutionReceiptFor, SealedSingletonReceipt};
13use sp_domains::{
14 BundleAndExecutionReceiptVersion, DomainAllowlistUpdates, DomainId, DomainInstanceData,
15 NominatorPosition, OperatorId, OperatorPublicKey, PermissionedActionAllowedBy,
16};
17use sp_domains_fraud_proof::fraud_proof::FraudProof;
18use sp_domains_fraud_proof::storage_proof::FraudProofStorageKeyRequest;
19use sp_messenger::messages::{
20 BlockMessagesQuery, ChainId, ChannelId, ChannelStateWithNonce, CrossDomainMessage, MessageKey,
21 MessagesWithStorageKey, Nonce as XdmNonce,
22};
23use sp_messenger::{ChannelNonce, XdmId};
24use sp_runtime::traits::NumberFor;
25use sp_runtime::transaction_validity::{TransactionSource, TransactionValidity};
26use sp_runtime::{ApplyExtrinsicResult, ExtrinsicInclusionMode};
27use sp_subspace_mmr::ConsensusChainMmrLeafProof;
28use sp_version::RuntimeVersion;
29use std::collections::btree_map::BTreeMap;
30use std::collections::btree_set::BTreeSet;
31use subspace_core_primitives::objects::BlockObjectMapping;
32use subspace_core_primitives::segments::{
33 HistorySize, SegmentCommitment, SegmentHeader, SegmentIndex,
34};
35use subspace_core_primitives::{PublicKey, Randomness, U256};
36use subspace_runtime_primitives::opaque::Block;
37use subspace_runtime_primitives::{
38 AccountId, Balance, BlockHashFor, BlockNumber, ExtrinsicFor, HeaderFor, Moment, Nonce,
39};
40
41mod mmr {
42 pub use pallet_mmr::primitives::*;
43 use sp_core::H256;
44 pub type Hash = H256;
47}
48
49struct Runtime;
50
51sp_api::impl_runtime_apis! {
52 impl sp_api::Core<Block> for Runtime {
53 fn version() -> RuntimeVersion {
54 unreachable!()
55 }
56
57 fn execute_block(_block: Block) {
58 unreachable!()
59 }
60
61 fn initialize_block(_header: &HeaderFor<Block>) -> ExtrinsicInclusionMode {
62 unreachable!()
63 }
64 }
65
66 impl sp_api::Metadata<Block> for Runtime {
67 fn metadata() -> OpaqueMetadata {
68 unreachable!()
69 }
70
71 fn metadata_at_version(_version: u32) -> Option<OpaqueMetadata> {
72 unreachable!()
73 }
74
75 fn metadata_versions() -> Vec<u32> {
76 unreachable!()
77 }
78 }
79
80 impl sp_block_builder::BlockBuilder<Block> for Runtime {
81 fn apply_extrinsic(_extrinsic: ExtrinsicFor<Block>) -> ApplyExtrinsicResult {
82 unreachable!()
83 }
84
85 fn finalize_block() -> HeaderFor<Block> {
86 unreachable!()
87 }
88
89 fn inherent_extrinsics(_data: sp_inherents::InherentData) -> Vec<ExtrinsicFor<Block>> {
90 unreachable!()
91 }
92
93 fn check_inherents(
94 _block: Block,
95 _data: sp_inherents::InherentData,
96 ) -> sp_inherents::CheckInherentsResult {
97 unreachable!()
98 }
99 }
100
101 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
102 fn validate_transaction(
103 _source: TransactionSource,
104 _tx: ExtrinsicFor<Block>,
105 _block_hash: BlockHashFor<Block>,
106 ) -> TransactionValidity {
107 unreachable!()
108 }
109 }
110
111 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
112 fn offchain_worker(_header: &HeaderFor<Block>) {
113 unreachable!()
114 }
115 }
116
117 impl sp_objects::ObjectsApi<Block> for Runtime {
118 fn extract_block_object_mapping(_block: Block) -> BlockObjectMapping {
119 unreachable!()
120 }
121 }
122
123 impl sp_consensus_subspace::SubspaceApi<Block, PublicKey> for Runtime {
124 fn pot_parameters() -> PotParameters {
125 unreachable!()
126 }
127
128 fn solution_ranges() -> SolutionRanges {
129 unreachable!()
130 }
131
132 fn submit_vote_extrinsic(
133 _signed_vote: SignedVote<NumberFor<Block>, BlockHashFor<Block>, PublicKey>,
134 ) {
135 unreachable!()
136 }
137
138 fn history_size() -> HistorySize {
139 unreachable!()
140 }
141
142 fn max_pieces_in_sector() -> u16 {
143 unreachable!()
144 }
145
146 fn segment_commitment(_segment_index: SegmentIndex) -> Option<SegmentCommitment> {
147 unreachable!()
148 }
149
150 fn extract_segment_headers(_ext: &ExtrinsicFor<Block>) -> Option<Vec<SegmentHeader >> {
151 unreachable!()
152 }
153
154 fn is_inherent(_ext: &ExtrinsicFor<Block>) -> bool {
155 unreachable!()
156 }
157
158 fn root_plot_public_key() -> Option<PublicKey> {
159 unreachable!()
160 }
161
162 fn should_adjust_solution_range() -> bool {
163 unreachable!()
164 }
165
166 fn chain_constants() -> ChainConstants {
167 unreachable!()
168 }
169 }
170
171 impl sp_domains::DomainsApi<Block, DomainHeader> for Runtime {
172 fn submit_bundle_unsigned(
173 _opaque_bundle: sp_domains::bundle::OpaqueBundle<NumberFor<Block>, BlockHashFor<Block>, DomainHeader, Balance>,
174 ) {
175 unreachable!()
176 }
177
178 fn submit_receipt_unsigned(
179 _singleton_receipt: SealedSingletonReceipt<NumberFor<Block>, BlockHashFor<Block>, DomainHeader, Balance>,
180 ) {
181 unreachable!()
182 }
183
184 fn extract_successful_bundles(
185 _domain_id: DomainId,
186 _extrinsics: Vec<ExtrinsicFor<Block>>,
187 ) -> sp_domains::bundle::OpaqueBundles<Block, DomainHeader, Balance> {
188 unreachable!()
189 }
190
191 fn extrinsics_shuffling_seed() -> Randomness {
192 unreachable!()
193 }
194
195 fn domain_runtime_code(_domain_id: DomainId) -> Option<Vec<u8>> {
196 unreachable!()
197 }
198
199 fn runtime_id(_domain_id: DomainId) -> Option<sp_domains::RuntimeId> {
200 unreachable!()
201 }
202
203 fn runtime_upgrades() -> Vec<sp_domains::RuntimeId> {
204 unreachable!()
205 }
206
207 fn domain_instance_data(_domain_id: DomainId) -> Option<(DomainInstanceData, NumberFor<Block>)> {
208 unreachable!()
209 }
210
211 fn domain_timestamp() -> Moment {
212 unreachable!()
213 }
214
215 fn consensus_transaction_byte_fee() -> Balance {
216 unreachable!()
217 }
218
219 fn domain_tx_range(_domain_id: DomainId) -> U256 {
220 unreachable!()
221 }
222
223 fn genesis_state_root(_domain_id: DomainId) -> Option<H256> {
224 unreachable!()
225 }
226
227 fn head_receipt_number(_domain_id: DomainId) -> DomainNumber {
228 unreachable!()
229 }
230
231 fn oldest_unconfirmed_receipt_number(_domain_id: DomainId) -> Option<DomainNumber> {
232 unreachable!()
233 }
234
235 fn domain_bundle_limit(_domain_id: DomainId) -> Option<sp_domains::DomainBundleLimit> {
236 unreachable!()
237 }
238
239 fn non_empty_er_exists(_domain_id: DomainId) -> bool {
240 unreachable!()
241 }
242
243 fn domain_best_number(_domain_id: DomainId) -> Option<DomainNumber> {
244 unreachable!()
245 }
246
247 fn execution_receipt(_receipt_hash: DomainHash) -> Option<ExecutionReceiptFor<DomainHeader, Block, Balance>> {
248 unreachable!()
249 }
250
251 fn domain_operators(_domain_id: DomainId) -> Option<(BTreeMap<OperatorId, Balance>, Vec<OperatorId>)> {
252 unreachable!()
253 }
254
255 fn receipt_hash(_domain_id: DomainId, _domain_number: DomainNumber) -> Option<DomainHash> {
256 unreachable!()
257 }
258
259 fn latest_confirmed_domain_block(_domain_id: DomainId) -> Option<(DomainNumber, DomainHash)>{
260 unreachable!()
261 }
262
263 fn is_bad_er_pending_to_prune(_domain_id: DomainId, _receipt_hash: DomainHash) -> bool {
264 unreachable!()
265 }
266
267 fn storage_fund_account_balance(_operator_id: OperatorId) -> Balance {
268 unreachable!()
269 }
270
271 fn is_domain_runtime_upgraded_since(_domain_id: DomainId, _at: NumberFor<Block>) -> Option<bool> {
272 unreachable!()
273 }
274
275 fn domain_sudo_call(_domain_id: DomainId) -> Option<Vec<u8>> {
276 unreachable!()
277 }
278
279 fn evm_domain_contract_creation_allowed_by_call(_domain_id: DomainId) -> Option<PermissionedActionAllowedBy<EthereumAccountId>>{
280 unreachable!()
281 }
282
283 fn last_confirmed_domain_block_receipt(_domain_id: DomainId) -> Option<ExecutionReceiptFor<DomainHeader, Block, Balance>> {
284 unreachable!()
285 }
286
287 fn current_bundle_and_execution_receipt_version() -> BundleAndExecutionReceiptVersion {
288 unreachable!()
289 }
290
291 fn genesis_execution_receipt(_domain_id: DomainId) -> Option<ExecutionReceiptFor<DomainHeader, Block, Balance>> {
292 unreachable!()
293 }
294
295 fn nominator_position(
296 _operator_id: OperatorId,
297 _nominator_account: sp_runtime::AccountId32,
298 ) -> Option<NominatorPosition<Balance, DomainNumber, Balance>> {
299 unreachable!()
300 }
301
302 fn block_pruning_depth() -> NumberFor<Block> {
303 unreachable!()
304 }
305 }
306
307 impl sp_domains::BundleProducerElectionApi<Block, Balance> for Runtime {
308 fn bundle_producer_election_params(_domain_id: DomainId) -> Option<BundleProducerElectionParams<Balance>> {
309 unreachable!()
310 }
311
312 fn operator(_operator_id: OperatorId) -> Option<(OperatorPublicKey, Balance)> {
313 unreachable!()
314 }
315 }
316
317 impl sp_session::SessionKeys<Block> for Runtime {
318 fn generate_session_keys(_seed: Option<Vec<u8>>) -> Vec<u8> {
319 unreachable!()
320 }
321
322 fn decode_session_keys(
323 _encoded: Vec<u8>,
324 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
325 unreachable!()
326 }
327 }
328
329 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
330 fn account_nonce(_account: AccountId) -> Nonce {
331 unreachable!()
332 }
333 }
334
335 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
336 fn query_info(
337 _uxt: ExtrinsicFor<Block>,
338 _len: u32,
339 ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
340 unreachable!()
341 }
342 fn query_fee_details(
343 _uxt: ExtrinsicFor<Block>,
344 _len: u32,
345 ) -> pallet_transaction_payment::FeeDetails<Balance> {
346 unreachable!()
347 }
348 fn query_weight_to_fee(_weight: Weight) -> Balance {
349 unreachable!()
350 }
351 fn query_length_to_fee(_length: u32) -> Balance {
352 unreachable!()
353 }
354 }
355
356 impl sp_messenger::MessengerApi<Block, BlockNumber, BlockHashFor<Block>> for Runtime {
357 fn is_xdm_mmr_proof_valid(
358 _ext: &ExtrinsicFor<Block>
359 ) -> Option<bool> {
360 unreachable!()
361 }
362
363 fn extract_xdm_mmr_proof(_ext: &ExtrinsicFor<Block>) -> Option<ConsensusChainMmrLeafProof<BlockNumber, BlockHashFor<Block>, sp_core::H256>> {
364 unreachable!()
365 }
366
367 fn batch_extract_xdm_mmr_proof(_extrinsics: &Vec<ExtrinsicFor<Block>>) -> BTreeMap<u32, ConsensusChainMmrLeafProof<BlockNumber, BlockHashFor<Block>, sp_core::H256>> {
368 unreachable!()
369 }
370
371 fn confirmed_domain_block_storage_key(_domain_id: DomainId) -> Vec<u8> {
372 unreachable!()
373 }
374
375 fn outbox_storage_key(_message_key: MessageKey) -> Vec<u8> {
376 unreachable!()
377 }
378
379 fn inbox_response_storage_key(_message_key: MessageKey) -> Vec<u8> {
380 unreachable!()
381 }
382
383 fn domain_chains_allowlist_update(_domain_id: DomainId) -> Option<DomainAllowlistUpdates>{
384 unreachable!()
385 }
386
387 fn xdm_id(_ext: &ExtrinsicFor<Block>) -> Option<XdmId> {
388 unreachable!()
389 }
390
391 fn channel_nonce(_chain_id: ChainId, _channel_id: ChannelId) -> Option<ChannelNonce> {
392 unreachable!()
393 }
394 }
395
396 impl sp_messenger::RelayerApi<Block, BlockNumber, BlockNumber, BlockHashFor<Block>> for Runtime {
397 fn outbox_message_unsigned(_msg: CrossDomainMessage<NumberFor<Block>, BlockHashFor<Block>, BlockHashFor<Block>>) -> Option<ExtrinsicFor<Block>> {
398 unreachable!()
399 }
400
401 fn inbox_response_message_unsigned(_msg: CrossDomainMessage<NumberFor<Block>, BlockHashFor<Block>, BlockHashFor<Block>>) -> Option<ExtrinsicFor<Block>> {
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}