polkadot_omni_node_lib/fake_runtime_api/
utils.rs1pub(crate) mod imports {
18 pub use cumulus_primitives_core::ParaId;
19 pub use parachains_common::{AccountId, Balance, Nonce};
20 pub use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
21 pub use sp_runtime::{
22 traits::Block as BlockT,
23 transaction_validity::{TransactionSource, TransactionValidity},
24 ApplyExtrinsicResult,
25 };
26 pub use sp_weights::Weight;
27}
28
29macro_rules! impl_node_runtime_apis {
30 ($runtime: ty, $block: tt, $aura_id: ty) => {
31 sp_api::impl_runtime_apis! {
32 impl sp_api::Core<$block> for $runtime {
33 fn version() -> sp_version::RuntimeVersion {
34 unimplemented!()
35 }
36
37 fn execute_block(_: $block) {
38 unimplemented!()
39 }
40
41 fn initialize_block(
42 _: &<$block as BlockT>::Header
43 ) -> sp_runtime::ExtrinsicInclusionMode {
44 unimplemented!()
45 }
46 }
47
48 impl sp_api::Metadata<$block> for $runtime {
49 fn metadata() -> OpaqueMetadata {
50 unimplemented!()
51 }
52
53 fn metadata_at_version(_: u32) -> Option<OpaqueMetadata> {
54 unimplemented!()
55 }
56
57 fn metadata_versions() -> Vec<u32> {
58 unimplemented!()
59 }
60 }
61
62 impl cumulus_primitives_core::RelayParentOffsetApi<$block> for $runtime {
63 fn relay_parent_offset() -> u32 {
64 unimplemented!()
65 }
66 }
67
68 impl sp_consensus_aura::AuraApi<$block, $aura_id> for $runtime {
69 fn slot_duration() -> sp_consensus_aura::SlotDuration {
70 unimplemented!()
71 }
72
73 fn authorities() -> Vec<$aura_id> {
74 unimplemented!()
75 }
76 }
77
78 impl cumulus_primitives_aura::AuraUnincludedSegmentApi<$block> for $runtime {
79 fn can_build_upon(
80 _: <$block as BlockT>::Hash,
81 _: cumulus_primitives_aura::Slot,
82 ) -> bool {
83 unimplemented!()
84 }
85 }
86
87 impl sp_block_builder::BlockBuilder<$block> for $runtime {
88 fn apply_extrinsic(_: <$block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
89 unimplemented!()
90 }
91
92 fn finalize_block() -> <$block as BlockT>::Header {
93 unimplemented!()
94 }
95
96 fn inherent_extrinsics(
97 _: sp_inherents::InherentData
98 ) -> Vec<<$block as BlockT>::Extrinsic> {
99 unimplemented!()
100 }
101
102 fn check_inherents(
103 _: $block,
104 _: sp_inherents::InherentData
105 ) -> sp_inherents::CheckInherentsResult {
106 unimplemented!()
107 }
108 }
109
110 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<$block> for $runtime {
111 fn validate_transaction(
112 _: TransactionSource,
113 _: <$block as BlockT>::Extrinsic,
114 _: <$block as BlockT>::Hash,
115 ) -> TransactionValidity {
116 unimplemented!()
117 }
118 }
119
120 impl sp_offchain::OffchainWorkerApi<$block> for $runtime {
121 fn offchain_worker(_: &<$block as BlockT>::Header) {
122 unimplemented!()
123 }
124 }
125
126 impl sp_session::SessionKeys<$block> for $runtime {
127 fn generate_session_keys(_: Option<Vec<u8>>) -> Vec<u8> {
128 unimplemented!()
129 }
130
131 fn decode_session_keys(
132 _: Vec<u8>,
133 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
134 unimplemented!()
135 }
136 }
137
138 impl
139 pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
140 $block,
141 Balance,
142 > for $runtime
143 {
144 fn query_info(
145 _: <$block as BlockT>::Extrinsic,
146 _: u32,
147 ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
148 unimplemented!()
149 }
150 fn query_fee_details(
151 _: <$block as BlockT>::Extrinsic,
152 _: u32,
153 ) -> pallet_transaction_payment::FeeDetails<Balance> {
154 unimplemented!()
155 }
156 fn query_weight_to_fee(_: Weight) -> Balance {
157 unimplemented!()
158 }
159 fn query_length_to_fee(_: u32) -> Balance {
160 unimplemented!()
161 }
162 }
163
164 impl cumulus_primitives_core::CollectCollationInfo<$block> for $runtime {
165 fn collect_collation_info(
166 _: &<$block as BlockT>::Header
167 ) -> cumulus_primitives_core::CollationInfo {
168 unimplemented!()
169 }
170 }
171
172 impl cumulus_primitives_core::GetParachainInfo<$block> for $runtime {
173 fn parachain_id() -> ParaId {
174 unimplemented!()
175 }
176 }
177 #[cfg(feature = "try-runtime")]
178 impl frame_try_runtime::TryRuntime<$block> for $runtime {
179 fn on_runtime_upgrade(
180 _: frame_try_runtime::UpgradeCheckSelect
181 ) -> (Weight, Weight) {
182 unimplemented!()
183 }
184
185 fn execute_block(
186 _: $block,
187 _: bool,
188 _: bool,
189 _: frame_try_runtime::TryStateSelect,
190 ) -> Weight {
191 unimplemented!()
192 }
193 }
194
195 impl frame_system_rpc_runtime_api::AccountNonceApi<
196 $block,
197 AccountId,
198 Nonce
199 > for $runtime {
200 fn account_nonce(_: AccountId) -> Nonce {
201 unimplemented!()
202 }
203 }
204
205 #[cfg(feature = "runtime-benchmarks")]
206 impl frame_benchmarking::Benchmark<$block> for $runtime {
207 fn benchmark_metadata(_: bool) -> (
208 Vec<frame_benchmarking::BenchmarkList>,
209 Vec<frame_support::traits::StorageInfo>,
210 ) {
211 unimplemented!()
212 }
213
214 #[allow(non_local_definitions)]
215 fn dispatch_benchmark(
216 _: frame_benchmarking::BenchmarkConfig
217 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, String> {
218 unimplemented!()
219 }
220 }
221
222 impl sp_genesis_builder::GenesisBuilder<$block> for $runtime {
223 fn build_state(_: Vec<u8>) -> sp_genesis_builder::Result {
224 unimplemented!()
225 }
226
227 fn get_preset(_id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
228 unimplemented!()
229 }
230
231 fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
232 unimplemented!()
233 }
234 }
235
236 impl sp_statement_store::runtime_api::ValidateStatement<$block> for $runtime {
237 fn validate_statement(
238 _source: sp_statement_store::runtime_api::StatementSource,
239 _statement: sp_statement_store::Statement,
240 ) -> Result<sp_statement_store::runtime_api::ValidStatement, sp_statement_store::runtime_api::InvalidStatement> {
241 unimplemented!()
242 }
243 }
244 }
245 };
246}
247
248pub(crate) use impl_node_runtime_apis;