// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Pezkuwi.
// Pezkuwi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Pezkuwi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Pezkuwi. If not, see .
//! Provides "fake" runtime API implementations
//!
//! These are used to provide a type that implements these runtime APIs without requiring to import
//! the native runtimes.
use pezpallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use pezkuwi_primitives::{
runtime_api, slashing, AccountId, AuthorityDiscoveryId, Balance, Block, BlockNumber,
CandidateCommitments, CandidateEvent, CandidateHash,
CommittedCandidateReceiptV2 as CommittedCandidateReceipt, CoreState, DisputeState,
ExecutorParams, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage,
InboundHrmpMessage, Nonce, OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement,
ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash,
ValidatorId, ValidatorIndex, ValidatorSignature,
};
use pezsp_consensus_beefy::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
use pezsp_consensus_grandpa::AuthorityId as GrandpaId;
use pezsp_core::OpaqueMetadata;
use pezsp_runtime::{
traits::Block as BlockT,
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult,
};
use pezsp_version::RuntimeVersion;
use pezsp_weights::Weight;
use std::collections::BTreeMap;
use xcm::{
Version as XcmVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
pezsp_api::decl_runtime_apis! {
/// This runtime API is only implemented for the test runtime!
pub trait GetLastTimestamp {
/// Returns the last timestamp of a runtime.
fn get_last_timestamp() -> u64;
}
}
#[allow(dead_code)]
struct Runtime;
pezsp_api::impl_runtime_apis! {
impl pezsp_api::Core for Runtime {
fn version() -> RuntimeVersion {
unimplemented!()
}
fn execute_block(_: ::LazyBlock) {
unimplemented!()
}
fn initialize_block(_: &::Header) -> pezsp_runtime::ExtrinsicInclusionMode {
unimplemented!()
}
}
impl pezsp_api::Metadata for Runtime {
fn metadata() -> OpaqueMetadata {
unimplemented!()
}
fn metadata_at_version(_: u32) -> Option {
unimplemented!()
}
fn metadata_versions() -> Vec {
unimplemented!()
}
}
impl pezsp_block_builder::BlockBuilder for Runtime {
fn apply_extrinsic(_: ::Extrinsic) -> ApplyExtrinsicResult {
unimplemented!()
}
fn finalize_block() -> ::Header {
unimplemented!()
}
fn inherent_extrinsics(_: pezsp_inherents::InherentData) -> Vec<::Extrinsic> {
unimplemented!()
}
fn check_inherents(
_: ::LazyBlock,
_: pezsp_inherents::InherentData,
) -> pezsp_inherents::CheckInherentsResult {
unimplemented!()
}
}
impl pezsp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime {
fn validate_transaction(
_: TransactionSource,
_: ::Extrinsic,
_: ::Hash,
) -> TransactionValidity {
unimplemented!()
}
}
impl pezsp_offchain::OffchainWorkerApi for Runtime {
fn offchain_worker(_: &::Header) {
unimplemented!()
}
}
impl runtime_api::TeyrchainHost for Runtime {
fn validators() -> Vec {
unimplemented!()
}
fn validator_groups() -> (Vec>, GroupRotationInfo) {
unimplemented!()
}
fn availability_cores() -> Vec> {
unimplemented!()
}
fn persisted_validation_data(_: ParaId, _: OccupiedCoreAssumption)
-> Option> {
unimplemented!()
}
fn assumed_validation_data(
_: ParaId,
_: Hash,
) -> Option<(PersistedValidationData, ValidationCodeHash)> {
unimplemented!()
}
fn check_validation_outputs(
_: ParaId,
_: CandidateCommitments,
) -> bool {
unimplemented!()
}
fn session_index_for_child() -> SessionIndex {
unimplemented!()
}
fn validation_code(_: ParaId, _: OccupiedCoreAssumption)
-> Option {
unimplemented!()
}
fn candidate_pending_availability(_: ParaId) -> Option> {
unimplemented!()
}
fn candidate_events() -> Vec> {
unimplemented!()
}
fn session_info(_: SessionIndex) -> Option {
unimplemented!()
}
fn session_executor_params(_: SessionIndex) -> Option {
unimplemented!()
}
fn dmq_contents(_: ParaId) -> Vec> {
unimplemented!()
}
fn inbound_hrmp_channels_contents(
_: ParaId
) -> BTreeMap>> {
unimplemented!()
}
fn validation_code_by_hash(_: ValidationCodeHash) -> Option {
unimplemented!()
}
fn on_chain_votes() -> Option> {
unimplemented!()
}
fn submit_pvf_check_statement(
_: PvfCheckStatement,
_: ValidatorSignature,
) {
unimplemented!()
}
fn pvfs_require_precheck() -> Vec {
unimplemented!()
}
fn validation_code_hash(_: ParaId, _: OccupiedCoreAssumption)
-> Option
{
unimplemented!()
}
fn disputes() -> Vec<(SessionIndex, CandidateHash, DisputeState)> {
unimplemented!()
}
fn unapplied_slashes(
) -> Vec<(SessionIndex, CandidateHash, slashing::LegacyPendingSlashes)> {
unimplemented!()
}
fn key_ownership_proof(
_: ValidatorId,
) -> Option {
unimplemented!()
}
fn submit_report_dispute_lost(
_: slashing::DisputeProof,
_: slashing::OpaqueKeyOwnershipProof,
) -> Option<()> {
unimplemented!()
}
}
impl pezsp_consensus_beefy::BeefyApi for Runtime {
fn beefy_genesis() -> Option {
unimplemented!()
}
fn validator_set() -> Option> {
unimplemented!()
}
fn submit_report_double_voting_unsigned_extrinsic(
_: pezsp_consensus_beefy::DoubleVotingProof<
BlockNumber,
BeefyId,
BeefySignature,
>,
_: pezsp_consensus_beefy::OpaqueKeyOwnershipProof,
) -> Option<()> {
unimplemented!()
}
fn submit_report_fork_voting_unsigned_extrinsic(
_: pezsp_consensus_beefy::ForkVotingProof<
::Header,
BeefyId,
pezsp_runtime::OpaqueValue
>,
_: pezsp_consensus_beefy::OpaqueKeyOwnershipProof,
) -> Option<()> {
unimplemented!()
}
fn submit_report_future_block_voting_unsigned_extrinsic(
_: pezsp_consensus_beefy::FutureBlockVotingProof,
_: pezsp_consensus_beefy::OpaqueKeyOwnershipProof,
) -> Option<()> {
unimplemented!()
}
fn generate_key_ownership_proof(
_: pezsp_consensus_beefy::ValidatorSetId,
_: BeefyId,
) -> Option {
unimplemented!()
}
}
impl pezsp_mmr_primitives::MmrApi for Runtime {
fn mmr_root() -> Result {
unimplemented!()
}
fn mmr_leaf_count() -> Result {
unimplemented!()
}
fn generate_proof(
_: Vec,
_: Option,
) -> Result<(Vec, pezsp_mmr_primitives::LeafProof), pezsp_mmr_primitives::Error> {
unimplemented!()
}
fn generate_ancestry_proof(
_: BlockNumber,
_: Option,
) -> Result, pezsp_mmr_primitives::Error> {
unimplemented!()
}
fn verify_proof(_: Vec, _: pezsp_mmr_primitives::LeafProof)
-> Result<(), pezsp_mmr_primitives::Error>
{
unimplemented!()
}
fn verify_proof_stateless(
_: Hash,
_: Vec,
_: pezsp_mmr_primitives::LeafProof
) -> Result<(), pezsp_mmr_primitives::Error> {
unimplemented!()
}
}
impl pezsp_consensus_grandpa::GrandpaApi for Runtime {
fn grandpa_authorities() -> Vec<(GrandpaId, u64)> {
unimplemented!()
}
fn current_set_id() -> pezsp_consensus_grandpa::SetId {
unimplemented!()
}
fn submit_report_equivocation_unsigned_extrinsic(
_: pezsp_consensus_grandpa::EquivocationProof<
::Hash,
pezsp_runtime::traits::NumberFor,
>,
_: pezsp_consensus_grandpa::OpaqueKeyOwnershipProof,
) -> Option<()> {
unimplemented!()
}
fn generate_key_ownership_proof(
_: pezsp_consensus_grandpa::SetId,
_: pezsp_consensus_grandpa::AuthorityId,
) -> Option {
unimplemented!()
}
}
impl pezsp_consensus_babe::BabeApi for Runtime {
fn configuration() -> pezsp_consensus_babe::BabeConfiguration {
unimplemented!()
}
fn current_epoch_start() -> pezsp_consensus_babe::Slot {
unimplemented!()
}
fn current_epoch() -> pezsp_consensus_babe::Epoch {
unimplemented!()
}
fn next_epoch() -> pezsp_consensus_babe::Epoch {
unimplemented!()
}
fn generate_key_ownership_proof(
_: pezsp_consensus_babe::Slot,
_: pezsp_consensus_babe::AuthorityId,
) -> Option {
unimplemented!()
}
fn submit_report_equivocation_unsigned_extrinsic(
_: pezsp_consensus_babe::EquivocationProof<::Header>,
_: pezsp_consensus_babe::OpaqueKeyOwnershipProof,
) -> Option<()> {
unimplemented!()
}
}
impl pezsp_authority_discovery::AuthorityDiscoveryApi for Runtime {
fn authorities() -> Vec {
unimplemented!()
}
}
impl pezsp_session::SessionKeys for Runtime {
fn generate_session_keys(_: Option>) -> Vec {
unimplemented!()
}
fn decode_session_keys(
_: Vec,
) -> Option, pezsp_core::crypto::KeyTypeId)>> {
unimplemented!()
}
}
impl pezframe_system_rpc_runtime_api::AccountNonceApi for Runtime {
fn account_nonce(_: AccountId) -> Nonce {
unimplemented!()
}
}
impl pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
Balance,
> for Runtime {
fn query_info(_: ::Extrinsic, _: u32) -> RuntimeDispatchInfo {
unimplemented!()
}
fn query_fee_details(_: ::Extrinsic, _: u32) -> FeeDetails {
unimplemented!()
}
fn query_weight_to_fee(_: Weight) -> Balance {
unimplemented!()
}
fn query_length_to_fee(_: u32) -> Balance {
unimplemented!()
}
}
impl crate::fake_runtime_api::GetLastTimestamp for Runtime {
fn get_last_timestamp() -> u64 {
unimplemented!()
}
}
impl xcm_runtime_pezapis::fees::XcmPaymentApi for Runtime {
fn query_acceptable_payment_assets(_: xcm::Version) -> Result, xcm_runtime_pezapis::fees::Error> {
unimplemented!()
}
fn query_weight_to_asset_fee(_: Weight, _: VersionedAssetId) -> Result {
unimplemented!()
}
fn query_xcm_weight(_: VersionedXcm<()>) -> Result {
unimplemented!()
}
fn query_delivery_fees(_: VersionedLocation, _: VersionedXcm<()>, _: VersionedAssetId) -> Result {
unimplemented!()
}
}
impl xcm_runtime_pezapis::dry_run::DryRunApi for Runtime {
fn dry_run_call(_: (), _: (), _: XcmVersion) -> Result, xcm_runtime_pezapis::dry_run::Error> {
unimplemented!()
}
fn dry_run_xcm(_: VersionedLocation, _: VersionedXcm<()>) -> Result, xcm_runtime_pezapis::dry_run::Error> {
unimplemented!()
}
}
}