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