mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Phase 1 of repo reorg (#719)
* Remove unneeded script * Rename Substrate Demo -> Substrate * Rename demo -> node * Build wasm from last rename. * Merge ed25519 into substrate-primitives * Minor tweak * Rename substrate -> core * Move substrate-runtime-support to core/runtime/support * Rename/move substrate-runtime-version * Move codec up a level * Rename substrate-codec -> parity-codec * Move environmental up a level * Move pwasm-* up to top, ready for removal * Remove requirement of s-r-support from s-r-primitives * Move core/runtime/primitives into core/runtime-primitives * Remove s-r-support dep from s-r-version * Remove dep of s-r-support from bft * Remove dep of s-r-support from node/consensus * Sever all other core deps from s-r-support * Forgot the no_std directive * Rename non-SRML modules to sr-* to avoid match clashes * Move runtime/* to srml/* * Rename substrate-runtime-* -> srml-* * Move srml to top-level
This commit is contained in:
committed by
Arkadiy Paronyan
parent
8fe5aa4c81
commit
1e01162505
@@ -3,13 +3,13 @@
|
||||
*.swp
|
||||
.wasm-binaries
|
||||
polkadot/runtime/wasm/target/
|
||||
substrate/executor/wasm/target/
|
||||
substrate/test-runtime/wasm/target/
|
||||
substrate/pwasm-alloc/target/
|
||||
substrate/pwasm-libc/target/
|
||||
substrate/pwasm-alloc/Cargo.lock
|
||||
substrate/pwasm-libc/Cargo.lock
|
||||
demo/runtime/wasm/target/
|
||||
core/executor/wasm/target/
|
||||
core/test-runtime/wasm/target/
|
||||
pwasm-alloc/target/
|
||||
pwasm-libc/target/
|
||||
pwasm-alloc/Cargo.lock
|
||||
pwasm-libc/Cargo.lock
|
||||
node/runtime/wasm/target/
|
||||
**/._*
|
||||
.vscode
|
||||
polkadot.*
|
||||
|
||||
@@ -50,7 +50,6 @@ test:rust:stable: &test
|
||||
- ./scripts/init.sh
|
||||
- export PATH="${CI_PROJECT_DIR}/cargo/bin/:$PATH"
|
||||
- ./scripts/build.sh
|
||||
- ./scripts/build-demos.sh
|
||||
- time cargo test --all --release
|
||||
tags:
|
||||
- rust-stable
|
||||
@@ -74,7 +73,6 @@ build:linux:ubuntu:amd64: &build
|
||||
- ./scripts/init.sh
|
||||
- export PATH="${CI_PROJECT_DIR}/cargo/bin/:$PATH"
|
||||
- ./scripts/build.sh
|
||||
- ./scripts/build-demos.sh
|
||||
- cargo build --release
|
||||
<<: *collect_artifacts
|
||||
tags:
|
||||
|
||||
@@ -18,9 +18,9 @@ There are a few basic ground-rules for contributors (including the maintainer(s)
|
||||
|
||||
Merging pull requests once CI is successful:
|
||||
|
||||
. A pull request that does not alter any logic (e.g. comments, dependencies, docs) may be tagged https://github.com/paritytech/substrate/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3AA2-insubstantial[`insubstantial`] and merged by its author.
|
||||
. A pull request that does not alter any logic (e.g. comments, dependencies, docs) may be tagged https://github.com/paritytech/core/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3AA2-insubstantial[`insubstantial`] and merged by its author.
|
||||
. A pull request with no large change to logic that is an urgent fix may be merged after a non-author contributor has reviewed it well.
|
||||
. All other PRs should sit for 48 hours with the https://github.com/paritytech/substrate/pulls?q=is%3Apr+is%3Aopen+label%3AA0-pleasereview[`pleasereview`] tag in order to garner feedback.
|
||||
. All other PRs should sit for 48 hours with the https://github.com/paritytech/core/pulls?q=is%3Apr+is%3Aopen+label%3AA0-pleasereview[`pleasereview`] tag in order to garner feedback.
|
||||
. No PR should be merged until all reviews' comments are addressed.
|
||||
|
||||
.Reviewing pull requests:
|
||||
|
||||
Generated
+569
-587
File diff suppressed because it is too large
Load Diff
+56
-55
@@ -1,63 +1,64 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"substrate/bft",
|
||||
"substrate/cli",
|
||||
"substrate/client",
|
||||
"substrate/client/db",
|
||||
"substrate/codec",
|
||||
"substrate/codec/derive",
|
||||
"substrate/environmental",
|
||||
"substrate/executor",
|
||||
"substrate/extrinsic-pool",
|
||||
"substrate/keyring",
|
||||
"substrate/misbehavior-check",
|
||||
"substrate/network",
|
||||
"substrate/primitives",
|
||||
"substrate/rpc",
|
||||
"substrate/rpc-servers",
|
||||
"substrate/runtime-io",
|
||||
"substrate/runtime-sandbox",
|
||||
"substrate/runtime-std",
|
||||
"substrate/runtime-support",
|
||||
"substrate/runtime/balances",
|
||||
"substrate/runtime/consensus",
|
||||
"substrate/runtime/contract",
|
||||
"substrate/runtime/council",
|
||||
"substrate/runtime/democracy",
|
||||
"substrate/runtime/example",
|
||||
"substrate/runtime/executive",
|
||||
"substrate/runtime/primitives",
|
||||
"substrate/runtime/session",
|
||||
"substrate/runtime/staking",
|
||||
"substrate/runtime/system",
|
||||
"substrate/runtime/timestamp",
|
||||
"substrate/runtime/treasury",
|
||||
"substrate/runtime/version",
|
||||
"substrate/serializer",
|
||||
"substrate/service",
|
||||
"substrate/state-db",
|
||||
"substrate/state-machine",
|
||||
"substrate/test-runtime",
|
||||
"substrate/telemetry",
|
||||
"substrate/keystore",
|
||||
"demo",
|
||||
"demo/cli",
|
||||
"demo/api",
|
||||
"demo/consensus",
|
||||
"demo/executor",
|
||||
"demo/network",
|
||||
"demo/primitives",
|
||||
"demo/runtime",
|
||||
"demo/service",
|
||||
"demo/transaction-pool",
|
||||
"codec",
|
||||
"codec/derive",
|
||||
"environmental",
|
||||
"core/bft",
|
||||
"core/cli",
|
||||
"core/client",
|
||||
"core/client/db",
|
||||
"core/executor",
|
||||
"core/extrinsic-pool",
|
||||
"core/keyring",
|
||||
"core/metadata",
|
||||
"core/misbehavior-check",
|
||||
"core/network",
|
||||
"core/primitives",
|
||||
"core/rpc",
|
||||
"core/rpc-servers",
|
||||
"core/sr-io",
|
||||
"core/sr-sandbox",
|
||||
"core/sr-std",
|
||||
"core/sr-version",
|
||||
"srml/support",
|
||||
"srml/balances",
|
||||
"srml/consensus",
|
||||
"srml/contract",
|
||||
"srml/council",
|
||||
"srml/democracy",
|
||||
"srml/example",
|
||||
"srml/executive",
|
||||
"core/sr-primitives",
|
||||
"srml/session",
|
||||
"srml/staking",
|
||||
"srml/system",
|
||||
"srml/timestamp",
|
||||
"srml/treasury",
|
||||
"core/serializer",
|
||||
"core/service",
|
||||
"core/state-db",
|
||||
"core/state-machine",
|
||||
"core/test-runtime",
|
||||
"core/telemetry",
|
||||
"core/keystore",
|
||||
"node",
|
||||
"node/cli",
|
||||
"node/api",
|
||||
"node/consensus",
|
||||
"node/executor",
|
||||
"node/network",
|
||||
"node/primitives",
|
||||
"node/runtime",
|
||||
"node/service",
|
||||
"node/transaction-pool",
|
||||
"subkey",
|
||||
]
|
||||
exclude = [
|
||||
"demo/runtime/wasm",
|
||||
"substrate/executor/wasm",
|
||||
"substrate/pwasm-alloc",
|
||||
"substrate/pwasm-libc",
|
||||
"substrate/test-runtime/wasm",
|
||||
"node/runtime/wasm",
|
||||
"core/executor/wasm",
|
||||
"pwasm-alloc",
|
||||
"pwasm-libc",
|
||||
"core/test-runtime/wasm",
|
||||
]
|
||||
|
||||
[badges]
|
||||
|
||||
@@ -145,7 +145,6 @@ Then build the code:
|
||||
[source, shell]
|
||||
----
|
||||
./scripts/build.sh # Builds the WebAssembly binaries
|
||||
./scripts/build-demos.sh # Builds the WebAssembly binaries
|
||||
cargo build # Builds all native code
|
||||
----
|
||||
|
||||
|
||||
@@ -24,6 +24,5 @@ case $TARGET in
|
||||
# Install prerequisites and build all wasm projects
|
||||
./scripts/init.sh
|
||||
./scripts/build.sh
|
||||
./scripts/build-demos.sh
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "substrate-codec"
|
||||
name = "parity-codec"
|
||||
description = "Serialization and deserialization codec for runtime values"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "substrate-codec-derive"
|
||||
name = "parity-codec-derive"
|
||||
description = "Serialization and deserialization derive macro"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
@@ -13,7 +13,7 @@ quote = "0.6"
|
||||
proc-macro2 = "0.4"
|
||||
|
||||
[dev-dependencies]
|
||||
substrate-codec = { path = "../" }
|
||||
parity-codec = { path = "../" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -14,10 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate substrate_codec as codec;
|
||||
extern crate parity_codec as codec;
|
||||
|
||||
#[macro_use]
|
||||
extern crate substrate_codec_derive;
|
||||
extern crate parity_codec_derive;
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
@@ -5,12 +5,10 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
futures = "0.1.17"
|
||||
substrate-codec = { path = "../codec" }
|
||||
parity-codec = { path = "../../codec" }
|
||||
substrate-primitives = { path = "../primitives" }
|
||||
substrate-runtime-support = { path = "../runtime-support" }
|
||||
substrate-runtime-primitives = { path = "../runtime/primitives" }
|
||||
substrate-runtime-version = { path = "../runtime/version" }
|
||||
ed25519 = { path = "../ed25519" }
|
||||
sr-primitives = { path = "../sr-primitives" }
|
||||
sr-version = { path = "../sr-version" }
|
||||
tokio = "0.1.7"
|
||||
parking_lot = "0.4"
|
||||
error-chain = "0.12"
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
//! Error types in the BFT service.
|
||||
use runtime_version::RuntimeVersion;
|
||||
use primitives::ed25519;
|
||||
|
||||
error_chain! {
|
||||
errors {
|
||||
@@ -44,7 +45,7 @@ error_chain! {
|
||||
}
|
||||
|
||||
/// Error checking signature
|
||||
InvalidSignature(s: ::ed25519::Signature, a: ::primitives::AuthorityId) {
|
||||
InvalidSignature(s: ed25519::Signature, a: ::primitives::AuthorityId) {
|
||||
description("Message signature is invalid"),
|
||||
display("Message signature {:?} by {:?} is invalid.", s, a),
|
||||
}
|
||||
@@ -36,12 +36,10 @@
|
||||
|
||||
pub mod error;
|
||||
|
||||
extern crate substrate_codec as codec;
|
||||
extern crate parity_codec as codec;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate substrate_runtime_support as runtime_support;
|
||||
extern crate substrate_runtime_primitives as runtime_primitives;
|
||||
extern crate substrate_runtime_version as runtime_version;
|
||||
extern crate ed25519;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
extern crate sr_version as runtime_version;
|
||||
extern crate tokio;
|
||||
extern crate parking_lot;
|
||||
extern crate rhododendron;
|
||||
@@ -59,11 +57,10 @@ use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::time::{Instant, Duration};
|
||||
|
||||
use codec::Encode;
|
||||
use ed25519::LocalizedSignature;
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{Block, Header};
|
||||
use runtime_primitives::bft::{Message as PrimitiveMessage, Action as PrimitiveAction, Justification as PrimitiveJustification};
|
||||
use primitives::AuthorityId;
|
||||
use primitives::{AuthorityId, ed25519, ed25519::LocalizedSignature};
|
||||
|
||||
use futures::{Async, Stream, Sink, Future, IntoFuture};
|
||||
use futures::sync::oneshot;
|
||||
@@ -316,7 +313,7 @@ impl<B: Block, P: Proposer<B>> rhododendron::Context for BftInstance<B, P>
|
||||
use std::collections::HashSet;
|
||||
|
||||
let collect_pubkeys = |participants: HashSet<&Self::AuthorityId>| participants.into_iter()
|
||||
.map(|p| ::ed25519::Public::from_raw(p.0))
|
||||
.map(|p| ed25519::Public::from_raw(p.0))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let round_timeout = self.round_timeout_duration(next_round);
|
||||
@@ -23,12 +23,12 @@ futures = "0.1.17"
|
||||
fdlimit = "0.1"
|
||||
exit-future = "0.1"
|
||||
sysinfo = "0.5.7"
|
||||
substrate-client = { path = "../../substrate/client" }
|
||||
substrate-network = { path = "../../substrate/network" }
|
||||
substrate-network-libp2p = { path = "../../substrate/network-libp2p" }
|
||||
substrate-runtime-primitives = { path = "../../substrate/runtime/primitives" }
|
||||
substrate-service = { path = "../../substrate/service" }
|
||||
substrate-telemetry = { path = "../../substrate/telemetry" }
|
||||
substrate-client = { path = "../../core/client" }
|
||||
substrate-network = { path = "../../core/network" }
|
||||
substrate-network-libp2p = { path = "../../core/network-libp2p" }
|
||||
sr-primitives = { path = "../../core/sr-primitives" }
|
||||
substrate-service = { path = "../../core/service" }
|
||||
substrate-telemetry = { path = "../../core/telemetry" }
|
||||
names = "0.11.0"
|
||||
|
||||
[build-dependencies]
|
||||
@@ -37,7 +37,7 @@ extern crate sysinfo;
|
||||
extern crate substrate_client as client;
|
||||
extern crate substrate_network as network;
|
||||
extern crate substrate_network_libp2p as network_libp2p;
|
||||
extern crate substrate_runtime_primitives as runtime_primitives;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
extern crate substrate_service as service;
|
||||
#[macro_use]
|
||||
extern crate slog; // needed until we can reexport `slog_info` from `substrate_telemetry`
|
||||
@@ -11,18 +11,17 @@ parking_lot = "0.4"
|
||||
triehash = "0.2"
|
||||
hex-literal = "0.1"
|
||||
futures = "0.1.17"
|
||||
ed25519 = { path = "../ed25519" }
|
||||
slog = "^2"
|
||||
heapsize = "0.4"
|
||||
substrate-bft = { path = "../bft" }
|
||||
substrate-codec = { path = "../codec" }
|
||||
parity-codec = { path = "../../codec" }
|
||||
substrate-executor = { path = "../executor" }
|
||||
substrate-primitives = { path = "../primitives" }
|
||||
substrate-runtime-io = { path = "../runtime-io" }
|
||||
substrate-runtime-support = { path = "../runtime-support" }
|
||||
substrate-runtime-primitives = { path = "../runtime/primitives" }
|
||||
sr-io = { path = "../sr-io" }
|
||||
substrate-metadata = { path = "../metadata" }
|
||||
sr-primitives = { path = "../sr-primitives" }
|
||||
substrate-state-machine = { path = "../state-machine" }
|
||||
substrate-keyring = { path = "../../substrate/keyring" }
|
||||
substrate-keyring = { path = "../../core/keyring" }
|
||||
substrate-telemetry = { path = "../telemetry" }
|
||||
hashdb = "0.2.1"
|
||||
patricia-trie = "0.2.1"
|
||||
@@ -0,0 +1,23 @@
|
||||
[package]
|
||||
name = "substrate-client-db"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
parking_lot = "0.4"
|
||||
log = "0.3"
|
||||
kvdb = "0.1"
|
||||
kvdb-rocksdb = "0.1.3"
|
||||
hashdb = "0.2.1"
|
||||
memorydb = "0.2.1"
|
||||
substrate-primitives = { path = "../../../core/primitives" }
|
||||
sr-primitives = { path = "../../../core/sr-primitives" }
|
||||
substrate-client = { path = "../../../core/client" }
|
||||
substrate-state-machine = { path = "../../../core/state-machine" }
|
||||
parity-codec = { path = "../../../codec" }
|
||||
parity-codec-derive = { path = "../../../codec/derive" }
|
||||
substrate-executor = { path = "../../../core/executor" }
|
||||
substrate-state-db = { path = "../../../core/state-db" }
|
||||
|
||||
[dev-dependencies]
|
||||
kvdb-memorydb = "0.1"
|
||||
@@ -26,9 +26,8 @@ extern crate memorydb;
|
||||
extern crate parking_lot;
|
||||
extern crate substrate_state_machine as state_machine;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate substrate_runtime_support as runtime_support;
|
||||
extern crate substrate_runtime_primitives as runtime_primitives;
|
||||
extern crate substrate_codec as codec;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
extern crate parity_codec as codec;
|
||||
extern crate substrate_executor as executor;
|
||||
extern crate substrate_state_db as state_db;
|
||||
|
||||
@@ -36,7 +35,7 @@ extern crate substrate_state_db as state_db;
|
||||
extern crate log;
|
||||
|
||||
#[macro_use]
|
||||
extern crate substrate_codec_derive;
|
||||
extern crate parity_codec_derive;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate kvdb_memorydb;
|
||||
@@ -23,7 +23,7 @@ use primitives::AuthorityId;
|
||||
use runtime_primitives::{bft::Justification, generic::{BlockId, SignedBlock, Block as RuntimeBlock}};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, One, As, NumberFor};
|
||||
use runtime_primitives::BuildStorage;
|
||||
use runtime_support::metadata::JSONMetadataDecodable;
|
||||
use substrate_metadata::JsonMetadataDecodable;
|
||||
use primitives::{Blake2Hasher, RlpCodec};
|
||||
use primitives::storage::{StorageKey, StorageData};
|
||||
use codec::{Encode, Decode};
|
||||
@@ -255,7 +255,7 @@ impl<B, E, Block> Client<B, E, Block> where
|
||||
/// Returns the runtime metadata as JSON.
|
||||
pub fn json_metadata(&self, id: &BlockId<Block>) -> error::Result<String> {
|
||||
self.executor.call(id, "json_metadata",&[])
|
||||
.and_then(|r| Vec::<JSONMetadataDecodable>::decode(&mut &r.return_data[..])
|
||||
.and_then(|r| Vec::<JsonMetadataDecodable>::decode(&mut &r.return_data[..])
|
||||
.ok_or("JSON Metadata decoding failed".into()))
|
||||
.and_then(|metadata| {
|
||||
let mut json = metadata.into_iter().enumerate().fold(String::from("{"),
|
||||
@@ -50,8 +50,7 @@ mod tests {
|
||||
use test_client;
|
||||
use test_client::runtime::genesismap::{GenesisConfig, additional_storage_with_genesis};
|
||||
use test_client::runtime::{Hash, Transfer, Block, BlockNumber, Header, Digest, Extrinsic};
|
||||
use ed25519::{Public, Pair};
|
||||
use primitives::{Blake2Hasher, RlpCodec};
|
||||
use primitives::{Blake2Hasher, RlpCodec, ed25519::{Public, Pair}};
|
||||
|
||||
native_executor_instance!(Executor, test_client::runtime::api::dispatch, test_client::runtime::VERSION, include_bytes!("../../test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm"));
|
||||
|
||||
@@ -20,18 +20,17 @@
|
||||
#![recursion_limit="128"]
|
||||
|
||||
extern crate substrate_bft as bft;
|
||||
extern crate substrate_codec as codec;
|
||||
extern crate parity_codec as codec;
|
||||
extern crate substrate_metadata;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate substrate_runtime_io as runtime_io;
|
||||
extern crate substrate_runtime_support as runtime_support;
|
||||
extern crate substrate_runtime_primitives as runtime_primitives;
|
||||
extern crate sr_io as runtime_io;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
extern crate substrate_state_machine as state_machine;
|
||||
#[cfg(test)] extern crate substrate_keyring as keyring;
|
||||
#[cfg(test)] extern crate substrate_test_client as test_client;
|
||||
#[macro_use] extern crate substrate_telemetry;
|
||||
#[macro_use] extern crate slog; // needed until we can reexport `slog_info` from `substrate_telemetry`
|
||||
|
||||
extern crate ed25519;
|
||||
extern crate fnv;
|
||||
extern crate futures;
|
||||
extern crate parking_lot;
|
||||
@@ -5,13 +5,12 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
error-chain = "0.12"
|
||||
substrate-codec = { path = "../codec" }
|
||||
substrate-runtime-io = { path = "../runtime-io" }
|
||||
parity-codec = { path = "../../codec" }
|
||||
sr-io = { path = "../sr-io" }
|
||||
substrate-primitives = { path = "../primitives" }
|
||||
substrate-serializer = { path = "../serializer" }
|
||||
substrate-state-machine = { path = "../state-machine" }
|
||||
substrate-runtime-version = { path = "../runtime/version" }
|
||||
ed25519 = { path = "../ed25519" }
|
||||
sr-version = { path = "../sr-version" }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
wasmi = "0.4"
|
||||
@@ -30,13 +30,12 @@
|
||||
#![warn(missing_docs)]
|
||||
#![recursion_limit="128"]
|
||||
|
||||
extern crate substrate_codec as codec;
|
||||
extern crate substrate_runtime_io as runtime_io;
|
||||
extern crate parity_codec as codec;
|
||||
extern crate sr_io as runtime_io;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate substrate_serializer as serializer;
|
||||
extern crate substrate_state_machine as state_machine;
|
||||
extern crate substrate_runtime_version as runtime_version;
|
||||
extern crate ed25519;
|
||||
extern crate sr_version as runtime_version;
|
||||
|
||||
extern crate serde;
|
||||
extern crate wasmi;
|
||||
+9
-9
@@ -27,7 +27,7 @@ use wasmi::memory_units::{Pages, Bytes};
|
||||
use state_machine::Externalities;
|
||||
use error::{Error, ErrorKind, Result};
|
||||
use wasm_utils::UserError;
|
||||
use primitives::{blake2_256, twox_128, twox_256};
|
||||
use primitives::{blake2_256, twox_128, twox_256, ed25519};
|
||||
use primitives::hexdisplay::HexDisplay;
|
||||
use primitives::sandbox as sandbox_primitives;
|
||||
use primitives::Blake2Hasher;
|
||||
@@ -173,29 +173,29 @@ impl_function_executor!(this: FunctionExecutor<'e, E>,
|
||||
ext_memcpy(dest: *mut u8, src: *const u8, count: usize) -> *mut u8 => {
|
||||
this.memory.copy_nonoverlapping(src as usize, dest as usize, count as usize)
|
||||
.map_err(|_| UserError("Invalid attempt to copy_nonoverlapping in ext_memcpy"))?;
|
||||
debug_trace!(target: "runtime-io", "memcpy {} from {}, {} bytes", dest, src, count);
|
||||
debug_trace!(target: "sr-io", "memcpy {} from {}, {} bytes", dest, src, count);
|
||||
Ok(dest)
|
||||
},
|
||||
ext_memmove(dest: *mut u8, src: *const u8, count: usize) -> *mut u8 => {
|
||||
this.memory.copy(src as usize, dest as usize, count as usize)
|
||||
.map_err(|_| UserError("Invalid attempt to copy in ext_memmove"))?;
|
||||
debug_trace!(target: "runtime-io", "memmove {} from {}, {} bytes", dest, src, count);
|
||||
debug_trace!(target: "sr-io", "memmove {} from {}, {} bytes", dest, src, count);
|
||||
Ok(dest)
|
||||
},
|
||||
ext_memset(dest: *mut u8, val: u32, count: usize) -> *mut u8 => {
|
||||
debug_trace!(target: "runtime-io", "memset {} with {}, {} bytes", dest, val, count);
|
||||
debug_trace!(target: "sr-io", "memset {} with {}, {} bytes", dest, val, count);
|
||||
this.memory.clear(dest as usize, val as u8, count as usize)
|
||||
.map_err(|_| UserError("Invalid attempt to clear in ext_memset"))?;
|
||||
Ok(dest)
|
||||
},
|
||||
ext_malloc(size: usize) -> *mut u8 => {
|
||||
let r = this.heap.allocate(size);
|
||||
debug_trace!(target: "runtime-io", "malloc {} bytes at {}", size, r);
|
||||
debug_trace!(target: "sr-io", "malloc {} bytes at {}", size, r);
|
||||
Ok(r)
|
||||
},
|
||||
ext_free(addr: *mut u8) => {
|
||||
this.heap.deallocate(addr);
|
||||
debug_trace!(target: "runtime-io", "free {}", addr);
|
||||
debug_trace!(target: "sr-io", "free {}", addr);
|
||||
Ok(())
|
||||
},
|
||||
ext_set_storage(key_data: *const u8, key_len: u32, value_data: *const u8, value_len: u32) => {
|
||||
@@ -359,7 +359,7 @@ impl_function_executor!(this: FunctionExecutor<'e, E>,
|
||||
this.memory.get_into(pubkey_data, &mut pubkey[..]).map_err(|_| UserError("Invalid attempt to get pubkey in ext_ed25519_verify"))?;
|
||||
let msg = this.memory.get(msg_data, msg_len as usize).map_err(|_| UserError("Invalid attempt to get message in ext_ed25519_verify"))?;
|
||||
|
||||
Ok(if ::ed25519::verify(&sig, &msg, &pubkey) {
|
||||
Ok(if ed25519::verify(&sig, &msg, &pubkey) {
|
||||
0
|
||||
} else {
|
||||
5
|
||||
@@ -389,7 +389,7 @@ impl_function_executor!(this: FunctionExecutor<'e, E>,
|
||||
ext_sandbox_invoke(instance_idx: u32, export_ptr: *const u8, export_len: usize, args_ptr: *const u8, args_len: usize, return_val_ptr: *const u8, return_val_len: usize, state: usize) -> u32 => {
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
trace!(target: "runtime-sandbox", "invoke, instance_idx={}", instance_idx);
|
||||
trace!(target: "sr-sandbox", "invoke, instance_idx={}", instance_idx);
|
||||
let export = this.memory.get(export_ptr, export_len as usize)
|
||||
.map_err(|_| UserError("Sandbox error"))
|
||||
.and_then(|b|
|
||||
@@ -684,7 +684,7 @@ mod tests {
|
||||
fn ed25519_verify_should_work() {
|
||||
let mut ext = TestExternalities::default();
|
||||
let test_code = include_bytes!("../wasm/target/wasm32-unknown-unknown/release/runtime_test.compact.wasm");
|
||||
let key = ::ed25519::Pair::from_seed(&blake2_256(b"test"));
|
||||
let key = ed25519::Pair::from_seed(&blake2_256(b"test"));
|
||||
let sig = key.sign(b"all ok!");
|
||||
let mut calldata = vec![];
|
||||
calldata.extend_from_slice(key.public().as_ref());
|
||||
+42
-42
@@ -31,6 +31,22 @@ name = "nodrop"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "parity-codec"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-codec-derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.14.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "plain_hasher"
|
||||
version = "0.2.0"
|
||||
@@ -71,9 +87,9 @@ dependencies = [
|
||||
name = "runtime-test"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"sr-io 0.1.0",
|
||||
"sr-sandbox 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
"substrate-runtime-io 0.1.0",
|
||||
"substrate-runtime-sandbox 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -108,19 +124,34 @@ version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "substrate-codec"
|
||||
name = "sr-io"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec 0.1.0",
|
||||
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-std 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "substrate-codec-derive"
|
||||
name = "sr-sandbox"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.14.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec 0.1.0",
|
||||
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-io 0.1.0",
|
||||
"sr-std 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sr-std"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"pwasm-alloc 0.1.0",
|
||||
"pwasm-libc 0.1.0",
|
||||
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -131,46 +162,15 @@ dependencies = [
|
||||
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fixed-hash 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec 0.1.0",
|
||||
"parity-codec-derive 0.1.0",
|
||||
"plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-hex 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"substrate-codec 0.1.0",
|
||||
"substrate-codec-derive 0.1.0",
|
||||
"substrate-runtime-std 0.1.0",
|
||||
"sr-std 0.1.0",
|
||||
"uint 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "substrate-runtime-io"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"substrate-codec 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
"substrate-runtime-std 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "substrate-runtime-sandbox"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"substrate-codec 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
"substrate-runtime-io 0.1.0",
|
||||
"substrate-runtime-std 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "substrate-runtime-std"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"pwasm-alloc 0.1.0",
|
||||
"pwasm-libc 0.1.0",
|
||||
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.14.7"
|
||||
+2
-2
@@ -7,8 +7,8 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
substrate-runtime-io = { path = "../../runtime-io", version = "0.1", default_features = false }
|
||||
substrate-runtime-sandbox = { path = "../../runtime-sandbox", version = "0.1", default_features = false }
|
||||
sr-io = { path = "../../sr-io", version = "0.1", default_features = false }
|
||||
sr-sandbox = { path = "../../sr-sandbox", version = "0.1", default_features = false }
|
||||
substrate-primitives = { path = "../../primitives", default_features = false }
|
||||
|
||||
[profile.release]
|
||||
+2
-2
@@ -7,8 +7,8 @@ extern crate alloc;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[macro_use]
|
||||
extern crate substrate_runtime_io as runtime_io;
|
||||
extern crate substrate_runtime_sandbox as sandbox;
|
||||
extern crate sr_io as runtime_io;
|
||||
extern crate sr_sandbox as sandbox;
|
||||
extern crate substrate_primitives;
|
||||
|
||||
use runtime_io::{
|
||||
+4
-4
@@ -11,9 +11,9 @@ futures = "0.1"
|
||||
log = "0.3"
|
||||
parking_lot = "0.4"
|
||||
transaction-pool = "1.13.2"
|
||||
substrate-runtime-primitives = { path = "../../substrate/runtime/primitives" }
|
||||
sr-primitives = { path = "../../core/sr-primitives" }
|
||||
|
||||
[dev-dependencies]
|
||||
substrate-test-client = { path = "../../substrate/test-client" }
|
||||
substrate-keyring = { path = "../../substrate/keyring" }
|
||||
substrate-codec = { path = "../../substrate/codec" }
|
||||
substrate-test-client = { path = "../../core/test-client" }
|
||||
substrate-keyring = { path = "../../core/keyring" }
|
||||
parity-codec = { path = "../../codec" }
|
||||
+2
-2
@@ -23,7 +23,7 @@
|
||||
|
||||
extern crate futures;
|
||||
extern crate parking_lot;
|
||||
extern crate substrate_runtime_primitives as runtime_primitives;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
@@ -33,7 +33,7 @@ extern crate serde_derive;
|
||||
extern crate transaction_pool as txpool;
|
||||
#[cfg(test)] extern crate substrate_test_client as test_client;
|
||||
#[cfg(test)] extern crate substrate_keyring as keyring;
|
||||
#[cfg(test)] extern crate substrate_codec as codec;
|
||||
#[cfg(test)] extern crate parity_codec as codec;
|
||||
|
||||
pub mod watcher;
|
||||
mod error;
|
||||
@@ -4,6 +4,6 @@ version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
ed25519 = { path = "../ed25519" }
|
||||
substrate-primitives = { path = "../primitives" }
|
||||
hex-literal = { version = "0.1.0" }
|
||||
lazy_static = { version = "1.0" }
|
||||
@@ -20,11 +20,12 @@
|
||||
|
||||
#[macro_use] extern crate hex_literal;
|
||||
#[macro_use] extern crate lazy_static;
|
||||
pub extern crate ed25519;
|
||||
extern crate substrate_primitives;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::ops::Deref;
|
||||
use ed25519::{Pair, Public, Signature};
|
||||
use substrate_primitives::ed25519::{Pair, Public, Signature};
|
||||
pub use substrate_primitives::ed25519;
|
||||
|
||||
/// Set of test accounts.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
@@ -6,7 +6,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
[dependencies]
|
||||
substrate-primitives = { path = "../primitives" }
|
||||
parity-crypto = { version = "0.1", default_features = false }
|
||||
ed25519 = { path = "../ed25519" }
|
||||
error-chain = "0.12"
|
||||
hex = "0.3"
|
||||
rand = "0.4"
|
||||
@@ -21,7 +21,6 @@
|
||||
extern crate substrate_primitives;
|
||||
extern crate parity_crypto as crypto;
|
||||
extern crate subtle;
|
||||
extern crate ed25519;
|
||||
extern crate rand;
|
||||
extern crate serde_json;
|
||||
extern crate serde;
|
||||
@@ -41,8 +40,7 @@ use std::path::PathBuf;
|
||||
use std::fs::{self, File};
|
||||
use std::io::{self, Write};
|
||||
|
||||
use substrate_primitives::hashing::blake2_256;
|
||||
use ed25519::{Pair, Public, PKCS_LEN};
|
||||
use substrate_primitives::{hashing::blake2_256, ed25519::{Pair, Public, PKCS_LEN}};
|
||||
|
||||
pub use crypto::KEY_ITERATIONS;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "substrate-metadata"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
parity-codec = { path = "../../codec", default_features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"parity-codec/std"
|
||||
]
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
= ED25519
|
||||
= Substrate BFT
|
||||
|
||||
.Summary
|
||||
[source, toml]
|
||||
@@ -0,0 +1,190 @@
|
||||
// Copyright 2017 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/>.
|
||||
|
||||
//! Decodable variant of the JsonMetadata.
|
||||
//!
|
||||
//! This really doesn't belong here, but is necessary for the moment. In the future
|
||||
//! it should be removed entirely to an external module for shimming on to the
|
||||
//! codec-encoded metadata.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate parity_codec as codec;
|
||||
|
||||
use codec::{Encode, Output};
|
||||
#[cfg(feature = "std")]
|
||||
use codec::{Decode, Input};
|
||||
|
||||
/// The metadata of a runtime encoded as JSON.
|
||||
#[derive(Eq)]
|
||||
#[cfg_attr(feature = "std", derive(Debug))]
|
||||
pub enum JsonMetadata {
|
||||
Events { name: &'static str, events: &'static [(&'static str, fn() -> &'static str)] },
|
||||
Module { module: &'static str, prefix: &'static str },
|
||||
ModuleWithStorage { module: &'static str, prefix: &'static str, storage: &'static str }
|
||||
}
|
||||
|
||||
impl Encode for JsonMetadata {
|
||||
fn encode_to<W: Output>(&self, dest: &mut W) {
|
||||
match self {
|
||||
JsonMetadata::Events { name, events } => {
|
||||
0i8.encode_to(dest);
|
||||
name.encode_to(dest);
|
||||
events.iter().fold(0u32, |count, _| count + 1).encode_to(dest);
|
||||
events
|
||||
.iter()
|
||||
.map(|(module, data)| (module, data()))
|
||||
.for_each(|val| val.encode_to(dest));
|
||||
},
|
||||
JsonMetadata::Module { module, prefix } => {
|
||||
1i8.encode_to(dest);
|
||||
prefix.encode_to(dest);
|
||||
module.encode_to(dest);
|
||||
},
|
||||
JsonMetadata::ModuleWithStorage { module, prefix, storage } => {
|
||||
2i8.encode_to(dest);
|
||||
prefix.encode_to(dest);
|
||||
module.encode_to(dest);
|
||||
storage.encode_to(dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<JsonMetadata> for JsonMetadata {
|
||||
fn eq(&self, other: &JsonMetadata) -> bool {
|
||||
match (self, other) {
|
||||
(
|
||||
JsonMetadata::Events { name: lname, events: left },
|
||||
JsonMetadata::Events { name: rname, events: right }
|
||||
) => {
|
||||
lname == rname && left.iter().zip(right.iter()).fold(true, |res, (l, r)| {
|
||||
res && l.0 == r.0 && l.1() == r.1()
|
||||
})
|
||||
},
|
||||
(
|
||||
JsonMetadata::Module { prefix: lpre, module: lmod },
|
||||
JsonMetadata::Module { prefix: rpre, module: rmod }
|
||||
) => {
|
||||
lpre == rpre && lmod == rmod
|
||||
},
|
||||
(
|
||||
JsonMetadata::ModuleWithStorage { prefix: lpre, module: lmod, storage: lstore },
|
||||
JsonMetadata::ModuleWithStorage { prefix: rpre, module: rmod, storage: rstore }
|
||||
) => {
|
||||
lpre == rpre && lmod == rmod && lstore == rstore
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Utility struct for making `JsonMetadata` decodeable.
|
||||
#[derive(Eq, PartialEq, Debug)]
|
||||
#[cfg(feature = "std")]
|
||||
pub enum JsonMetadataDecodable {
|
||||
Events { name: String, events: Vec<(String, String)> },
|
||||
Module { module: String, prefix: String },
|
||||
ModuleWithStorage { module: String, prefix: String, storage: String }
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl JsonMetadataDecodable {
|
||||
/// Returns the instance as JSON string.
|
||||
/// The first value of the tuple is the name of the metadata type and the second in the JSON string.
|
||||
pub fn into_json_string(self) -> (&'static str, String) {
|
||||
match self {
|
||||
JsonMetadataDecodable::Events { name, events } => {
|
||||
(
|
||||
"events",
|
||||
format!(
|
||||
r#"{{ "name": "{}", "events": {{ {} }} }}"#, name,
|
||||
events.iter().enumerate()
|
||||
.fold(String::from(""), |mut json, (i, (name, data))| {
|
||||
if i > 0 {
|
||||
json.push_str(", ");
|
||||
}
|
||||
json.push_str(&format!(r#""{}": {}"#, name, data));
|
||||
json
|
||||
})
|
||||
)
|
||||
)
|
||||
},
|
||||
JsonMetadataDecodable::Module { prefix, module } => {
|
||||
("module", format!(r#"{{ "prefix": "{}", "module": {} }}"#, prefix, module))
|
||||
},
|
||||
JsonMetadataDecodable::ModuleWithStorage { prefix, module, storage } => {
|
||||
(
|
||||
"moduleWithStorage",
|
||||
format!(
|
||||
r#"{{ "prefix": "{}", "module": {}, "storage": {} }}"#,
|
||||
prefix, module, storage
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl Decode for JsonMetadataDecodable {
|
||||
fn decode<I: Input>(input: &mut I) -> Option<Self> {
|
||||
i8::decode(input).and_then(|variant| {
|
||||
match variant {
|
||||
0 => String::decode(input)
|
||||
.and_then(|name| Vec::<(String, String)>::decode(input).map(|events| (name, events)))
|
||||
.and_then(|(name, events)| Some(JsonMetadataDecodable::Events { name, events })),
|
||||
1 => String::decode(input)
|
||||
.and_then(|prefix| String::decode(input).map(|v| (prefix, v)))
|
||||
.and_then(|(prefix, module)| Some(JsonMetadataDecodable::Module { prefix, module })),
|
||||
2 => String::decode(input)
|
||||
.and_then(|prefix| String::decode(input).map(|v| (prefix, v)))
|
||||
.and_then(|(prefix, module)| String::decode(input).map(|v| (prefix, module, v)))
|
||||
.and_then(|(prefix, module, storage)| Some(JsonMetadataDecodable::ModuleWithStorage { prefix, module, storage })),
|
||||
_ => None,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl PartialEq<JsonMetadata> for JsonMetadataDecodable {
|
||||
fn eq(&self, other: &JsonMetadata) -> bool {
|
||||
match (self, other) {
|
||||
(
|
||||
JsonMetadataDecodable::Events { name: lname, events: left },
|
||||
JsonMetadata::Events { name: rname, events: right }
|
||||
) => {
|
||||
lname == rname && left.iter().zip(right.iter()).fold(true, |res, (l, r)| {
|
||||
res && l.0 == r.0 && l.1 == r.1()
|
||||
})
|
||||
},
|
||||
(
|
||||
JsonMetadataDecodable::Module { prefix: lpre, module: lmod },
|
||||
JsonMetadata::Module { prefix: rpre, module: rmod }
|
||||
) => {
|
||||
lpre == rpre && lmod == rmod
|
||||
},
|
||||
(
|
||||
JsonMetadataDecodable::ModuleWithStorage { prefix: lpre, module: lmod, storage: lstore },
|
||||
JsonMetadata::ModuleWithStorage { prefix: rpre, module: rmod, storage: rstore }
|
||||
) => {
|
||||
lpre == rpre && lmod == rmod && lstore == rstore
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -4,10 +4,10 @@ version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
substrate-codec = { path = "../codec", default-features = false }
|
||||
parity-codec = { path = "../../codec", default-features = false }
|
||||
substrate-primitives = { path = "../primitives", default-features = false }
|
||||
substrate-runtime-primitives = { path = "../runtime/primitives", default-features = false }
|
||||
substrate-runtime-io = { path = "../runtime-io", default-features = false }
|
||||
sr-primitives = { path = "../sr-primitives", default-features = false }
|
||||
sr-io = { path = "../sr-io", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
substrate-bft = { path = "../bft" }
|
||||
@@ -16,4 +16,4 @@ substrate-keyring = { path = "../keyring" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["substrate-codec/std", "substrate-primitives/std", "substrate-runtime-primitives/std", "substrate-runtime-io/std"]
|
||||
std = ["parity-codec/std", "substrate-primitives/std", "sr-primitives/std", "sr-io/std"]
|
||||
+3
-3
@@ -20,10 +20,10 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate substrate_codec as codec;
|
||||
extern crate parity_codec as codec;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate substrate_runtime_io as runtime_io;
|
||||
extern crate substrate_runtime_primitives as runtime_primitives;
|
||||
extern crate sr_io as runtime_io;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate substrate_bft;
|
||||
+1
-1
@@ -72,7 +72,7 @@ impl<T> RegisteredProtocol<T> {
|
||||
/// passed inside the `RegisteredProtocolOutput`.
|
||||
pub fn new(custom_data: T, protocol: ProtocolId, versions: &[(u8, u8)])
|
||||
-> Self {
|
||||
let mut proto_name = Bytes::from_static(b"/substrate/");
|
||||
let mut proto_name = Bytes::from_static(b"/core/");
|
||||
proto_name.extend_from_slice(&protocol);
|
||||
proto_name.extend_from_slice(b"/");
|
||||
|
||||
+3
-3
@@ -630,9 +630,9 @@ fn listener_handle<'a, C>(
|
||||
sender.send(
|
||||
IdentifyInfo {
|
||||
public_key: shared.network_state.local_public_key().clone(),
|
||||
protocol_version: concat!("substrate/",
|
||||
protocol_version: concat!("core/",
|
||||
env!("CARGO_PKG_VERSION")).to_owned(), // TODO: ?
|
||||
agent_version: concat!("substrate/",
|
||||
agent_version: concat!("core/",
|
||||
env!("CARGO_PKG_VERSION")).to_owned(),
|
||||
listen_addrs: shared.listened_addrs.read().clone(),
|
||||
protocols: Vec::new(), // TODO: protocols_to_report,
|
||||
@@ -771,7 +771,7 @@ fn build_kademlia_response(
|
||||
}
|
||||
|
||||
/// Handles a newly-opened connection to a remote with a custom protocol
|
||||
/// (eg. `/substrate/dot/0`).
|
||||
/// (eg. `/core/dot/0`).
|
||||
/// Returns a future that corresponds to when the handling is finished.
|
||||
fn handle_custom_connection(
|
||||
shared: Arc<Shared>,
|
||||
@@ -0,0 +1,29 @@
|
||||
[package]
|
||||
description = "Polkadot network protocol"
|
||||
name = "substrate-network"
|
||||
version = "0.1.0"
|
||||
license = "GPL-3.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
parking_lot = "0.4"
|
||||
error-chain = "0.12"
|
||||
bitflags = "1.0"
|
||||
futures = "0.1.17"
|
||||
linked-hash-map = "0.5"
|
||||
rustc-hex = "1.0"
|
||||
ethcore-io = { git = "https://github.com/paritytech/parity.git" }
|
||||
substrate-primitives = { path = "../../core/primitives" }
|
||||
substrate-client = { path = "../../core/client" }
|
||||
sr-primitives = { path = "../../core/sr-primitives" }
|
||||
parity-codec = { path = "../../codec" }
|
||||
parity-codec-derive = { path = "../../codec/derive" }
|
||||
substrate-network-libp2p = { path = "../../core/network-libp2p" }
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.4"
|
||||
substrate-keyring = { path = "../../core/keyring" }
|
||||
substrate-test-client = { path = "../../core/test-client" }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user