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 sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
83        fn slot_duration() -> sp_consensus_aura::SlotDuration {
84            unimplemented!()
85        }
86
87        fn authorities() -> Vec<AuraId> {
88            unimplemented!()
89        }
90    }
91
92    impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
93        fn can_build_upon(_included_hash: <Block as BlockT>::Hash, _slot: cumulus_primitives_aura::Slot) -> bool {
94            unimplemented!()
95        }
96    }
97
98    impl sp_block_builder::BlockBuilder<Block> for Runtime {
99        fn apply_extrinsic(_extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
100            unimplemented!()
101        }
102
103        fn finalize_block() -> <Block as BlockT>::Header {
104            unimplemented!()
105        }
106
107        fn inherent_extrinsics(_data: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
108            unimplemented!()
109        }
110
111        fn check_inherents(_block: <Block as BlockT>::LazyBlock, _data: InherentData) -> CheckInherentsResult {
112            unimplemented!()
113        }
114    }
115
116    impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
117        fn account_nonce(_account: AccountId) -> Nonce {
118            unimplemented!()
119        }
120    }
121
122    impl sp_session::SessionKeys<Block> for Runtime {
123        fn generate_session_keys(_seed: Option<Vec<u8>>) -> Vec<u8> {
124            unimplemented!()
125        }
126
127        fn decode_session_keys(_encoded: Vec<u8>) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> {
128            unimplemented!()
129        }
130    }
131
132    impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
133        Block,
134        Balance,
135    > for Runtime {
136        fn query_info(_uxt: <Block as BlockT>::Extrinsic, _len: u32) -> RuntimeDispatchInfo<Balance> {
137            unimplemented!()
138        }
139        fn query_fee_details(_uxt: <Block as BlockT>::Extrinsic, _len: u32) -> FeeDetails<Balance> {
140            unimplemented!()
141        }
142        fn query_weight_to_fee(_weight: Weight) -> Balance {
143            unimplemented!()
144        }
145        fn query_length_to_fee(_length: u32) -> Balance {
146            unimplemented!()
147        }
148    }
149
150    impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {
151        fn chain_id() -> u64 {
152            unimplemented!()
153        }
154
155        fn account_basic(_address: H160) -> pallet_evm::Account {
156            unimplemented!()
157        }
158
159        fn gas_price() -> U256 {
160            unimplemented!()
161        }
162
163        fn account_code_at(_address: H160) -> Vec<u8> {
164            unimplemented!()
165        }
166
167        fn author() -> H160 {
168            unimplemented!()
169        }
170
171        fn storage_at(_address: H160, _index: U256) -> H256 {
172            unimplemented!()
173        }
174
175        fn call(
176            _from: H160,
177            _to: H160,
178            _data: Vec<u8>,
179            _value: U256,
180            _gas_limit: U256,
181            _max_fee_per_gas: Option<U256>,
182            _max_priority_fee_per_gas: Option<U256>,
183            _nonce: Option<U256>,
184            _estimate: bool,
185            _access_list: Option<Vec<(H160, Vec<H256>)>>,
186            _authorization_list: Option<AuthorizationList>,
187        ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
188            unimplemented!()
189        }
190
191        fn create(
192            _from: H160,
193            _data: Vec<u8>,
194            _value: U256,
195            _gas_limit: U256,
196            _max_fee_per_gas: Option<U256>,
197            _max_priority_fee_per_gas: Option<U256>,
198            _nonce: Option<U256>,
199            _estimate: bool,
200            _access_list: Option<Vec<(H160, Vec<H256>)>>,
201            _authorization_list: Option<AuthorizationList>,
202        ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
203            unimplemented!()
204        }
205
206        fn current_transaction_statuses() -> Option<Vec<fp_rpc::TransactionStatus>> {
207            unimplemented!()
208        }
209
210        fn current_block() -> Option<pallet_ethereum::Block> {
211            unimplemented!()
212        }
213
214        fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
215            unimplemented!()
216        }
217
218        fn current_all() -> (
219            Option<pallet_ethereum::Block>,
220            Option<Vec<pallet_ethereum::Receipt>>,
221            Option<Vec<fp_rpc::TransactionStatus>>,
222        ) {
223            unimplemented!()
224        }
225
226        fn extrinsic_filter(_xts: Vec<<Block as BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {
227            unimplemented!()
228        }
229
230        fn elasticity() -> Option<Permill> {
231            unimplemented!()
232        }
233
234        fn gas_limit_multiplier_support() {}
235
236        fn pending_block(_xts: Vec<<Block as BlockT>::Extrinsic>) -> (Option<pallet_ethereum::Block>, Option<Vec<fp_rpc::TransactionStatus>>) {
237            unimplemented!()
238        }
239
240        fn initialize_pending_block(_header: &<Block as BlockT>::Header) {
241            unimplemented!()
242        }
243    }
244
245    impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
246        fn convert_transaction(_transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic {
247            unimplemented!()
248        }
249    }
250
251    impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
252        fn validate_transaction(_source: TransactionSource, _tx: <Block as BlockT>::Extrinsic, _block_hash: <Block as BlockT>::Hash) -> TransactionValidity {
253            unimplemented!()
254        }
255    }
256
257    impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
258        fn offchain_worker(_header: &<Block as BlockT>::Header) {
259            unimplemented!()
260        }
261    }
262
263    impl moonbeam_rpc_primitives_debug::DebugRuntimeApi<Block> for Runtime {
264        fn trace_transaction(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _traced_transaction: &pallet_ethereum::Transaction, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
265            unimplemented!()
266        }
267
268        fn trace_block(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _known_transactions: Vec<H256>, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
269            unimplemented!()
270        }
271
272        fn trace_call(
273            _header: &<Block as BlockT>::Header,
274            _from: H160,
275            _to: H160,
276            _data: Vec<u8>,
277            _value: U256,
278            _gas_limit: U256,
279            _max_fee_per_gas: Option<U256>,
280            _max_priority_fee_per_gas: Option<U256>,
281            _nonce: Option<U256>,
282            _access_list: Option<Vec<(H160, Vec<H256>)>>,
283            _authorization_list: Option<AuthorizationList>,
284        ) -> Result<(), sp_runtime::DispatchError> {
285            unimplemented!()
286        }
287    }
288
289    impl moonbeam_rpc_primitives_txpool::TxPoolRuntimeApi<Block> for Runtime {
290        fn extrinsic_filter(_xts_ready: Vec<<Block as BlockT>::Extrinsic>, _xts_future: Vec<<Block as BlockT>::Extrinsic>) -> moonbeam_rpc_primitives_txpool::TxPoolResponse {
291            unimplemented!()
292        }
293    }
294
295    #[cfg(feature = "runtime-benchmarks")]
296    impl frame_benchmarking::Benchmark<Block> for Runtime {
297        fn benchmark_metadata(_extra: bool) -> (Vec<frame_benchmarking::BenchmarkList>, Vec<frame_support::traits::StorageInfo>) {
298            unimplemented!()
299        }
300
301        fn dispatch_benchmark(_config: frame_benchmarking::BenchmarkConfig) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
302            unimplemented!()
303        }
304    }
305
306    #[cfg(feature = "try-runtime")]
307    impl frame_try_runtime::TryRuntime<Block> for Runtime {
308        fn on_runtime_upgrade(_checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
309            unimplemented!()
310        }
311
312        fn execute_block(_block: <Block as BlockT>::LazyBlock, _state_root_check: bool, _signature_check: bool, _select: frame_try_runtime::TryStateSelect) -> Weight {
313            unimplemented!()
314        }
315    }
316}