astar_collator/parachain/
fake_runtime_api.rs

1// This file is part of Astar.
2
3// Copyright (C) Stake Technologies Pte.Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later
5
6// Astar is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// Astar is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with Astar. If not, see <http://www.gnu.org/licenses/>.
18
19#![allow(missing_docs)]
20
21#[cfg(feature = "runtime-benchmarks")]
22extern crate alloc;
23
24use astar_primitives::{AccountId, Balance, Block, Nonce};
25use ethereum::AuthorizationList;
26use frame_support::weights::Weight;
27use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
28use sp_api::impl_runtime_apis;
29use sp_consensus_aura::sr25519::AuthorityId as AuraId;
30use sp_core::{OpaqueMetadata, H160, H256, U256};
31use sp_inherents::{CheckInherentsResult, InherentData};
32use sp_runtime::{
33    traits::Block as BlockT,
34    transaction_validity::{TransactionSource, TransactionValidity},
35    ApplyExtrinsicResult, Permill,
36};
37use sp_version::RuntimeVersion;
38
39pub struct Runtime;
40
41impl_runtime_apis! {
42    impl sp_api::Core<Block> for Runtime {
43        fn version() -> RuntimeVersion {
44            unimplemented!()
45        }
46
47        fn execute_block(_block: <Block as BlockT>::LazyBlock) {
48            unimplemented!()
49        }
50
51        fn initialize_block(_header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
52            unimplemented!()
53        }
54    }
55
56    impl sp_api::Metadata<Block> for Runtime {
57        fn metadata() -> OpaqueMetadata {
58            unimplemented!()
59        }
60
61        fn metadata_at_version(_version: u32) -> Option<OpaqueMetadata> {
62            unimplemented!()
63        }
64
65        fn metadata_versions() -> sp_std::vec::Vec<u32> {
66            unimplemented!()
67        }
68    }
69
70    impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
71        fn collect_collation_info(_header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
72            unimplemented!()
73        }
74    }
75
76    impl cumulus_primitives_core::RelayParentOffsetApi<Block> for Runtime {
77        fn relay_parent_offset() -> u32 {
78            unimplemented!()
79        }
80    }
81
82    impl cumulus_primitives_core::KeyToIncludeInRelayProof<Block> for Runtime {
83        fn keys_to_prove() -> cumulus_primitives_core::RelayProofRequest {
84            unimplemented!()
85        }
86    }
87
88    impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
89        fn slot_duration() -> sp_consensus_aura::SlotDuration {
90            unimplemented!()
91        }
92
93        fn authorities() -> Vec<AuraId> {
94            unimplemented!()
95        }
96    }
97
98    impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
99        fn can_build_upon(_included_hash: <Block as BlockT>::Hash, _slot: cumulus_primitives_aura::Slot) -> bool {
100            unimplemented!()
101        }
102    }
103
104    impl sp_block_builder::BlockBuilder<Block> for Runtime {
105        fn apply_extrinsic(_extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
106            unimplemented!()
107        }
108
109        fn finalize_block() -> <Block as BlockT>::Header {
110            unimplemented!()
111        }
112
113        fn inherent_extrinsics(_data: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
114            unimplemented!()
115        }
116
117        fn check_inherents(_block: <Block as BlockT>::LazyBlock, _data: InherentData) -> CheckInherentsResult {
118            unimplemented!()
119        }
120    }
121
122    impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
123        fn account_nonce(_account: AccountId) -> Nonce {
124            unimplemented!()
125        }
126    }
127
128    impl sp_session::SessionKeys<Block> for Runtime {
129        fn generate_session_keys(_owner: Vec<u8>, _seed: Option<Vec<u8>>) -> sp_session::OpaqueGeneratedSessionKeys {
130            unimplemented!()
131        }
132
133        fn decode_session_keys(_encoded: Vec<u8>) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> {
134            unimplemented!()
135        }
136    }
137
138    impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
139        Block,
140        Balance,
141    > for Runtime {
142        fn query_info(_uxt: <Block as BlockT>::Extrinsic, _len: u32) -> RuntimeDispatchInfo<Balance> {
143            unimplemented!()
144        }
145        fn query_fee_details(_uxt: <Block as BlockT>::Extrinsic, _len: u32) -> FeeDetails<Balance> {
146            unimplemented!()
147        }
148        fn query_weight_to_fee(_weight: Weight) -> Balance {
149            unimplemented!()
150        }
151        fn query_length_to_fee(_length: u32) -> Balance {
152            unimplemented!()
153        }
154    }
155
156    impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {
157        fn chain_id() -> u64 {
158            unimplemented!()
159        }
160
161        fn account_basic(_address: H160) -> pallet_evm::Account {
162            unimplemented!()
163        }
164
165        fn gas_price() -> U256 {
166            unimplemented!()
167        }
168
169        fn account_code_at(_address: H160) -> Vec<u8> {
170            unimplemented!()
171        }
172
173        fn author() -> H160 {
174            unimplemented!()
175        }
176
177        fn storage_at(_address: H160, _index: U256) -> H256 {
178            unimplemented!()
179        }
180
181        fn call(
182            _from: H160,
183            _to: H160,
184            _data: Vec<u8>,
185            _value: U256,
186            _gas_limit: U256,
187            _max_fee_per_gas: Option<U256>,
188            _max_priority_fee_per_gas: Option<U256>,
189            _nonce: Option<U256>,
190            _estimate: bool,
191            _access_list: Option<Vec<(H160, Vec<H256>)>>,
192            _authorization_list: Option<AuthorizationList>,
193            _state_override: fp_evm::StateOverride,
194        ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
195            unimplemented!()
196        }
197
198        fn create(
199            _from: H160,
200            _data: Vec<u8>,
201            _value: U256,
202            _gas_limit: U256,
203            _max_fee_per_gas: Option<U256>,
204            _max_priority_fee_per_gas: Option<U256>,
205            _nonce: Option<U256>,
206            _estimate: bool,
207            _access_list: Option<Vec<(H160, Vec<H256>)>>,
208            _authorization_list: Option<AuthorizationList>,
209        ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
210            unimplemented!()
211        }
212
213        fn current_transaction_statuses() -> Option<Vec<fp_rpc::TransactionStatus>> {
214            unimplemented!()
215        }
216
217        fn current_block() -> Option<pallet_ethereum::Block> {
218            unimplemented!()
219        }
220
221        fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
222            unimplemented!()
223        }
224
225        fn current_all() -> (
226            Option<pallet_ethereum::Block>,
227            Option<Vec<pallet_ethereum::Receipt>>,
228            Option<Vec<fp_rpc::TransactionStatus>>,
229        ) {
230            unimplemented!()
231        }
232
233        fn extrinsic_filter(_xts: Vec<<Block as BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {
234            unimplemented!()
235        }
236
237        fn elasticity() -> Option<Permill> {
238            unimplemented!()
239        }
240
241        fn gas_limit_multiplier_support() {}
242
243        fn pending_block(_xts: Vec<<Block as BlockT>::Extrinsic>) -> (Option<pallet_ethereum::Block>, Option<Vec<fp_rpc::TransactionStatus>>) {
244            unimplemented!()
245        }
246
247        fn initialize_pending_block(_header: &<Block as BlockT>::Header) {
248            unimplemented!()
249        }
250    }
251
252    impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
253        fn convert_transaction(_transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic {
254            unimplemented!()
255        }
256    }
257
258    impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
259        fn validate_transaction(_source: TransactionSource, _tx: <Block as BlockT>::Extrinsic, _block_hash: <Block as BlockT>::Hash) -> TransactionValidity {
260            unimplemented!()
261        }
262    }
263
264    impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
265        fn offchain_worker(_header: &<Block as BlockT>::Header) {
266            unimplemented!()
267        }
268    }
269
270    impl moonbeam_rpc_primitives_debug::DebugRuntimeApi<Block> for Runtime {
271        fn trace_transaction(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _traced_transaction: &pallet_ethereum::Transaction, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
272            unimplemented!()
273        }
274
275        fn trace_block(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _known_transactions: Vec<H256>, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
276            unimplemented!()
277        }
278
279        fn trace_call(
280            _header: &<Block as BlockT>::Header,
281            _from: H160,
282            _to: H160,
283            _data: Vec<u8>,
284            _value: U256,
285            _gas_limit: U256,
286            _max_fee_per_gas: Option<U256>,
287            _max_priority_fee_per_gas: Option<U256>,
288            _nonce: Option<U256>,
289            _access_list: Option<Vec<(H160, Vec<H256>)>>,
290            _authorization_list: Option<AuthorizationList>,
291        ) -> Result<(), sp_runtime::DispatchError> {
292            unimplemented!()
293        }
294    }
295
296    impl moonbeam_rpc_primitives_txpool::TxPoolRuntimeApi<Block> for Runtime {
297        fn extrinsic_filter(_xts_ready: Vec<<Block as BlockT>::Extrinsic>, _xts_future: Vec<<Block as BlockT>::Extrinsic>) -> moonbeam_rpc_primitives_txpool::TxPoolResponse {
298            unimplemented!()
299        }
300    }
301
302    #[cfg(feature = "runtime-benchmarks")]
303    impl frame_benchmarking::Benchmark<Block> for Runtime {
304        fn benchmark_metadata(_extra: bool) -> (Vec<frame_benchmarking::BenchmarkList>, Vec<frame_support::traits::StorageInfo>) {
305            unimplemented!()
306        }
307
308        fn dispatch_benchmark(_config: frame_benchmarking::BenchmarkConfig) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
309            unimplemented!()
310        }
311    }
312
313    #[cfg(feature = "try-runtime")]
314    impl frame_try_runtime::TryRuntime<Block> for Runtime {
315        fn on_runtime_upgrade(_checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
316            unimplemented!()
317        }
318
319        fn execute_block(_block: <Block as BlockT>::LazyBlock, _state_root_check: bool, _signature_check: bool, _select: frame_try_runtime::TryStateSelect) -> Weight {
320            unimplemented!()
321        }
322    }
323}