Additional runtime tests for the test-runtime (#69)

* Remove rustc dependency from ed25519 and refactor a little.

* Runtime support provides more extensive test-key functionality.

* Additional APIs for ed25519 stuff.

* Extensive test for test-runtime.

* Fixes for the new test key API.

* Additional convenience for tests

* Take advantage of more convenient API.

* Redo formating.

* Remove old test identities.

* Remove boilerplate, add test.

* Refactor out unneeded code.

* Clean up algo for determining authorities.

* Remove unneeded API.

* Make `to_*` consume

* Only export keyring when testing

* Fix build & warning

* Extract Keyring into separate library.

* Add tests for Keyring and a trait-based API.

* Address grumbles.
This commit is contained in:
Gav Wood
2018-02-12 15:30:38 +01:00
committed by Robert Habermeier
parent 72fa8f3fe2
commit f344e15bf8
38 changed files with 528 additions and 341 deletions
@@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
ed25519 = { path = "../ed25519", optional = true }
hex-literal = { version = "0.1.0", optional = true }
substrate-runtime-std = { path = "../runtime-std", default_features = false }
substrate-runtime-io = { path = "../runtime-io", default_features = false }
@@ -14,6 +15,7 @@ substrate-codec = { path = "../codec", default_features = false }
[features]
default = ["std"]
std = [
"ed25519",
"hex-literal",
"environmental",
"substrate-primitives/std",
@@ -22,18 +22,9 @@ extern crate substrate_runtime_std as rstd;
extern crate substrate_runtime_io as runtime_io;
extern crate substrate_codec as codec;
extern crate substrate_primitives as primitives;
#[macro_use]
#[cfg(any(feature = "std", test))]
extern crate hex_literal;
pub mod storage;
mod hashable;
#[macro_use]
#[cfg(feature = "std")]
mod testing;
pub use self::storage::StorageVec;
pub use self::hashable::Hashable;
#[cfg(feature = "std")]
pub use self::testing::{one, two};
@@ -1,28 +0,0 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot 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.
// Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! Testing helpers.
use primitives::AuthorityId;
/// One account (to which we know the secret key).
pub fn one() -> AuthorityId {
hex!("2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee")
}
/// Another account (secret key known).
pub fn two() -> AuthorityId {
hex!("d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a")
}