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 cumulus_primitives_core::RelayParentOffsetApi<Block> for Runtime {
77        fn relay_parent_offset() -> u32 {
78            unimplemented!()
79        }
80    }
81
82    impl cumulus_primitives_core::GetCoreSelectorApi<Block> for Runtime {
83        fn core_selector() -> (cumulus_primitives_core::CoreSelector, cumulus_primitives_core::ClaimQueueOffset) {
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, _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(_seed: Option<Vec<u8>>) -> Vec<u8> {
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        ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
194            unimplemented!()
195        }
196
197        fn create(
198            _from: H160,
199            _data: Vec<u8>,
200            _value: U256,
201            _gas_limit: U256,
202            _max_fee_per_gas: Option<U256>,
203            _max_priority_fee_per_gas: Option<U256>,
204            _nonce: Option<U256>,
205            _estimate: bool,
206            _access_list: Option<Vec<(H160, Vec<H256>)>>,
207            _authorization_list: Option<AuthorizationList>,
208        ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
209            unimplemented!()
210        }
211
212        fn current_transaction_statuses() -> Option<Vec<fp_rpc::TransactionStatus>> {
213            unimplemented!()
214        }
215
216        fn current_block() -> Option<pallet_ethereum::Block> {
217            unimplemented!()
218        }
219
220        fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
221            unimplemented!()
222        }
223
224        fn current_all() -> (
225            Option<pallet_ethereum::Block>,
226            Option<Vec<pallet_ethereum::Receipt>>,
227            Option<Vec<fp_rpc::TransactionStatus>>,
228        ) {
229            unimplemented!()
230        }
231
232        fn extrinsic_filter(_xts: Vec<<Block as BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {
233            unimplemented!()
234        }
235
236        fn elasticity() -> Option<Permill> {
237            unimplemented!()
238        }
239
240        fn gas_limit_multiplier_support() {}
241
242        fn pending_block(_xts: Vec<<Block as BlockT>::Extrinsic>) -> (Option<pallet_ethereum::Block>, Option<Vec<fp_rpc::TransactionStatus>>) {
243            unimplemented!()
244        }
245
246        fn initialize_pending_block(_header: &<Block as BlockT>::Header) {
247            unimplemented!()
248        }
249    }
250
251    impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
252        fn convert_transaction(_transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic {
253            unimplemented!()
254        }
255    }
256
257    impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
258        fn validate_transaction(_source: TransactionSource, _tx: <Block as BlockT>::Extrinsic, _block_hash: <Block as BlockT>::Hash) -> TransactionValidity {
259            unimplemented!()
260        }
261    }
262
263    impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
264        fn offchain_worker(_header: &<Block as BlockT>::Header) {
265            unimplemented!()
266        }
267    }
268
269    impl moonbeam_rpc_primitives_debug::DebugRuntimeApi<Block> for Runtime {
270        fn trace_transaction(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _traced_transaction: &pallet_ethereum::Transaction, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
271            unimplemented!()
272        }
273
274        fn trace_block(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _known_transactions: Vec<H256>, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
275            unimplemented!()
276        }
277
278        fn trace_call(
279            _header: &<Block as BlockT>::Header,
280            _from: H160,
281            _to: H160,
282            _data: Vec<u8>,
283            _value: U256,
284            _gas_limit: U256,
285            _max_fee_per_gas: Option<U256>,
286            _max_priority_fee_per_gas: Option<U256>,
287            _nonce: Option<U256>,
288            _access_list: Option<Vec<(H160, Vec<H256>)>>,
289            _authorization_list: Option<AuthorizationList>,
290        ) -> Result<(), sp_runtime::DispatchError> {
291            unimplemented!()
292        }
293    }
294
295    impl moonbeam_rpc_primitives_txpool::TxPoolRuntimeApi<Block> for Runtime {
296        fn extrinsic_filter(_xts_ready: Vec<<Block as BlockT>::Extrinsic>, _xts_future: Vec<<Block as BlockT>::Extrinsic>) -> moonbeam_rpc_primitives_txpool::TxPoolResponse {
297            unimplemented!()
298        }
299    }
300
301    #[cfg(feature = "runtime-benchmarks")]
302    impl frame_benchmarking::Benchmark<Block> for Runtime {
303        fn benchmark_metadata(_extra: bool) -> (Vec<frame_benchmarking::BenchmarkList>, Vec<frame_support::traits::StorageInfo>) {
304            unimplemented!()
305        }
306
307        fn dispatch_benchmark(_config: frame_benchmarking::BenchmarkConfig) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
308            unimplemented!()
309        }
310    }
311
312    #[cfg(feature = "try-runtime")]
313    impl frame_try_runtime::TryRuntime<Block> for Runtime {
314        fn on_runtime_upgrade(_checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
315            unimplemented!()
316        }
317
318        fn execute_block(_block: Block, _state_root_check: bool, _signature_check: bool, _select: frame_try_runtime::TryStateSelect) -> Weight {
319            unimplemented!()
320        }
321    }
322}