mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +00:00
break sp-api dependency cycle (#4352)
* move benches into tests, ignore non-passing doctests * Rename sr-api folder * Move test-primitives to primitives, use that for sp-api doctests
This commit is contained in:
committed by
Bastian Köcher
parent
f6f0f1cc16
commit
8721d98dd6
@@ -1,21 +0,0 @@
|
||||
[package]
|
||||
name = "substrate-test-primitives"
|
||||
version = "2.0.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
app-crypto = { package = "sc-application-crypto", path = "../../../primitives/application-crypto", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
primitives = { package = "sp-core", path = "../../../primitives/core", default-features = false }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
sp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
||||
|
||||
[features]
|
||||
default = [
|
||||
"std",
|
||||
]
|
||||
std = [
|
||||
"app-crypto/std",
|
||||
"serde",
|
||||
]
|
||||
@@ -1,78 +0,0 @@
|
||||
// Copyright 2017-2019 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Substrate 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.
|
||||
|
||||
// Substrate 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 Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! The Substrate test primitives to share
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
use app_crypto::sr25519;
|
||||
pub use app_crypto;
|
||||
|
||||
pub use primitives::{hash::H256, RuntimeDebug};
|
||||
use sp_runtime::traits::{BlakeTwo256, Verify, Extrinsic as ExtrinsicT,};
|
||||
|
||||
/// Extrinsic for test-runtime.
|
||||
#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug)]
|
||||
pub enum Extrinsic {
|
||||
IncludeData(Vec<u8>),
|
||||
StorageChange(Vec<u8>, Option<Vec<u8>>),
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl serde::Serialize for Extrinsic {
|
||||
fn serialize<S>(&self, seq: S) -> Result<S::Ok, S::Error> where S: ::serde::Serializer {
|
||||
self.using_encoded(|bytes| seq.serialize_bytes(bytes))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl ExtrinsicT for Extrinsic {
|
||||
type Call = Extrinsic;
|
||||
type SignaturePayload = ();
|
||||
|
||||
fn is_signed(&self) -> Option<bool> {
|
||||
if let Extrinsic::IncludeData(_) = *self {
|
||||
Some(false)
|
||||
} else {
|
||||
Some(true)
|
||||
}
|
||||
}
|
||||
|
||||
fn new(call: Self::Call, _signature_payload: Option<Self::SignaturePayload>) -> Option<Self> {
|
||||
Some(call)
|
||||
}
|
||||
}
|
||||
|
||||
/// The signature type used by accounts/transactions.
|
||||
pub type AccountSignature = sr25519::Signature;
|
||||
/// An identifier for an account on this system.
|
||||
pub type AccountId = <AccountSignature as Verify>::Signer;
|
||||
/// A simple hash type for all our hashing.
|
||||
pub type Hash = H256;
|
||||
/// The block number type used in this runtime.
|
||||
pub type BlockNumber = u64;
|
||||
/// Index of a transaction.
|
||||
pub type Index = u64;
|
||||
/// The item of a block digest.
|
||||
pub type DigestItem = sp_runtime::generic::DigestItem<H256>;
|
||||
/// The digest of a block.
|
||||
pub type Digest = sp_runtime::generic::Digest<H256>;
|
||||
/// A test block.
|
||||
pub type Block = sp_runtime::generic::Block<Header, Extrinsic>;
|
||||
/// A test block's header.
|
||||
pub type Header = sp_runtime::generic::Header<BlockNumber, BlakeTwo256>;
|
||||
@@ -26,7 +26,7 @@ runtime_support = { package = "frame-support", path = "../../../frame/support",
|
||||
runtime_version = { package = "sp-version", path = "../../../primitives/sr-version", default-features = false }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
session = { package = "sp-session", path = "../../../primitives/session", default-features = false }
|
||||
sp-api = { path = "../../../primitives/sr-api", default-features = false }
|
||||
sp-api = { path = "../../../primitives/api", default-features = false }
|
||||
sp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
||||
pallet-babe = { path = "../../../frame/babe", default-features = false }
|
||||
frame-system = { path = "../../../frame/system", default-features = false }
|
||||
|
||||
@@ -13,7 +13,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive
|
||||
consensus_common = { package = "sp-consensus", path = "../../../primitives/consensus/common" }
|
||||
log = "0.4.8"
|
||||
primitives = { package = "sp-core", path = "../../../primitives/core" }
|
||||
sp-api = { path = "../../../primitives/sr-api" }
|
||||
sp-api = { path = "../../../primitives/api" }
|
||||
sp-runtime = { path = "../../../primitives/runtime" }
|
||||
sc-service = { path = "../../../client/service" }
|
||||
sp-blockchain = { path = "../../../primitives/blockchain" }
|
||||
|
||||
Reference in New Issue
Block a user