From f44873dce009b1b651434c836b5be09d546f1915 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Thu, 14 Nov 2019 21:51:17 +0100 Subject: [PATCH] Reorganising the repository - external renames and moves (#4074) * Adding first rough ouline of the repository structure * Remove old CI stuff * add title * formatting fixes * move node-exits job's script to scripts dir * Move docs into subdir * move to bin * move maintainence scripts, configs and helpers into its own dir * add .local to ignore * move core->client * start up 'test' area * move test client * move test runtime * make test move compile * Add dependencies rule enforcement. * Fix indexing. * Update docs to reflect latest changes * Moving /srml->/paint * update docs * move client/sr-* -> primitives/ * clean old readme * remove old broken code in rhd * update lock * Step 1. * starting to untangle client * Fix after merge. * start splitting out client interfaces * move children and blockchain interfaces * Move trie and state-machine to primitives. * Fix WASM builds. * fixing broken imports * more interface moves * move backend and light to interfaces * move CallExecutor * move cli off client * moving around more interfaces * re-add consensus crates into the mix * fix subkey path * relieve client from executor * starting to pull out client from grandpa * move is_decendent_of out of client * grandpa still depends on client directly * lemme tests pass * rename srml->paint * Make it compile. * rename interfaces->client-api * Move keyring to primitives. * fixup libp2p dep * fix broken use * allow dependency enforcement to fail * move fork-tree * Moving wasm-builder * make env * move build-script-utils * fixup broken crate depdencies and names * fix imports for authority discovery * fix typo * update cargo.lock * fixing imports * Fix paths and add missing crates * re-add missing crates --- .dockerignore | 1 + .gitignore | 1 + .gitlab-ci.yml | 47 +- Dockerfile => .maintain/Dockerfile | 0 {scripts => .maintain}/build-only-wasm.sh | 0 {ci => .maintain}/check_for_exit.sh | 0 {scripts => .maintain}/common.sh | 0 .../docker/subkey.Dockerfile | 2 +- .../docker/substrate.Dockerfile | 2 +- .maintain/ensure-deps.sh | 61 + {scripts => .maintain}/flamingfir-deploy.sh | 0 {scripts => .maintain}/getgoing.sh | 0 .../gitlab/check_line_width.sh | 0 .../gitlab/check_runtime.sh | 6 +- {node-template/scripts => .maintain}/init.sh | 0 {scripts => .maintain}/kubernetes/Chart.yaml | 0 {scripts => .maintain}/kubernetes/README.md | 0 .../templates/poddisruptionbudget.yaml | 0 .../kubernetes/templates/secrets.yaml | 0 .../kubernetes/templates/service.yaml | 0 .../kubernetes/templates/serviceaccount.yaml | 0 .../kubernetes/templates/statefulset.yaml | 0 {scripts => .maintain}/kubernetes/values.yaml | 0 .../node-template-release.sh | 2 +- .../node-template-release/Cargo.toml | 0 .../node-template-release/src/main.rs | 0 {scripts => .maintain}/runtime-dep.py | 2 +- .../rustdoc-header.html | 0 .../sentry-node/docker-compose.yml | 2 +- {scripts => .maintain}/update-copyright.sh | 0 {scripts => .maintain}/update-deps.sh | 0 {scripts => .maintain}/update.sh | 0 .travis.yml | 28 - Cargo.lock | 2857 +++++++++-------- Cargo.toml | 247 +- README.adoc | 519 +-- bin/node-template/Cargo.toml | 41 + {node-template => bin/node-template}/LICENSE | 0 .../node-template}/README.md | 0 {node-template => bin/node-template}/build.rs | 0 bin/node-template/runtime/Cargo.toml | 67 + .../node-template}/runtime/build.rs | 0 .../node-template}/runtime/src/lib.rs | 0 .../node-template}/runtime/src/template.rs | 2 +- .../node-template/scripts}/init.sh | 0 .../node-template}/src/chain_spec.rs | 0 .../node-template}/src/cli.rs | 0 .../node-template}/src/main.rs | 0 .../node-template}/src/service.rs | 1 + {node => bin/node}/cli/Cargo.toml | 82 +- {node => bin/node}/cli/bin/main.rs | 0 .../node}/cli/browser-demo/.gitignore | 0 {node => bin/node}/cli/browser-demo/README.md | 0 {node => bin/node}/cli/browser-demo/build.sh | 0 .../node}/cli/browser-demo/favicon.png | Bin .../node}/cli/browser-demo/index.html | 0 {node => bin/node}/cli/browser-demo/ws.js | 0 {node => bin/node}/cli/build.rs | 0 .../node}/cli/doc/shell-completion.adoc | 0 {node => bin/node}/cli/res/flaming-fir.json | 0 {node => bin/node}/cli/src/browser.rs | 0 {node => bin/node}/cli/src/chain_spec.rs | 0 {node => bin/node}/cli/src/cli.rs | 0 {node => bin/node}/cli/src/factory_impl.rs | 0 {node => bin/node}/cli/src/lib.rs | 0 {node => bin/node}/cli/src/service.rs | 2 +- bin/node/executor/Cargo.toml | 48 + {node => bin/node}/executor/benches/bench.rs | 0 {node => bin/node}/executor/src/lib.rs | 0 {node => bin/node}/primitives/Cargo.toml | 6 +- {node => bin/node}/primitives/src/lib.rs | 0 {node => bin/node}/rpc-client/Cargo.toml | 2 +- {node => bin/node}/rpc-client/src/main.rs | 0 bin/node/rpc/Cargo.toml | 16 + {node => bin/node}/rpc/src/lib.rs | 14 +- bin/node/runtime/Cargo.toml | 122 + .../node/runtime}/build.rs | 2 +- {node => bin/node}/runtime/src/constants.rs | 0 {node => bin/node}/runtime/src/impls.rs | 0 {node => bin/node}/runtime/src/lib.rs | 2 +- bin/node/testing/Cargo.toml | 31 + {node => bin/node}/testing/src/client.rs | 0 {node => bin/node}/testing/src/genesis.rs | 0 {node => bin/node}/testing/src/keyring.rs | 0 {node => bin/node}/testing/src/lib.rs | 0 {subkey => bin/subkey}/Cargo.toml | 10 +- {subkey => bin/subkey}/README.adoc | 0 {subkey => bin/subkey}/src/cli.yml | 0 {subkey => bin/subkey}/src/main.rs | 0 {subkey => bin/subkey}/src/vanity.rs | 0 ci/script.sh | 31 - {core/client => client}/Cargo.toml | 41 +- client/api/Cargo.toml | 41 + {core/client => client/api}/src/backend.rs | 53 +- {core/client => client/api}/src/blockchain.rs | 0 client/api/src/call_executor.rs | 148 + client/api/src/client.rs | 141 + {core/client => client/api}/src/error.rs | 0 client/api/src/lib.rs | 84 + client/api/src/light.rs | 335 ++ .../api}/src/notifications.rs | 0 client/api/src/offchain.rs | 77 + .../authority-discovery/Cargo.toml | 16 +- {core => client}/authority-discovery/build.rs | 0 .../authority-discovery/src/error.rs | 2 +- .../authority-discovery/src/lib.rs | 32 +- .../authority-discovery/src/schema/dht.proto | 0 {core => client}/basic-authorship/Cargo.toml | 13 +- .../basic-authorship/src/basic_authorship.rs | 15 +- {core => client}/basic-authorship/src/lib.rs | 0 {core => client}/block-builder/Cargo.toml | 10 +- {core => client}/block-builder/src/lib.rs | 0 {core => client}/chain-spec/Cargo.toml | 10 +- {core => client}/chain-spec/derive/Cargo.toml | 0 .../chain-spec/derive/src/impls.rs | 0 {core => client}/chain-spec/derive/src/lib.rs | 0 .../chain-spec/res/chain_spec.json | 0 .../chain-spec/res/chain_spec2.json | 0 {core => client}/chain-spec/src/chain_spec.rs | 0 {core => client}/chain-spec/src/extension.rs | 0 {core => client}/chain-spec/src/lib.rs | 0 {core => client}/cli/Cargo.toml | 20 +- {core => client}/cli/README.adoc | 0 {core => client}/cli/src/error.rs | 4 +- .../cli/src/execution_strategy.rs | 0 {core => client}/cli/src/informant.rs | 2 +- {core => client}/cli/src/informant/display.rs | 2 +- {core => client}/cli/src/lib.rs | 2 +- {core => client}/cli/src/params.rs | 12 +- {core => client}/cli/src/traits.rs | 0 {core => client}/consensus/aura/Cargo.toml | 42 +- {core => client}/consensus/aura/src/digest.rs | 0 {core => client}/consensus/aura/src/lib.rs | 13 +- {core => client}/consensus/babe/Cargo.toml | 34 +- .../consensus/babe/src/authorship.rs | 0 .../consensus/babe/src/aux_schema.rs | 6 +- .../consensus/babe/src/epoch_changes.rs | 10 +- {core => client}/consensus/babe/src/lib.rs | 37 +- {core => client}/consensus/babe/src/tests.rs | 4 +- .../consensus/babe/src/verification.rs | 0 {core => client}/consensus/pow/Cargo.toml | 16 +- {core => client}/consensus/pow/src/lib.rs | 19 +- {core => client}/consensus/slots/Cargo.toml | 12 +- {core => client}/consensus/slots/build.rs | 0 .../consensus/slots/src/aux_schema.rs | 4 +- {core => client}/consensus/slots/src/lib.rs | 9 +- {core => client}/consensus/slots/src/slots.rs | 0 client/consensus/uncles/Cargo.toml | 15 + {core => client}/consensus/uncles/src/lib.rs | 6 +- {core/client => client}/db/Cargo.toml | 21 +- .../db/src/cache/list_cache.rs | 2 +- .../db/src/cache/list_entry.rs | 2 +- .../db/src/cache/list_storage.rs | 2 +- {core/client => client}/db/src/cache/mod.rs | 6 +- {core/client => client/db}/src/children.rs | 2 +- {core/client => client}/db/src/lib.rs | 29 +- {core/client => client}/db/src/light.rs | 2 +- {core/client => client}/db/src/offchain.rs | 4 +- .../client => client}/db/src/storage_cache.rs | 2 +- {core/client => client}/db/src/utils.rs | 0 {core => client}/executor/Cargo.toml | 22 +- client/executor/runtime-test/Cargo.toml | 20 + .../executor/runtime-test}/build.rs | 2 +- .../executor/runtime-test/src/lib.rs | 0 {core => client}/executor/src/allocator.rs | 0 .../executor/src/deprecated_host_interface.rs | 0 {core => client}/executor/src/error.rs | 0 client/executor/src/host_interface.rs | 1075 +++++++ .../executor/src/integration_tests/mod.rs | 2 +- .../executor/src/integration_tests/sandbox.rs | 0 {core => client}/executor/src/lib.rs | 0 .../executor/src/native_executor.rs | 0 {core => client}/executor/src/sandbox.rs | 4 +- {core => client}/executor/src/wasm_runtime.rs | 0 {core => client}/executor/src/wasm_utils.rs | 0 .../executor/src/wasmi_execution.rs | 0 .../src/wasmtime/function_executor.rs | 0 {core => client}/executor/src/wasmtime/mod.rs | 0 .../executor/src/wasmtime/runtime.rs | 0 .../executor/src/wasmtime/trampoline.rs | 0 .../executor/src/wasmtime/util.rs | 0 {core => client}/finality-grandpa/Cargo.toml | 29 +- .../finality-grandpa/src/authorities.rs | 0 .../finality-grandpa/src/aux_schema.rs | 4 +- .../src/communication/gossip.rs | 0 .../finality-grandpa/src/communication/mod.rs | 0 .../src/communication/periodic.rs | 0 .../src/communication/tests.rs | 0 .../finality-grandpa/src/consensus_changes.rs | 4 +- .../finality-grandpa/src/environment.rs | 12 +- .../finality-grandpa/src/finality_proof.rs | 12 +- .../finality-grandpa/src/import.rs | 10 +- .../finality-grandpa/src/justification.rs | 5 +- {core => client}/finality-grandpa/src/lib.rs | 18 +- .../finality-grandpa/src/light_import.rs | 6 +- .../finality-grandpa/src/observer.rs | 5 +- .../finality-grandpa/src/tests.rs | 5 +- .../finality-grandpa/src/until_imported.rs | 4 +- .../finality-grandpa/src/voting_rule.rs | 2 +- .../header-metadata/Cargo.toml | 2 +- .../header-metadata/src/lib.rs | 0 {core => client}/keystore/Cargo.toml | 4 +- {core => client}/keystore/src/lib.rs | 0 {core => client}/network/Cargo.toml | 32 +- {core => client}/network/src/behaviour.rs | 0 {core => client}/network/src/chain.rs | 8 +- {core => client}/network/src/config.rs | 0 {core => client}/network/src/debug_info.rs | 0 {core => client}/network/src/discovery.rs | 0 {core => client}/network/src/error.rs | 4 +- .../network/src/legacy_proto/behaviour.rs | 0 .../network/src/legacy_proto/handler.rs | 0 .../network/src/legacy_proto/mod.rs | 0 .../network/src/legacy_proto/tests.rs | 0 .../network/src/legacy_proto/upgrade.rs | 0 {core => client}/network/src/lib.rs | 0 .../network/src/on_demand_layer.rs | 4 +- {core => client}/network/src/protocol.rs | 6 +- .../network/src/protocol/consensus_gossip.rs | 0 .../network/src/protocol/event.rs | 0 .../network/src/protocol/light_dispatch.rs | 8 +- .../network/src/protocol/message.rs | 2 +- .../network/src/protocol/specialization.rs | 0 {core => client}/network/src/protocol/sync.rs | 2 +- .../network/src/protocol/sync/blocks.rs | 0 .../src/protocol/sync/extra_requests.rs | 4 +- {core => client}/network/src/protocol/util.rs | 0 {core => client}/network/src/service.rs | 0 .../network/src/test/block_import.rs | 0 {core => client}/network/src/test/mod.rs | 9 +- {core => client}/network/src/test/sync.rs | 0 {core => client}/network/src/transport.rs | 0 {core => client}/offchain/Cargo.toml | 18 +- {core => client}/offchain/src/api.rs | 2 +- {core => client}/offchain/src/api/http.rs | 0 .../offchain/src/api/http_dummy.rs | 0 .../offchain/src/api/timestamp.rs | 0 {core => client}/offchain/src/lib.rs | 3 +- {core => client}/offchain/src/testing.rs | 6 +- {core => client}/rpc-servers/Cargo.toml | 2 +- {core => client}/rpc-servers/src/lib.rs | 0 {core => client}/rpc/Cargo.toml | 21 +- {core => client}/rpc/api/Cargo.toml | 6 +- {core => client}/rpc/api/src/author/error.rs | 0 {core => client}/rpc/api/src/author/hash.rs | 0 {core => client}/rpc/api/src/author/mod.rs | 0 {core => client}/rpc/api/src/chain/error.rs | 0 {core => client}/rpc/api/src/chain/mod.rs | 0 {core => client}/rpc/api/src/errors.rs | 0 {core => client}/rpc/api/src/helpers.rs | 0 {core => client}/rpc/api/src/lib.rs | 0 {core => client}/rpc/api/src/state/error.rs | 0 {core => client}/rpc/api/src/state/mod.rs | 0 {core => client}/rpc/api/src/subscriptions.rs | 0 {core => client}/rpc/api/src/system/error.rs | 0 .../rpc/api/src/system/helpers.rs | 0 {core => client}/rpc/api/src/system/mod.rs | 0 {core => client}/rpc/src/author/mod.rs | 7 +- {core => client}/rpc/src/author/tests.rs | 0 {core => client}/rpc/src/chain/chain_full.rs | 3 +- {core => client}/rpc/src/chain/chain_light.rs | 2 +- {core => client}/rpc/src/chain/mod.rs | 10 +- {core => client}/rpc/src/chain/tests.rs | 0 {core => client}/rpc/src/lib.rs | 0 {core => client}/rpc/src/metadata.rs | 0 {core => client}/rpc/src/state/mod.rs | 8 +- {core => client}/rpc/src/state/state_full.rs | 3 +- {core => client}/rpc/src/state/state_light.rs | 3 +- {core => client}/rpc/src/state/tests.rs | 0 {core => client}/rpc/src/system/mod.rs | 0 {core => client}/rpc/src/system/tests.rs | 0 client/service/Cargo.toml | 62 + {core => client}/service/src/builder.rs | 17 +- {core => client}/service/src/chain_ops.rs | 0 {core => client}/service/src/config.rs | 0 {core => client}/service/src/error.rs | 0 {core => client}/service/src/lib.rs | 6 +- {core => client}/service/src/status_sinks.rs | 0 {core => client}/service/test/Cargo.toml | 12 +- {core => client}/service/test/src/lib.rs | 0 {core/client => client}/src/call_executor.rs | 124 +- {core/client => client}/src/cht.rs | 2 +- {core/client => client}/src/client.rs | 191 +- {core/client => client}/src/genesis.rs | 0 {core/client => client}/src/in_mem.rs | 66 +- {core/client => client}/src/leaves.rs | 2 +- {core/client => client}/src/lib.rs | 23 +- {core/client => client}/src/light/backend.rs | 24 +- .../client => client}/src/light/blockchain.rs | 88 +- .../src/light/call_executor.rs | 14 +- {core/client => client}/src/light/fetcher.rs | 252 +- {core/client => client}/src/light/mod.rs | 7 +- {core => client}/state-db/Cargo.toml | 2 +- {core => client}/state-db/src/lib.rs | 0 {core => client}/state-db/src/noncanonical.rs | 0 {core => client}/state-db/src/pruning.rs | 0 {core => client}/state-db/src/test.rs | 0 {core => client}/telemetry/Cargo.toml | 0 {core => client}/telemetry/src/lib.rs | 0 {core => client}/telemetry/src/worker.rs | 0 {core => client}/telemetry/src/worker/node.rs | 0 {core => client}/transaction-pool/Cargo.toml | 16 +- .../transaction-pool/graph/Cargo.toml | 6 +- .../transaction-pool/graph/benches/basics.rs | 0 .../transaction-pool/graph/src/base_pool.rs | 0 .../transaction-pool/graph/src/error.rs | 0 .../transaction-pool/graph/src/future.rs | 0 .../transaction-pool/graph/src/lib.rs | 0 .../transaction-pool/graph/src/listener.rs | 0 .../transaction-pool/graph/src/pool.rs | 0 .../transaction-pool/graph/src/ready.rs | 0 .../transaction-pool/graph/src/rotator.rs | 0 .../graph/src/validated_pool.rs | 0 .../transaction-pool/graph/src/watcher.rs | 0 {core => client}/transaction-pool/src/api.rs | 0 .../transaction-pool/src/error.rs | 0 {core => client}/transaction-pool/src/lib.rs | 0 .../transaction-pool/src/tests.rs | 0 .../utils/wasm-builder-runner/Cargo.toml | 0 .../utils/wasm-builder-runner/README.md | 0 .../utils/wasm-builder-runner/src/lib.rs | 4 +- core/consensus/aura/primitives/Cargo.toml | 23 - core/consensus/rhd/Cargo.toml | 37 - core/consensus/rhd/src/error.rs | 50 - core/consensus/rhd/src/lib.rs | 1699 ---------- core/consensus/rhd/src/misbehaviour_check.rs | 191 -- core/consensus/rhd/src/service.rs | 181 -- core/consensus/uncles/Cargo.toml | 15 - core/executor/runtime-test/Cargo.toml | 20 - core/service/Cargo.toml | 61 - core/test-client/Cargo.toml | 18 - core/test-runtime/Cargo.toml | 83 - core/test-runtime/client/Cargo.toml | 14 - CODEOWNERS => docs/CODEOWNERS | 16 +- .../CODE_OF_CONDUCT.adoc | 0 CONTRIBUTING.adoc => docs/CONTRIBUTING.adoc | 0 .../PULL_REQUEST_TEMPLATE.md | 0 docs/README.adoc | 528 +++ SECURITY.md => docs/SECURITY.md | 0 docs/Structure.adoc | 110 + license_header.txt => docs/license_header.txt | 0 node-template/Cargo.toml | 41 - node-template/runtime/Cargo.toml | 67 - node/executor/Cargo.toml | 48 - node/rpc/Cargo.toml | 16 - node/runtime/Cargo.toml | 124 - node/testing/Cargo.toml | 31 - {srml => paint}/assets/Cargo.toml | 14 +- {srml => paint}/assets/src/lib.rs | 4 +- paint/aura/Cargo.toml | 41 + {srml => paint}/aura/src/lib.rs | 6 +- {srml => paint}/aura/src/mock.rs | 0 {srml => paint}/aura/src/tests.rs | 0 paint/authority-discovery/Cargo.toml | 37 + .../authority-discovery/src/lib.rs | 0 {srml => paint}/authorship/Cargo.toml | 16 +- {srml => paint}/authorship/src/lib.rs | 0 paint/babe/Cargo.toml | 44 + {srml => paint}/babe/src/lib.rs | 4 +- {srml => paint}/babe/src/mock.rs | 0 {srml => paint}/babe/src/tests.rs | 0 {srml => paint}/balances/Cargo.toml | 18 +- {srml => paint}/balances/src/lib.rs | 10 +- {srml => paint}/balances/src/mock.rs | 0 {srml => paint}/balances/src/tests.rs | 0 {srml => paint}/collective/Cargo.toml | 16 +- {srml => paint}/collective/src/lib.rs | 0 {srml => paint}/contracts/COMPLEXITY.md | 0 {srml => paint}/contracts/Cargo.toml | 22 +- {srml => paint}/contracts/rpc/Cargo.toml | 12 +- .../contracts/rpc/runtime-api/Cargo.toml | 8 +- .../contracts/rpc/runtime-api/src/lib.rs | 0 {srml => paint}/contracts/rpc/src/lib.rs | 2 +- {srml => paint}/contracts/src/account_db.rs | 0 {srml => paint}/contracts/src/exec.rs | 0 {srml => paint}/contracts/src/gas.rs | 0 {srml => paint}/contracts/src/lib.rs | 2 +- {srml => paint}/contracts/src/rent.rs | 0 {srml => paint}/contracts/src/tests.rs | 0 .../contracts/src/wasm/code_cache.rs | 0 .../contracts/src/wasm/env_def/macros.rs | 0 .../contracts/src/wasm/env_def/mod.rs | 0 {srml => paint}/contracts/src/wasm/mod.rs | 0 {srml => paint}/contracts/src/wasm/prepare.rs | 0 {srml => paint}/contracts/src/wasm/runtime.rs | 0 {srml => paint}/democracy/Cargo.toml | 16 +- {srml => paint}/democracy/src/lib.rs | 0 .../democracy/src/vote_threshold.rs | 0 paint/elections-phragmen/Cargo.toml | 31 + {srml => paint}/elections-phragmen/src/lib.rs | 8 +- {srml => paint}/elections/Cargo.toml | 16 +- {srml => paint}/elections/src/lib.rs | 0 {srml => paint}/elections/src/mock.rs | 0 {srml => paint}/elections/src/tests.rs | 0 {srml => paint}/evm/Cargo.toml | 18 +- {srml => paint}/evm/src/backend.rs | 0 {srml => paint}/evm/src/lib.rs | 0 {srml => paint}/example/Cargo.toml | 16 +- {srml => paint}/example/src/lib.rs | 6 +- paint/executive/Cargo.toml | 33 + {srml => paint}/executive/src/lib.rs | 4 +- paint/finality-tracker/Cargo.toml | 31 + {srml => paint}/finality-tracker/src/lib.rs | 8 +- {srml => paint}/generic-asset/Cargo.toml | 14 +- {srml => paint}/generic-asset/src/lib.rs | 0 {srml => paint}/generic-asset/src/mock.rs | 0 {srml => paint}/generic-asset/src/tests.rs | 0 paint/grandpa/Cargo.toml | 38 + {srml => paint}/grandpa/src/lib.rs | 0 {srml => paint}/grandpa/src/mock.rs | 0 {srml => paint}/grandpa/src/tests.rs | 0 paint/im-online/Cargo.toml | 39 + {srml => paint}/im-online/src/lib.rs | 8 +- {srml => paint}/im-online/src/mock.rs | 0 {srml => paint}/im-online/src/tests.rs | 0 {srml => paint}/indices/Cargo.toml | 16 +- {srml => paint}/indices/src/address.rs | 0 {srml => paint}/indices/src/lib.rs | 0 {srml => paint}/indices/src/mock.rs | 0 {srml => paint}/indices/src/tests.rs | 0 {srml => paint}/membership/Cargo.toml | 14 +- {srml => paint}/membership/src/lib.rs | 0 {srml => paint}/metadata/Cargo.toml | 6 +- {srml => paint}/metadata/src/lib.rs | 0 {srml => paint}/nicks/Cargo.toml | 16 +- {srml => paint}/nicks/src/lib.rs | 0 paint/offences/Cargo.toml | 32 + {srml => paint}/offences/src/lib.rs | 0 {srml => paint}/offences/src/mock.rs | 2 +- {srml => paint}/offences/src/tests.rs | 0 .../randomness-collective-flip/Cargo.toml | 14 +- .../randomness-collective-flip/src/lib.rs | 2 +- {srml => paint}/scored-pool/Cargo.toml | 16 +- {srml => paint}/scored-pool/src/lib.rs | 4 +- {srml => paint}/scored-pool/src/mock.rs | 0 {srml => paint}/scored-pool/src/tests.rs | 0 {srml => paint}/session/Cargo.toml | 22 +- {srml => paint}/session/src/historical.rs | 0 {srml => paint}/session/src/lib.rs | 14 +- {srml => paint}/session/src/mock.rs | 0 paint/staking/Cargo.toml | 45 + .../staking/reward-curve/Cargo.toml | 4 +- .../staking/reward-curve/src/lib.rs | 4 +- .../staking/reward-curve/src/log.rs | 0 .../staking/reward-curve/tests/test.rs | 6 +- {srml => paint}/staking/src/inflation.rs | 2 +- {srml => paint}/staking/src/lib.rs | 8 +- {srml => paint}/staking/src/mock.rs | 2 +- {srml => paint}/staking/src/tests.rs | 0 {srml => paint}/sudo/Cargo.toml | 14 +- {srml => paint}/sudo/src/lib.rs | 4 +- {srml => paint}/support/Cargo.toml | 22 +- {srml => paint}/support/procedural/Cargo.toml | 4 +- {srml => paint}/support/procedural/src/lib.rs | 22 +- .../src/storage/genesis_config/builder_def.rs | 2 +- .../genesis_config/genesis_config_def.rs | 2 +- .../src/storage/genesis_config/mod.rs | 0 .../support/procedural/src/storage/getters.rs | 0 .../procedural/src/storage/instance_trait.rs | 0 .../procedural/src/storage/metadata.rs | 2 +- .../support/procedural/src/storage/mod.rs | 6 +- .../support/procedural/src/storage/parse.rs | 2 +- .../procedural/src/storage/storage_struct.rs | 0 .../procedural/src/storage/store_trait.rs | 0 .../support/procedural/tools/Cargo.toml | 4 +- .../procedural/tools/derive/Cargo.toml | 2 +- .../procedural/tools/derive/src/lib.rs | 0 .../support/procedural/tools/src/lib.rs | 6 +- .../support/procedural/tools/src/syn_ext.rs | 2 +- {srml => paint}/support/rpc/Cargo.toml | 10 +- {srml => paint}/support/rpc/src/lib.rs | 16 +- {srml => paint}/support/src/debug.rs | 6 +- {srml => paint}/support/src/dispatch.rs | 36 +- {srml => paint}/support/src/error.rs | 4 +- {srml => paint}/support/src/event.rs | 12 +- {srml => paint}/support/src/hash.rs | 2 +- {srml => paint}/support/src/inherent.rs | 0 {srml => paint}/support/src/lib.rs | 16 +- {srml => paint}/support/src/metadata.rs | 10 +- {srml => paint}/support/src/origin.rs | 0 {srml => paint}/support/src/runtime.rs | 0 {srml => paint}/support/src/storage/child.rs | 0 .../src/storage/generator/double_map.rs | 0 .../src/storage/generator/linked_map.rs | 0 .../support/src/storage/generator/map.rs | 0 .../support/src/storage/generator/mod.rs | 0 .../support/src/storage/generator/value.rs | 0 {srml => paint}/support/src/storage/hashed.rs | 0 {srml => paint}/support/src/storage/mod.rs | 0 .../support/src/storage/unhashed.rs | 0 {srml => paint}/support/src/traits.rs | 2 +- {srml => paint}/support/src/unsigned.rs | 6 +- {srml => paint}/support/test/Cargo.toml | 14 +- {srml => paint}/support/test/src/lib.rs | 2 +- .../support/test/tests/decl_storage.rs | 0 .../support/test/tests/decl_storage_ui.rs | 0 .../tests/decl_storage_ui/config_duplicate.rs | 0 .../decl_storage_ui/config_duplicate.stderr | 0 .../decl_storage_ui/config_get_duplicate.rs | 0 .../config_get_duplicate.stderr | 0 .../tests/decl_storage_ui/get_duplicate.rs | 0 .../decl_storage_ui/get_duplicate.stderr | 0 .../support/test/tests/final_keys.rs | 0 .../support/test/tests/genesisconfig.rs | 0 .../support/test/tests/instance.rs | 0 .../support/test/tests/issue2219.rs | 0 .../support/test/tests/reserved_keyword.rs | 0 .../tests/reserved_keyword/on_initialize.rs | 0 .../reserved_keyword/on_initialize.stderr | 0 {srml => paint}/support/test/tests/system.rs | 0 {srml => paint}/system/Cargo.toml | 14 +- {srml => paint}/system/benches/bench.rs | 2 +- {srml => paint}/system/rpc/Cargo.toml | 14 +- .../system/rpc/runtime-api/Cargo.toml | 4 +- .../system/rpc/runtime-api/src/lib.rs | 0 {srml => paint}/system/rpc/src/lib.rs | 2 +- {srml => paint}/system/src/lib.rs | 2 +- {srml => paint}/system/src/offchain.rs | 0 {srml => paint}/timestamp/Cargo.toml | 16 +- {srml => paint}/timestamp/src/lib.rs | 6 +- paint/transaction-payment/Cargo.toml | 29 + .../transaction-payment/rpc/Cargo.toml | 12 +- .../rpc/runtime-api/Cargo.toml | 8 +- .../rpc/runtime-api/src/lib.rs | 0 .../transaction-payment/rpc/src/lib.rs | 4 +- .../transaction-payment/src/lib.rs | 0 {srml => paint}/treasury/Cargo.toml | 16 +- {srml => paint}/treasury/src/lib.rs | 0 {srml => paint}/utility/Cargo.toml | 16 +- {srml => paint}/utility/src/lib.rs | 0 .../application-crypto/Cargo.toml | 8 +- .../application-crypto/src/ed25519.rs | 0 .../application-crypto/src/lib.rs | 0 .../application-crypto/src/sr25519.rs | 0 .../application-crypto/src/traits.rs | 0 .../authority-discovery}/Cargo.toml | 10 +- .../authority-discovery}/src/lib.rs | 3 +- .../block-builder/runtime-api/Cargo.toml | 0 .../block-builder/runtime-api/src/lib.rs | 0 .../consensus/aura}/Cargo.toml | 17 +- .../consensus/aura}/src/lib.rs | 0 .../consensus/babe}/Cargo.toml | 20 +- .../consensus/babe}/src/digest.rs | 0 .../consensus/babe}/src/lib.rs | 0 .../consensus/common/Cargo.toml | 4 +- .../consensus/common/src/block_import.rs | 0 .../consensus/common/src/block_validation.rs | 0 .../consensus/common/src/error.rs | 0 .../consensus/common/src/evaluation.rs | 0 .../consensus/common/src/import_queue.rs | 0 .../common/src/import_queue/basic_queue.rs | 0 .../common/src/import_queue/buffered_link.rs | 0 .../consensus/common/src/lib.rs | 0 .../consensus/common/src/offline_tracker.rs | 0 .../consensus/common/src/select_chain.rs | 0 .../consensus/pow}/Cargo.toml | 8 +- .../consensus/pow}/src/lib.rs | 0 .../primitives => primitives/core}/Cargo.toml | 0 .../core}/benches/bench.rs | 0 .../core}/debug-derive/Cargo.toml | 0 .../core}/debug-derive/src/impls.rs | 0 .../core}/debug-derive/src/lib.rs | 0 .../core}/debug-derive/tests/tests.rs | 0 .../core}/src/changes_trie.rs | 0 .../core}/src/crypto.rs | 0 .../core}/src/ecdsa.rs | 0 .../core}/src/ed25519.rs | 0 .../core}/src/hash.rs | 0 .../core}/src/hasher.rs | 0 .../core}/src/hashing.rs | 0 .../core}/src/hexdisplay.rs | 0 .../primitives => primitives/core}/src/lib.rs | 0 .../core}/src/offchain.rs | 0 .../core}/src/sandbox.rs | 0 .../core}/src/sr25519.rs | 0 .../core}/src/testing.rs | 0 .../core}/src/tests.rs | 0 .../core}/src/traits.rs | 0 .../core}/src/u32_trait.rs | 0 .../core}/src/uint.rs | 4 +- .../core}/storage/Cargo.toml | 0 .../core}/storage/src/lib.rs | 0 {core => primitives}/externalities/Cargo.toml | 2 +- .../externalities/src/extensions.rs | 0 {core => primitives}/externalities/src/lib.rs | 0 .../externalities/src/scope_limited.rs | 0 primitives/finality-grandpa/Cargo.toml | 24 + .../finality-grandpa}/src/lib.rs | 0 {core => primitives}/inherents/Cargo.toml | 2 +- {core => primitives}/inherents/src/lib.rs | 0 {core => primitives}/keyring/Cargo.toml | 2 +- {core => primitives}/keyring/src/ed25519.rs | 0 {core => primitives}/keyring/src/lib.rs | 0 {core => primitives}/keyring/src/sr25519.rs | 0 .../offchain}/Cargo.toml | 4 +- .../offchain}/src/lib.rs | 0 {core => primitives}/panic-handler/Cargo.toml | 0 {core => primitives}/panic-handler/src/lib.rs | 0 {core => primitives}/peerset/Cargo.toml | 0 {core => primitives}/peerset/src/lib.rs | 0 .../peerset/src/peersstate.rs | 0 {core => primitives}/peerset/tests/fuzz.rs | 0 {core => primitives}/phragmen/Cargo.toml | 6 +- .../phragmen/benches/phragmen.rs | 0 {core => primitives}/phragmen/src/lib.rs | 0 {core => primitives}/phragmen/src/mock.rs | 0 {core => primitives}/phragmen/src/tests.rs | 0 .../primitives => primitives/rpc}/Cargo.toml | 2 +- .../primitives => primitives/rpc}/src/lib.rs | 0 .../rpc}/src/number.rs | 0 .../runtime-interface/Cargo.toml | 6 +- .../runtime-interface/proc-macro/Cargo.toml | 0 .../runtime-interface/proc-macro/src/lib.rs | 0 .../proc-macro/src/pass_by/codec.rs | 0 .../proc-macro/src/pass_by/enum_.rs | 0 .../proc-macro/src/pass_by/inner.rs | 0 .../proc-macro/src/pass_by/mod.rs | 0 .../bare_function_interface.rs | 0 .../host_function_interface.rs | 0 .../proc-macro/src/runtime_interface/mod.rs | 0 .../src/runtime_interface/trait_decl_impl.rs | 0 .../runtime-interface/proc-macro/src/utils.rs | 0 .../runtime-interface/proc-macro/tests/ui.rs | 0 .../tests/ui/no_generic_parameters.rs | 0 .../tests/ui/no_generic_parameters.stderr | 0 .../tests/ui/no_method_implementation.rs | 0 .../tests/ui/no_method_implementation.stderr | 0 .../tests/ui/pass_by_enum_with_struct.rs | 0 .../tests/ui/pass_by_enum_with_struct.stderr | 0 .../ui/pass_by_enum_with_value_variant.rs | 0 .../ui/pass_by_enum_with_value_variant.stderr | 0 .../tests/ui/pass_by_inner_with_two_fields.rs | 0 .../ui/pass_by_inner_with_two_fields.stderr | 0 .../proc-macro/tests/ui/take_self_by_value.rs | 0 .../tests/ui/take_self_by_value.stderr | 0 .../runtime-interface/src/host.rs | 0 .../runtime-interface/src/impls.rs | 0 .../runtime-interface/src/lib.rs | 0 .../runtime-interface/src/pass_by.rs | 0 .../runtime-interface/src/wasm.rs | 0 .../runtime-interface/test-wasm/Cargo.toml | 4 +- .../runtime-interface/test-wasm/build.rs | 2 +- .../runtime-interface/test-wasm/src/lib.rs | 0 {core => primitives}/serializer/Cargo.toml | 0 {core => primitives}/serializer/src/lib.rs | 0 {core => primitives}/session/Cargo.toml | 0 {core => primitives}/session/src/lib.rs | 0 {core => primitives}/sr-api/Cargo.toml | 6 +- {core => primitives}/sr-api/benches/bench.rs | 0 .../sr-api/proc-macro/Cargo.toml | 2 +- .../proc-macro/src/decl_runtime_apis.rs | 0 .../proc-macro/src/impl_runtime_apis.rs | 0 .../sr-api/proc-macro/src/lib.rs | 0 .../sr-api/proc-macro/src/utils.rs | 0 {core => primitives}/sr-api/src/lib.rs | 0 {core => primitives}/sr-api/test/Cargo.toml | 6 +- .../sr-api/test/tests/decl_and_impl.rs | 0 .../sr-api/test/tests/runtime_calls.rs | 0 .../sr-api/test/tests/trybuild.rs | 0 .../test/tests/ui/adding_self_parameter.rs | 0 .../tests/ui/adding_self_parameter.stderr | 0 .../tests/ui/changed_in_unknown_version.rs | 0 .../ui/changed_in_unknown_version.stderr | 0 .../test/tests/ui/declaring_old_block.rs | 0 .../test/tests/ui/declaring_old_block.stderr | 0 ...declaring_own_block_with_different_name.rs | 0 ...aring_own_block_with_different_name.stderr | 0 .../tests/ui/empty_impl_runtime_apis_call.rs | 0 .../ui/empty_impl_runtime_apis_call.stderr | 0 .../ui/impl_incorrect_method_signature.rs | 0 .../ui/impl_incorrect_method_signature.stderr | 0 .../ui/impl_two_traits_with_same_name.rs | 0 .../ui/impl_two_traits_with_same_name.stderr | 0 .../test/tests/ui/invalid_api_version.rs | 0 .../test/tests/ui/invalid_api_version.stderr | 0 .../test/tests/ui/invalid_api_version_2.rs | 0 .../tests/ui/invalid_api_version_2.stderr | 0 .../test/tests/ui/invalid_api_version_3.rs | 0 .../tests/ui/invalid_api_version_3.stderr | 0 .../ui/missing_block_generic_parameter.rs | 0 .../ui/missing_block_generic_parameter.stderr | 0 .../test/tests/ui/missing_path_for_trait.rs | 0 .../tests/ui/missing_path_for_trait.stderr | 0 ...ype_reference_in_impl_runtime_apis_call.rs | 0 ...reference_in_impl_runtime_apis_call.stderr | 0 {core => primitives}/sr-arithmetic/Cargo.toml | 2 +- .../sr-arithmetic/benches/bench.rs | 0 .../sr-arithmetic/fuzzer/.gitignore | 0 .../sr-arithmetic/fuzzer/Cargo.lock | 0 .../sr-arithmetic/fuzzer/Cargo.toml | 0 .../sr-arithmetic/fuzzer/src/biguint.rs | 0 .../sr-arithmetic/fuzzer/src/rational128.rs | 0 .../sr-arithmetic/src/biguint.rs | 0 .../sr-arithmetic/src/fixed64.rs | 0 .../sr-arithmetic/src/helpers_128bit.rs | 0 {core => primitives}/sr-arithmetic/src/lib.rs | 0 .../sr-arithmetic/src/per_things.rs | 0 .../sr-arithmetic/src/rational128.rs | 0 .../sr-arithmetic/src/traits.rs | 0 {core => primitives}/sr-io/Cargo.toml | 6 +- {core => primitives}/sr-io/src/lib.rs | 6 +- primitives/sr-io/with_std.rs | 553 ++++ primitives/sr-io/without_std.rs | 1241 +++++++ {core => primitives}/sr-primitives/Cargo.toml | 6 +- .../sr-primitives/src/curve.rs | 0 .../sr-primitives/src/generic/block.rs | 0 .../src/generic/checked_extrinsic.rs | 0 .../sr-primitives/src/generic/digest.rs | 0 .../sr-primitives/src/generic/era.rs | 0 .../sr-primitives/src/generic/header.rs | 0 .../sr-primitives/src/generic/mod.rs | 0 .../sr-primitives/src/generic/tests.rs | 0 .../src/generic/unchecked_extrinsic.rs | 0 {core => primitives}/sr-primitives/src/lib.rs | 6 +- .../sr-primitives/src/offchain/http.rs | 0 .../sr-primitives/src/offchain/mod.rs | 0 .../sr-primitives/src/testing.rs | 4 +- .../sr-primitives/src/traits.rs | 0 .../sr-primitives/src/transaction_validity.rs | 0 .../sr-primitives/src/weights.rs | 0 {core => primitives}/sr-sandbox/Cargo.toml | 2 +- {core => primitives}/sr-sandbox/src/lib.rs | 4 +- {core => primitives}/sr-sandbox/with_std.rs | 0 .../sr-sandbox/without_std.rs | 0 .../sr-staking-primitives/Cargo.toml | 0 .../sr-staking-primitives/src/lib.rs | 0 .../sr-staking-primitives/src/offence.rs | 0 {core => primitives}/sr-std/Cargo.toml | 0 {core => primitives}/sr-std/src/lib.rs | 8 +- {core => primitives}/sr-std/with_std.rs | 0 {core => primitives}/sr-std/without_std.rs | 0 {core => primitives}/sr-version/Cargo.toml | 0 {core => primitives}/sr-version/src/lib.rs | 0 {core => primitives}/state-machine/Cargo.toml | 2 +- .../state-machine/src/backend.rs | 0 .../state-machine/src/basic.rs | 0 .../state-machine/src/changes_trie/build.rs | 0 .../src/changes_trie/build_cache.rs | 0 .../src/changes_trie/build_iterator.rs | 0 .../src/changes_trie/changes_iterator.rs | 0 .../state-machine/src/changes_trie/input.rs | 0 .../state-machine/src/changes_trie/mod.rs | 0 .../state-machine/src/changes_trie/prune.rs | 21 +- .../state-machine/src/changes_trie/storage.rs | 0 .../src/changes_trie/surface_iterator.rs | 0 .../state-machine/src/error.rs | 0 {core => primitives}/state-machine/src/ext.rs | 0 {core => primitives}/state-machine/src/lib.rs | 0 .../state-machine/src/overlayed_changes.rs | 40 +- .../state-machine/src/proving_backend.rs | 0 .../state-machine/src/testing.rs | 0 .../state-machine/src/trie_backend.rs | 0 .../state-machine/src/trie_backend_essence.rs | 0 .../transaction-pool/runtime-api/Cargo.toml | 4 +- .../transaction-pool/runtime-api/src/lib.rs | 0 {core => primitives}/trie/Cargo.toml | 2 +- {core => primitives}/trie/benches/bench.rs | 0 {core => primitives}/trie/src/error.rs | 0 {core => primitives}/trie/src/lib.rs | 0 {core => primitives}/trie/src/node_codec.rs | 0 {core => primitives}/trie/src/node_header.rs | 0 {core => primitives}/trie/src/trie_stream.rs | 0 .../wasm-interface/Cargo.toml | 0 .../wasm-interface/src/lib.rs | 0 .../wasm-interface/src/wasmi_impl.rs | 0 srml/README.adoc | 26 - srml/aura/Cargo.toml | 41 - srml/authority-discovery/Cargo.toml | 37 - srml/babe/Cargo.toml | 44 - srml/elections-phragmen/Cargo.toml | 31 - srml/executive/Cargo.toml | 33 - srml/finality-tracker/Cargo.toml | 31 - srml/grandpa/Cargo.toml | 38 - srml/im-online/Cargo.toml | 39 - srml/offences/Cargo.toml | 32 - srml/staking/Cargo.toml | 45 - srml/transaction-payment/Cargo.toml | 29 - test-utils/transaction-factory/Cargo.toml | 24 - .../utils}/chain-spec-builder/Cargo.toml | 6 +- .../utils}/chain-spec-builder/build.rs | 0 .../utils}/chain-spec-builder/src/main.rs | 0 test/utils/client/Cargo.toml | 19 + .../utils/client}/src/client_ext.rs | 5 +- .../utils/client}/src/lib.rs | 6 +- test/utils/primitives/Cargo.toml | 71 + test/utils/primitives/src/lib.rs | 78 + test/utils/runtime/Cargo.toml | 83 + .../utils/runtime}/build.rs | 2 +- test/utils/runtime/client/Cargo.toml | 15 + .../runtime}/client/src/block_builder_ext.rs | 0 .../utils/runtime}/client/src/lib.rs | 2 +- .../utils/runtime}/client/src/trait_tests.rs | 10 +- .../utils/runtime}/src/genesismap.rs | 0 .../utils/runtime}/src/lib.rs | 24 +- .../utils/runtime}/src/system.rs | 2 +- test/utils/transaction-factory/Cargo.toml | 19 + .../transaction-factory/src/complex_mode.rs | 2 +- .../utils}/transaction-factory/src/lib.rs | 6 +- .../utils}/transaction-factory/src/modes.rs | 0 .../transaction-factory/src/simple_modes.rs | 2 +- .../build-script-utils/Cargo.toml | 0 .../build-script-utils/src/lib.rs | 0 {core/utils => utils}/fork-tree/Cargo.toml | 0 {core/utils => utils}/fork-tree/src/lib.rs | 0 {core/utils => utils}/wasm-builder/Cargo.toml | 0 {core/utils => utils}/wasm-builder/README.md | 2 +- {core/utils => utils}/wasm-builder/src/lib.rs | 2 +- .../wasm-builder/src/prerequisites.rs | 0 .../wasm-builder/src/wasm_project.rs | 0 809 files changed, 8332 insertions(+), 6995 deletions(-) rename Dockerfile => .maintain/Dockerfile (100%) rename {scripts => .maintain}/build-only-wasm.sh (100%) rename {ci => .maintain}/check_for_exit.sh (100%) rename {scripts => .maintain}/common.sh (100%) rename {scripts => .maintain}/docker/subkey.Dockerfile (93%) rename {scripts => .maintain}/docker/substrate.Dockerfile (96%) create mode 100755 .maintain/ensure-deps.sh rename {scripts => .maintain}/flamingfir-deploy.sh (100%) rename {scripts => .maintain}/getgoing.sh (100%) rename {scripts => .maintain}/gitlab/check_line_width.sh (100%) rename {scripts => .maintain}/gitlab/check_runtime.sh (93%) rename {node-template/scripts => .maintain}/init.sh (100%) rename {scripts => .maintain}/kubernetes/Chart.yaml (100%) rename {scripts => .maintain}/kubernetes/README.md (100%) rename {scripts => .maintain}/kubernetes/templates/poddisruptionbudget.yaml (100%) rename {scripts => .maintain}/kubernetes/templates/secrets.yaml (100%) rename {scripts => .maintain}/kubernetes/templates/service.yaml (100%) rename {scripts => .maintain}/kubernetes/templates/serviceaccount.yaml (100%) rename {scripts => .maintain}/kubernetes/templates/statefulset.yaml (100%) rename {scripts => .maintain}/kubernetes/values.yaml (100%) rename {scripts => .maintain}/node-template-release.sh (84%) rename {scripts => .maintain}/node-template-release/Cargo.toml (100%) rename {scripts => .maintain}/node-template-release/src/main.rs (100%) rename {scripts => .maintain}/runtime-dep.py (91%) rename rustdoc-header.html => .maintain/rustdoc-header.html (100%) rename {scripts => .maintain}/sentry-node/docker-compose.yml (97%) rename {scripts => .maintain}/update-copyright.sh (100%) rename {scripts => .maintain}/update-deps.sh (100%) rename {scripts => .maintain}/update.sh (100%) delete mode 100644 .travis.yml create mode 100644 bin/node-template/Cargo.toml rename {node-template => bin/node-template}/LICENSE (100%) rename {node-template => bin/node-template}/README.md (100%) rename {node-template => bin/node-template}/build.rs (100%) create mode 100644 bin/node-template/runtime/Cargo.toml rename {node-template => bin/node-template}/runtime/build.rs (100%) rename {node-template => bin/node-template}/runtime/src/lib.rs (100%) rename {node-template => bin/node-template}/runtime/src/template.rs (98%) rename {scripts => bin/node-template/scripts}/init.sh (100%) rename {node-template => bin/node-template}/src/chain_spec.rs (100%) rename {node-template => bin/node-template}/src/cli.rs (100%) rename {node-template => bin/node-template}/src/main.rs (100%) rename {node-template => bin/node-template}/src/service.rs (99%) rename {node => bin/node}/cli/Cargo.toml (53%) rename {node => bin/node}/cli/bin/main.rs (100%) rename {node => bin/node}/cli/browser-demo/.gitignore (100%) rename {node => bin/node}/cli/browser-demo/README.md (100%) rename {node => bin/node}/cli/browser-demo/build.sh (100%) rename {node => bin/node}/cli/browser-demo/favicon.png (100%) rename {node => bin/node}/cli/browser-demo/index.html (100%) rename {node => bin/node}/cli/browser-demo/ws.js (100%) rename {node => bin/node}/cli/build.rs (100%) rename {node => bin/node}/cli/doc/shell-completion.adoc (100%) rename {node => bin/node}/cli/res/flaming-fir.json (100%) rename {node => bin/node}/cli/src/browser.rs (100%) rename {node => bin/node}/cli/src/chain_spec.rs (100%) rename {node => bin/node}/cli/src/cli.rs (100%) rename {node => bin/node}/cli/src/factory_impl.rs (100%) rename {node => bin/node}/cli/src/lib.rs (100%) rename {node => bin/node}/cli/src/service.rs (99%) create mode 100644 bin/node/executor/Cargo.toml rename {node => bin/node}/executor/benches/bench.rs (100%) rename {node => bin/node}/executor/src/lib.rs (100%) rename {node => bin/node}/primitives/Cargo.toml (50%) rename {node => bin/node}/primitives/src/lib.rs (100%) rename {node => bin/node}/rpc-client/Cargo.toml (82%) rename {node => bin/node}/rpc-client/src/main.rs (100%) create mode 100644 bin/node/rpc/Cargo.toml rename {node => bin/node}/rpc/src/lib.rs (81%) create mode 100644 bin/node/runtime/Cargo.toml rename {core/executor/runtime-test => bin/node/runtime}/build.rs (96%) rename {node => bin/node}/runtime/src/constants.rs (100%) rename {node => bin/node}/runtime/src/impls.rs (100%) rename {node => bin/node}/runtime/src/lib.rs (99%) create mode 100644 bin/node/testing/Cargo.toml rename {node => bin/node}/testing/src/client.rs (100%) rename {node => bin/node}/testing/src/genesis.rs (100%) rename {node => bin/node}/testing/src/keyring.rs (100%) rename {node => bin/node}/testing/src/lib.rs (100%) rename {subkey => bin/subkey}/Cargo.toml (61%) rename {subkey => bin/subkey}/README.adoc (100%) rename {subkey => bin/subkey}/src/cli.yml (100%) rename {subkey => bin/subkey}/src/main.rs (100%) rename {subkey => bin/subkey}/src/vanity.rs (100%) delete mode 100755 ci/script.sh rename {core/client => client}/Cargo.toml (60%) create mode 100644 client/api/Cargo.toml rename {core/client => client/api}/src/backend.rs (89%) rename {core/client => client/api}/src/blockchain.rs (100%) create mode 100644 client/api/src/call_executor.rs create mode 100644 client/api/src/client.rs rename {core/client => client/api}/src/error.rs (100%) create mode 100644 client/api/src/lib.rs create mode 100644 client/api/src/light.rs rename {core/client => client/api}/src/notifications.rs (100%) create mode 100644 client/api/src/offchain.rs rename {core => client}/authority-discovery/Cargo.toml (60%) rename {core => client}/authority-discovery/build.rs (100%) rename {core => client}/authority-discovery/src/error.rs (97%) rename {core => client}/authority-discovery/src/lib.rs (96%) rename {core => client}/authority-discovery/src/schema/dht.proto (100%) rename {core => client}/basic-authorship/Cargo.toml (59%) rename {core => client}/basic-authorship/src/basic_authorship.rs (95%) rename {core => client}/basic-authorship/src/lib.rs (100%) rename {core => client}/block-builder/Cargo.toml (56%) rename {core => client}/block-builder/src/lib.rs (100%) rename {core => client}/chain-spec/Cargo.toml (51%) rename {core => client}/chain-spec/derive/Cargo.toml (100%) rename {core => client}/chain-spec/derive/src/impls.rs (100%) rename {core => client}/chain-spec/derive/src/lib.rs (100%) rename {core => client}/chain-spec/res/chain_spec.json (100%) rename {core => client}/chain-spec/res/chain_spec2.json (100%) rename {core => client}/chain-spec/src/chain_spec.rs (100%) rename {core => client}/chain-spec/src/extension.rs (100%) rename {core => client}/chain-spec/src/lib.rs (100%) rename {core => client}/cli/Cargo.toml (60%) rename {core => client}/cli/README.adoc (100%) rename {core => client}/cli/src/error.rs (97%) rename {core => client}/cli/src/execution_strategy.rs (100%) rename {core => client}/cli/src/informant.rs (98%) rename {core => client}/cli/src/informant/display.rs (99%) rename {core => client}/cli/src/lib.rs (99%) rename {core => client}/cli/src/params.rs (98%) rename {core => client}/cli/src/traits.rs (100%) rename {core => client}/consensus/aura/Cargo.toml (57%) rename {core => client}/consensus/aura/src/digest.rs (100%) rename {core => client}/consensus/aura/src/lib.rs (98%) rename {core => client}/consensus/babe/Cargo.toml (62%) rename {core => client}/consensus/babe/src/authorship.rs (100%) rename {core => client}/consensus/babe/src/aux_schema.rs (96%) rename {core => client}/consensus/babe/src/epoch_changes.rs (99%) rename {core => client}/consensus/babe/src/lib.rs (97%) rename {core => client}/consensus/babe/src/tests.rs (99%) rename {core => client}/consensus/babe/src/verification.rs (100%) rename {core => client}/consensus/pow/Cargo.toml (53%) rename {core => client}/consensus/pow/src/lib.rs (97%) rename {core => client}/consensus/slots/Cargo.toml (59%) rename {core => client}/consensus/slots/build.rs (100%) rename {core => client}/consensus/slots/src/aux_schema.rs (98%) rename {core => client}/consensus/slots/src/lib.rs (98%) rename {core => client}/consensus/slots/src/slots.rs (100%) create mode 100644 client/consensus/uncles/Cargo.toml rename {core => client}/consensus/uncles/src/lib.rs (91%) rename {core/client => client}/db/Cargo.toml (68%) rename {core/client => client}/db/src/cache/list_cache.rs (99%) rename {core/client => client}/db/src/cache/list_entry.rs (99%) rename {core/client => client}/db/src/cache/list_storage.rs (99%) rename {core/client => client}/db/src/cache/mod.rs (98%) rename {core/client => client/db}/src/children.rs (99%) rename {core/client => client}/db/src/lib.rs (98%) rename {core/client => client}/db/src/light.rs (99%) rename {core/client => client}/db/src/offchain.rs (97%) rename {core/client => client}/db/src/storage_cache.rs (99%) rename {core/client => client}/db/src/utils.rs (100%) rename {core => client}/executor/Cargo.toml (74%) create mode 100644 client/executor/runtime-test/Cargo.toml rename {node/runtime => client/executor/runtime-test}/build.rs (96%) rename {core => client}/executor/runtime-test/src/lib.rs (100%) rename {core => client}/executor/src/allocator.rs (100%) rename {core => client}/executor/src/deprecated_host_interface.rs (100%) rename {core => client}/executor/src/error.rs (100%) create mode 100644 client/executor/src/host_interface.rs rename {core => client}/executor/src/integration_tests/mod.rs (99%) rename {core => client}/executor/src/integration_tests/sandbox.rs (100%) rename {core => client}/executor/src/lib.rs (100%) rename {core => client}/executor/src/native_executor.rs (100%) rename {core => client}/executor/src/sandbox.rs (99%) rename {core => client}/executor/src/wasm_runtime.rs (100%) rename {core => client}/executor/src/wasm_utils.rs (100%) rename {core => client}/executor/src/wasmi_execution.rs (100%) rename {core => client}/executor/src/wasmtime/function_executor.rs (100%) rename {core => client}/executor/src/wasmtime/mod.rs (100%) rename {core => client}/executor/src/wasmtime/runtime.rs (100%) rename {core => client}/executor/src/wasmtime/trampoline.rs (100%) rename {core => client}/executor/src/wasmtime/util.rs (100%) rename {core => client}/finality-grandpa/Cargo.toml (62%) rename {core => client}/finality-grandpa/src/authorities.rs (100%) rename {core => client}/finality-grandpa/src/aux_schema.rs (99%) rename {core => client}/finality-grandpa/src/communication/gossip.rs (100%) rename {core => client}/finality-grandpa/src/communication/mod.rs (100%) rename {core => client}/finality-grandpa/src/communication/periodic.rs (100%) rename {core => client}/finality-grandpa/src/communication/tests.rs (100%) rename {core => client}/finality-grandpa/src/consensus_changes.rs (95%) rename {core => client}/finality-grandpa/src/environment.rs (99%) rename {core => client}/finality-grandpa/src/finality_proof.rs (99%) rename {core => client}/finality-grandpa/src/import.rs (99%) rename {core => client}/finality-grandpa/src/justification.rs (98%) rename {core => client}/finality-grandpa/src/lib.rs (98%) rename {core => client}/finality-grandpa/src/light_import.rs (99%) rename {core => client}/finality-grandpa/src/observer.rs (98%) rename {core => client}/finality-grandpa/src/tests.rs (99%) rename {core => client}/finality-grandpa/src/until_imported.rs (99%) rename {core => client}/finality-grandpa/src/voting_rule.rs (99%) rename {core/client => client}/header-metadata/Cargo.toml (78%) rename {core/client => client}/header-metadata/src/lib.rs (100%) rename {core => client}/keystore/Cargo.toml (74%) rename {core => client}/keystore/src/lib.rs (100%) rename {core => client}/network/Cargo.toml (66%) rename {core => client}/network/src/behaviour.rs (100%) rename {core => client}/network/src/chain.rs (96%) rename {core => client}/network/src/config.rs (100%) rename {core => client}/network/src/debug_info.rs (100%) rename {core => client}/network/src/discovery.rs (100%) rename {core => client}/network/src/error.rs (97%) rename {core => client}/network/src/legacy_proto/behaviour.rs (100%) rename {core => client}/network/src/legacy_proto/handler.rs (100%) rename {core => client}/network/src/legacy_proto/mod.rs (100%) rename {core => client}/network/src/legacy_proto/tests.rs (100%) rename {core => client}/network/src/legacy_proto/upgrade.rs (100%) rename {core => client}/network/src/lib.rs (100%) rename {core => client}/network/src/on_demand_layer.rs (98%) rename {core => client}/network/src/protocol.rs (99%) rename {core => client}/network/src/protocol/consensus_gossip.rs (100%) rename {core => client}/network/src/protocol/event.rs (100%) rename {core => client}/network/src/protocol/light_dispatch.rs (99%) rename {core => client}/network/src/protocol/message.rs (99%) rename {core => client}/network/src/protocol/specialization.rs (100%) rename {core => client}/network/src/protocol/sync.rs (99%) rename {core => client}/network/src/protocol/sync/blocks.rs (100%) rename {core => client}/network/src/protocol/sync/extra_requests.rs (99%) rename {core => client}/network/src/protocol/util.rs (100%) rename {core => client}/network/src/service.rs (100%) rename {core => client}/network/src/test/block_import.rs (100%) rename {core => client}/network/src/test/mod.rs (99%) rename {core => client}/network/src/test/sync.rs (100%) rename {core => client}/network/src/transport.rs (100%) rename {core => client}/offchain/Cargo.toml (65%) rename {core => client}/offchain/src/api.rs (99%) rename {core => client}/offchain/src/api/http.rs (100%) rename {core => client}/offchain/src/api/http_dummy.rs (100%) rename {core => client}/offchain/src/api/timestamp.rs (100%) rename {core => client}/offchain/src/lib.rs (98%) rename {core => client}/offchain/src/testing.rs (98%) rename {core => client}/rpc-servers/Cargo.toml (88%) rename {core => client}/rpc-servers/src/lib.rs (100%) rename {core => client}/rpc/Cargo.toml (64%) rename {core => client}/rpc/api/Cargo.toml (77%) rename {core => client}/rpc/api/src/author/error.rs (100%) rename {core => client}/rpc/api/src/author/hash.rs (100%) rename {core => client}/rpc/api/src/author/mod.rs (100%) rename {core => client}/rpc/api/src/chain/error.rs (100%) rename {core => client}/rpc/api/src/chain/mod.rs (100%) rename {core => client}/rpc/api/src/errors.rs (100%) rename {core => client}/rpc/api/src/helpers.rs (100%) rename {core => client}/rpc/api/src/lib.rs (100%) rename {core => client}/rpc/api/src/state/error.rs (100%) rename {core => client}/rpc/api/src/state/mod.rs (100%) rename {core => client}/rpc/api/src/subscriptions.rs (100%) rename {core => client}/rpc/api/src/system/error.rs (100%) rename {core => client}/rpc/api/src/system/helpers.rs (100%) rename {core => client}/rpc/api/src/system/mod.rs (100%) rename {core => client}/rpc/src/author/mod.rs (96%) rename {core => client}/rpc/src/author/tests.rs (100%) rename {core => client}/rpc/src/chain/chain_full.rs (97%) rename {core => client}/rpc/src/chain/chain_light.rs (97%) rename {core => client}/rpc/src/chain/mod.rs (95%) rename {core => client}/rpc/src/chain/tests.rs (100%) rename {core => client}/rpc/src/lib.rs (100%) rename {core => client}/rpc/src/metadata.rs (100%) rename {core => client}/rpc/src/state/mod.rs (96%) rename {core => client}/rpc/src/state/state_full.rs (99%) rename {core => client}/rpc/src/state/state_light.rs (99%) rename {core => client}/rpc/src/state/tests.rs (100%) rename {core => client}/rpc/src/system/mod.rs (100%) rename {core => client}/rpc/src/system/tests.rs (100%) create mode 100644 client/service/Cargo.toml rename {core => client}/service/src/builder.rs (98%) rename {core => client}/service/src/chain_ops.rs (100%) rename {core => client}/service/src/config.rs (100%) rename {core => client}/service/src/error.rs (100%) rename {core => client}/service/src/lib.rs (98%) rename {core => client}/service/src/status_sinks.rs (100%) rename {core => client}/service/test/Cargo.toml (56%) rename {core => client}/service/test/src/lib.rs (100%) rename {core/client => client}/src/call_executor.rs (68%) rename {core/client => client}/src/cht.rs (99%) rename {core/client => client}/src/client.rs (94%) rename {core/client => client}/src/genesis.rs (100%) rename {core/client => client}/src/in_mem.rs (94%) rename {core/client => client}/src/leaves.rs (99%) rename {core/client => client}/src/lib.rs (90%) rename {core/client => client}/src/light/backend.rs (96%) rename {core/client => client}/src/light/blockchain.rs (78%) rename {core/client => client}/src/light/call_executor.rs (98%) rename {core/client => client}/src/light/fetcher.rs (75%) rename {core/client => client}/src/light/mod.rs (95%) rename {core => client}/state-db/Cargo.toml (78%) rename {core => client}/state-db/src/lib.rs (100%) rename {core => client}/state-db/src/noncanonical.rs (100%) rename {core => client}/state-db/src/pruning.rs (100%) rename {core => client}/state-db/src/test.rs (100%) rename {core => client}/telemetry/Cargo.toml (100%) rename {core => client}/telemetry/src/lib.rs (100%) rename {core => client}/telemetry/src/worker.rs (100%) rename {core => client}/telemetry/src/worker/node.rs (100%) rename {core => client}/transaction-pool/Cargo.toml (59%) rename {core => client}/transaction-pool/graph/Cargo.toml (84%) rename {core => client}/transaction-pool/graph/benches/basics.rs (100%) rename {core => client}/transaction-pool/graph/src/base_pool.rs (100%) rename {core => client}/transaction-pool/graph/src/error.rs (100%) rename {core => client}/transaction-pool/graph/src/future.rs (100%) rename {core => client}/transaction-pool/graph/src/lib.rs (100%) rename {core => client}/transaction-pool/graph/src/listener.rs (100%) rename {core => client}/transaction-pool/graph/src/pool.rs (100%) rename {core => client}/transaction-pool/graph/src/ready.rs (100%) rename {core => client}/transaction-pool/graph/src/rotator.rs (100%) rename {core => client}/transaction-pool/graph/src/validated_pool.rs (100%) rename {core => client}/transaction-pool/graph/src/watcher.rs (100%) rename {core => client}/transaction-pool/src/api.rs (100%) rename {core => client}/transaction-pool/src/error.rs (100%) rename {core => client}/transaction-pool/src/lib.rs (100%) rename {core => client}/transaction-pool/src/tests.rs (100%) rename {core => client}/utils/wasm-builder-runner/Cargo.toml (100%) rename {core => client}/utils/wasm-builder-runner/README.md (100%) rename {core => client}/utils/wasm-builder-runner/src/lib.rs (98%) delete mode 100644 core/consensus/aura/primitives/Cargo.toml delete mode 100644 core/consensus/rhd/Cargo.toml delete mode 100644 core/consensus/rhd/src/error.rs delete mode 100644 core/consensus/rhd/src/lib.rs delete mode 100644 core/consensus/rhd/src/misbehaviour_check.rs delete mode 100644 core/consensus/rhd/src/service.rs delete mode 100644 core/consensus/uncles/Cargo.toml delete mode 100644 core/executor/runtime-test/Cargo.toml delete mode 100644 core/service/Cargo.toml delete mode 100644 core/test-client/Cargo.toml delete mode 100644 core/test-runtime/Cargo.toml delete mode 100644 core/test-runtime/client/Cargo.toml rename CODEOWNERS => docs/CODEOWNERS (85%) rename CODE_OF_CONDUCT.adoc => docs/CODE_OF_CONDUCT.adoc (100%) rename CONTRIBUTING.adoc => docs/CONTRIBUTING.adoc (100%) rename PULL_REQUEST_TEMPLATE.md => docs/PULL_REQUEST_TEMPLATE.md (100%) create mode 100644 docs/README.adoc rename SECURITY.md => docs/SECURITY.md (100%) create mode 100644 docs/Structure.adoc rename license_header.txt => docs/license_header.txt (100%) delete mode 100644 node-template/Cargo.toml delete mode 100644 node-template/runtime/Cargo.toml delete mode 100644 node/executor/Cargo.toml delete mode 100644 node/rpc/Cargo.toml delete mode 100644 node/runtime/Cargo.toml delete mode 100644 node/testing/Cargo.toml rename {srml => paint}/assets/Cargo.toml (62%) rename {srml => paint}/assets/src/lib.rs (99%) create mode 100644 paint/aura/Cargo.toml rename {srml => paint}/aura/src/lib.rs (96%) rename {srml => paint}/aura/src/mock.rs (100%) rename {srml => paint}/aura/src/tests.rs (100%) create mode 100644 paint/authority-discovery/Cargo.toml rename {srml => paint}/authority-discovery/src/lib.rs (100%) rename {srml => paint}/authorship/Cargo.toml (52%) rename {srml => paint}/authorship/src/lib.rs (100%) create mode 100644 paint/babe/Cargo.toml rename {srml => paint}/babe/src/lib.rs (99%) rename {srml => paint}/babe/src/mock.rs (100%) rename {srml => paint}/babe/src/tests.rs (100%) rename {srml => paint}/balances/Cargo.toml (51%) rename {srml => paint}/balances/src/lib.rs (98%) rename {srml => paint}/balances/src/mock.rs (100%) rename {srml => paint}/balances/src/tests.rs (100%) rename {srml => paint}/collective/Cargo.toml (55%) rename {srml => paint}/collective/src/lib.rs (100%) rename {srml => paint}/contracts/COMPLEXITY.md (100%) rename {srml => paint}/contracts/Cargo.toml (53%) rename {srml => paint}/contracts/rpc/Cargo.toml (61%) rename {srml => paint}/contracts/rpc/runtime-api/Cargo.toml (57%) rename {srml => paint}/contracts/rpc/runtime-api/src/lib.rs (100%) rename {srml => paint}/contracts/rpc/src/lib.rs (99%) rename {srml => paint}/contracts/src/account_db.rs (100%) rename {srml => paint}/contracts/src/exec.rs (100%) rename {srml => paint}/contracts/src/gas.rs (100%) rename {srml => paint}/contracts/src/lib.rs (99%) rename {srml => paint}/contracts/src/rent.rs (100%) rename {srml => paint}/contracts/src/tests.rs (100%) rename {srml => paint}/contracts/src/wasm/code_cache.rs (100%) rename {srml => paint}/contracts/src/wasm/env_def/macros.rs (100%) rename {srml => paint}/contracts/src/wasm/env_def/mod.rs (100%) rename {srml => paint}/contracts/src/wasm/mod.rs (100%) rename {srml => paint}/contracts/src/wasm/prepare.rs (100%) rename {srml => paint}/contracts/src/wasm/runtime.rs (100%) rename {srml => paint}/democracy/Cargo.toml (56%) rename {srml => paint}/democracy/src/lib.rs (100%) rename {srml => paint}/democracy/src/vote_threshold.rs (100%) create mode 100644 paint/elections-phragmen/Cargo.toml rename {srml => paint}/elections-phragmen/src/lib.rs (99%) rename {srml => paint}/elections/Cargo.toml (55%) rename {srml => paint}/elections/src/lib.rs (100%) rename {srml => paint}/elections/src/mock.rs (100%) rename {srml => paint}/elections/src/tests.rs (100%) rename {srml => paint}/evm/Cargo.toml (53%) rename {srml => paint}/evm/src/backend.rs (100%) rename {srml => paint}/evm/src/lib.rs (100%) rename {srml => paint}/example/Cargo.toml (50%) rename {srml => paint}/example/src/lib.rs (99%) create mode 100644 paint/executive/Cargo.toml rename {srml => paint}/executive/src/lib.rs (99%) create mode 100644 paint/finality-tracker/Cargo.toml rename {srml => paint}/finality-tracker/src/lib.rs (98%) rename {srml => paint}/generic-asset/Cargo.toml (57%) rename {srml => paint}/generic-asset/src/lib.rs (100%) rename {srml => paint}/generic-asset/src/mock.rs (100%) rename {srml => paint}/generic-asset/src/tests.rs (100%) create mode 100644 paint/grandpa/Cargo.toml rename {srml => paint}/grandpa/src/lib.rs (100%) rename {srml => paint}/grandpa/src/mock.rs (100%) rename {srml => paint}/grandpa/src/tests.rs (100%) create mode 100644 paint/im-online/Cargo.toml rename {srml => paint}/im-online/src/lib.rs (98%) rename {srml => paint}/im-online/src/mock.rs (100%) rename {srml => paint}/im-online/src/tests.rs (100%) rename {srml => paint}/indices/Cargo.toml (56%) rename {srml => paint}/indices/src/address.rs (100%) rename {srml => paint}/indices/src/lib.rs (100%) rename {srml => paint}/indices/src/mock.rs (100%) rename {srml => paint}/indices/src/tests.rs (100%) rename {srml => paint}/membership/Cargo.toml (54%) rename {srml => paint}/membership/src/lib.rs (100%) rename {srml => paint}/metadata/Cargo.toml (63%) rename {srml => paint}/metadata/src/lib.rs (100%) rename {srml => paint}/nicks/Cargo.toml (50%) rename {srml => paint}/nicks/src/lib.rs (100%) create mode 100644 paint/offences/Cargo.toml rename {srml => paint}/offences/src/lib.rs (100%) rename {srml => paint}/offences/src/mock.rs (97%) rename {srml => paint}/offences/src/tests.rs (100%) rename {srml => paint}/randomness-collective-flip/Cargo.toml (55%) rename {srml => paint}/randomness-collective-flip/src/lib.rs (99%) rename {srml => paint}/scored-pool/Cargo.toml (51%) rename {srml => paint}/scored-pool/src/lib.rs (99%) rename {srml => paint}/scored-pool/src/mock.rs (100%) rename {srml => paint}/scored-pool/src/tests.rs (100%) rename {srml => paint}/session/Cargo.toml (52%) rename {srml => paint}/session/src/historical.rs (100%) rename {srml => paint}/session/src/lib.rs (98%) rename {srml => paint}/session/src/mock.rs (100%) create mode 100644 paint/staking/Cargo.toml rename {srml => paint}/staking/reward-curve/Cargo.toml (73%) rename {srml => paint}/staking/reward-curve/src/lib.rs (99%) rename {srml => paint}/staking/reward-curve/src/log.rs (100%) rename {srml => paint}/staking/reward-curve/tests/test.rs (89%) rename {srml => paint}/staking/src/inflation.rs (99%) rename {srml => paint}/staking/src/lib.rs (99%) rename {srml => paint}/staking/src/mock.rs (99%) rename {srml => paint}/staking/src/tests.rs (100%) rename {srml => paint}/sudo/Cargo.toml (55%) rename {srml => paint}/sudo/src/lib.rs (98%) rename {srml => paint}/support/Cargo.toml (54%) rename {srml => paint}/support/procedural/Cargo.toml (63%) rename {srml => paint}/support/procedural/src/lib.rs (88%) rename {srml => paint}/support/procedural/src/storage/genesis_config/builder_def.rs (98%) rename {srml => paint}/support/procedural/src/storage/genesis_config/genesis_config_def.rs (98%) rename {srml => paint}/support/procedural/src/storage/genesis_config/mod.rs (100%) rename {srml => paint}/support/procedural/src/storage/getters.rs (100%) rename {srml => paint}/support/procedural/src/storage/instance_trait.rs (100%) rename {srml => paint}/support/procedural/src/storage/metadata.rs (99%) rename {srml => paint}/support/procedural/src/storage/mod.rs (99%) rename {srml => paint}/support/procedural/src/storage/parse.rs (99%) rename {srml => paint}/support/procedural/src/storage/storage_struct.rs (100%) rename {srml => paint}/support/procedural/src/storage/store_trait.rs (100%) rename {srml => paint}/support/procedural/tools/Cargo.toml (59%) rename {srml => paint}/support/procedural/tools/derive/Cargo.toml (86%) rename {srml => paint}/support/procedural/tools/derive/src/lib.rs (100%) rename {srml => paint}/support/procedural/tools/src/lib.rs (94%) rename {srml => paint}/support/procedural/tools/src/syn_ext.rs (99%) rename {srml => paint}/support/rpc/Cargo.toml (58%) rename {srml => paint}/support/rpc/src/lib.rs (90%) rename {srml => paint}/support/src/debug.rs (98%) rename {srml => paint}/support/src/dispatch.rs (98%) rename {srml => paint}/support/src/error.rs (97%) rename {srml => paint}/support/src/event.rs (98%) rename {srml => paint}/support/src/hash.rs (97%) rename {srml => paint}/support/src/inherent.rs (100%) rename {srml => paint}/support/src/lib.rs (98%) rename {srml => paint}/support/src/metadata.rs (98%) rename {srml => paint}/support/src/origin.rs (100%) rename {srml => paint}/support/src/runtime.rs (100%) rename {srml => paint}/support/src/storage/child.rs (100%) rename {srml => paint}/support/src/storage/generator/double_map.rs (100%) rename {srml => paint}/support/src/storage/generator/linked_map.rs (100%) rename {srml => paint}/support/src/storage/generator/map.rs (100%) rename {srml => paint}/support/src/storage/generator/mod.rs (100%) rename {srml => paint}/support/src/storage/generator/value.rs (100%) rename {srml => paint}/support/src/storage/hashed.rs (100%) rename {srml => paint}/support/src/storage/mod.rs (100%) rename {srml => paint}/support/src/storage/unhashed.rs (100%) rename {srml => paint}/support/src/traits.rs (99%) rename {srml => paint}/support/src/unsigned.rs (94%) rename {srml => paint}/support/test/Cargo.toml (59%) rename {srml => paint}/support/test/src/lib.rs (90%) rename {srml => paint}/support/test/tests/decl_storage.rs (100%) rename {srml => paint}/support/test/tests/decl_storage_ui.rs (100%) rename {srml => paint}/support/test/tests/decl_storage_ui/config_duplicate.rs (100%) rename {srml => paint}/support/test/tests/decl_storage_ui/config_duplicate.stderr (100%) rename {srml => paint}/support/test/tests/decl_storage_ui/config_get_duplicate.rs (100%) rename {srml => paint}/support/test/tests/decl_storage_ui/config_get_duplicate.stderr (100%) rename {srml => paint}/support/test/tests/decl_storage_ui/get_duplicate.rs (100%) rename {srml => paint}/support/test/tests/decl_storage_ui/get_duplicate.stderr (100%) rename {srml => paint}/support/test/tests/final_keys.rs (100%) rename {srml => paint}/support/test/tests/genesisconfig.rs (100%) rename {srml => paint}/support/test/tests/instance.rs (100%) rename {srml => paint}/support/test/tests/issue2219.rs (100%) rename {srml => paint}/support/test/tests/reserved_keyword.rs (100%) rename {srml => paint}/support/test/tests/reserved_keyword/on_initialize.rs (100%) rename {srml => paint}/support/test/tests/reserved_keyword/on_initialize.stderr (100%) rename {srml => paint}/support/test/tests/system.rs (100%) rename {srml => paint}/system/Cargo.toml (63%) rename {srml => paint}/system/benches/bench.rs (99%) rename {srml => paint}/system/rpc/Cargo.toml (61%) rename {srml => paint}/system/rpc/runtime-api/Cargo.toml (70%) rename {srml => paint}/system/rpc/runtime-api/src/lib.rs (100%) rename {srml => paint}/system/rpc/src/lib.rs (98%) rename {srml => paint}/system/src/lib.rs (99%) rename {srml => paint}/system/src/offchain.rs (100%) rename {srml => paint}/timestamp/Cargo.toml (52%) rename {srml => paint}/timestamp/src/lib.rs (99%) create mode 100644 paint/transaction-payment/Cargo.toml rename {srml => paint}/transaction-payment/rpc/Cargo.toml (59%) rename {srml => paint}/transaction-payment/rpc/runtime-api/Cargo.toml (56%) rename {srml => paint}/transaction-payment/rpc/runtime-api/src/lib.rs (100%) rename {srml => paint}/transaction-payment/rpc/src/lib.rs (94%) rename {srml => paint}/transaction-payment/src/lib.rs (100%) rename {srml => paint}/treasury/Cargo.toml (52%) rename {srml => paint}/treasury/src/lib.rs (100%) rename {srml => paint}/utility/Cargo.toml (50%) rename {srml => paint}/utility/src/lib.rs (100%) rename {core => primitives}/application-crypto/Cargo.toml (76%) rename {core => primitives}/application-crypto/src/ed25519.rs (100%) rename {core => primitives}/application-crypto/src/lib.rs (100%) rename {core => primitives}/application-crypto/src/sr25519.rs (100%) rename {core => primitives}/application-crypto/src/traits.rs (100%) rename {core/authority-discovery/primitives => primitives/authority-discovery}/Cargo.toml (64%) rename {core/authority-discovery/primitives => primitives/authority-discovery}/src/lib.rs (96%) rename {core => primitives}/block-builder/runtime-api/Cargo.toml (100%) rename {core => primitives}/block-builder/runtime-api/src/lib.rs (100%) rename {core/finality-grandpa/primitives => primitives/consensus/aura}/Cargo.toml (78%) rename {core/consensus/aura/primitives => primitives/consensus/aura}/src/lib.rs (100%) rename {core/consensus/babe/primitives => primitives/consensus/babe}/Cargo.toml (62%) rename {core/consensus/babe/primitives => primitives/consensus/babe}/src/digest.rs (100%) rename {core/consensus/babe/primitives => primitives/consensus/babe}/src/lib.rs (100%) rename {core => primitives}/consensus/common/Cargo.toml (88%) rename {core => primitives}/consensus/common/src/block_import.rs (100%) rename {core => primitives}/consensus/common/src/block_validation.rs (100%) rename {core => primitives}/consensus/common/src/error.rs (100%) rename {core => primitives}/consensus/common/src/evaluation.rs (100%) rename {core => primitives}/consensus/common/src/import_queue.rs (100%) rename {core => primitives}/consensus/common/src/import_queue/basic_queue.rs (100%) rename {core => primitives}/consensus/common/src/import_queue/buffered_link.rs (100%) rename {core => primitives}/consensus/common/src/lib.rs (100%) rename {core => primitives}/consensus/common/src/offline_tracker.rs (100%) rename {core => primitives}/consensus/common/src/select_chain.rs (100%) rename {core/consensus/pow/primitives => primitives/consensus/pow}/Cargo.toml (56%) rename {core/consensus/pow/primitives => primitives/consensus/pow}/src/lib.rs (100%) rename {core/primitives => primitives/core}/Cargo.toml (100%) rename {core/primitives => primitives/core}/benches/bench.rs (100%) rename {core/primitives => primitives/core}/debug-derive/Cargo.toml (100%) rename {core/primitives => primitives/core}/debug-derive/src/impls.rs (100%) rename {core/primitives => primitives/core}/debug-derive/src/lib.rs (100%) rename {core/primitives => primitives/core}/debug-derive/tests/tests.rs (100%) rename {core/primitives => primitives/core}/src/changes_trie.rs (100%) rename {core/primitives => primitives/core}/src/crypto.rs (100%) rename {core/primitives => primitives/core}/src/ecdsa.rs (100%) rename {core/primitives => primitives/core}/src/ed25519.rs (100%) rename {core/primitives => primitives/core}/src/hash.rs (100%) rename {core/primitives => primitives/core}/src/hasher.rs (100%) rename {core/primitives => primitives/core}/src/hashing.rs (100%) rename {core/primitives => primitives/core}/src/hexdisplay.rs (100%) rename {core/primitives => primitives/core}/src/lib.rs (100%) rename {core/primitives => primitives/core}/src/offchain.rs (100%) rename {core/primitives => primitives/core}/src/sandbox.rs (100%) rename {core/primitives => primitives/core}/src/sr25519.rs (100%) rename {core/primitives => primitives/core}/src/testing.rs (100%) rename {core/primitives => primitives/core}/src/tests.rs (100%) rename {core/primitives => primitives/core}/src/traits.rs (100%) rename {core/primitives => primitives/core}/src/u32_trait.rs (100%) rename {core/primitives => primitives/core}/src/uint.rs (97%) rename {core/primitives => primitives/core}/storage/Cargo.toml (100%) rename {core/primitives => primitives/core}/storage/src/lib.rs (100%) rename {core => primitives}/externalities/Cargo.toml (91%) rename {core => primitives}/externalities/src/extensions.rs (100%) rename {core => primitives}/externalities/src/lib.rs (100%) rename {core => primitives}/externalities/src/scope_limited.rs (100%) create mode 100644 primitives/finality-grandpa/Cargo.toml rename {core/finality-grandpa/primitives => primitives/finality-grandpa}/src/lib.rs (100%) rename {core => primitives}/inherents/Cargo.toml (84%) rename {core => primitives}/inherents/src/lib.rs (100%) rename {core => primitives}/keyring/Cargo.toml (76%) rename {core => primitives}/keyring/src/ed25519.rs (100%) rename {core => primitives}/keyring/src/lib.rs (100%) rename {core => primitives}/keyring/src/sr25519.rs (100%) rename {core/offchain/primitives => primitives/offchain}/Cargo.toml (68%) rename {core/offchain/primitives => primitives/offchain}/src/lib.rs (100%) rename {core => primitives}/panic-handler/Cargo.toml (100%) rename {core => primitives}/panic-handler/src/lib.rs (100%) rename {core => primitives}/peerset/Cargo.toml (100%) rename {core => primitives}/peerset/src/lib.rs (100%) rename {core => primitives}/peerset/src/peersstate.rs (100%) rename {core => primitives}/peerset/tests/fuzz.rs (100%) rename {core => primitives}/phragmen/Cargo.toml (64%) rename {core => primitives}/phragmen/benches/phragmen.rs (100%) rename {core => primitives}/phragmen/src/lib.rs (100%) rename {core => primitives}/phragmen/src/mock.rs (100%) rename {core => primitives}/phragmen/src/tests.rs (100%) rename {core/rpc/primitives => primitives/rpc}/Cargo.toml (72%) rename {core/rpc/primitives => primitives/rpc}/src/lib.rs (100%) rename {core/rpc/primitives => primitives/rpc}/src/number.rs (100%) rename {core => primitives}/runtime-interface/Cargo.toml (88%) rename {core => primitives}/runtime-interface/proc-macro/Cargo.toml (100%) rename {core => primitives}/runtime-interface/proc-macro/src/lib.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/src/pass_by/codec.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/src/pass_by/enum_.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/src/pass_by/inner.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/src/pass_by/mod.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/src/runtime_interface/bare_function_interface.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/src/runtime_interface/host_function_interface.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/src/runtime_interface/mod.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/src/runtime_interface/trait_decl_impl.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/src/utils.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/no_generic_parameters.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/no_generic_parameters.stderr (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/no_method_implementation.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/no_method_implementation.stderr (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.stderr (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.stderr (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.stderr (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/take_self_by_value.rs (100%) rename {core => primitives}/runtime-interface/proc-macro/tests/ui/take_self_by_value.stderr (100%) rename {core => primitives}/runtime-interface/src/host.rs (100%) rename {core => primitives}/runtime-interface/src/impls.rs (100%) rename {core => primitives}/runtime-interface/src/lib.rs (100%) rename {core => primitives}/runtime-interface/src/pass_by.rs (100%) rename {core => primitives}/runtime-interface/src/wasm.rs (100%) rename {core => primitives}/runtime-interface/test-wasm/Cargo.toml (78%) rename {core => primitives}/runtime-interface/test-wasm/build.rs (96%) rename {core => primitives}/runtime-interface/test-wasm/src/lib.rs (100%) rename {core => primitives}/serializer/Cargo.toml (100%) rename {core => primitives}/serializer/src/lib.rs (100%) rename {core => primitives}/session/Cargo.toml (100%) rename {core => primitives}/session/src/lib.rs (100%) rename {core => primitives}/sr-api/Cargo.toml (82%) rename {core => primitives}/sr-api/benches/bench.rs (100%) rename {core => primitives}/sr-api/proc-macro/Cargo.toml (93%) rename {core => primitives}/sr-api/proc-macro/src/decl_runtime_apis.rs (100%) rename {core => primitives}/sr-api/proc-macro/src/impl_runtime_apis.rs (100%) rename {core => primitives}/sr-api/proc-macro/src/lib.rs (100%) rename {core => primitives}/sr-api/proc-macro/src/utils.rs (100%) rename {core => primitives}/sr-api/src/lib.rs (100%) rename {core => primitives}/sr-api/test/Cargo.toml (83%) rename {core => primitives}/sr-api/test/tests/decl_and_impl.rs (100%) rename {core => primitives}/sr-api/test/tests/runtime_calls.rs (100%) rename {core => primitives}/sr-api/test/tests/trybuild.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/adding_self_parameter.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/adding_self_parameter.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/changed_in_unknown_version.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/changed_in_unknown_version.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/declaring_old_block.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/declaring_old_block.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/declaring_own_block_with_different_name.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/declaring_own_block_with_different_name.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/empty_impl_runtime_apis_call.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/empty_impl_runtime_apis_call.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/impl_incorrect_method_signature.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/impl_incorrect_method_signature.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/impl_two_traits_with_same_name.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/impl_two_traits_with_same_name.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/invalid_api_version.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/invalid_api_version.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/invalid_api_version_2.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/invalid_api_version_2.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/invalid_api_version_3.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/invalid_api_version_3.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/missing_block_generic_parameter.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/missing_block_generic_parameter.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/missing_path_for_trait.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/missing_path_for_trait.stderr (100%) rename {core => primitives}/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.rs (100%) rename {core => primitives}/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.stderr (100%) rename {core => primitives}/sr-arithmetic/Cargo.toml (88%) rename {core => primitives}/sr-arithmetic/benches/bench.rs (100%) rename {core => primitives}/sr-arithmetic/fuzzer/.gitignore (100%) rename {core => primitives}/sr-arithmetic/fuzzer/Cargo.lock (100%) rename {core => primitives}/sr-arithmetic/fuzzer/Cargo.toml (100%) rename {core => primitives}/sr-arithmetic/fuzzer/src/biguint.rs (100%) rename {core => primitives}/sr-arithmetic/fuzzer/src/rational128.rs (100%) rename {core => primitives}/sr-arithmetic/src/biguint.rs (100%) rename {core => primitives}/sr-arithmetic/src/fixed64.rs (100%) rename {core => primitives}/sr-arithmetic/src/helpers_128bit.rs (100%) rename {core => primitives}/sr-arithmetic/src/lib.rs (100%) rename {core => primitives}/sr-arithmetic/src/per_things.rs (100%) rename {core => primitives}/sr-arithmetic/src/rational128.rs (100%) rename {core => primitives}/sr-arithmetic/src/traits.rs (100%) rename {core => primitives}/sr-io/Cargo.toml (81%) rename {core => primitives}/sr-io/src/lib.rs (99%) create mode 100644 primitives/sr-io/with_std.rs create mode 100644 primitives/sr-io/without_std.rs rename {core => primitives}/sr-primitives/Cargo.toml (80%) rename {core => primitives}/sr-primitives/src/curve.rs (100%) rename {core => primitives}/sr-primitives/src/generic/block.rs (100%) rename {core => primitives}/sr-primitives/src/generic/checked_extrinsic.rs (100%) rename {core => primitives}/sr-primitives/src/generic/digest.rs (100%) rename {core => primitives}/sr-primitives/src/generic/era.rs (100%) rename {core => primitives}/sr-primitives/src/generic/header.rs (100%) rename {core => primitives}/sr-primitives/src/generic/mod.rs (100%) rename {core => primitives}/sr-primitives/src/generic/tests.rs (100%) rename {core => primitives}/sr-primitives/src/generic/unchecked_extrinsic.rs (100%) rename {core => primitives}/sr-primitives/src/lib.rs (99%) rename {core => primitives}/sr-primitives/src/offchain/http.rs (100%) rename {core => primitives}/sr-primitives/src/offchain/mod.rs (100%) rename {core => primitives}/sr-primitives/src/testing.rs (99%) rename {core => primitives}/sr-primitives/src/traits.rs (100%) rename {core => primitives}/sr-primitives/src/transaction_validity.rs (100%) rename {core => primitives}/sr-primitives/src/weights.rs (100%) rename {core => primitives}/sr-sandbox/Cargo.toml (85%) rename {core => primitives}/sr-sandbox/src/lib.rs (99%) rename {core => primitives}/sr-sandbox/with_std.rs (100%) rename {core => primitives}/sr-sandbox/without_std.rs (100%) rename {core => primitives}/sr-staking-primitives/Cargo.toml (100%) rename {core => primitives}/sr-staking-primitives/src/lib.rs (100%) rename {core => primitives}/sr-staking-primitives/src/offence.rs (100%) rename {core => primitives}/sr-std/Cargo.toml (100%) rename {core => primitives}/sr-std/src/lib.rs (86%) rename {core => primitives}/sr-std/with_std.rs (100%) rename {core => primitives}/sr-std/without_std.rs (100%) rename {core => primitives}/sr-version/Cargo.toml (100%) rename {core => primitives}/sr-version/src/lib.rs (100%) rename {core => primitives}/state-machine/Cargo.toml (90%) rename {core => primitives}/state-machine/src/backend.rs (100%) rename {core => primitives}/state-machine/src/basic.rs (100%) rename {core => primitives}/state-machine/src/changes_trie/build.rs (100%) rename {core => primitives}/state-machine/src/changes_trie/build_cache.rs (100%) rename {core => primitives}/state-machine/src/changes_trie/build_iterator.rs (100%) rename {core => primitives}/state-machine/src/changes_trie/changes_iterator.rs (100%) rename {core => primitives}/state-machine/src/changes_trie/input.rs (100%) rename {core => primitives}/state-machine/src/changes_trie/mod.rs (100%) rename {core => primitives}/state-machine/src/changes_trie/prune.rs (95%) rename {core => primitives}/state-machine/src/changes_trie/storage.rs (100%) rename {core => primitives}/state-machine/src/changes_trie/surface_iterator.rs (100%) rename {core => primitives}/state-machine/src/error.rs (100%) rename {core => primitives}/state-machine/src/ext.rs (100%) rename {core => primitives}/state-machine/src/lib.rs (100%) rename {core => primitives}/state-machine/src/overlayed_changes.rs (92%) rename {core => primitives}/state-machine/src/proving_backend.rs (100%) rename {core => primitives}/state-machine/src/testing.rs (100%) rename {core => primitives}/state-machine/src/trie_backend.rs (100%) rename {core => primitives}/state-machine/src/trie_backend_essence.rs (100%) rename {core => primitives}/transaction-pool/runtime-api/Cargo.toml (91%) rename {core => primitives}/transaction-pool/runtime-api/src/lib.rs (100%) rename {core => primitives}/trie/Cargo.toml (90%) rename {core => primitives}/trie/benches/bench.rs (100%) rename {core => primitives}/trie/src/error.rs (100%) rename {core => primitives}/trie/src/lib.rs (100%) rename {core => primitives}/trie/src/node_codec.rs (100%) rename {core => primitives}/trie/src/node_header.rs (100%) rename {core => primitives}/trie/src/trie_stream.rs (100%) rename {core => primitives}/wasm-interface/Cargo.toml (100%) rename {core => primitives}/wasm-interface/src/lib.rs (100%) rename {core => primitives}/wasm-interface/src/wasmi_impl.rs (100%) delete mode 100644 srml/README.adoc delete mode 100644 srml/aura/Cargo.toml delete mode 100644 srml/authority-discovery/Cargo.toml delete mode 100644 srml/babe/Cargo.toml delete mode 100644 srml/elections-phragmen/Cargo.toml delete mode 100644 srml/executive/Cargo.toml delete mode 100644 srml/finality-tracker/Cargo.toml delete mode 100644 srml/grandpa/Cargo.toml delete mode 100644 srml/im-online/Cargo.toml delete mode 100644 srml/offences/Cargo.toml delete mode 100644 srml/staking/Cargo.toml delete mode 100644 srml/transaction-payment/Cargo.toml delete mode 100644 test-utils/transaction-factory/Cargo.toml rename {test-utils => test/utils}/chain-spec-builder/Cargo.toml (65%) rename {test-utils => test/utils}/chain-spec-builder/build.rs (100%) rename {test-utils => test/utils}/chain-spec-builder/src/main.rs (100%) create mode 100644 test/utils/client/Cargo.toml rename {core/test-client => test/utils/client}/src/client_ext.rs (97%) rename {core/test-client => test/utils/client}/src/lib.rs (97%) create mode 100644 test/utils/primitives/Cargo.toml create mode 100644 test/utils/primitives/src/lib.rs create mode 100644 test/utils/runtime/Cargo.toml rename {core/test-runtime => test/utils/runtime}/build.rs (97%) create mode 100644 test/utils/runtime/client/Cargo.toml rename {core/test-runtime => test/utils/runtime}/client/src/block_builder_ext.rs (100%) rename {core/test-runtime => test/utils/runtime}/client/src/lib.rs (99%) rename {core/test-runtime => test/utils/runtime}/client/src/trait_tests.rs (97%) rename {core/test-runtime => test/utils/runtime}/src/genesismap.rs (100%) rename {core/test-runtime => test/utils/runtime}/src/lib.rs (97%) rename {core/test-runtime => test/utils/runtime}/src/system.rs (99%) create mode 100644 test/utils/transaction-factory/Cargo.toml rename {test-utils => test/utils}/transaction-factory/src/complex_mode.rs (98%) rename {test-utils => test/utils}/transaction-factory/src/lib.rs (97%) rename {test-utils => test/utils}/transaction-factory/src/modes.rs (100%) rename {test-utils => test/utils}/transaction-factory/src/simple_modes.rs (98%) rename {core/utils => utils}/build-script-utils/Cargo.toml (100%) rename {core/utils => utils}/build-script-utils/src/lib.rs (100%) rename {core/utils => utils}/fork-tree/Cargo.toml (100%) rename {core/utils => utils}/fork-tree/src/lib.rs (100%) rename {core/utils => utils}/wasm-builder/Cargo.toml (100%) rename {core/utils => utils}/wasm-builder/README.md (96%) rename {core/utils => utils}/wasm-builder/src/lib.rs (99%) rename {core/utils => utils}/wasm-builder/src/prerequisites.rs (100%) rename {core/utils => utils}/wasm-builder/src/wasm_project.rs (100%) diff --git a/.dockerignore b/.dockerignore index 834924b9f79d8..39dbc05c97e16 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,4 @@ doc .idea/ Dockerfile .dockerignore +.local diff --git a/.gitignore b/.gitignore index 28885a4830d9b..6c79bfaf62ed1 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ rls*.log *.orig *.rej **/wip/*.stderr +.local diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c8c5abddce982..f1aecb91fbaf1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -78,7 +78,7 @@ check-runtime: GITLAB_API: "https://gitlab.parity.io/api/v4" GITHUB_API_PROJECT: "parity%2Finfrastructure%2Fgithub-api" script: - - ./scripts/gitlab/check_runtime.sh + - ./.maintain/gitlab/check_runtime.sh allow_failure: true @@ -89,7 +89,7 @@ check-line-width: only: - /^[0-9]+$/ script: - - ./scripts/gitlab/check_line_width.sh + - ./.maintain/gitlab/check_line_width.sh allow_failure: true @@ -117,7 +117,7 @@ cargo-check-subkey: except: - /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 script: - - cd ./subkey + - cd ./bin/subkey - BUILD_DUMMY_WASM_BINARY=1 time cargo check --release - sccache -s @@ -145,8 +145,17 @@ test-linux-stable: &test-linux paths: - ${CI_COMMIT_SHORT_SHA}_warnings.log +test-dependency-rules: &test-linux + stage: test + <<: *docker-env + allow_failure: true + except: + variables: + - $DEPLOY_TAG + script: + - .maintain/ensure-deps.sh -test-srml-staking: &test-srml-staking +test-paint-staking: &test-paint-staking stage: test <<: *docker-env variables: @@ -158,7 +167,7 @@ test-srml-staking: &test-srml-staking variables: - $DEPLOY_TAG script: - - cd srml/staking/ + - cd paint/staking/ - WASM_BUILD_NO_COLOR=1 time cargo test --release --verbose --no-default-features --features std - sccache -s @@ -174,7 +183,7 @@ test-wasmtime: &test-wasmtime variables: - $DEPLOY_TAG script: - - cd core/executor + - cd client/executor - WASM_BUILD_NO_COLOR=1 time cargo test --release --verbose --features wasmtime - sccache -s @@ -219,7 +228,7 @@ check-web-wasm: - time cargo web build -p substrate-consensus-common - time cargo web build -p substrate-telemetry # Note: the command below is a bit weird because several Cargo issues prevent us from compiling the node in a more straight-forward way. - - time cargo build --manifest-path=node/cli/Cargo.toml --no-default-features --features "browser" --target=wasm32-unknown-unknown + - time cargo build --manifest-path=bin/node/cli/Cargo.toml --no-default-features --features "browser" --target=wasm32-unknown-unknown - sccache -s node-exits: @@ -228,7 +237,7 @@ node-exits: except: - /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 script: - - ./ci/check_for_exit.sh + - ./.maintain/check_for_exit.sh test-full-crypto-feature: &test-full-crypto-feature @@ -243,7 +252,7 @@ test-full-crypto-feature: &test-full-crypto-feature variables: - $DEPLOY_TAG script: - - cd core/primitives/ + - cd primitives/core/ - time cargo +nightly build --verbose --no-default-features --features full_crypto - cd ../application-crypto - time cargo +nightly build --verbose --no-default-features --features full_crypto @@ -274,8 +283,8 @@ build-linux-substrate: fi - sha256sum ./artifacts/substrate/substrate | tee ./artifacts/substrate/substrate.sha256 - printf '\n# building node-template\n\n' - - ./scripts/node-template-release.sh ./artifacts/substrate/substrate-node-template.tar.gz - - cp -r scripts/docker/substrate.Dockerfile ./artifacts/substrate/ + - ./.maintain/node-template-release.sh ./artifacts/substrate/substrate-node-template.tar.gz + - cp -r .maintain/docker/substrate.Dockerfile ./artifacts/substrate/ - sccache -s build-linux-subkey: @@ -298,7 +307,7 @@ build-linux-subkey: sed -n -r 's/^subkey ([0-9.]+.*)/\1/p' | tee ./artifacts/subkey/VERSION; - sha256sum ./artifacts/subkey/subkey | tee ./artifacts/subkey/subkey.sha256 - - cp -r scripts/docker/subkey.Dockerfile ./artifacts/subkey/ + - cp -r .maintain/docker/subkey.Dockerfile ./artifacts/subkey/ - sccache -s build-rust-doc-release: @@ -314,7 +323,7 @@ build-rust-doc-release: <<: *build-only script: - rm -f ./crate-docs/index.html # use it as an indicator if the job succeeds - - BUILD_DUMMY_WASM_BINARY=1 RUSTDOCFLAGS="--html-in-header $(pwd)/rustdoc-header.html" time cargo +nightly doc --release --all --verbose + - BUILD_DUMMY_WASM_BINARY=1 RUSTDOCFLAGS="--html-in-header $(pwd).maintain/rustdoc-header.html" time cargo +nightly doc --release --all --verbose - cp -R ./target/doc ./crate-docs - echo "" > ./crate-docs/index.html - sccache -s @@ -533,10 +542,10 @@ publish-gh-doc: - echo "Substrate version = ${DEPLOY_TAG}" # or use helm to render the template - helm template - --values ./scripts/kubernetes/values.yaml + --values ./.maintain/kubernetes/values.yaml --set image.tag=${DEPLOY_TAG} --set validator.keys=${VALIDATOR_KEYS} - ./scripts/kubernetes | kubectl apply -f - --dry-run=false + ./.maintain/kubernetes | kubectl apply -f - --dry-run=false - echo "# substrate namespace ${KUBE_NAMESPACE}" - kubectl -n ${KUBE_NAMESPACE} get all - echo "# substrate's nodes' external ip addresses:" @@ -598,16 +607,16 @@ deploy-ue1-tag: validator 1 4: <<: *validator-deploy script: - - ./scripts/flamingfir-deploy.sh flamingfir-validator1 + - ./.maintain/flamingfir-deploy.sh flamingfir-validator1 validator 2 4: <<: *validator-deploy script: - - ./scripts/flamingfir-deploy.sh flamingfir-validator2 + - ./.maintain/flamingfir-deploy.sh flamingfir-validator2 validator 3 4: <<: *validator-deploy script: - - ./scripts/flamingfir-deploy.sh flamingfir-validator3 + - ./.maintain/flamingfir-deploy.sh flamingfir-validator3 validator 4 4: <<: *validator-deploy script: - - ./scripts/flamingfir-deploy.sh flamingfir-validator4 + - ./.maintain/flamingfir-deploy.sh flamingfir-validator4 diff --git a/Dockerfile b/.maintain/Dockerfile similarity index 100% rename from Dockerfile rename to .maintain/Dockerfile diff --git a/scripts/build-only-wasm.sh b/.maintain/build-only-wasm.sh similarity index 100% rename from scripts/build-only-wasm.sh rename to .maintain/build-only-wasm.sh diff --git a/ci/check_for_exit.sh b/.maintain/check_for_exit.sh similarity index 100% rename from ci/check_for_exit.sh rename to .maintain/check_for_exit.sh diff --git a/scripts/common.sh b/.maintain/common.sh similarity index 100% rename from scripts/common.sh rename to .maintain/common.sh diff --git a/scripts/docker/subkey.Dockerfile b/.maintain/docker/subkey.Dockerfile similarity index 93% rename from scripts/docker/subkey.Dockerfile rename to .maintain/docker/subkey.Dockerfile index 6d5c559ea03dd..9184cad5b4058 100644 --- a/scripts/docker/subkey.Dockerfile +++ b/.maintain/docker/subkey.Dockerfile @@ -8,7 +8,7 @@ LABEL io.parity.image.authors="devops-team@parity.io" \ io.parity.image.vendor="Parity Technologies" \ io.parity.image.title="parity/subkey" \ io.parity.image.description="Subkey: key generating utility for Substrate." \ - io.parity.image.source="https://github.com/paritytech/substrate/blob/${VCS_REF}/scripts/docker/subkey.Dockerfile" \ + io.parity.image.source="https://github.com/paritytech/substrate/blob/${VCS_REF}/.maintain/docker/subkey.Dockerfile" \ io.parity.image.revision="${VCS_REF}" \ io.parity.image.created="${BUILD_DATE}" \ io.parity.image.documentation="https://github.com/paritytech/substrate/tree/${VCS_REF}/subkey" diff --git a/scripts/docker/substrate.Dockerfile b/.maintain/docker/substrate.Dockerfile similarity index 96% rename from scripts/docker/substrate.Dockerfile rename to .maintain/docker/substrate.Dockerfile index 2bdf49e2fcec2..7cd4576a9e89f 100644 --- a/scripts/docker/substrate.Dockerfile +++ b/.maintain/docker/substrate.Dockerfile @@ -8,7 +8,7 @@ LABEL io.parity.image.authors="devops-team@parity.io" \ io.parity.image.vendor="Parity Technologies" \ io.parity.image.title="parity/substrate" \ io.parity.image.description="Substrate: The platform for blockchain innovators." \ - io.parity.image.source="https://github.com/paritytech/substrate/blob/${VCS_REF}/scripts/docker/Dockerfile" \ + io.parity.image.source="https://github.com/paritytech/substrate/blob/${VCS_REF}/.maintain/docker/Dockerfile" \ io.parity.image.revision="${VCS_REF}" \ io.parity.image.created="${BUILD_DATE}" \ io.parity.image.documentation="https://wiki.parity.io/Parity-Substrate" diff --git a/.maintain/ensure-deps.sh b/.maintain/ensure-deps.sh new file mode 100755 index 0000000000000..b4477dab5392c --- /dev/null +++ b/.maintain/ensure-deps.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# The script is meant to check if the rules regarding packages +# dependencies are satisfied. +# The general format is: +# [top-lvl-dir]<[crate-name-prefix] + +# For instance no crate within `./client` directory +# is allowed to import any crate with a directory path containing `paint`. +# Such rule is just: `client /dev/null +done + +# Display violations and fail +I=0 +for v in "${VIOLATIONS[@]}" +do + cat << EOF + +=========================================== +======= Violation of rule: $v +=========================================== +${PACKAGES[$I]} + + +EOF + I=$I+1 +done + +exit ${#VIOLATIONS[@]} diff --git a/scripts/flamingfir-deploy.sh b/.maintain/flamingfir-deploy.sh similarity index 100% rename from scripts/flamingfir-deploy.sh rename to .maintain/flamingfir-deploy.sh diff --git a/scripts/getgoing.sh b/.maintain/getgoing.sh similarity index 100% rename from scripts/getgoing.sh rename to .maintain/getgoing.sh diff --git a/scripts/gitlab/check_line_width.sh b/.maintain/gitlab/check_line_width.sh similarity index 100% rename from scripts/gitlab/check_line_width.sh rename to .maintain/gitlab/check_line_width.sh diff --git a/scripts/gitlab/check_runtime.sh b/.maintain/gitlab/check_runtime.sh similarity index 93% rename from scripts/gitlab/check_runtime.sh rename to .maintain/gitlab/check_runtime.sh index cd988718d05db..2b3a93e34bdbc 100755 --- a/scripts/gitlab/check_runtime.sh +++ b/.maintain/gitlab/check_runtime.sh @@ -1,7 +1,7 @@ #!/bin/sh # # -# check for any changes in the node/src/runtime, srml/ and core/sr_* trees. if +# check for any changes in the node/src/runtime, paint/ and core/sr_* trees. if # there are any changes found, it should mark the PR breaksconsensus and # "auto-fail" the PR if there isn't a change in the runtime/src/lib.rs file # that alters the version. @@ -32,7 +32,7 @@ github_label () { # check if the wasm sources changed if ! git diff --name-only origin/master...${CI_COMMIT_SHA} \ - | grep -q -e '^node/src/runtime' -e '^srml/' -e '^core/sr-' | grep -v -e '^core/sr-arithmetic/fuzzer' + | grep -q -e '^node/src/runtime' -e '^paint/' -e '^core/sr-' | grep -v -e '^core/sr-arithmetic/fuzzer' then cat <<-EOT @@ -102,7 +102,7 @@ else source file directories: - node/src/runtime - - srml + - paint - core/sr-* versions file: ${VERSIONS_FILE} diff --git a/node-template/scripts/init.sh b/.maintain/init.sh similarity index 100% rename from node-template/scripts/init.sh rename to .maintain/init.sh diff --git a/scripts/kubernetes/Chart.yaml b/.maintain/kubernetes/Chart.yaml similarity index 100% rename from scripts/kubernetes/Chart.yaml rename to .maintain/kubernetes/Chart.yaml diff --git a/scripts/kubernetes/README.md b/.maintain/kubernetes/README.md similarity index 100% rename from scripts/kubernetes/README.md rename to .maintain/kubernetes/README.md diff --git a/scripts/kubernetes/templates/poddisruptionbudget.yaml b/.maintain/kubernetes/templates/poddisruptionbudget.yaml similarity index 100% rename from scripts/kubernetes/templates/poddisruptionbudget.yaml rename to .maintain/kubernetes/templates/poddisruptionbudget.yaml diff --git a/scripts/kubernetes/templates/secrets.yaml b/.maintain/kubernetes/templates/secrets.yaml similarity index 100% rename from scripts/kubernetes/templates/secrets.yaml rename to .maintain/kubernetes/templates/secrets.yaml diff --git a/scripts/kubernetes/templates/service.yaml b/.maintain/kubernetes/templates/service.yaml similarity index 100% rename from scripts/kubernetes/templates/service.yaml rename to .maintain/kubernetes/templates/service.yaml diff --git a/scripts/kubernetes/templates/serviceaccount.yaml b/.maintain/kubernetes/templates/serviceaccount.yaml similarity index 100% rename from scripts/kubernetes/templates/serviceaccount.yaml rename to .maintain/kubernetes/templates/serviceaccount.yaml diff --git a/scripts/kubernetes/templates/statefulset.yaml b/.maintain/kubernetes/templates/statefulset.yaml similarity index 100% rename from scripts/kubernetes/templates/statefulset.yaml rename to .maintain/kubernetes/templates/statefulset.yaml diff --git a/scripts/kubernetes/values.yaml b/.maintain/kubernetes/values.yaml similarity index 100% rename from scripts/kubernetes/values.yaml rename to .maintain/kubernetes/values.yaml diff --git a/scripts/node-template-release.sh b/.maintain/node-template-release.sh similarity index 84% rename from scripts/node-template-release.sh rename to .maintain/node-template-release.sh index 3b2c0d6f0f6b8..897677edc5c39 100755 --- a/scripts/node-template-release.sh +++ b/.maintain/node-template-release.sh @@ -11,6 +11,6 @@ if [ "$#" -ne 1 ]; then fi PATH_TO_ARCHIVE=$(pwd)/$1 -cd $PROJECT_ROOT/scripts/node-template-release +cd $PROJECT_ROOT/.maintain/node-template-release cargo run $PROJECT_ROOT/node-template $PATH_TO_ARCHIVE diff --git a/scripts/node-template-release/Cargo.toml b/.maintain/node-template-release/Cargo.toml similarity index 100% rename from scripts/node-template-release/Cargo.toml rename to .maintain/node-template-release/Cargo.toml diff --git a/scripts/node-template-release/src/main.rs b/.maintain/node-template-release/src/main.rs similarity index 100% rename from scripts/node-template-release/src/main.rs rename to .maintain/node-template-release/src/main.rs diff --git a/scripts/runtime-dep.py b/.maintain/runtime-dep.py similarity index 91% rename from scripts/runtime-dep.py rename to .maintain/runtime-dep.py index 1d0c42b2f57e8..3198bb3e2669e 100755 --- a/scripts/runtime-dep.py +++ b/.maintain/runtime-dep.py @@ -4,7 +4,7 @@ # pip install toml # sudo apt-get install graphviz # the first parameter is the runtime folder -# python ./scripts/runtime-dep.py ./substrate/runtime | dot -Tpng -o output.png +# python ./.maintain/runtime-dep.py ./substrate/runtime | dot -Tpng -o output.png import sys import os import toml diff --git a/rustdoc-header.html b/.maintain/rustdoc-header.html similarity index 100% rename from rustdoc-header.html rename to .maintain/rustdoc-header.html diff --git a/scripts/sentry-node/docker-compose.yml b/.maintain/sentry-node/docker-compose.yml similarity index 97% rename from scripts/sentry-node/docker-compose.yml rename to .maintain/sentry-node/docker-compose.yml index 78f8ba36b82ee..dd2aee6995473 100644 --- a/scripts/sentry-node/docker-compose.yml +++ b/.maintain/sentry-node/docker-compose.yml @@ -12,7 +12,7 @@ # # 1. Build `target/release/substrate` binary: `cargo build --release` # -# 2. Start networks and containers: `sudo docker-compose -f scripts/sentry-node/docker-compose.yml up` +# 2. Start networks and containers: `sudo docker-compose -f .maintain/sentry-node/docker-compose.yml up` # # 3. Reach: # - polkadot/apps on localhost:3000 diff --git a/scripts/update-copyright.sh b/.maintain/update-copyright.sh similarity index 100% rename from scripts/update-copyright.sh rename to .maintain/update-copyright.sh diff --git a/scripts/update-deps.sh b/.maintain/update-deps.sh similarity index 100% rename from scripts/update-deps.sh rename to .maintain/update-deps.sh diff --git a/scripts/update.sh b/.maintain/update.sh similarity index 100% rename from scripts/update.sh rename to .maintain/update.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4180defedfd6a..0000000000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Request an environment that provides sudo (that goes with larger containers) -# and a minimal language environment. -sudo: true -language: minimal - -cache: cargo - -branches: - only: - - master - -env: - global: - - RUST_BACKTRACE=1 - matrix: - - RUST_TOOLCHAIN=nightly TARGET=wasm - - RUST_TOOLCHAIN=stable TARGET=native - -before_install: - # Check how much space we've got on this machine. - - df -h - -script: - - ./ci/script.sh - -after_script: - # Check how much free disk space left after the build - - df -h diff --git a/Cargo.lock b/Cargo.lock index 2fb1475f31ba9..5fe1e3003edc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -999,15 +999,6 @@ dependencies = [ "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "error-chain" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "evm" version = "0.14.0" @@ -2707,22 +2698,22 @@ dependencies = [ "node-primitives 2.0.0", "node-rpc 2.0.0", "node-runtime 2.0.0", + "paint-authority-discovery 0.1.0", + "paint-balances 2.0.0", + "paint-contracts 2.0.0", + "paint-finality-tracker 2.0.0", + "paint-im-online 0.1.0", + "paint-indices 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "paint-transaction-payment 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", - "srml-authority-discovery 0.1.0", - "srml-balances 2.0.0", - "srml-contracts 2.0.0", - "srml-finality-tracker 2.0.0", - "srml-im-online 0.1.0", - "srml-indices 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "srml-transaction-payment 2.0.0", "structopt 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-authority-discovery 2.0.0", "substrate-authority-discovery-primitives 2.0.0", @@ -2731,6 +2722,7 @@ dependencies = [ "substrate-chain-spec 2.0.0", "substrate-cli 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-client-db 2.0.0", "substrate-consensus-babe 2.0.0", "substrate-consensus-babe-primitives 2.0.0", @@ -2764,19 +2756,19 @@ dependencies = [ "node-primitives 2.0.0", "node-runtime 2.0.0", "node-testing 2.0.0", + "paint-balances 2.0.0", + "paint-contracts 2.0.0", + "paint-grandpa 2.0.0", + "paint-indices 2.0.0", + "paint-session 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "paint-transaction-payment 2.0.0", + "paint-treasury 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", - "srml-balances 2.0.0", - "srml-contracts 2.0.0", - "srml-grandpa 2.0.0", - "srml-indices 2.0.0", - "srml-session 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "srml-transaction-payment 2.0.0", - "srml-treasury 2.0.0", "substrate-executor 2.0.0", "substrate-primitives 2.0.0", "substrate-state-machine 2.0.0", @@ -2803,10 +2795,10 @@ dependencies = [ "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 2.0.0", "node-runtime 2.0.0", + "paint-contracts-rpc 2.0.0", + "paint-system-rpc 2.0.0", + "paint-transaction-payment-rpc 2.0.0", "sr-primitives 2.0.0", - "srml-contracts-rpc 2.0.0", - "srml-system-rpc 2.0.0", - "srml-transaction-payment-rpc 2.0.0", "substrate-client 2.0.0", "substrate-transaction-pool 2.0.0", ] @@ -2830,6 +2822,36 @@ version = "2.0.0" dependencies = [ "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 2.0.0", + "paint-authority-discovery 0.1.0", + "paint-authorship 0.1.0", + "paint-babe 2.0.0", + "paint-balances 2.0.0", + "paint-collective 2.0.0", + "paint-contracts 2.0.0", + "paint-contracts-rpc-runtime-api 2.0.0", + "paint-democracy 2.0.0", + "paint-elections-phragmen 2.0.0", + "paint-executive 2.0.0", + "paint-finality-tracker 2.0.0", + "paint-grandpa 2.0.0", + "paint-im-online 0.1.0", + "paint-indices 2.0.0", + "paint-membership 2.0.0", + "paint-nicks 2.0.0", + "paint-offences 1.0.0", + "paint-randomness-collective-flip 2.0.0", + "paint-session 2.0.0", + "paint-staking 2.0.0", + "paint-staking-reward-curve 2.0.0", + "paint-sudo 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-system-rpc-runtime-api 2.0.0", + "paint-timestamp 2.0.0", + "paint-transaction-payment 2.0.0", + "paint-transaction-payment-rpc-runtime-api 2.0.0", + "paint-treasury 2.0.0", + "paint-utility 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2840,36 +2862,6 @@ dependencies = [ "sr-staking-primitives 2.0.0", "sr-std 2.0.0", "sr-version 2.0.0", - "srml-authority-discovery 0.1.0", - "srml-authorship 0.1.0", - "srml-babe 2.0.0", - "srml-balances 2.0.0", - "srml-collective 2.0.0", - "srml-contracts 2.0.0", - "srml-contracts-rpc-runtime-api 2.0.0", - "srml-democracy 2.0.0", - "srml-elections-phragmen 2.0.0", - "srml-executive 2.0.0", - "srml-finality-tracker 2.0.0", - "srml-grandpa 2.0.0", - "srml-im-online 0.1.0", - "srml-indices 2.0.0", - "srml-membership 2.0.0", - "srml-nicks 2.0.0", - "srml-offences 1.0.0", - "srml-randomness-collective-flip 2.0.0", - "srml-session 2.0.0", - "srml-staking 2.0.0", - "srml-staking-reward-curve 2.0.0", - "srml-sudo 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-system-rpc-runtime-api 2.0.0", - "srml-timestamp 2.0.0", - "srml-transaction-payment 2.0.0", - "srml-transaction-payment-rpc-runtime-api 2.0.0", - "srml-treasury 2.0.0", - "srml-utility 2.0.0", "substrate-authority-discovery-primitives 2.0.0", "substrate-block-builder-runtime-api 2.0.0", "substrate-consensus-babe-primitives 2.0.0", @@ -2919,6 +2911,17 @@ dependencies = [ name = "node-template-runtime" version = "2.0.0" dependencies = [ + "paint-aura 2.0.0", + "paint-balances 2.0.0", + "paint-executive 2.0.0", + "paint-grandpa 2.0.0", + "paint-indices 2.0.0", + "paint-randomness-collective-flip 2.0.0", + "paint-sudo 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "paint-transaction-payment 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2927,17 +2930,6 @@ dependencies = [ "sr-primitives 2.0.0", "sr-std 2.0.0", "sr-version 2.0.0", - "srml-aura 2.0.0", - "srml-balances 2.0.0", - "srml-executive 2.0.0", - "srml-grandpa 2.0.0", - "srml-indices 2.0.0", - "srml-randomness-collective-flip 2.0.0", - "srml-sudo 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "srml-transaction-payment 2.0.0", "substrate-block-builder-runtime-api 2.0.0", "substrate-consensus-aura-primitives 2.0.0", "substrate-inherents 2.0.0", @@ -2945,7 +2937,7 @@ dependencies = [ "substrate-primitives 2.0.0", "substrate-session 2.0.0", "substrate-transaction-pool-runtime-api 2.0.0", - "substrate-wasm-builder-runner 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-wasm-builder-runner 1.0.4", ] [[package]] @@ -2955,20 +2947,20 @@ dependencies = [ "node-executor 2.0.0", "node-primitives 2.0.0", "node-runtime 2.0.0", + "paint-balances 2.0.0", + "paint-contracts 2.0.0", + "paint-grandpa 2.0.0", + "paint-indices 2.0.0", + "paint-session 2.0.0", + "paint-staking 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "paint-transaction-payment 2.0.0", + "paint-treasury 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", - "srml-balances 2.0.0", - "srml-contracts 2.0.0", - "srml-grandpa 2.0.0", - "srml-indices 2.0.0", - "srml-session 2.0.0", - "srml-staking 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "srml-transaction-payment 2.0.0", - "srml-treasury 2.0.0", "substrate-client 2.0.0", "substrate-executor 2.0.0", "substrate-keyring 2.0.0", @@ -3117,2036 +3109,2023 @@ dependencies = [ ] [[package]] -name = "parity-bytes" -version = "0.1.0" -source = "git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d#b0317f649ab2c665b7987b8475878fc4d2e1f81d" - -[[package]] -name = "parity-multiaddr" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-assets" +version = "2.0.0" dependencies = [ - "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parity-multihash" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-aura" +version = "2.0.0" dependencies = [ - "blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-session 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-application-crypto 2.0.0", + "substrate-consensus-aura-primitives 2.0.0", + "substrate-inherents 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parity-scale-codec" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-authority-discovery" +version = "0.1.0" dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "bitvec 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-slice-cast 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec-derive 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-session 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-staking-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-application-crypto 2.0.0", + "substrate-authority-discovery-primitives 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parity-scale-codec-derive" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-authorship" +version = "0.1.0" dependencies = [ - "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-inherents 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parity-send-wrapper" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-babe" +version = "2.0.0" +dependencies = [ + "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-session 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-staking-primitives 2.0.0", + "sr-std 2.0.0", + "sr-version 2.0.0", + "substrate-consensus-babe-primitives 2.0.0", + "substrate-inherents 2.0.0", + "substrate-primitives 2.0.0", + "substrate-test-runtime 2.0.0", +] [[package]] -name = "parity-util-mem" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-balances" +version = "2.0.0" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-transaction-payment 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-keyring 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parity-wasm" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-collective" +version = "2.0.0" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parity-wasm" -version = "0.40.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-contracts" +version = "2.0.0" +dependencies = [ + "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-randomness-collective-flip 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-wasm 0.40.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pwasm-utils 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-sandbox 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", + "wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi-validation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "parity-wasm" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-contracts-rpc" +version = "2.0.0" +dependencies = [ + "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core-client 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-derive 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-contracts-rpc-runtime-api 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 2.0.0", + "substrate-client 2.0.0", + "substrate-primitives 2.0.0", + "substrate-rpc-primitives 2.0.0", +] [[package]] -name = "parking_lot" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-contracts-rpc-runtime-api" +version = "2.0.0" dependencies = [ - "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-api 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", ] [[package]] -name = "parking_lot" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-democracy" +version = "2.0.0" dependencies = [ - "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parking_lot" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-elections" +version = "2.0.0" dependencies = [ - "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parking_lot" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-elections-phragmen" +version = "2.0.0" dependencies = [ - "lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-phragmen 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parking_lot_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-evm" +version = "2.0.0" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "evm 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parking_lot_core" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-example" +version = "2.0.0" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parking_lot_core" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-executive" +version = "2.0.0" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-indices 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-transaction-payment 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "parking_lot_core" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-finality-tracker" +version = "2.0.0" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-inherents 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "paste" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-generic-asset" +version = "2.0.0" dependencies = [ - "paste-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "paste-impl" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-grandpa" +version = "2.0.0" dependencies = [ - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-finality-tracker 2.0.0", + "paint-session 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-staking-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-finality-grandpa-primitives 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "pbkdf2" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-im-online" +version = "0.1.0" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-authorship 0.1.0", + "paint-session 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-staking-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-application-crypto 2.0.0", + "substrate-offchain 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "pdqselect" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-indices" +version = "2.0.0" +dependencies = [ + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-keyring 2.0.0", + "substrate-primitives 2.0.0", +] [[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-membership" +version = "2.0.0" +dependencies = [ + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", +] [[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-metadata" +version = "2.0.0" +dependencies = [ + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", +] [[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-nicks" +version = "2.0.0" +dependencies = [ + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", +] [[package]] -name = "petgraph" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-offences" +version = "1.0.0" dependencies = [ - "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-staking-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "pin-utils" -version = "0.1.0-alpha.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-randomness-collective-flip" +version = "2.0.0" +dependencies = [ + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", +] [[package]] -name = "pkg-config" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-scored-pool" +version = "1.0.0" +dependencies = [ + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", +] [[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-session" +version = "2.0.0" +dependencies = [ + "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-staking-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-application-crypto 2.0.0", + "substrate-primitives 2.0.0", + "substrate-trie 2.0.0", +] [[package]] -name = "ppv-lite86" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-staking" +version = "2.0.0" +dependencies = [ + "paint-authorship 0.1.0", + "paint-balances 2.0.0", + "paint-session 2.0.0", + "paint-staking-reward-curve 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-timestamp 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-staking-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-keyring 2.0.0", + "substrate-phragmen 2.0.0", + "substrate-primitives 2.0.0", +] [[package]] -name = "pretty_assertions" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-staking-reward-curve" +version = "2.0.0" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ctor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 2.0.0", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "primitive-types" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-sudo" +version = "2.0.0" dependencies = [ - "fixed-hash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-codec 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "proc-macro-crate" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-support" +version = "2.0.0" dependencies = [ - "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-metadata 2.0.0", + "paint-support-procedural 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-inherents 2.0.0", + "substrate-primitives 2.0.0", + "substrate-state-machine 2.0.0", ] [[package]] -name = "proc-macro-error" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-support-procedural" +version = "2.0.0" dependencies = [ + "paint-support-procedural-tools 2.0.0", "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "proc-macro-hack" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-support-procedural-tools" +version = "2.0.0" dependencies = [ + "paint-support-procedural-tools-derive 2.0.0", + "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "proc-macro-nested" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-support-procedural-tools-derive" +version = "2.0.0" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-support-rpc" +version = "2.0.0" dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-client-transports 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-primitives-storage 2.0.0", + "substrate-rpc-api 2.0.0", + "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "proc-macro2" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-support-test" +version = "2.0.0" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "substrate-inherents 2.0.0", + "substrate-primitives 2.0.0", + "substrate-state-machine 2.0.0", + "trybuild 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "prost" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-system" +version = "2.0.0" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "prost-derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "sr-version 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "prost-build" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-system-rpc" +version = "2.0.0" dependencies = [ - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core-client 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-derive 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prost-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-system-rpc-runtime-api 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 2.0.0", + "substrate-client 2.0.0", + "substrate-primitives 2.0.0", + "substrate-test-runtime-client 2.0.0", + "substrate-transaction-pool 2.0.0", ] [[package]] -name = "prost-derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-system-rpc-runtime-api" +version = "2.0.0" dependencies = [ - "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-api 2.0.0", ] [[package]] -name = "prost-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-timestamp" +version = "2.0.0" dependencies = [ - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-inherents 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "protobuf" -version = "2.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-transaction-payment" +version = "2.0.0" +dependencies = [ + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-transaction-payment-rpc-runtime-api 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", +] [[package]] -name = "pwasm-utils" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-transaction-payment-rpc" +version = "2.0.0" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-wasm 0.40.3 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core-client 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-derive 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-transaction-payment-rpc-runtime-api 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 2.0.0", + "substrate-client 2.0.0", + "substrate-primitives 2.0.0", + "substrate-rpc-primitives 2.0.0", ] [[package]] -name = "quick-error" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-transaction-payment-rpc-runtime-api" +version = "2.0.0" +dependencies = [ + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-api 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", +] [[package]] -name = "quickcheck" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-treasury" +version = "2.0.0" dependencies = [ - "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "quickcheck" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "paint-utility" +version = "2.0.0" dependencies = [ - "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-balances 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "substrate-primitives 2.0.0", ] [[package]] -name = "quote" -version = "0.6.13" +name = "parity-bytes" +version = "0.1.0" +source = "git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d#b0317f649ab2c665b7987b8475878fc4d2e1f81d" + +[[package]] +name = "parity-multiaddr" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "quote" -version = "1.0.2" +name = "parity-multihash" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand" -version = "0.3.23" +name = "parity-scale-codec" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "bitvec 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-slice-cast 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec-derive 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand" -version = "0.4.6" +name = "parity-scale-codec-derive" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand" -version = "0.5.6" +name = "parity-send-wrapper" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "rand" -version = "0.6.5" +name = "parity-util-mem" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand" -version = "0.7.2" +name = "parity-wasm" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_chacha" -version = "0.1.1" +name = "parity-wasm" +version = "0.40.3" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "rand_chacha" -version = "0.2.1" +name = "parity-wasm" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "rand_core" -version = "0.3.1" +name = "parking_lot" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_core" -version = "0.4.2" +name = "parking_lot" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "rand_core" -version = "0.5.1" +name = "parking_lot" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_hc" -version = "0.1.0" +name = "parking_lot" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_hc" -version = "0.2.0" +name = "parking_lot_core" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_isaac" -version = "0.1.1" +name = "parking_lot_core" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_jitter" -version = "0.1.4" +name = "parking_lot_core" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_os" -version = "0.1.3" +name = "parking_lot_core" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_os" -version = "0.2.2" +name = "paste" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_pcg" -version = "0.1.2" +name = "paste-impl" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_xorshift" -version = "0.1.1" +name = "pbkdf2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_xoshiro" +name = "pdqselect" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "rand_xoshiro" -version = "0.3.1" +name = "peeking_take_while" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "raw-cpuid" -version = "6.1.0" +name = "percent-encoding" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "rayon" -version = "1.2.0" +name = "percent-encoding" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "rayon-core" -version = "1.6.0" +name = "petgraph" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rdrand" -version = "0.4.0" +name = "pin-utils" +version = "0.1.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "redox_syscall" -version = "0.1.56" +name = "pkg-config" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "redox_users" -version = "0.3.1" +name = "plain" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "ref_thread_local" -version = "0.0.0" +name = "ppv-lite86" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "regex" -version = "1.3.1" +name = "pretty_assertions" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ctor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "regex-automata" -version = "0.1.8" +name = "primitive-types" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-codec 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "regex-syntax" -version = "0.6.12" +name = "proc-macro-crate" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "region" -version = "2.1.2" +name = "proc-macro-error" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "remove_dir_all" -version = "0.5.2" +name = "proc-macro-hack" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rhododendron" -version = "0.7.0" +name = "proc-macro-nested" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "ring" -version = "0.16.9" +name = "proc-macro2" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.31 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rlp" -version = "0.4.3" +name = "proc-macro2" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rocksdb" -version = "0.11.0" +name = "prost" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "librocksdb-sys 5.18.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "prost-derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rpassword" -version = "4.0.1" +name = "prost-build" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "prost-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rust-argon2" -version = "0.5.1" +name = "prost-derive" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rustc-demangle" -version = "0.1.16" +name = "prost-types" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "rustc-hex" -version = "2.0.1" +name = "protobuf" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "rustc_version" -version = "0.2.3" +name = "pwasm-utils" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-wasm 0.40.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rustls" -version = "0.16.0" +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quickcheck" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", - "sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webpki 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rustversion" -version = "1.0.0" +name = "quickcheck" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rw-stream-sink" -version = "0.1.2" +name = "quote" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "ryu" +name = "quote" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "safe-mix" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "safemem" -version = "0.3.3" +name = "rand" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "same-file" -version = "1.0.5" +name = "rand" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "schannel" -version = "0.1.16" +name = "rand" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "schnorrkel" -version = "0.8.5" +name = "rand" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "merlin 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "scopeguard" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "scopeguard" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "scroll" -version = "0.9.2" +name = "rand" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "scroll_derive 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "scroll_derive" -version = "0.9.5" +name = "rand_chacha" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sct" -version = "0.6.0" +name = "rand_chacha" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "security-framework" -version = "0.3.3" +name = "rand_core" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "security-framework-sys" -version = "0.3.3" +name = "rand_core" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "semver" -version = "0.6.0" +name = "rand_core" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "semver" -version = "0.9.0" +name = "rand_hc" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "send_wrapper" +name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.102" -source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "serde_derive" -version = "1.0.102" +name = "rand_isaac" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "serde_json" -version = "1.0.41" +name = "rand_jitter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sha-1" -version = "0.8.1" +name = "rand_os" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "sha2" -version = "0.8.0" +name = "rand_os" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sha3" -version = "0.8.2" +name = "rand_pcg" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "shell32-sys" -version = "0.1.2" +name = "rand_xorshift" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "slab" -version = "0.4.2" +name = "rand_xoshiro" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "slog" -version = "2.5.2" +name = "rand_xoshiro" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "slog-async" -version = "2.3.0" -source = "git+https://github.com/paritytech/slog-async#107848e7ded5e80dc43f6296c2b96039eb92c0a5" +name = "raw-cpuid" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "slog-json" -version = "2.3.0" +name = "rayon" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", - "erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "slog-scope" -version = "4.3.0" +name = "rayon-core" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arc-swap 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "slog_derive" -version = "0.1.1" +name = "rdrand" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "smallvec" -version = "0.6.13" +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_users" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "snow" -version = "0.6.1" +name = "ref_thread_local" +version = "0.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "regex" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "soketto" -version = "0.2.3" +name = "regex-automata" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sourcefile" -version = "0.1.4" +name = "regex-syntax" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "spin" -version = "0.5.2" +name = "region" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "sr-api" -version = "2.0.0" +name = "remove_dir_all" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api-proc-macro 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "sr-version 2.0.0", - "substrate-primitives 2.0.0", - "substrate-state-machine 2.0.0", - "substrate-test-runtime-client 2.0.0", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sr-api-proc-macro" -version = "2.0.0" +name = "ring" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api 2.0.0", - "sr-primitives 2.0.0", - "sr-version 2.0.0", - "substrate-test-runtime-client 2.0.0", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.31 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sr-api-test" -version = "2.0.0" +name = "rlp" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api 2.0.0", - "sr-primitives 2.0.0", - "sr-version 2.0.0", - "substrate-consensus-common 2.0.0", - "substrate-state-machine 2.0.0", - "substrate-test-runtime-client 2.0.0", - "trybuild 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sr-arithmetic" -version = "2.0.0" +name = "rocksdb" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 2.0.0", - "substrate-debug-derive 2.0.0", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "librocksdb-sys 5.18.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sr-io" -version = "2.0.0" +name = "rpassword" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libsecp256k1 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 2.0.0", - "substrate-externalities 2.0.0", - "substrate-primitives 2.0.0", - "substrate-runtime-interface 2.0.0", - "substrate-state-machine 2.0.0", - "substrate-trie 2.0.0", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sr-primitives" -version = "2.0.0" +name = "rust-argon2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-arithmetic 2.0.0", - "sr-io 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-application-crypto 2.0.0", - "substrate-inherents 2.0.0", - "substrate-offchain 2.0.0", - "substrate-primitives 2.0.0", -] - -[[package]] -name = "sr-sandbox" -version = "2.0.0" -dependencies = [ - "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-std 2.0.0", - "substrate-primitives 2.0.0", - "wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "sr-staking-primitives" -version = "2.0.0" -dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 2.0.0", - "sr-std 2.0.0", + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sr-std" -version = "2.0.0" - -[[package]] -name = "sr-version" -version = "2.0.0" -dependencies = [ - "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 2.0.0", - "sr-std 2.0.0", -] +name = "rustc-demangle" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "srml-assets" -version = "2.0.0" -dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", -] +name = "rustc-hex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "srml-aura" -version = "2.0.0" +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-session 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "substrate-application-crypto 2.0.0", - "substrate-consensus-aura-primitives 2.0.0", - "substrate-inherents 2.0.0", - "substrate-primitives 2.0.0", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-authority-discovery" -version = "0.1.0" +name = "rustls" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-staking-primitives 2.0.0", - "sr-std 2.0.0", - "srml-session 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-application-crypto 2.0.0", - "substrate-authority-discovery-primitives 2.0.0", - "substrate-primitives 2.0.0", + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", + "sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-authorship" -version = "0.1.0" +name = "rustversion" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-inherents 2.0.0", - "substrate-primitives 2.0.0", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-babe" -version = "2.0.0" +name = "rw-stream-sink" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-staking-primitives 2.0.0", - "sr-std 2.0.0", - "sr-version 2.0.0", - "srml-session 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "substrate-consensus-babe-primitives 2.0.0", - "substrate-inherents 2.0.0", - "substrate-primitives 2.0.0", - "substrate-test-runtime 2.0.0", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-balances" -version = "2.0.0" -dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-transaction-payment 2.0.0", - "substrate-keyring 2.0.0", - "substrate-primitives 2.0.0", -] +name = "ryu" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "srml-collective" -version = "2.0.0" +name = "safe-mix" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-contracts" -version = "2.0.0" -dependencies = [ - "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-wasm 0.40.3 (registry+https://github.com/rust-lang/crates.io-index)", - "pwasm-utils 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-sandbox 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-randomness-collective-flip 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "substrate-primitives 2.0.0", - "wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi-validation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "srml-contracts-rpc" -version = "2.0.0" +name = "same-file" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core-client 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-derive 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 2.0.0", - "srml-contracts-rpc-runtime-api 2.0.0", - "substrate-client 2.0.0", - "substrate-primitives 2.0.0", - "substrate-rpc-primitives 2.0.0", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-contracts-rpc-runtime-api" -version = "2.0.0" +name = "schannel" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-democracy" -version = "2.0.0" +name = "schnorrkel" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", + "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "merlin 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-elections" -version = "2.0.0" -dependencies = [ - "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", -] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "srml-elections-phragmen" -version = "2.0.0" -dependencies = [ - "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-phragmen 2.0.0", - "substrate-primitives 2.0.0", -] +name = "scopeguard" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "srml-evm" -version = "2.0.0" +name = "scroll" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "evm 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rlp 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "substrate-primitives 2.0.0", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scroll_derive 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-example" -version = "2.0.0" -dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", +name = "scroll_derive" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-executive" -version = "2.0.0" +name = "sct" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-indices 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-transaction-payment 2.0.0", - "substrate-primitives 2.0.0", + "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-finality-tracker" -version = "2.0.0" +name = "security-framework" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-inherents 2.0.0", - "substrate-primitives 2.0.0", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-generic-asset" -version = "2.0.0" +name = "security-framework-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-grandpa" -version = "2.0.0" +name = "semver" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-staking-primitives 2.0.0", - "sr-std 2.0.0", - "srml-finality-tracker 2.0.0", - "srml-session 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-finality-grandpa-primitives 2.0.0", - "substrate-primitives 2.0.0", + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-im-online" -version = "0.1.0" +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-staking-primitives 2.0.0", - "sr-std 2.0.0", - "srml-authorship 0.1.0", - "srml-session 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-application-crypto 2.0.0", - "substrate-offchain 2.0.0", - "substrate-primitives 2.0.0", ] [[package]] -name = "srml-indices" -version = "2.0.0" -dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-keyring 2.0.0", - "substrate-primitives 2.0.0", -] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "srml-membership" -version = "2.0.0" +name = "send_wrapper" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", + "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-metadata" -version = "2.0.0" +name = "serde_derive" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 2.0.0", - "substrate-primitives 2.0.0", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-nicks" -version = "2.0.0" +name = "serde_json" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", ] [[package]] -name = "srml-offences" -version = "1.0.0" +name = "sha-1" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-staking-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-randomness-collective-flip" -version = "2.0.0" +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "sha2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-scored-pool" -version = "1.0.0" +name = "sha3" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-session" -version = "2.0.0" +name = "shell32-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-staking-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "substrate-application-crypto 2.0.0", - "substrate-primitives 2.0.0", - "substrate-trie 2.0.0", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-staking" -version = "2.0.0" +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slog" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-staking-primitives 2.0.0", - "sr-std 2.0.0", - "srml-authorship 0.1.0", - "srml-balances 2.0.0", - "srml-session 2.0.0", - "srml-staking-reward-curve 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-timestamp 2.0.0", - "substrate-keyring 2.0.0", - "substrate-phragmen 2.0.0", - "substrate-primitives 2.0.0", + "erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-staking-reward-curve" -version = "2.0.0" +name = "slog-async" +version = "2.3.0" +source = "git+https://github.com/paritytech/slog-async#107848e7ded5e80dc43f6296c2b96039eb92c0a5" dependencies = [ - "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 2.0.0", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-sudo" -version = "2.0.0" +name = "slog-json" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", + "erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-support" -version = "2.0.0" -dependencies = [ - "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "once_cell 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-std 2.0.0", - "srml-metadata 2.0.0", - "srml-support-procedural 2.0.0", - "srml-system 2.0.0", - "substrate-inherents 2.0.0", - "substrate-primitives 2.0.0", - "substrate-state-machine 2.0.0", +name = "slog-scope" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arc-swap 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-support-procedural" -version = "2.0.0" +name = "slog_derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "srml-support-procedural-tools 2.0.0", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-support-procedural-tools" -version = "2.0.0" +name = "smallvec" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "srml-support-procedural-tools-derive 2.0.0", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-support-procedural-tools-derive" -version = "2.0.0" +name = "snow" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-support-rpc" -version = "2.0.0" +name = "soketto" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-client-transports 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives-storage 2.0.0", - "substrate-rpc-api 2.0.0", - "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-support-test" -version = "2.0.0" -dependencies = [ - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "srml-support 2.0.0", - "substrate-inherents 2.0.0", - "substrate-primitives 2.0.0", - "substrate-state-machine 2.0.0", - "trybuild 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", -] +name = "sourcefile" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "srml-system" +name = "sr-api" version = "2.0.0" dependencies = [ - "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", + "sr-api-proc-macro 2.0.0", "sr-primitives 2.0.0", "sr-std 2.0.0", "sr-version 2.0.0", - "srml-support 2.0.0", "substrate-primitives 2.0.0", + "substrate-state-machine 2.0.0", + "substrate-test-runtime-client 2.0.0", ] [[package]] -name = "srml-system-rpc" +name = "sr-api-proc-macro" version = "2.0.0" dependencies = [ - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core-client 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-derive 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-api 2.0.0", "sr-primitives 2.0.0", - "srml-system-rpc-runtime-api 2.0.0", - "substrate-client 2.0.0", - "substrate-primitives 2.0.0", + "sr-version 2.0.0", "substrate-test-runtime-client 2.0.0", - "substrate-transaction-pool 2.0.0", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-system-rpc-runtime-api" +name = "sr-api-test" version = "2.0.0" dependencies = [ "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api 2.0.0", + "sr-primitives 2.0.0", + "sr-version 2.0.0", + "substrate-consensus-common 2.0.0", + "substrate-state-machine 2.0.0", + "substrate-test-runtime-client 2.0.0", + "trybuild 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-timestamp" +name = "sr-arithmetic" version = "2.0.0" dependencies = [ - "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", "sr-std 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-inherents 2.0.0", - "substrate-primitives 2.0.0", + "substrate-debug-derive 2.0.0", ] [[package]] -name = "srml-transaction-payment" +name = "sr-io" version = "2.0.0" dependencies = [ + "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libsecp256k1 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-transaction-payment-rpc-runtime-api 2.0.0", + "substrate-externalities 2.0.0", "substrate-primitives 2.0.0", + "substrate-runtime-interface 2.0.0", + "substrate-state-machine 2.0.0", + "substrate-trie 2.0.0", ] [[package]] -name = "srml-transaction-payment-rpc" +name = "sr-primitives" version = "2.0.0" dependencies = [ - "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core-client 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-derive 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 2.0.0", - "srml-transaction-payment-rpc-runtime-api 2.0.0", - "substrate-client 2.0.0", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-arithmetic 2.0.0", + "sr-io 2.0.0", + "sr-std 2.0.0", + "substrate-application-crypto 2.0.0", + "substrate-inherents 2.0.0", + "substrate-offchain 2.0.0", "substrate-primitives 2.0.0", - "substrate-rpc-primitives 2.0.0", ] [[package]] -name = "srml-transaction-payment-rpc-runtime-api" +name = "sr-sandbox" version = "2.0.0" dependencies = [ + "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api 2.0.0", - "sr-primitives 2.0.0", + "sr-io 2.0.0", "sr-std 2.0.0", + "substrate-primitives 2.0.0", + "wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "srml-treasury" +name = "sr-staking-primitives" version = "2.0.0" dependencies = [ "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", "sr-primitives 2.0.0", "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", ] [[package]] -name = "srml-utility" +name = "sr-std" +version = "2.0.0" + +[[package]] +name = "sr-version" version = "2.0.0" dependencies = [ + "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", "sr-primitives 2.0.0", "sr-std 2.0.0", - "srml-balances 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-primitives 2.0.0", ] [[package]] @@ -5234,13 +5213,13 @@ dependencies = [ "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 2.0.0", "node-runtime 2.0.0", + "paint-balances 2.0.0", + "paint-system 2.0.0", + "paint-transaction-payment 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", - "srml-balances 2.0.0", - "srml-system 2.0.0", - "srml-transaction-payment 2.0.0", "substrate-bip39 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 2.0.0", "tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5277,7 +5256,7 @@ dependencies = [ "sr-api 2.0.0", "sr-primitives 2.0.0", "substrate-authority-discovery-primitives 2.0.0", - "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-keystore 2.0.0", "substrate-network 2.0.0", "substrate-peerset 2.0.0", @@ -5306,6 +5285,7 @@ dependencies = [ "sr-primitives 2.0.0", "substrate-block-builder 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-common 2.0.0", "substrate-inherents 2.0.0", "substrate-primitives 2.0.0", @@ -5397,7 +5377,7 @@ dependencies = [ "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "structopt 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-header-metadata 2.0.0", "substrate-keyring 2.0.0", "substrate-network 2.0.0", @@ -5414,6 +5394,43 @@ dependencies = [ [[package]] name = "substrate-client" version = "2.0.0" +dependencies = [ + "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", + "kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-api 2.0.0", + "sr-primitives 2.0.0", + "sr-std 2.0.0", + "sr-version 2.0.0", + "substrate-block-builder 2.0.0", + "substrate-client-api 2.0.0", + "substrate-client-db 2.0.0", + "substrate-consensus-common 2.0.0", + "substrate-executor 2.0.0", + "substrate-header-metadata 2.0.0", + "substrate-inherents 2.0.0", + "substrate-keyring 2.0.0", + "substrate-panic-handler 2.0.0", + "substrate-primitives 2.0.0", + "substrate-state-machine 2.0.0", + "substrate-telemetry 2.0.0", + "substrate-test-runtime-client 2.0.0", + "substrate-trie 2.0.0", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "substrate-client-api" +version = "2.0.0" dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5442,6 +5459,7 @@ dependencies = [ "substrate-primitives 2.0.0", "substrate-state-machine 2.0.0", "substrate-telemetry 2.0.0", + "substrate-test-primitives 2.0.0", "substrate-test-runtime-client 2.0.0", "substrate-trie 2.0.0", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5463,6 +5481,7 @@ dependencies = [ "quickcheck 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-common 2.0.0", "substrate-executor 2.0.0", "substrate-header-metadata 2.0.0", @@ -5484,17 +5503,17 @@ dependencies = [ "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-aura 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api 2.0.0", "sr-io 2.0.0", "sr-primitives 2.0.0", "sr-version 2.0.0", - "srml-aura 2.0.0", - "srml-support 2.0.0", "substrate-application-crypto 2.0.0", "substrate-block-builder-runtime-api 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-aura-primitives 2.0.0", "substrate-consensus-common 2.0.0", "substrate-consensus-slots 2.0.0", @@ -5537,6 +5556,7 @@ dependencies = [ "num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-babe 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "pdqselect 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5546,12 +5566,11 @@ dependencies = [ "sr-io 2.0.0", "sr-primitives 2.0.0", "sr-version 2.0.0", - "srml-babe 2.0.0", - "srml-support 2.0.0", "substrate-application-crypto 2.0.0", "substrate-block-builder 2.0.0", "substrate-block-builder-runtime-api 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-babe-primitives 2.0.0", "substrate-consensus-common 2.0.0", "substrate-consensus-slots 2.0.0", @@ -5609,11 +5628,11 @@ dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-timestamp 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", - "srml-timestamp 2.0.0", "substrate-block-builder-runtime-api 2.0.0", - "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-common 2.0.0", "substrate-consensus-pow-primitives 2.0.0", "substrate-inherents 2.0.0", @@ -5631,30 +5650,6 @@ dependencies = [ "substrate-primitives 2.0.0", ] -[[package]] -name = "substrate-consensus-rhd" -version = "2.0.0" -dependencies = [ - "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rhododendron 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 2.0.0", - "sr-primitives 2.0.0", - "sr-version 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "substrate-client 2.0.0", - "substrate-consensus-common 2.0.0", - "substrate-keyring 2.0.0", - "substrate-primitives 2.0.0", - "substrate-transaction-pool 2.0.0", - "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "substrate-consensus-slots" version = "2.0.0" @@ -5665,7 +5660,7 @@ dependencies = [ "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", - "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-common 2.0.0", "substrate-inherents 2.0.0", "substrate-primitives 2.0.0", @@ -5678,9 +5673,9 @@ name = "substrate-consensus-uncles" version = "2.0.0" dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-authorship 0.1.0", "sr-primitives 2.0.0", - "srml-authorship 0.1.0", - "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-common 2.0.0", "substrate-inherents 2.0.0", "substrate-primitives 2.0.0", @@ -5715,7 +5710,7 @@ dependencies = [ "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-version 2.0.0", - "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-externalities 2.0.0", "substrate-offchain 2.0.0", "substrate-panic-handler 2.0.0", @@ -5754,14 +5749,15 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-finality-tracker 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api 2.0.0", "sr-primitives 2.0.0", - "srml-finality-tracker 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-babe-primitives 2.0.0", "substrate-consensus-common 2.0.0", "substrate-finality-grandpa-primitives 2.0.0", @@ -5868,9 +5864,11 @@ dependencies = [ "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "slog_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-arithmetic 2.0.0", "sr-primitives 2.0.0", "substrate-block-builder 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-babe-primitives 2.0.0", "substrate-consensus-common 2.0.0", "substrate-header-metadata 2.0.0", @@ -5907,7 +5905,7 @@ dependencies = [ "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api 2.0.0", "sr-primitives 2.0.0", - "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-client-db 2.0.0", "substrate-keystore 2.0.0", "substrate-network 2.0.0", @@ -5952,12 +5950,12 @@ dependencies = [ name = "substrate-phragmen" version = "2.0.0" dependencies = [ + "paint-support 2.0.0", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 2.0.0", "sr-primitives 2.0.0", "sr-std 2.0.0", - "srml-support 2.0.0", ] [[package]] @@ -6032,6 +6030,7 @@ dependencies = [ "sr-primitives 2.0.0", "sr-version 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-executor 2.0.0", "substrate-keystore 2.0.0", "substrate-network 2.0.0", @@ -6179,6 +6178,7 @@ dependencies = [ "substrate-application-crypto 2.0.0", "substrate-chain-spec 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-client-db 2.0.0", "substrate-consensus-babe-primitives 2.0.0", "substrate-consensus-common 2.0.0", @@ -6291,6 +6291,7 @@ dependencies = [ "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-client-db 2.0.0", "substrate-consensus-common 2.0.0", "substrate-executor 2.0.0", @@ -6299,6 +6300,17 @@ dependencies = [ "substrate-state-machine 2.0.0", ] +[[package]] +name = "substrate-test-primitives" +version = "2.0.0" +dependencies = [ + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 2.0.0", + "substrate-application-crypto 2.0.0", + "substrate-primitives 2.0.0", +] + [[package]] name = "substrate-test-runtime" version = "2.0.0" @@ -6306,6 +6318,12 @@ dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "paint-babe 2.0.0", + "paint-executive 2.0.0", + "paint-support 2.0.0", + "paint-system 2.0.0", + "paint-system-rpc-runtime-api 2.0.0", + "paint-timestamp 2.0.0", "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api 2.0.0", @@ -6313,12 +6331,6 @@ dependencies = [ "sr-primitives 2.0.0", "sr-std 2.0.0", "sr-version 2.0.0", - "srml-babe 2.0.0", - "srml-executive 2.0.0", - "srml-support 2.0.0", - "srml-system 2.0.0", - "srml-system-rpc-runtime-api 2.0.0", - "srml-timestamp 2.0.0", "substrate-application-crypto 2.0.0", "substrate-block-builder-runtime-api 2.0.0", "substrate-client 2.0.0", @@ -6346,6 +6358,8 @@ dependencies = [ "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", "substrate-block-builder 2.0.0", + "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-primitives 2.0.0", "substrate-test-client 2.0.0", "substrate-test-runtime 2.0.0", @@ -6431,11 +6445,6 @@ dependencies = [ name = "substrate-wasm-builder-runner" version = "1.0.4" -[[package]] -name = "substrate-wasm-builder-runner" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "substrate-wasm-interface" version = "2.0.0" @@ -6869,6 +6878,7 @@ dependencies = [ "substrate-block-builder-runtime-api 2.0.0", "substrate-cli 2.0.0", "substrate-client 2.0.0", + "substrate-client-api 2.0.0", "substrate-consensus-common 2.0.0", "substrate-primitives 2.0.0", "substrate-service 2.0.0", @@ -7700,7 +7710,6 @@ dependencies = [ "checksum erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3beee4bc16478a1b26f2e80ad819a52d24745e292f521a63c16eea5f74b7eb60" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" "checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" -"checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9" "checksum evm 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1138816a9b7f9a9d1fcabb1b8a7afed2687d035692baf297bd3fea122acdc96f" "checksum evm-core 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bcde5af3d542874ddeb53de0919302d57586ea04b3f76f54d865f8a6cdc70ae" "checksum evm-gasometer 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b82bc9f275cb59d2bcc05d85c98736ddfaba003a7ef7b73893fa7c1c1fab29dc" @@ -7960,7 +7969,6 @@ dependencies = [ "checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" "checksum region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "448e868c6e4cfddfa49b6a72c95906c04e8547465e9536575b95c70a4044f856" "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" -"checksum rhododendron 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "36542aafc2429a4c010fafa079a20dee953b663cb2427f51d86cf1d436846b4d" "checksum ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6747f8da1f2b1fabbee1aaa4eb8a11abf9adef0bf58a41cee45db5d59cecdfac" "checksum rlp 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8376a3f725ebb53f69263bbebb42196361fdfd551212409c8a721239aab4f09f" "checksum rocksdb 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1651697fefd273bfb4fd69466cc2a9d20de557a0213b97233b22b5e95924b5e" @@ -8019,7 +8027,6 @@ dependencies = [ "checksum strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1c33039533f051704951680f1adfd468fd37ac46816ded0d9ee068e60f05f" "checksum strum_macros 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "47cd23f5c7dee395a00fa20135e2ec0fffcdfa151c56182966d7a3261343432e" "checksum substrate-bip39 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3be511be555a3633e71739a79e4ddff6a6aaa6579fa6114182a51d72c3eb93c5" -"checksum substrate-wasm-builder-runner 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bd48273fe9d7f92c1f7d6c1c537bb01c8068f925b47ad2cd8367e11dc32f8550" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab3af2eb31c42e8f0ccf43548232556c42737e01a96db6e1777b0be108e79799" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" diff --git a/Cargo.toml b/Cargo.toml index 42f78db493b50..f35cab80144e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,118 +1,139 @@ [workspace] members = [ - "core/authority-discovery", - "core/application-crypto", - "core/chain-spec", - "core/chain-spec/derive", - "core/cli", - "core/client", - "core/client/db", - "core/client/header-metadata", - "core/consensus/aura", - "core/consensus/babe", - "core/consensus/common", - "core/consensus/rhd", - "core/consensus/slots", - "core/consensus/uncles", - "core/consensus/pow", - "core/block-builder", - "core/block-builder/runtime-api", - "core/executor", - "core/executor/runtime-test", - "core/externalities", - "core/finality-grandpa", - "core/finality-grandpa/primitives", - "core/inherents", - "core/keyring", - "core/keystore", - "core/network", - "core/panic-handler", - "core/primitives", - "core/rpc", - "core/rpc/primitives", - "core/rpc-servers", - "core/runtime-interface", - "core/runtime-interface/proc-macro", - "core/runtime-interface/test-wasm", - "core/serializer", - "core/service", - "core/service/test", - "core/session", - "core/sr-api", - "core/sr-api/proc-macro", - "core/sr-api/test", - "core/sr-arithmetic", - "core/sr-io", - "core/sr-primitives", - "core/sr-staking-primitives", - "core/sr-sandbox", - "core/sr-std", - "core/sr-version", - "core/state-machine", - "core/telemetry", - "core/test-client", - "core/test-runtime", - "core/test-runtime/client", - "core/transaction-pool", - "core/transaction-pool/graph", - "core/transaction-pool/runtime-api", - "core/trie", - "core/utils/fork-tree", - "core/utils/wasm-builder", - "core/utils/wasm-builder-runner", - "core/wasm-interface", - "srml/support", - "srml/support/rpc", - "srml/support/procedural", - "srml/support/procedural/tools", - "srml/support/procedural/tools/derive", - "srml/support/test", - "srml/authorship", - "srml/assets", - "srml/aura", - "srml/balances", - "srml/contracts", - "srml/contracts/rpc", - "srml/collective", - "srml/democracy", - "srml/elections", - "srml/elections-phragmen", - "srml/example", - "srml/executive", - "srml/finality-tracker", - "srml/generic-asset", - "srml/grandpa", - "srml/im-online", - "srml/authority-discovery", - "srml/indices", - "srml/membership", - "srml/metadata", - "srml/nicks", - "srml/offences", - "srml/randomness-collective-flip", - "srml/scored-pool", - "srml/session", - "srml/staking", - "srml/staking/reward-curve", - "srml/sudo", - "srml/system", - "srml/system/rpc", - "srml/timestamp", - "srml/treasury", - "srml/transaction-payment", - "srml/transaction-payment/rpc", - "srml/utility", - "srml/evm", - "node/cli", - "node/executor", - "node/primitives", - "node/rpc", - "node/rpc-client", - "node/runtime", - "node/testing", - "node-template", - "subkey", - "test-utils/chain-spec-builder", + "bin/node-template", + "bin/node-template/runtime", + "bin/node/cli", + "bin/node/executor", + "bin/node/primitives", + "bin/node/rpc-client", + "bin/node/rpc", + "bin/node/runtime", + "bin/node/testing", + "bin/subkey", + "client", + "client/api", + "client/authority-discovery", + "client/basic-authorship", + "client/block-builder", + "client/chain-spec", + "client/chain-spec/derive", + "client/cli", + "client/consensus/aura", + "client/consensus/babe", + "client/consensus/pow", + "client/consensus/slots", + "client/consensus/uncles", + "client/db", + "client/executor", + "client/executor/runtime-test", + "client/finality-grandpa", + "client/header-metadata", + "client/keystore", + "client/network", + "client/offchain", + "client/rpc-servers", + "client/rpc", + "client/rpc/api", + "client/service", + "client/service/test", + "client/state-db", + "client/telemetry", + "client/transaction-pool", + "client/transaction-pool/graph", + "client/utils/wasm-builder-runner", + "paint/assets", + "paint/aura", + "paint/authority-discovery", + "paint/authorship", + "paint/babe", + "paint/balances", + "paint/collective", + "paint/contracts", + "paint/contracts/rpc", + "paint/contracts/rpc/runtime-api", + "paint/democracy", + "paint/elections-phragmen", + "paint/elections", + "paint/evm", + "paint/example", + "paint/executive", + "paint/finality-tracker", + "paint/generic-asset", + "paint/grandpa", + "paint/im-online", + "paint/indices", + "paint/membership", + "paint/metadata", + "paint/nicks", + "paint/offences", + "paint/randomness-collective-flip", + "paint/scored-pool", + "paint/session", + "paint/staking", + "paint/staking/reward-curve", + "paint/sudo", + "paint/support", + "paint/support/procedural", + "paint/support/procedural/tools", + "paint/support/procedural/tools/derive", + "paint/support/rpc", + "paint/support/test", + "paint/system", + "paint/system/rpc", + "paint/system/rpc/runtime-api", + "paint/timestamp", + "paint/transaction-payment", + "paint/transaction-payment/rpc", + "paint/transaction-payment/rpc/runtime-api", + "paint/treasury", + "paint/utility", + "primitives/application-crypto", + "primitives/authority-discovery", + "primitives/block-builder/runtime-api", + "primitives/consensus/aura", + "primitives/consensus/babe", + "primitives/consensus/common", + "primitives/consensus/pow", + "primitives/core", + "primitives/core/debug-derive", + "primitives/core/storage", + "primitives/externalities", + "primitives/finality-grandpa", + "primitives/inherents", + "primitives/keyring", + "primitives/offchain", + "primitives/panic-handler", + "primitives/peerset", + "primitives/phragmen", + "primitives/rpc", + "primitives/runtime-interface", + "primitives/runtime-interface/proc-macro", + "primitives/runtime-interface/test-wasm", + "primitives/serializer", + "primitives/session", + "primitives/sr-api", + "primitives/sr-api/proc-macro", + "primitives/sr-api/test", + "primitives/sr-arithmetic", + "primitives/sr-io", + "primitives/sr-primitives", + "primitives/sr-sandbox", + "primitives/sr-staking-primitives", + "primitives/sr-std", + "primitives/sr-version", + "primitives/state-machine", + "primitives/transaction-pool/runtime-api", + "primitives/trie", + "primitives/wasm-interface", + "test/utils/chain-spec-builder", + "test/utils/client", + "test/utils/primitives", + "test/utils/runtime", + "test/utils/runtime/client", + "test/utils/transaction-factory", + "utils/build-script-utils", + "utils/fork-tree", + "utils/wasm-builder", ] [profile.release] diff --git a/README.adoc b/README.adoc index 5caa3f932b23e..62673f70e48c7 100644 --- a/README.adoc +++ b/README.adoc @@ -4,525 +4,20 @@ :toc: :sectnums: -== Intro in one sentence - Substrate is a next-generation framework for blockchain innovation. -== Description - -At its heart, Substrate is a combination of three technologies: https://webassembly.org/[WebAssembly], https://libp2p.io/[Libp2p] and GRANDPA Consensus. About GRANDPA, see this https://hackmd.io/Jd0byWX0RiqFiXUVC78Bdw?view#GRANDPA[definition], https://medium.com/polkadot-network/grandpa-block-finality-in-polkadot-an-introduction-part-1-d08a24a021b5[introduction] and https://github.com/w3f/consensus/blob/master/pdf/grandpa.pdf[formal specification]. It is both a library for building new blockchains and a "skeleton key" of a blockchain client, able to synchronize to any Substrate-based chain. - -Substrate chains have three distinct features that make them "next-generation": a dynamic, self-defining state-transition function; light-client functionality from day one; and a progressive consensus algorithm with fast block production and adaptive, definite finality. The STF, encoded in WebAssembly, is known as the "runtime". This defines the `execute_block` function, and can specify everything from the staking algorithm, transaction semantics, logging mechanisms and procedures for replacing any aspect of itself or of the blockchain's state ("governance"). Because the runtime is entirely dynamic all of these can be switched out or upgraded at any time. A Substrate chain is very much a "living organism". - -See also https://www.parity.io/what-is-substrate/. - -== Usage - -Substrate is still an early stage project, and while it has already been used as the basis of major projects like Polkadot, using it is still a significant undertaking. In particular, you should have a good knowledge of blockchain concepts and basic cryptography. Terminology like header, block, client, hash, transaction and signature should be familiar. At present you will need a working knowledge of Rust to be able to do anything interesting (though eventually, we aim for this not to be the case). - -Substrate is designed for use in one of three ways: - -**1. Trivial**: By running the Substrate binary `substrate` and configuring it with a genesis block that includes the current demonstration runtime. In this case, you just build Substrate, configure a JSON file, and launch your own blockchain. This affords you the least amount of customizability, primarily allowing you to change the genesis parameters of the various included runtime modules such as balances, staking, block-period, fees, and governance. - -**2. Modular**: By hacking together modules from the Substrate Runtime Module Library (SRML) into a new runtime and possibly altering or reconfiguring the Substrate client's block authoring logic. This affords you a very large amount of freedom over your blockchain's logic, letting you change datatypes, add or remove modules, and crucially, add your own modules. Much can be changed without touching the block authoring logic (since it is generic). If this is the case, then the existing Substrate binary can be used for block authoring and syncing. If the block authoring logic needs to be tweaked, then a new, altered block authoring binary must be built as a separate project and used by validators. This is how the Polkadot relay chain is built and should suffice for almost all circumstances in the near to mid-term. - -**3. Generic**: The entire SRML can be ignored and the entire runtime designed and implemented from scratch. If desired, this can be done in a language other than Rust, provided it can target WebAssembly. If the runtime can be made compatible with the existing client's block authoring logic, then you can simply construct a new genesis block from your Wasm blob and launch your chain with the existing Rust-based Substrate client. If not, then you'll need to alter the client's block authoring logic accordingly. This is probably a useless option for most projects right now, but provides complete flexibility allowing for a long-term, far-reaching upgrade path for the Substrate paradigm. - -=== The Basics of Substrate - -Substrate is a blockchain platform with a completely generic state transition function. That said, it does come with both standards and conventions (particularly regarding the Runtime Module Library) regarding underlying data structures. Roughly speaking, these core datatypes correspond to +trait+s in terms of the actual non-negotiable standard and generic +struct+s in terms of the convention. - -``` -Header := Parent + ExtrinsicsRoot + StorageRoot + Digest -Block := Header + Extrinsics + Justifications -``` - -=== Extrinsics - -Extrinsics in Substrate are pieces of information from "the outside world" that are contained in the blocks of the chain. You might think "ahh, that means *transactions*": in fact, no. Extrinsics fall into two broad categories of which only one is *transactions*. The other is known as *inherents*. The difference between these two is that transactions are signed and gossiped on the network and can be deemed useful *per se*. This fits the mold of what you would call transactions in Bitcoin or Ethereum. - -Inherents, meanwhile, are not passed on the network and are not signed. They represent data which describes the environment but which cannot call upon anything to prove it such as a signature. Rather they are assumed to be "true" simply because a sufficiently large number of validators have agreed on them being reasonable. - -To give an example, there is the timestamp inherent, which sets the current timestamp of the block. This is not a fixed part of Substrate, but does come as part of the Substrate Runtime Module Library to be used as desired. No signature could fundamentally prove that a block were authored at a given time in quite the same way that a signature can "prove" the desire to spend some particular funds. Rather, it is the business of each validator to ensure that they believe the timestamp is set to something reasonable before they agree that the block candidate is valid. - -Other examples include the parachain-heads extrinsic in Polkadot and the "note-missed-proposal" extrinsic used in the Substrate Runtime Module Library to determine and punish or deactivate offline validators. - - -=== Runtime and API - -Substrate chains all have a runtime. The runtime is a WebAssembly "blob" that includes a number of entry-points. Some entry-points are required as part of the underlying Substrate specification. Others are merely convention and required for the default implementation of the Substrate client to be able to author blocks. - -If you want to develop a chain with Substrate, you will need to implement the `Core` trait. This `Core` trait generates an API with the minimum necessary functionality to interact with your runtime. A special macro is provided called `impl_runtime_apis!` that help you implement runtime API traits. All runtime API trait implementations need to be done in one call of the `impl_runtime_apis!` macro. All parameters and return values need to implement https://crates.io/crates/parity-codec[`parity-codec`] to be encodable and decodable. - -Here's a snippet of the Polkadot API implementation as of PoC-3: - -```rust -impl_runtime_apis! { - impl client_api::Core for Runtime { - fn version() -> RuntimeVersion { - VERSION - } - - fn execute_block(block: Block) { - Executive::execute_block(block) - } - - fn initialize_block(header: ::Header) { - Executive::initialize_block(&header) - } - } - // ---snip--- -} -``` - - -=== Inherent Extrinsics - -The Substrate Runtime Module Library includes functionality for timestamps and slashing. If used, these rely on "trusted" external information being passed in via inherent extrinsics. The Substrate reference block authoring client software will expect to be able to call into the runtime API with collated data (in the case of the reference Substrate authoring client, this is merely the current timestamp and which nodes were offline) in order to return the appropriate extrinsics ready for inclusion. If new inherent extrinsic types and data are to be used in a modified runtime, then it is this function (and its argument type) that would change. - -=== Block-authoring Logic - -In Substrate, there is a major distinction between blockchain *syncing* and block *authoring* ("authoring" is a more general term for what is called "mining" in Bitcoin). The first case might be referred to as a "full node" (or "light node" - Substrate supports both): authoring necessarily requires a synced node and, therefore, all authoring clients must necessarily be able to synchronize. However, the reverse is not true. The primary functionality that authoring nodes have which is not in "sync nodes" is threefold: transaction queue logic, inherent transaction knowledge and BFT consensus logic. BFT consensus logic is provided as a core element of Substrate and can be ignored since it is only exposed in the SDK under the `authorities()` API entry. - -Transaction queue logic in Substrate is designed to be as generic as possible, allowing a runtime to express which transactions are fit for inclusion in a block through the `initialize_block` and `apply_extrinsic` calls. However, more subtle aspects like prioritization and replacement policy must currently be expressed "hard coded" as part of the blockchain's authoring code. That said, Substrate's reference implementation for a transaction queue should be sufficient for an initial chain implementation. - -Inherent extrinsic knowledge is again somewhat generic, and the actual construction of the extrinsics is, by convention, delegated to the "soft code" in the runtime. If ever there needs to be additional extrinsic information in the chain, then both the block authoring logic will need to be altered to provide it into the runtime and the runtime's `inherent_extrinsics` call will need to use this extra information in order to construct any additional extrinsic transactions for inclusion in the block. - -== Roadmap - -=== So far - -- 0.1 "PoC-1": PBFT consensus, Wasm runtime engine, basic runtime modules. -- 0.2 "PoC-2": Libp2p - -=== In progress - -- AfG consensus -- Improved PoS -- Smart contract runtime module - -=== The future - -- Splitting out runtime modules into separate repo -- Introduce substrate executable (the skeleton-key runtime) -- Introduce basic but extensible transaction queue and block-builder and place them in the executable. -- DAO runtime module -- Audit - -== Trying out Substrate Node - -Substrate Node is Substrate's pre-baked blockchain client. You can run a development node locally or configure a new chain and launch your own global testnet. - -=== On Mac and Ubuntu - -To get going as fast as possible, there is a simple script that installs all required dependencies and installs Substrate into your path. Just open a terminal and run: - -[source, shell] ----- -curl https://getsubstrate.io -sSf | bash ----- - -You can start a local Substrate development chain with running `substrate --dev`. - -To create your own global network/cryptocurrency, you'll need to make a new Substrate Node chain specification file ("chainspec"). - -First let's get a template chainspec that you can edit. We'll use the "staging" chain, a sort of default chain that the node comes pre-configured with: - -[source, shell] ----- -substrate build-spec --chain=staging > ~/chainspec.json ----- - -Now, edit `~/chainspec.json` in your editor. There are a lot of individual fields for each module, and one very large one which contains the WebAssembly code blob for this chain. The easiest field to edit is the block `period`. Change it to 10 (seconds): - -[source, json] ----- - "timestamp": { - "minimumPeriod": 10 - }, ----- - -Now with this new chainspec file, you can build a "raw" chain definition for your new chain: - -[source, shell] ----- -substrate build-spec --chain ~/chainspec.json --raw > ~/mychain.json ----- - -This can be fed into Substrate: - -[source, shell] ----- -substrate --chain ~/mychain.json ----- - -It won't do much until you start producing blocks though, so to do that you'll need to use the `--validator` option together with passing the seed for the account(s) that is configured to be the initial authorities: - -[source, shell] ----- -substrate --chain ~/mychain.json --validator ----- - -You can distribute `mychain.json` so that everyone can synchronize and (depending on your authorities list) validate on your chain. - - -== Building - -=== Hacking on Substrate - -If you'd actually like to hack on Substrate, you can just grab the source code and -build it. Ensure you have Rust and the support software installed: - -==== Linux and Mac - -For Unix-based operating systems, you should run the following commands: - -[source, shell] ----- -curl https://sh.rustup.rs -sSf | sh - -rustup update nightly -rustup target add wasm32-unknown-unknown --toolchain nightly -rustup update stable ----- - -You will also need to install the following packages: - - - Linux: -[source, shell] -sudo apt install cmake pkg-config libssl-dev git clang libclang-dev - -- Linux on ARM: -`rust-lld` is required for linking wasm, but is missing on non Tier 1 platforms. -So, use this https://github.com/Plume-org/Plume/blob/master/script/wasm-deps.sh[script] -to build `lld` and create the symlink `/usr/bin/rust-lld` to the build binary. - - - Mac: -[source, shell] -brew install cmake pkg-config openssl git llvm - -To finish installation of Substrate, jump down to <>. - -==== Windows - -If you are trying to set up Substrate on Windows, you should do the following: - -1. First, you will need to download and install "Build Tools for Visual Studio:" - - * You can get it at this link: https://aka.ms/buildtools - * Run the installation file: `vs_buildtools.exe` - * Please ensure the Windows 10 SDK component is included when installing the Visual C++ Build Tools. - * image:https://i.imgur.com/zayVLmu.png[image] - * Restart your computer. - -2. Next, you need to install Rust: - - * Detailed instructions are provided by the https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windows[Rust Book]. - * Download from: https://www.rust-lang.org/tools/install - * Run the installation file: `rustup-init.exe` - > Note that it should not prompt you to install vs_buildtools since you did it in step 1. - * Choose "Default Installation." - * To get started, you need Cargo's bin directory (%USERPROFILE%\.cargo\bin) in your PATH environment variable. Future applications will automatically have the correct environment, but you may need to restart your current shell. - -3. Then, you will need to run some commands in CMD to set up your Wasm Build Environment: - - rustup update nightly - rustup update stable - rustup target add wasm32-unknown-unknown --toolchain nightly - -4. Then, you need to install LLVM: https://releases.llvm.org/download.html - -5. Next, you need to install OpenSSL, which we will do with `vcpkg`: - - mkdir \Tools - cd \Tools - git clone https://github.com/Microsoft/vcpkg.git - cd vcpkg - .\bootstrap-vcpkg.bat - .\vcpkg.exe install openssl:x64-windows-static - -6. After, you need to add OpenSSL to your System Variables. Note that in order for the following commands to work, you need to use Windows Powershell: - - $env:OPENSSL_DIR = 'C:\Tools\vcpkg\installed\x64-windows-static' - $env:OPENSSL_STATIC = 'Yes' - [System.Environment]::SetEnvironmentVariable('OPENSSL_DIR', $env:OPENSSL_DIR, [System.EnvironmentVariableTarget]::User) - [System.Environment]::SetEnvironmentVariable('OPENSSL_STATIC', $env:OPENSSL_STATIC, [System.EnvironmentVariableTarget]::User) - -7. Finally, you need to install `cmake`: https://cmake.org/download/ - -==== Shared Steps - -Then, grab the Substrate source code: - -[source, shell] ----- -git clone https://github.com/paritytech/substrate.git -cd substrate ----- - -Then build the code: - -[source, shell] ----- -cargo build # Builds all native code ----- - -You can run all the tests if you like: - -[source, shell] -cargo test --all - -Or just run the tests of a specific package (i.e. `cargo test -p srml-assets`) - -You can start a development chain with: - -[source, shell] -cargo run --release -- --dev - -Detailed logs may be shown by running the node with the following environment variables set: `RUST_LOG=debug RUST_BACKTRACE=1 cargo run --release \-- --dev`. - -If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet with two validator nodes for Alice and Bob, who are the initial authorities of the genesis chain specification that have been endowed with a testnet DOTs. We'll give each node a name and expose them so they are listed on link:https://telemetry.polkadot.io/#/Local%20Testnet[Telemetry]. You'll need two terminal windows open. - -We'll start Alice's Substrate node first on default TCP port 30333 with her chain database stored locally at `/tmp/alice`. The Bootnode ID of her node is `QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR`, which is generated from the `--node-key` value that we specify below: - -[source, shell] -cargo run --release \-- \ - --base-path /tmp/alice \ - --chain=local \ - --alice \ - --node-key 0000000000000000000000000000000000000000000000000000000000000001 \ - --telemetry-url ws://telemetry.polkadot.io:1024 \ - --validator - -In the second terminal, we'll run the following to start Bob's Substrate node on a different TCP port of 30334, and with his chain database stored locally at `/tmp/bob`. We'll specify a value for the `--bootnodes` option that will connect his node to Alice's Bootnode ID on TCP port 30333: - -[source, shell] -cargo run --release \-- \ - --base-path /tmp/bob \ - --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR \ - --chain=local \ - --bob \ - --port 30334 \ - --telemetry-url ws://telemetry.polkadot.io:1024 \ - --validator - -Additional Substrate CLI usage options are available and may be shown by running `cargo run \-- --help`. - -=== WASM binaries - -The WASM binaries are built during the normal `cargo build` process. To control the WASM binary building, -we support multiple environment variables: - -* `SKIP_WASM_BUILD` - Skips building any WASM binary. This is useful when only native should be recompiled. -* `BUILD_DUMMY_WASM_BINARY` - Builds dummy WASM binaries. These dummy binaries are empty and useful - for `cargo check` runs. -* `WASM_BUILD_TYPE` - Sets the build type for building WASM binaries. Supported values are `release` or `debug`. - By default the build type is equal to the build type used by the main build. -* `TRIGGER_WASM_BUILD` - Can be set to trigger a WASM build. On subsequent calls the value of the variable - needs to change. As WASM builder instructs `cargo` to watch for file changes - this environment variable should only be required in certain circumstances. -* `WASM_TARGET_DIRECTORY` - Will copy any build WASM binary to the given directory. The path needs - to be absolute. -* `WASM_BUILD_RUSTFLAGS` - Extend `RUSTFLAGS` given to `cargo build` while building the wasm binary. -* `WASM_BUILD_NO_COLOR` - Disable color output of the wasm build. - -Each project can be skipped individually by using the environment variable `SKIP_PROJECT_NAME_WASM_BUILD`. -Where `PROJECT_NAME` needs to be replaced by the name of the cargo project, e.g. `node-runtime` will -be `NODE_RUNTIME`. - -[[flaming-fir]] -=== Joining the Flaming Fir Testnet - -Flaming Fir is the new testnet for Substrate master (2.0) to test the latest development features. Please note that master is not compatible with the BBQ Birch, Charred Cherry, Dried Danta or Emberic Elm testnets. Ensure you have the dependencies listed above before compiling. - -Since Flaming Fir is targeting the master branch we make absolutely no guarantees of stability and/or persistence of the network. We might reset the chain at any time if it is necessary to deploy new changes. Currently, the validators are running with a client built from `d013bd900`, if you build from this commit you should be able to successfully sync, later commits may not work as new breaking changes may be introduced in master. - -Latest known working version: `a2a0eb5398d6223e531455b4c155ef053a4a3a2b` - -[source, shell] ----- -git clone https://github.com/paritytech/substrate.git -cd substrate -git checkout -b flaming-fir a2a0eb5398d6223e531455b4c155ef053a4a3a2b ----- - -You can run the tests if you like: - -[source, shell] -cargo test --all - -Start your node: - -[source, shell] -cargo run --release \-- - -To see a list of command line options, enter: - -[source, shell] -cargo run --release \-- --help - -For example, you can choose a custom node name: - -[source, shell] -cargo run --release \-- --name my_custom_name - -If you are successful, you will see your node syncing at https://telemetry.polkadot.io/#/Flaming%20Fir - -=== Joining the Emberic Elm Testnet - -Emberic Elm is the testnet for Substrate 1.0. Please note that 1.0 is not compatible with the BBQ Birch, Charred Cherry, Dried Danta or Flaming Fir testnets. -In order to join the Emberic Elm testnet you should build from the `v1.0` branch. Ensure you have the dependencies listed above before compiling. - -[source, shell] ----- -git clone https://github.com/paritytech/substrate.git -cd substrate -git checkout -b v1.0 origin/v1.0 ----- - -You can then follow the same steps for building and running as described above in <>. - -== Key management - -Keys in Substrate are stored in the keystore in the file system. To store keys into this keystore, -you need to use one of the two provided RPC calls. If your keys are encrypted or should be encrypted -by the keystore, you need to provide the key using one of the cli arguments `--password`, -`--password-interactive` or `--password-filename`. - -=== Recommended RPC call - -For most users who want to run a validator node, the `author_rotateKeys` RPC call is sufficient. -The RPC call will generate `N` Session keys for you and return their public keys. `N` is the number -of session keys configured in the runtime. The output of the RPC call can be used as input for the -`session::set_keys` transaction. - -``` -curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_rotateKeys", "id":1 }' localhost:9933 -``` - -=== Advanced RPC call - -If the Session keys need to match a fixed seed, they can be set individually key by key. The RPC call -expects the key seed and the key type. The key types supported by default in Substrate are listed -https://github.com/paritytech/substrate/blob/master/core/primitives/src/crypto.rs#L767[here], but the -user can declare any key type. - -``` -curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["KEY_TYPE", "SEED", "PUBLIC"],"id":1 }' localhost:9933 -``` - -`KEY_TYPE` - needs to be replaced with the 4-character key type identifier. -`SEED` - is the seed of the key. -`PUBLIC` - public key for the given key. - -== Documentation - -=== Viewing documentation for Substrate packages - -You can generate documentation for a Substrate Rust package and have it automatically open in your web browser using https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html#using-rustdoc-with-cargo[rustdoc with Cargo], -(of the The Rustdoc Book), by running the following command: - -``` -cargo doc --package --open -``` - -Replacing `` with one of the following (i.e. `cargo doc --package substrate --open`): - -* All Substrate Packages -[source, shell] -substrate -* Substrate Core -[source, shell] -substrate, substrate-cli, substrate-client, substrate-client-db, -substrate-consensus-common, substrate-consensus-rhd, -substrate-executor, substrate-finality-grandpa, substrate-keyring, substrate-keystore, substrate-network, -substrate-network-libp2p, substrate-primitives, substrate-rpc, substrate-rpc-servers, -substrate-serializer, substrate-service, substrate-service-test, substrate-state-db, -substrate-state-machine, substrate-telemetry, substrate-test-client, -substrate-test-runtime, substrate-transaction-graph, substrate-transaction-pool, -substrate-trie -* Substrate Runtime -[source, shell] -sr-api, sr-io, sr-primitives, sr-sandbox, sr-std, sr-version -* Substrate Runtime Module Library (SRML) -[source, shell] -srml-assets, srml-balances, srml-consensus, srml-contracts, srml-council, srml-democracy, srml-example, -srml-executive, srml-metadata, srml-session, srml-staking, srml-support, srml-system, srml-timestamp, -srml-treasury -* Node -[source, shell] -node-cli, node-consensus, node-executor, node-network, node-primitives, node-runtime -* Subkey -[source, shell] -subkey - -=== Contributing to documentation for Substrate packages - -https://doc.rust-lang.org/1.9.0/book/documentation.html[Document source code] for Substrate packages by annotating the source code with documentation comments. - -Example (generic): -```markdown -/// Summary -/// -/// Description -/// -/// # Panics -/// -/// # Errors -/// -/// # Safety -/// -/// # Examples -/// -/// Summary of Example 1 -/// -/// ```rust -/// // insert example 1 code here -/// ``` -/// -``` - -* Important notes: -** Documentation comments must use annotations with a triple slash `///` -** Modules are documented using `//!` -``` -//! Summary (of module) -//! -//! Description (of module) -``` -* Special section header is indicated with a hash `#`. -** `Panics` section requires an explanation if the function triggers a panic -** `Errors` section is for describing conditions under which a function of method returns `Err(E)` if it returns a `Result` -** `Safety` section requires an explanation if the function is `unsafe` -** `Examples` section includes examples of using the function or method -* Code block annotations for examples are included between triple graves, as shown above. -Instead of including the programming language to use for syntax highlighting as the annotation -after the triple graves, alternative annotations include the `ignore`, `text`, `should_panic`, or `no_run`. -* Summary sentence is a short high level single sentence of its functionality -* Description paragraph is for details additional to the summary sentence -* Missing documentation annotations may be used to identify where to generate warnings with `#![warn(missing_docs)]` -or errors `#![deny(missing_docs)]` -* Hide documentation for items with `#[doc(hidden)]` - -=== Contributing to documentation (tests, extended examples, macros) for Substrate packages - -The code block annotations in the `# Example` section may be used as https://doc.rust-lang.org/1.9.0/book/documentation.html#documentation-as-tests[documentation as tests and for extended examples]. - -* Important notes: -** Rustdoc will automatically add a `main()` wrapper around the code block to test it -** https://doc.rust-lang.org/1.9.0/book/documentation.html#documenting-macros[Documenting macros]. -** Documentation as tests examples are included when running `cargo test` +== Trying it out -== Contributing +Simply go to [substrate.dev](https://substrate.dev) and follow the instructions as listed. -=== Contributing Guidelines +== Contributions & Code of Conduct -include::CONTRIBUTING.adoc[] +Please follow the contributions guidelines as outlined in [`docs/CONTRIBUTING.adoc`](docs/CONTRIBUTING.adoc). In all communications and contributions, this project follows the [Contributor Covenant Code of Conduct](docs/CODE_OF_CONDUCT.adoc). -=== Contributor Code of Conduct +== Security -include::CODE_OF_CONDUCT.adoc[] +The security policy and procedures can be found in [`docs/SECURITY.md`](docs/SECURITY.md). == License -https://github.com/paritytech/substrate/blob/master/LICENSE[LICENSE] +GPL 3.0 see `LICENSE`-file in the repo root. \ No newline at end of file diff --git a/bin/node-template/Cargo.toml b/bin/node-template/Cargo.toml new file mode 100644 index 0000000000000..99ea7af798f16 --- /dev/null +++ b/bin/node-template/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "node-template" +version = "2.0.0" +authors = ["Anonymous"] +build = "build.rs" +edition = "2018" + +[[bin]] +name = "node-template" +path = "src/main.rs" + +[dependencies] +derive_more = "0.15.0" +futures = "0.1.29" +ctrlc = { version = "3.1.3", features = ["termination"] } +log = "0.4.8" +tokio = "0.1.22" +exit-future = "0.1.4" +parking_lot = "0.9.0" +codec = { package = "parity-scale-codec", version = "1.0.0" } +trie-root = "0.15.2" +sr-io = { path = "../../primitives/sr-io" } +substrate-cli = { path = "../../client/cli" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +substrate-executor = { path = "../../client/executor" } +substrate-service = { path = "../../client/service" } +inherents = { package = "substrate-inherents", path = "../../primitives/inherents" } +transaction-pool = { package = "substrate-transaction-pool", path = "../../client/transaction-pool" } +network = { package = "substrate-network", path = "../../client/network" } +aura = { package = "substrate-consensus-aura", path = "../../client/consensus/aura" } +aura-primitives = { package = "substrate-consensus-aura-primitives", path = "../../primitives/consensus/aura" } +grandpa = { package = "substrate-finality-grandpa", path = "../../client/finality-grandpa" } +grandpa-primitives = { package = "substrate-finality-grandpa-primitives", path = "../../primitives/finality-grandpa" } +substrate-client = { path = "../../client/" } +runtime = { package = "node-template-runtime", path = "runtime" } +sr-primitives = { path = "../../primitives/sr-primitives" } +basic-authorship = { package = "substrate-basic-authorship", path = "../../client/basic-authorship"} + +[build-dependencies] +vergen = "3.0.4" +build-script-utils = { package = "substrate-build-script-utils", path = "../../utils/build-script-utils" } diff --git a/node-template/LICENSE b/bin/node-template/LICENSE similarity index 100% rename from node-template/LICENSE rename to bin/node-template/LICENSE diff --git a/node-template/README.md b/bin/node-template/README.md similarity index 100% rename from node-template/README.md rename to bin/node-template/README.md diff --git a/node-template/build.rs b/bin/node-template/build.rs similarity index 100% rename from node-template/build.rs rename to bin/node-template/build.rs diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml new file mode 100644 index 0000000000000..17b1c59106cd7 --- /dev/null +++ b/bin/node-template/runtime/Cargo.toml @@ -0,0 +1,67 @@ +[package] +name = "node-template-runtime" +version = "2.0.0" +authors = ["Anonymous"] +edition = "2018" + +[dependencies] +aura = { package = "paint-aura", path = "../../../paint/aura", default-features = false } +aura-primitives = { package = "substrate-consensus-aura-primitives", path = "../../../primitives/consensus/aura", default-features = false } +balances = { package = "paint-balances", path = "../../../paint/balances", default-features = false } +block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../../primitives/block-builder/runtime-api", default-features = false} +codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } +executive = { package = "paint-executive", path = "../../../paint/executive", default-features = false } +grandpa = { package = "paint-grandpa", path = "../../../paint/grandpa", default-features = false } +indices = { package = "paint-indices", path = "../../../paint/indices", default-features = false } +inherents = { package = "substrate-inherents", path = "../../../primitives/inherents", default-features = false} +offchain-primitives = { package = "substrate-offchain-primitives", path = "../../../primitives/offchain", default-features = false } +primitives = { package = "substrate-primitives", path = "../../../primitives/core", default-features = false } +randomness-collective-flip = { package = "paint-randomness-collective-flip", path = "../../../paint/randomness-collective-flip", default-features = false } +rstd = { package = "sr-std", path = "../../../primitives/sr-std", default-features = false } +runtime-io = { package = "sr-io", path = "../../../primitives/sr-io", default-features = false } +safe-mix = { version = "1.0.0", default-features = false } +serde = { version = "1.0.101", optional = true, features = ["derive"] } +sr-api = { path = "../../../primitives/sr-api", default-features = false } +sr-primitives = { path = "../../../primitives/sr-primitives", default-features = false } +substrate-session = { path = "../../../primitives/session", default-features = false } +sudo = { package = "paint-sudo", path = "../../../paint/sudo", default-features = false } +support = { package = "paint-support", path = "../../../paint/support", default-features = false } +system = { package = "paint-system", path = "../../../paint/system", default-features = false } +timestamp = { package = "paint-timestamp", path = "../../../paint/timestamp", default-features = false } +transaction-payment = { package = "paint-transaction-payment", path = "../../../paint/transaction-payment", default-features = false } +tx-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../../../primitives/transaction-pool/runtime-api", default-features = false } +version = { package = "sr-version", path = "../../../primitives/sr-version", default-features = false } + +[build-dependencies] +wasm-builder-runner = { package = "substrate-wasm-builder-runner", path = "../../../client/utils/wasm-builder-runner", version = "1.0.4" } + +[features] +default = ["std"] +std = [ + "aura-primitives/std", + "aura/std", + "balances/std", + "block-builder-api/std", + "codec/std", + "executive/std", + "grandpa/std", + "indices/std", + "inherents/std", + "offchain-primitives/std", + "primitives/std", + "randomness-collective-flip/std", + "rstd/std", + "runtime-io/std", + "safe-mix/std", + "serde", + "sr-api/std", + "sr-primitives/std", + "substrate-session/std", + "sudo/std", + "support/std", + "system/std", + "timestamp/std", + "transaction-payment/std", + "tx-pool-api/std", + "version/std", +] diff --git a/node-template/runtime/build.rs b/bin/node-template/runtime/build.rs similarity index 100% rename from node-template/runtime/build.rs rename to bin/node-template/runtime/build.rs diff --git a/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs similarity index 100% rename from node-template/runtime/src/lib.rs rename to bin/node-template/runtime/src/lib.rs diff --git a/node-template/runtime/src/template.rs b/bin/node-template/runtime/src/template.rs similarity index 98% rename from node-template/runtime/src/template.rs rename to bin/node-template/runtime/src/template.rs index db7bd24b0e419..e28099d825e79 100644 --- a/node-template/runtime/src/template.rs +++ b/bin/node-template/runtime/src/template.rs @@ -6,7 +6,7 @@ /// For more guidance on Substrate modules, see the example module -/// https://github.com/paritytech/substrate/blob/master/srml/example/src/lib.rs +/// https://github.com/paritytech/substrate/blob/master/paint/example/src/lib.rs use support::{decl_module, decl_storage, decl_event, dispatch::Result}; use system::ensure_signed; diff --git a/scripts/init.sh b/bin/node-template/scripts/init.sh similarity index 100% rename from scripts/init.sh rename to bin/node-template/scripts/init.sh diff --git a/node-template/src/chain_spec.rs b/bin/node-template/src/chain_spec.rs similarity index 100% rename from node-template/src/chain_spec.rs rename to bin/node-template/src/chain_spec.rs diff --git a/node-template/src/cli.rs b/bin/node-template/src/cli.rs similarity index 100% rename from node-template/src/cli.rs rename to bin/node-template/src/cli.rs diff --git a/node-template/src/main.rs b/bin/node-template/src/main.rs similarity index 100% rename from node-template/src/main.rs rename to bin/node-template/src/main.rs diff --git a/node-template/src/service.rs b/bin/node-template/src/service.rs similarity index 99% rename from node-template/src/service.rs rename to bin/node-template/src/service.rs index 7967a1d2d4e8f..ad517d956b4c7 100644 --- a/node-template/src/service.rs +++ b/bin/node-template/src/service.rs @@ -12,6 +12,7 @@ use substrate_executor::native_executor_instance; pub use substrate_executor::NativeExecutor; use aura_primitives::sr25519::{AuthorityPair as AuraPair}; use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider}; +use basic_authorship; // Our native executor instance. native_executor_instance!( diff --git a/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml similarity index 53% rename from node/cli/Cargo.toml rename to bin/node/cli/Cargo.toml index 7af9497864e3e..ba7568f571e83 100644 --- a/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -34,41 +34,43 @@ rand = "0.7.2" structopt = "0.3.3" # primitives -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -sr-primitives = { path = "../../core/sr-primitives" } -babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../core/consensus/babe/primitives" } -grandpa_primitives = { package = "substrate-finality-grandpa-primitives", path = "../../core/finality-grandpa/primitives" } -authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", path = "../../core/authority-discovery/primitives"} +authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", path = "../../../primitives/authority-discovery"} +babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../../primitives/consensus/babe" } +grandpa_primitives = { package = "substrate-finality-grandpa-primitives", path = "../../../primitives/finality-grandpa" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +sr-primitives = { path = "../../../primitives/sr-primitives" } # core dependencies -runtime-io = { package = "sr-io", path = "../../core/sr-io" } -client = { package = "substrate-client", path = "../../core/client" } -inherents = { package = "substrate-inherents", path = "../../core/inherents" } -chain-spec = { package = "substrate-chain-spec", path = "../../core/chain-spec" } -transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" } -network = { package = "substrate-network", path = "../../core/network" } -babe = { package = "substrate-consensus-babe", path = "../../core/consensus/babe" } -grandpa = { package = "substrate-finality-grandpa", path = "../../core/finality-grandpa" } -authority-discovery = { package = "substrate-authority-discovery", path = "../../core/authority-discovery"} -keyring = { package = "substrate-keyring", path = "../../core/keyring" } -client_db = { package = "substrate-client-db", path = "../../core/client/db", default-features = false } -offchain = { package = "substrate-offchain", path = "../../core/offchain" } -substrate-rpc = { package = "substrate-rpc", path = "../../core/rpc" } -substrate-basic-authorship = { path = "../../core/basic-authorship" } -substrate-service = { path = "../../core/service", default-features = false } -substrate-telemetry = { package = "substrate-telemetry", path = "../../core/telemetry" } +runtime-io = { package = "sr-io", path = "../../../primitives/sr-io" } +client-api = { package = "substrate-client-api", path = "../../../client/api" } +client = { package = "substrate-client", path = "../../../client/" } +inherents = { package = "substrate-inherents", path = "../../../primitives/inherents" } +chain-spec = { package = "substrate-chain-spec", path = "../../../client/chain-spec" } +transaction_pool = { package = "substrate-transaction-pool", path = "../../../client/transaction-pool" } +network = { package = "substrate-network", path = "../../../client/network" } +babe = { package = "substrate-consensus-babe", path = "../../../client/consensus/babe" } +grandpa = { package = "substrate-finality-grandpa", path = "../../../client/finality-grandpa" } +keyring = { package = "substrate-keyring", path = "../../../primitives/keyring" } +client_db = { package = "substrate-client-db", path = "../../../client/db", default-features = false } +offchain = { package = "substrate-offchain", path = "../../../client/offchain" } +substrate-rpc = { package = "substrate-rpc", path = "../../../client/rpc" } +substrate-basic-authorship = { path = "../../../client/basic-authorship" } +substrate-service = { path = "../../../client/service", default-features = false } +substrate-telemetry = { package = "substrate-telemetry", path = "../../../client/telemetry" } +authority-discovery = { package = "substrate-authority-discovery", path = "../../../client/authority-discovery"} + +# paint dependencies +indices = { package = "paint-indices", path = "../../../paint/indices" } +timestamp = { package = "paint-timestamp", path = "../../../paint/timestamp", default-features = false } +finality_tracker = { package = "paint-finality-tracker", path = "../../../paint/finality-tracker", default-features = false } +contracts = { package = "paint-contracts", path = "../../../paint/contracts" } +system = { package = "paint-system", path = "../../../paint/system" } +balances = { package = "paint-balances", path = "../../../paint/balances" } +transaction-payment = { package = "paint-transaction-payment", path = "../../../paint/transaction-payment" } +support = { package = "paint-support", path = "../../../paint/support", default-features = false } +im_online = { package = "paint-im-online", path = "../../../paint/im-online", default-features = false } +sr-authority-discovery = { package = "paint-authority-discovery", path = "../../../paint/authority-discovery"} -# srml dependencies -indices = { package = "srml-indices", path = "../../srml/indices" } -timestamp = { package = "srml-timestamp", path = "../../srml/timestamp", default-features = false } -finality_tracker = { package = "srml-finality-tracker", path = "../../srml/finality-tracker", default-features = false } -contracts = { package = "srml-contracts", path = "../../srml/contracts" } -system = { package = "srml-system", path = "../../srml/system" } -balances = { package = "srml-balances", path = "../../srml/balances" } -transaction-payment = { package = "srml-transaction-payment", path = "../../srml/transaction-payment" } -support = { package = "srml-support", path = "../../srml/support", default-features = false } -im_online = { package = "srml-im-online", path = "../../srml/im-online", default-features = false } -sr-authority-discovery = { package = "srml-authority-discovery", path = "../../srml/authority-discovery", default-features = false } # node-specific dependencies node-runtime = { path = "../runtime" } @@ -79,8 +81,8 @@ node-executor = { path = "../executor" } # CLI-specific dependencies tokio = { version = "0.1.22", optional = true } exit-future = { version = "0.1.4", optional = true } -substrate-cli = { path = "../../core/cli", optional = true } -transaction-factory = { path = "../../test-utils/transaction-factory", optional = true } +substrate-cli = { path = "../../../client/cli", optional = true } +transaction-factory = { path = "../../../test/utils/transaction-factory", optional = true } ctrlc = { version = "3.1.3", features = ["termination"], optional = true } # WASM-specific dependencies @@ -95,16 +97,16 @@ kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="b031 rand6 = { package = "rand", version = "0.6", features = ["wasm-bindgen"], optional = true } # Imported just for the `wasm-bindgen` feature [dev-dependencies] -keystore = { package = "substrate-keystore", path = "../../core/keystore" } -babe = { package = "substrate-consensus-babe", path = "../../core/consensus/babe", features = ["test-helpers"] } -consensus-common = { package = "substrate-consensus-common", path = "../../core/consensus/common" } -service-test = { package = "substrate-service-test", path = "../../core/service/test" } +keystore = { package = "substrate-keystore", path = "../../../client/keystore" } +babe = { package = "substrate-consensus-babe", path = "../../../client/consensus/babe", features = ["test-helpers"] } +consensus-common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" } +service-test = { package = "substrate-service-test", path = "../../../client/service/test" } futures03 = { package = "futures-preview", version = "0.3.0-alpha.19" } tempfile = "3.1.0" [build-dependencies] -substrate-cli = { package = "substrate-cli", path = "../../core/cli" } -build-script-utils = { package = "substrate-build-script-utils", path = "../../core/utils/build-script-utils" } +substrate-cli = { package = "substrate-cli", path = "../../../client/cli" } +build-script-utils = { package = "substrate-build-script-utils", path = "../../../utils/build-script-utils" } structopt = "0.3.3" vergen = "3.0.4" diff --git a/node/cli/bin/main.rs b/bin/node/cli/bin/main.rs similarity index 100% rename from node/cli/bin/main.rs rename to bin/node/cli/bin/main.rs diff --git a/node/cli/browser-demo/.gitignore b/bin/node/cli/browser-demo/.gitignore similarity index 100% rename from node/cli/browser-demo/.gitignore rename to bin/node/cli/browser-demo/.gitignore diff --git a/node/cli/browser-demo/README.md b/bin/node/cli/browser-demo/README.md similarity index 100% rename from node/cli/browser-demo/README.md rename to bin/node/cli/browser-demo/README.md diff --git a/node/cli/browser-demo/build.sh b/bin/node/cli/browser-demo/build.sh similarity index 100% rename from node/cli/browser-demo/build.sh rename to bin/node/cli/browser-demo/build.sh diff --git a/node/cli/browser-demo/favicon.png b/bin/node/cli/browser-demo/favicon.png similarity index 100% rename from node/cli/browser-demo/favicon.png rename to bin/node/cli/browser-demo/favicon.png diff --git a/node/cli/browser-demo/index.html b/bin/node/cli/browser-demo/index.html similarity index 100% rename from node/cli/browser-demo/index.html rename to bin/node/cli/browser-demo/index.html diff --git a/node/cli/browser-demo/ws.js b/bin/node/cli/browser-demo/ws.js similarity index 100% rename from node/cli/browser-demo/ws.js rename to bin/node/cli/browser-demo/ws.js diff --git a/node/cli/build.rs b/bin/node/cli/build.rs similarity index 100% rename from node/cli/build.rs rename to bin/node/cli/build.rs diff --git a/node/cli/doc/shell-completion.adoc b/bin/node/cli/doc/shell-completion.adoc similarity index 100% rename from node/cli/doc/shell-completion.adoc rename to bin/node/cli/doc/shell-completion.adoc diff --git a/node/cli/res/flaming-fir.json b/bin/node/cli/res/flaming-fir.json similarity index 100% rename from node/cli/res/flaming-fir.json rename to bin/node/cli/res/flaming-fir.json diff --git a/node/cli/src/browser.rs b/bin/node/cli/src/browser.rs similarity index 100% rename from node/cli/src/browser.rs rename to bin/node/cli/src/browser.rs diff --git a/node/cli/src/chain_spec.rs b/bin/node/cli/src/chain_spec.rs similarity index 100% rename from node/cli/src/chain_spec.rs rename to bin/node/cli/src/chain_spec.rs diff --git a/node/cli/src/cli.rs b/bin/node/cli/src/cli.rs similarity index 100% rename from node/cli/src/cli.rs rename to bin/node/cli/src/cli.rs diff --git a/node/cli/src/factory_impl.rs b/bin/node/cli/src/factory_impl.rs similarity index 100% rename from node/cli/src/factory_impl.rs rename to bin/node/cli/src/factory_impl.rs diff --git a/node/cli/src/lib.rs b/bin/node/cli/src/lib.rs similarity index 100% rename from node/cli/src/lib.rs rename to bin/node/cli/src/lib.rs diff --git a/node/cli/src/service.rs b/bin/node/cli/src/service.rs similarity index 99% rename from node/cli/src/service.rs rename to bin/node/cli/src/service.rs index 3afa57b59c1c4..f4c0ad69f1427 100644 --- a/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -283,7 +283,7 @@ pub fn new_full(config: NodeConfiguration) TransactionPool>, OffchainWorkers< ConcreteClient, - >::OffchainStorage, + >::OffchainStorage, ConcreteBlock, > >, diff --git a/bin/node/executor/Cargo.toml b/bin/node/executor/Cargo.toml new file mode 100644 index 0000000000000..5526b9691c07d --- /dev/null +++ b/bin/node/executor/Cargo.toml @@ -0,0 +1,48 @@ +[package] +name = "node-executor" +version = "2.0.0" +authors = ["Parity Technologies "] +description = "Substrate node implementation in Rust." +edition = "2018" + +[dependencies] +trie-root = "0.15.2" +codec = { package = "parity-scale-codec", version = "1.0.0" } +runtime_io = { package = "sr-io", path = "../../../primitives/sr-io" } +state_machine = { package = "substrate-state-machine", path = "../../../primitives/state-machine" } +substrate-executor = { path = "../../../client/executor" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +trie = { package = "substrate-trie", path = "../../../primitives/trie" } +node-primitives = { path = "../primitives" } +node-runtime = { path = "../runtime" } + +[dev-dependencies] +node-testing = { path = "../testing" } +test-client = { package = "substrate-test-client", path = "../../../test/utils/client" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +runtime_support = { package = "paint-support", path = "../../../paint/support" } +balances = { package = "paint-balances", path = "../../../paint/balances" } +transaction-payment = { package = "paint-transaction-payment", path = "../../../paint/transaction-payment" } +session = { package = "paint-session", path = "../../../paint/session" } +system = { package = "paint-system", path = "../../../paint/system" } +timestamp = { package = "paint-timestamp", path = "../../../paint/timestamp" } +treasury = { package = "paint-treasury", path = "../../../paint/treasury" } +contracts = { package = "paint-contracts", path = "../../../paint/contracts" } +grandpa = { package = "paint-grandpa", path = "../../../paint/grandpa" } +indices = { package = "paint-indices", path = "../../../paint/indices" } +wabt = "0.9.2" +criterion = "0.3.0" + +[features] +wasmtime = [ + "substrate-executor/wasmtime", +] +wasmi-errno = [ + "substrate-executor/wasmi-errno", +] +stress-test = [] + +[[bench]] +name = "bench" +harness = false + diff --git a/node/executor/benches/bench.rs b/bin/node/executor/benches/bench.rs similarity index 100% rename from node/executor/benches/bench.rs rename to bin/node/executor/benches/bench.rs diff --git a/node/executor/src/lib.rs b/bin/node/executor/src/lib.rs similarity index 100% rename from node/executor/src/lib.rs rename to bin/node/executor/src/lib.rs diff --git a/node/primitives/Cargo.toml b/bin/node/primitives/Cargo.toml similarity index 50% rename from node/primitives/Cargo.toml rename to bin/node/primitives/Cargo.toml index 25725449a3a5a..1f632dda8dd5c 100644 --- a/node/primitives/Cargo.toml +++ b/bin/node/primitives/Cargo.toml @@ -5,11 +5,11 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } +primitives = { package = "substrate-primitives", path = "../../../primitives/core", default-features = false } +sr-primitives = { path = "../../../primitives/sr-primitives", default-features = false } [dev-dependencies] -substrate-serializer = { path = "../../core/serializer" } +substrate-serializer = { path = "../../../primitives/serializer" } pretty_assertions = "0.6.1" [features] diff --git a/node/primitives/src/lib.rs b/bin/node/primitives/src/lib.rs similarity index 100% rename from node/primitives/src/lib.rs rename to bin/node/primitives/src/lib.rs diff --git a/node/rpc-client/Cargo.toml b/bin/node/rpc-client/Cargo.toml similarity index 82% rename from node/rpc-client/Cargo.toml rename to bin/node/rpc-client/Cargo.toml index bc30f598bbc22..882dd7ee2b629 100644 --- a/node/rpc-client/Cargo.toml +++ b/bin/node/rpc-client/Cargo.toml @@ -11,4 +11,4 @@ hyper = "0.12.35" jsonrpc-core-client = { version = "14.0.3", features = ["http", "ws"] } log = "0.4.8" node-primitives = { path = "../primitives" } -substrate-rpc = { path = "../../core/rpc", version = "2.0.0" } +substrate-rpc = { path = "../../../client/rpc", version = "2.0.0" } diff --git a/node/rpc-client/src/main.rs b/bin/node/rpc-client/src/main.rs similarity index 100% rename from node/rpc-client/src/main.rs rename to bin/node/rpc-client/src/main.rs diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml new file mode 100644 index 0000000000000..18f63f6b40f0f --- /dev/null +++ b/bin/node/rpc/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "node-rpc" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +client = { package = "substrate-client", path = "../../../client/" } +jsonrpc-core = "14.0.3" +node-primitives = { path = "../primitives" } +node-runtime = { path = "../runtime" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +paint-contracts-rpc = { path = "../../../paint/contracts/rpc/" } +paint-transaction-payment-rpc = { path = "../../../paint/transaction-payment/rpc/" } +paint-system-rpc = { path = "../../../paint/system/rpc/" } +transaction_pool = { package = "substrate-transaction-pool", path = "../../../client/transaction-pool" } diff --git a/node/rpc/src/lib.rs b/bin/node/rpc/src/lib.rs similarity index 81% rename from node/rpc/src/lib.rs rename to bin/node/rpc/src/lib.rs index 99321373f8f8c..fd8dc2a5a7a6c 100644 --- a/node/rpc/src/lib.rs +++ b/bin/node/rpc/src/lib.rs @@ -19,7 +19,7 @@ //! Since `substrate` core functionality makes no assumptions //! about the modules used inside the runtime, so do //! RPC methods defined in `substrate-rpc` crate. -//! It means that `core/rpc` can't have any methods that +//! It means that `client/rpc` can't have any methods that //! need some strong assumptions about the particular runtime. //! //! The RPCs available in this crate however can make some assumptions @@ -41,15 +41,15 @@ pub fn create(client: Arc, pool: Arc>) -> jsonrpc_core::IoHa C: ProvideRuntimeApi, C: client::blockchain::HeaderBackend, C: Send + Sync + 'static, - C::Api: srml_system_rpc::AccountNonceApi, - C::Api: srml_contracts_rpc::ContractsRuntimeApi, - C::Api: srml_transaction_payment_rpc::TransactionPaymentRuntimeApi, + C::Api: paint_system_rpc::AccountNonceApi, + C::Api: paint_contracts_rpc::ContractsRuntimeApi, + C::Api: paint_transaction_payment_rpc::TransactionPaymentRuntimeApi, P: ChainApi + Sync + Send + 'static, M: jsonrpc_core::Metadata + Default, { - use srml_system_rpc::{System, SystemApi}; - use srml_contracts_rpc::{Contracts, ContractsApi}; - use srml_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi}; + use paint_system_rpc::{System, SystemApi}; + use paint_contracts_rpc::{Contracts, ContractsApi}; + use paint_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi}; let mut io = jsonrpc_core::IoHandler::default(); io.extend_with( diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml new file mode 100644 index 0000000000000..2cc7f84e8574c --- /dev/null +++ b/bin/node/runtime/Cargo.toml @@ -0,0 +1,122 @@ +[package] +name = "node-runtime" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" +build = "build.rs" + +[dependencies] +# third-party dependencies +codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] } +integer-sqrt = { version = "0.1.2" } +safe-mix = { version = "1.0", default-features = false } +rustc-hex = { version = "2.0", optional = true } +serde = { version = "1.0.102", optional = true } + +# primitives +authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", path = "../../../primitives/authority-discovery", default-features = false } +babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../../primitives/consensus/babe", default-features = false } +block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../../primitives/block-builder/runtime-api", default-features = false} +inherents = { package = "substrate-inherents", path = "../../../primitives/inherents", default-features = false } +node-primitives = { path = "../primitives", default-features = false } +offchain-primitives = { package = "substrate-offchain-primitives", path = "../../../primitives/offchain", default-features = false } +primitives = { package = "substrate-primitives", path = "../../../primitives/core", default-features = false } +rstd = { package = "sr-std", path = "../../../primitives/sr-std", default-features = false } +sr-api = { path = "../../../primitives/sr-api", default-features = false } +sr-primitives = { path = "../../../primitives/sr-primitives", default-features = false } +sr-staking-primitives = { path = "../../../primitives/sr-staking-primitives", default-features = false } +substrate-keyring = { path = "../../../primitives/keyring", optional = true } +substrate-session = { path = "../../../primitives/session", default-features = false } +tx-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../../../primitives/transaction-pool/runtime-api", default-features = false } +version = { package = "sr-version", path = "../../../primitives/sr-version", default-features = false } + +# paint dependencies +authority-discovery = { package = "paint-authority-discovery", path = "../../../paint/authority-discovery", default-features = false } +authorship = { package = "paint-authorship", path = "../../../paint/authorship", default-features = false } +babe = { package = "paint-babe", path = "../../../paint/babe", default-features = false } +balances = { package = "paint-balances", path = "../../../paint/balances", default-features = false } +collective = { package = "paint-collective", path = "../../../paint/collective", default-features = false } +contracts = { package = "paint-contracts", path = "../../../paint/contracts", default-features = false } +contracts-rpc-runtime-api = { package = "paint-contracts-rpc-runtime-api", path = "../../../paint/contracts/rpc/runtime-api/", default-features = false } +democracy = { package = "paint-democracy", path = "../../../paint/democracy", default-features = false } +elections-phragmen = { package = "paint-elections-phragmen", path = "../../../paint/elections-phragmen", default-features = false } +executive = { package = "paint-executive", path = "../../../paint/executive", default-features = false } +finality-tracker = { package = "paint-finality-tracker", path = "../../../paint/finality-tracker", default-features = false } +grandpa = { package = "paint-grandpa", path = "../../../paint/grandpa", default-features = false } +im-online = { package = "paint-im-online", path = "../../../paint/im-online", default-features = false } +indices = { package = "paint-indices", path = "../../../paint/indices", default-features = false } +membership = { package = "paint-membership", path = "../../../paint/membership", default-features = false } +nicks = { package = "paint-nicks", path = "../../../paint/nicks", default-features = false } +offences = { package = "paint-offences", path = "../../../paint/offences", default-features = false } +randomness-collective-flip = { package = "paint-randomness-collective-flip", path = "../../../paint/randomness-collective-flip", default-features = false } +session = { package = "paint-session", path = "../../../paint/session", default-features = false, features = ["historical"] } +staking = { package = "paint-staking", path = "../../../paint/staking", default-features = false } +paint-staking-reward-curve = { path = "../../../paint/staking/reward-curve"} +sudo = { package = "paint-sudo", path = "../../../paint/sudo", default-features = false } +support = { package = "paint-support", path = "../../../paint/support", default-features = false } +system = { package = "paint-system", path = "../../../paint/system", default-features = false } +system-rpc-runtime-api = { package = "paint-system-rpc-runtime-api", path = "../../../paint/system/rpc/runtime-api/", default-features = false } +timestamp = { package = "paint-timestamp", path = "../../../paint/timestamp", default-features = false } +treasury = { package = "paint-treasury", path = "../../../paint/treasury", default-features = false } +utility = { package = "paint-utility", path = "../../../paint/utility", default-features = false } +transaction-payment = { package = "paint-transaction-payment", path = "../../../paint/transaction-payment", default-features = false } +transaction-payment-rpc-runtime-api = { package = "paint-transaction-payment-rpc-runtime-api", path = "../../../paint/transaction-payment/rpc/runtime-api/", default-features = false } + +[build-dependencies] +wasm-builder-runner = { package = "substrate-wasm-builder-runner", path = "../../../client/utils/wasm-builder-runner", version = "1.0.4" } + +[dev-dependencies] +runtime_io = { package = "sr-io", path = "../../../primitives/sr-io" } + +[features] +default = ["std"] +std = [ + "authority-discovery-primitives/std", + "authority-discovery/std", + "authorship/std", + "babe-primitives/std", + "babe/std", + "balances/std", + "block-builder-api/std", + "codec/std", + "collective/std", + "contracts-rpc-runtime-api/std", + "contracts/std", + "democracy/std", + "elections-phragmen/std", + "executive/std", + "finality-tracker/std", + "grandpa/std", + "im-online/std", + "indices/std", + "inherents/std", + "membership/std", + "nicks/std", + "node-primitives/std", + "offchain-primitives/std", + "offences/std", + "primitives/std", + "randomness-collective-flip/std", + "rstd/std", + "rustc-hex", + "safe-mix/std", + "serde", + "session/std", + "sr-api/std", + "sr-primitives/std", + "sr-staking-primitives/std", + "staking/std", + "substrate-keyring", + "substrate-session/std", + "sudo/std", + "support/std", + "system-rpc-runtime-api/std", + "system/std", + "timestamp/std", + "transaction-payment-rpc-runtime-api/std", + "transaction-payment/std", + "treasury/std", + "tx-pool-api/std", + "utility/std", + "version/std", +] diff --git a/core/executor/runtime-test/build.rs b/bin/node/runtime/build.rs similarity index 96% rename from core/executor/runtime-test/build.rs rename to bin/node/runtime/build.rs index 68e5205f0c7a8..d6b0ae626facb 100644 --- a/core/executor/runtime-test/build.rs +++ b/bin/node/runtime/build.rs @@ -20,7 +20,7 @@ fn main() { build_current_project_with_rustflags( "wasm_binary.rs", WasmBuilderSource::CratesOrPath { - path: "../../utils/wasm-builder", + path: "../../../utils/wasm-builder", version: "1.0.8", }, // This instructs LLD to export __heap_base as a global variable, which is used by the diff --git a/node/runtime/src/constants.rs b/bin/node/runtime/src/constants.rs similarity index 100% rename from node/runtime/src/constants.rs rename to bin/node/runtime/src/constants.rs diff --git a/node/runtime/src/impls.rs b/bin/node/runtime/src/impls.rs similarity index 100% rename from node/runtime/src/impls.rs rename to bin/node/runtime/src/impls.rs diff --git a/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs similarity index 99% rename from node/runtime/src/lib.rs rename to bin/node/runtime/src/lib.rs index 8870db7265625..26c8288a4c911 100644 --- a/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -235,7 +235,7 @@ impl session::historical::Trait for Runtime { type FullIdentificationOf = staking::ExposureOf; } -srml_staking_reward_curve::build! { +paint_staking_reward_curve::build! { const REWARD_CURVE: PiecewiseLinear<'static> = curve!( min_inflation: 0_025_000, max_inflation: 0_100_000, diff --git a/bin/node/testing/Cargo.toml b/bin/node/testing/Cargo.toml new file mode 100644 index 0000000000000..1f585c19a9b30 --- /dev/null +++ b/bin/node/testing/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "node-testing" +version = "2.0.0" +authors = ["Parity Technologies "] +description = "Test utilities for Substrate node." +edition = "2018" + +[dependencies] +balances = { package = "paint-balances", path = "../../../paint/balances" } +client = { package = "substrate-client", path = "../../../client/" } +codec = { package = "parity-scale-codec", version = "1.0.0" } +contracts = { package = "paint-contracts", path = "../../../paint/contracts" } +grandpa = { package = "paint-grandpa", path = "../../../paint/grandpa" } +indices = { package = "paint-indices", path = "../../../paint/indices" } +keyring = { package = "substrate-keyring", path = "../../../primitives/keyring" } +node-executor = { path = "../executor" } +node-primitives = { path = "../primitives" } +node-runtime = { path = "../runtime" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +runtime-io = { package = "sr-io", path = "../../../primitives/sr-io" } +runtime_support = { package = "paint-support", path = "../../../paint/support" } +session = { package = "paint-session", path = "../../../paint/session" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +staking = { package = "paint-staking", path = "../../../paint/staking" } +substrate-executor = { path = "../../../client/executor" } +system = { package = "paint-system", path = "../../../paint/system" } +test-client = { package = "substrate-test-client", path = "../../../test/utils/client" } +timestamp = { package = "paint-timestamp", path = "../../../paint/timestamp" } +transaction-payment = { package = "paint-transaction-payment", path = "../../../paint/transaction-payment" } +treasury = { package = "paint-treasury", path = "../../../paint/treasury" } +wabt = "0.9.2" diff --git a/node/testing/src/client.rs b/bin/node/testing/src/client.rs similarity index 100% rename from node/testing/src/client.rs rename to bin/node/testing/src/client.rs diff --git a/node/testing/src/genesis.rs b/bin/node/testing/src/genesis.rs similarity index 100% rename from node/testing/src/genesis.rs rename to bin/node/testing/src/genesis.rs diff --git a/node/testing/src/keyring.rs b/bin/node/testing/src/keyring.rs similarity index 100% rename from node/testing/src/keyring.rs rename to bin/node/testing/src/keyring.rs diff --git a/node/testing/src/lib.rs b/bin/node/testing/src/lib.rs similarity index 100% rename from node/testing/src/lib.rs rename to bin/node/testing/src/lib.rs diff --git a/subkey/Cargo.toml b/bin/subkey/Cargo.toml similarity index 61% rename from subkey/Cargo.toml rename to bin/subkey/Cargo.toml index e1c3ef64d26d4..2a3a8318c9e85 100644 --- a/subkey/Cargo.toml +++ b/bin/subkey/Cargo.toml @@ -5,10 +5,10 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -primitives = { package = "substrate-primitives", version = "*", path = "../core/primitives" } +primitives = { package = "substrate-primitives", version = "*", path = "../../primitives/core" } node-runtime = { version = "*", path = "../node/runtime" } node-primitives = { version = "*", path = "../node/primitives" } -sr-primitives = { version = "*", path = "../core/sr-primitives" } +sr-primitives = { version = "*", path = "../../primitives/sr-primitives" } rand = "0.7.2" clap = { version = "2.33.0", features = ["yaml"] } tiny-bip39 = "0.6.2" @@ -17,9 +17,9 @@ substrate-bip39 = "0.3.1" hex = "0.3.2" hex-literal = "0.2.1" codec = { package = "parity-scale-codec", version = "1.0.0" } -system = { package = "srml-system", path = "../srml/system" } -balances = { package = "srml-balances", path = "../srml/balances" } -transaction-payment = { package = "srml-transaction-payment", path = "../srml/transaction-payment" } +system = { package = "paint-system", path = "../../paint/system" } +balances = { package = "paint-balances", path = "../../paint/balances" } +transaction-payment = { package = "paint-transaction-payment", path = "../../paint/transaction-payment" } [features] bench = [] diff --git a/subkey/README.adoc b/bin/subkey/README.adoc similarity index 100% rename from subkey/README.adoc rename to bin/subkey/README.adoc diff --git a/subkey/src/cli.yml b/bin/subkey/src/cli.yml similarity index 100% rename from subkey/src/cli.yml rename to bin/subkey/src/cli.yml diff --git a/subkey/src/main.rs b/bin/subkey/src/main.rs similarity index 100% rename from subkey/src/main.rs rename to bin/subkey/src/main.rs diff --git a/subkey/src/vanity.rs b/bin/subkey/src/vanity.rs similarity index 100% rename from subkey/src/vanity.rs rename to bin/subkey/src/vanity.rs diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100755 index b1b7dd3edf356..0000000000000 --- a/ci/script.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -eux - -# Enable warnings about unused extern crates -export RUSTFLAGS=" -W unused-extern-crates" - -# Install rustup and the specified rust toolchain. -curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=$RUST_TOOLCHAIN -y - -# Load cargo environment. Specifically, put cargo into PATH. -source ~/.cargo/env - -rustc --version -rustup --version -cargo --version - -case $TARGET in - "native") - sudo apt-get -y update - sudo apt-get install -y cmake pkg-config libssl-dev - - cargo test --all --release --locked "$@" - ;; - - "wasm") - # Install prerequisites and build all wasm projects - ./scripts/init.sh - ./scripts/build.sh "$@" - ;; -esac diff --git a/core/client/Cargo.toml b/client/Cargo.toml similarity index 60% rename from core/client/Cargo.toml rename to client/Cargo.toml index ea36b2fc4449c..194d3689cb9ee 100644 --- a/core/client/Cargo.toml +++ b/client/Cargo.toml @@ -5,36 +5,37 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] +client-api = { package = "substrate-client-api", path = "api" } +block-builder = { package = "substrate-block-builder", path = "block-builder" } +codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } +consensus = { package = "substrate-consensus-common", path = "../primitives/consensus/common" } +kvdb = { git = "https://github.com/paritytech/parity-common", rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" } derive_more = { version = "0.15.0" } +executor = { package = "substrate-executor", path = "executor" } fnv = { version = "1.0.6" } -log = { version = "0.4.8" } -parking_lot = { version = "0.9.0" } -hex-literal = { version = "0.2.1" } futures = { version = "0.1.29" } futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } -consensus = { package = "substrate-consensus-common", path = "../consensus/common" } -executor = { package = "substrate-executor", path = "../executor" } -state-machine = { package = "substrate-state-machine", path = "../state-machine" } -keyring = { package = "substrate-keyring", path = "../keyring" } -trie = { package = "substrate-trie", path = "../trie" } -substrate-telemetry = { path = "../telemetry" } hash-db = { version = "0.15.2" } -kvdb = { git = "https://github.com/paritytech/parity-common", rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" } -codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } -primitives = { package = "substrate-primitives", path = "../primitives" } -sr-primitives = { path = "../sr-primitives" } -runtime-version = { package = "sr-version", path = "../sr-version" } -rstd = { package = "sr-std", path = "../sr-std" } -inherents = { package = "substrate-inherents", path = "../inherents" } -sr-api = { path = "../sr-api" } header-metadata = { package = "substrate-header-metadata", path = "header-metadata" } -block-builder = { package = "substrate-block-builder", path = "../block-builder" } +hex-literal = { version = "0.2.1" } +inherents = { package = "substrate-inherents", path = "../primitives/inherents" } +keyring = { package = "substrate-keyring", path = "../primitives/keyring" } +log = { version = "0.4.8" } +parking_lot = { version = "0.9.0" } +primitives = { package = "substrate-primitives", path = "../primitives/core" } +rstd = { package = "sr-std", path = "../primitives/sr-std" } +runtime-version = { package = "sr-version", path = "../primitives/sr-version" } +sr-api = { path = "../primitives/sr-api" } +sr-primitives = { path = "../primitives/sr-primitives" } +state-machine = { package = "substrate-state-machine", path = "../primitives/state-machine" } +substrate-telemetry = { path = "telemetry" } +trie = { package = "substrate-trie", path = "../primitives/trie" } [dev-dependencies] env_logger = "0.7.0" tempfile = "3.1.0" client-db = { package = "substrate-client-db", path = "./db", features = ["kvdb-rocksdb"] } -test-client = { package = "substrate-test-runtime-client", path = "../test-runtime/client" } +test-client = { package = "substrate-test-runtime-client", path = "../test/utils/runtime/client" } kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" } -panic-handler = { package = "substrate-panic-handler", path = "../panic-handler" } +panic-handler = { package = "substrate-panic-handler", path = "../primitives/panic-handler" } diff --git a/client/api/Cargo.toml b/client/api/Cargo.toml new file mode 100644 index 0000000000000..9a122ad0f8591 --- /dev/null +++ b/client/api/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "substrate-client-api" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +block-builder = { package = "substrate-block-builder", path = "../block-builder" } +codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } +consensus = { package = "substrate-consensus-common", path = "../../primitives/consensus/common" } +derive_more = { version = "0.15.0" } +executor = { package = "substrate-executor", path = "../executor" } +fnv = { version = "1.0.6" } +futures = { version = "0.1.29" } +futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } +hash-db = { version = "0.15.2", default-features = false } +header-metadata = { package = "substrate-header-metadata", path = "../header-metadata" } +hex-literal = { version = "0.2.1" } +inherents = { package = "substrate-inherents", path = "../../primitives/inherents", default-features = false } +keyring = { package = "substrate-keyring", path = "../../primitives/keyring" } +kvdb = { git = "https://github.com/paritytech/parity-common", rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" } +log = { version = "0.4.8" } +parking_lot = { version = "0.9.0" } +primitives = { package = "substrate-primitives", path = "../../primitives/core", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +runtime-version = { package = "sr-version", path = "../../primitives/sr-version", default-features = false } +sr-api = { path = "../../primitives/sr-api" } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +state-machine = { package = "substrate-state-machine", path = "../../primitives/state-machine" } +substrate-telemetry = { path = "../telemetry" } +trie = { package = "substrate-trie", path = "../../primitives/trie" } + +[dev-dependencies] +env_logger = "0.7.0" +tempfile = "3.1.0" +client-db = { package = "substrate-client-db", path = ".././db", features = ["kvdb-rocksdb"] } +test-primitives = { package = "substrate-test-primitives", path = "../../test/utils/primitives" } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" } +kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" } +panic-handler = { package = "substrate-panic-handler", path = "../../primitives/panic-handler" } + diff --git a/core/client/src/backend.rs b/client/api/src/backend.rs similarity index 89% rename from core/client/src/backend.rs rename to client/api/src/backend.rs index dc0f0e5d4c301..03cd183ad2c21 100644 --- a/core/client/src/backend.rs +++ b/client/api/src/backend.rs @@ -18,14 +18,19 @@ use std::sync::Arc; use std::collections::HashMap; -use crate::error; -use crate::light::blockchain::RemoteBlockchain; use primitives::ChangesTrieConfiguration; use sr_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay}; use sr_primitives::traits::{Block as BlockT, NumberFor}; use state_machine::backend::Backend as StateBackend; use state_machine::{ChangesTrieStorage as StateChangesTrieStorage, ChangesTrieTransaction}; -use crate::blockchain::well_known_cache_keys; +use crate::{ + blockchain::{ + Backend as BlockchainBackend, well_known_cache_keys + }, + offchain::OffchainStorage, + error, + light::RemoteBlockchain, +}; use consensus::BlockOrigin; use hash_db::Hasher; use parking_lot::Mutex; @@ -36,13 +41,13 @@ pub type StorageCollection = Vec<(Vec, Option>)>; /// In memory arrays of storage values for multiple child tries. pub type ChildStorageCollection = Vec<(Vec, StorageCollection)>; -pub(crate) struct ImportSummary { - pub(crate) hash: Block::Hash, - pub(crate) origin: BlockOrigin, - pub(crate) header: Block::Header, - pub(crate) is_new_best: bool, - pub(crate) storage_changes: Option<(StorageCollection, ChildStorageCollection)>, - pub(crate) retracted: Vec, +pub struct ImportSummary { + pub hash: Block::Hash, + pub origin: BlockOrigin, + pub header: Block::Header, + pub is_new_best: bool, + pub storage_changes: Option<(StorageCollection, ChildStorageCollection)>, + pub retracted: Vec, } /// Import operation wrapper @@ -51,9 +56,9 @@ pub struct ClientImportOperation< H: Hasher, B: Backend, > { - pub(crate) op: B::BlockImportOperation, - pub(crate) notify_imported: Option>, - pub(crate) notify_finalized: Vec, + pub op: B::BlockImportOperation, + pub notify_imported: Option>, + pub notify_finalized: Vec, } /// State of a new block. @@ -216,7 +221,7 @@ pub trait Backend: AuxStore + Send + Sync where /// Associated block insertion operation type. type BlockImportOperation: BlockImportOperation; /// Associated blockchain backend type. - type Blockchain: crate::blockchain::Backend; + type Blockchain: BlockchainBackend; /// Associated state backend type. type State: StateBackend; /// Changes trie storage. @@ -295,26 +300,6 @@ pub trait Backend: AuxStore + Send + Sync where fn get_import_lock(&self) -> &Mutex<()>; } -/// Offchain workers local storage. -pub trait OffchainStorage: Clone + Send + Sync { - /// Persist a value in storage under given key and prefix. - fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8]); - - /// Retrieve a value from storage under given key and prefix. - fn get(&self, prefix: &[u8], key: &[u8]) -> Option>; - - /// Replace the value in storage if given old_value matches the current one. - /// - /// Returns `true` if the value has been set and false otherwise. - fn compare_and_set( - &mut self, - prefix: &[u8], - key: &[u8], - old_value: Option<&[u8]>, - new_value: &[u8], - ) -> bool; -} - /// Changes trie storage that supports pruning. pub trait PrunableStateChangesTrieStorage: StateChangesTrieStorage> diff --git a/core/client/src/blockchain.rs b/client/api/src/blockchain.rs similarity index 100% rename from core/client/src/blockchain.rs rename to client/api/src/blockchain.rs diff --git a/client/api/src/call_executor.rs b/client/api/src/call_executor.rs new file mode 100644 index 0000000000000..c143999047d5e --- /dev/null +++ b/client/api/src/call_executor.rs @@ -0,0 +1,148 @@ +// 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 . + +use std::{cmp::Ord, panic::UnwindSafe, result, cell::RefCell}; +use codec::{Encode, Decode}; +use sr_primitives::{ + generic::BlockId, traits::Block as BlockT, traits::NumberFor, +}; +use state_machine::{ + self, OverlayedChanges, ExecutionManager, ExecutionStrategy, + ChangesTrieTransaction, StorageProof, +}; +use executor::{RuntimeVersion, NativeVersion}; +use hash_db::Hasher; +use primitives::{offchain::OffchainExt, Blake2Hasher, NativeOrEncoded}; + +use sr_api::{ProofRecorder, InitializeBlock}; +use crate::error; + +/// Method call executor. +pub trait CallExecutor +where + B: BlockT, + H: Hasher, + H::Out: Ord, +{ + /// Externalities error type. + type Error: state_machine::Error; + + /// Execute a call to a contract on top of state in a block of given hash. + /// + /// No changes are made. + fn call( + &self, + id: &BlockId, + method: &str, + call_data: &[u8], + strategy: ExecutionStrategy, + side_effects_handler: Option, + ) -> Result, error::Error>; + + /// Execute a contextual call on top of state in a block of a given hash. + /// + /// No changes are made. + /// Before executing the method, passed header is installed as the current header + /// of the execution context. + fn contextual_call< + 'a, + IB: Fn() -> error::Result<()>, + EM: Fn( + Result, Self::Error>, + Result, Self::Error> + ) -> Result, Self::Error>, + R: Encode + Decode + PartialEq, + NC: FnOnce() -> result::Result + UnwindSafe, + >( + &self, + initialize_block_fn: IB, + at: &BlockId, + method: &str, + call_data: &[u8], + changes: &RefCell, + initialize_block: InitializeBlock<'a, B>, + execution_manager: ExecutionManager, + native_call: Option, + side_effects_handler: Option, + proof_recorder: &Option>, + enable_keystore: bool, + ) -> error::Result> where ExecutionManager: Clone; + + /// Extract RuntimeVersion of given block + /// + /// No changes are made. + fn runtime_version(&self, id: &BlockId) -> Result; + + /// Execute a call to a contract on top of given state. + /// + /// No changes are made. + fn call_at_state< + S: state_machine::Backend, + F: FnOnce( + Result, Self::Error>, + Result, Self::Error>, + ) -> Result, Self::Error>, + R: Encode + Decode + PartialEq, + NC: FnOnce() -> result::Result + UnwindSafe, + >(&self, + state: &S, + overlay: &mut OverlayedChanges, + method: &str, + call_data: &[u8], + manager: ExecutionManager, + native_call: Option, + side_effects_handler: Option, + ) -> Result< + ( + NativeOrEncoded, + (S::Transaction, H::Out), + Option>> + ), + error::Error, + >; + + /// Execute a call to a contract on top of given state, gathering execution proof. + /// + /// No changes are made. + fn prove_at_state>( + &self, + mut state: S, + overlay: &mut OverlayedChanges, + method: &str, + call_data: &[u8] + ) -> Result<(Vec, StorageProof), error::Error> { + let trie_state = state.as_trie_backend() + .ok_or_else(|| + Box::new(state_machine::ExecutionError::UnableToGenerateProof) + as Box + )?; + self.prove_at_trie_state(trie_state, overlay, method, call_data) + } + + /// Execute a call to a contract on top of given trie state, gathering execution proof. + /// + /// No changes are made. + fn prove_at_trie_state>( + &self, + trie_state: &state_machine::TrieBackend, + overlay: &mut OverlayedChanges, + method: &str, + call_data: &[u8] + ) -> Result<(Vec, StorageProof), error::Error>; + + /// Get runtime version if supported. + fn native_runtime_version(&self) -> Option<&NativeVersion>; +} diff --git a/client/api/src/client.rs b/client/api/src/client.rs new file mode 100644 index 0000000000000..a51fc9f03f875 --- /dev/null +++ b/client/api/src/client.rs @@ -0,0 +1,141 @@ +// Copyright 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 . + +use std::collections::HashMap; +use futures03::channel::mpsc; +use primitives::storage::StorageKey; +use state_machine::ExecutionStrategy; +use sr_primitives::{ + traits::{Block as BlockT, NumberFor}, + generic::BlockId +}; +use consensus::BlockOrigin; + +use crate::blockchain::Info; +use crate::notifications::StorageEventStream; +use crate::error; + +/// Type that implements `futures::Stream` of block import events. +pub type ImportNotifications = mpsc::UnboundedReceiver>; + +/// A stream of block finality notifications. +pub type FinalityNotifications = mpsc::UnboundedReceiver>; + +/// Expected hashes of blocks at given heights. +/// +/// This may be used as chain spec extension to filter out known, unwanted forks. +pub type ForkBlocks = Option, ::Hash>>; + +/// Execution strategies settings. +#[derive(Debug, Clone)] +pub struct ExecutionStrategies { + /// Execution strategy used when syncing. + pub syncing: ExecutionStrategy, + /// Execution strategy used when importing blocks. + pub importing: ExecutionStrategy, + /// Execution strategy used when constructing blocks. + pub block_construction: ExecutionStrategy, + /// Execution strategy used for offchain workers. + pub offchain_worker: ExecutionStrategy, + /// Execution strategy used in other cases. + pub other: ExecutionStrategy, +} + +impl Default for ExecutionStrategies { + fn default() -> ExecutionStrategies { + ExecutionStrategies { + syncing: ExecutionStrategy::NativeElseWasm, + importing: ExecutionStrategy::NativeElseWasm, + block_construction: ExecutionStrategy::AlwaysWasm, + offchain_worker: ExecutionStrategy::NativeWhenPossible, + other: ExecutionStrategy::NativeElseWasm, + } + } +} + +/// Figure out the block type for a given type (for now, just a `Client`). +pub trait BlockOf { + /// The type of the block. + type Type: BlockT; +} + +/// A source of blockchain events. +pub trait BlockchainEvents { + /// Get block import event stream. Not guaranteed to be fired for every + /// imported block. + fn import_notification_stream(&self) -> ImportNotifications; + + /// Get a stream of finality notifications. Not guaranteed to be fired for every + /// finalized block. + fn finality_notification_stream(&self) -> FinalityNotifications; + + /// Get storage changes event stream. + /// + /// Passing `None` as `filter_keys` subscribes to all storage changes. + fn storage_changes_notification_stream( + &self, + filter_keys: Option<&[StorageKey]>, + child_filter_keys: Option<&[(StorageKey, Option>)]>, + ) -> error::Result>; +} + +/// Fetch block body by ID. +pub trait BlockBody { + /// Get block body by ID. Returns `None` if the body is not stored. + fn block_body(&self, + id: &BlockId + ) -> error::Result::Extrinsic>>>; +} + +/// Provide a list of potential uncle headers for a given block. +pub trait ProvideUncles { + /// Gets the uncles of the block with `target_hash` going back `max_generation` ancestors. + fn uncles(&self, target_hash: Block::Hash, max_generation: NumberFor) + -> error::Result>; +} + +/// Client info +#[derive(Debug)] +pub struct ClientInfo { + /// Best block hash. + pub chain: Info, + /// State Cache Size currently used by the backend + pub used_state_cache_size: Option, +} + +/// Summary of an imported block +#[derive(Clone, Debug)] +pub struct BlockImportNotification { + /// Imported block header hash. + pub hash: Block::Hash, + /// Imported block origin. + pub origin: BlockOrigin, + /// Imported block header. + pub header: Block::Header, + /// Is this the new best block. + pub is_new_best: bool, + /// List of retracted blocks ordered by block number. + pub retracted: Vec, +} + +/// Summary of a finalized block. +#[derive(Clone, Debug)] +pub struct FinalityNotification { + /// Imported block header hash. + pub hash: Block::Hash, + /// Imported block header. + pub header: Block::Header, +} diff --git a/core/client/src/error.rs b/client/api/src/error.rs similarity index 100% rename from core/client/src/error.rs rename to client/api/src/error.rs diff --git a/client/api/src/lib.rs b/client/api/src/lib.rs new file mode 100644 index 0000000000000..4163320546db4 --- /dev/null +++ b/client/api/src/lib.rs @@ -0,0 +1,84 @@ +// Copyright 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 . + +//! Substrate client interfaces. + +// TODO: make internal +pub mod error; +pub mod backend; +pub mod blockchain; +pub mod light; +pub mod notifications; +pub mod call_executor; +pub mod client; +pub mod offchain; + +pub use error::*; +pub use backend::*; +pub use blockchain::*; +pub use light::*; +pub use notifications::*; +pub use call_executor::*; +pub use offchain::*; +pub use client::*; + +pub use state_machine::{StorageProof, ExecutionStrategy}; + + +/// Utility methods for the client. +pub mod utils { + use super::HeaderBackend; + use header_metadata::HeaderMetadata; + use crate::error; + use primitives::H256; + use sr_primitives::traits::{Block as BlockT}; + use std::borrow::Borrow; + + /// Returns a function for checking block ancestry, the returned function will + /// return `true` if the given hash (second parameter) is a descendent of the + /// base (first parameter). If the `current` parameter is defined, it should + /// represent the current block `hash` and its `parent hash`, if given the + /// function that's returned will assume that `hash` isn't part of the local DB + /// yet, and all searches in the DB will instead reference the parent. + pub fn is_descendent_of<'a, Block: BlockT, T, H: Borrow + 'a>( + client: &'a T, + current: Option<(H, H)>, + ) -> impl Fn(&H256, &H256) -> Result + 'a + where T: HeaderBackend + HeaderMetadata, + { + move |base, hash| { + if base == hash { return Ok(false); } + + let current = current.as_ref().map(|(c, p)| (c.borrow(), p.borrow())); + + let mut hash = hash; + if let Some((current_hash, current_parent_hash)) = current { + if base == current_hash { return Ok(false); } + if hash == current_hash { + if base == current_parent_hash { + return Ok(true); + } else { + hash = current_parent_hash; + } + } + } + + let ancestor = header_metadata::lowest_common_ancestor(client, *hash, *base)?; + + Ok(ancestor.hash == *base) + } + } +} diff --git a/client/api/src/light.rs b/client/api/src/light.rs new file mode 100644 index 0000000000000..b82f8ba745912 --- /dev/null +++ b/client/api/src/light.rs @@ -0,0 +1,335 @@ +// Copyright 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 . + +//! Substrate light client interfaces + +use std::sync::Arc; +use std::collections::{BTreeMap, HashMap}; +use std::future::Future; + +use sr_primitives::{ + traits::{ + Block as BlockT, Header as HeaderT, NumberFor, + }, + generic::BlockId +}; +use primitives::{ChangesTrieConfiguration}; +use state_machine::StorageProof; +use header_metadata::HeaderMetadata; +use crate::{ + backend::{ + AuxStore, NewBlockState, + }, + blockchain::{ + well_known_cache_keys, HeaderBackend, Cache as BlockchainCache, + }, + error::{ Error as ClientError, Result as ClientResult }, +}; +/// Remote call request. +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +pub struct RemoteCallRequest { + /// Call at state of given block. + pub block: Header::Hash, + /// Header of block at which call is performed. + pub header: Header, + /// Method to call. + pub method: String, + /// Call data. + pub call_data: Vec, + /// Number of times to retry request. None means that default RETRY_COUNT is used. + pub retry_count: Option, +} + +/// Remote canonical header request. +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +pub struct RemoteHeaderRequest { + /// The root of CHT this block is included in. + pub cht_root: Header::Hash, + /// Number of the header to query. + pub block: Header::Number, + /// Number of times to retry request. None means that default RETRY_COUNT is used. + pub retry_count: Option, +} + +/// Remote storage read request. +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +pub struct RemoteReadRequest { + /// Read at state of given block. + pub block: Header::Hash, + /// Header of block at which read is performed. + pub header: Header, + /// Storage key to read. + pub keys: Vec>, + /// Number of times to retry request. None means that default RETRY_COUNT is used. + pub retry_count: Option, +} + +/// Remote storage read child request. +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +pub struct RemoteReadChildRequest { + /// Read at state of given block. + pub block: Header::Hash, + /// Header of block at which read is performed. + pub header: Header, + /// Storage key for child. + pub storage_key: Vec, + /// Child storage key to read. + pub keys: Vec>, + /// Number of times to retry request. None means that default RETRY_COUNT is used. + pub retry_count: Option, +} + +/// Remote key changes read request. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct RemoteChangesRequest { + /// Changes trie configuration. + pub changes_trie_config: ChangesTrieConfiguration, + /// Query changes from range of blocks, starting (and including) with this hash... + pub first_block: (Header::Number, Header::Hash), + /// ...ending (and including) with this hash. Should come after first_block and + /// be the part of the same fork. + pub last_block: (Header::Number, Header::Hash), + /// Only use digests from blocks up to this hash. Should be last_block OR come + /// after this block and be the part of the same fork. + pub max_block: (Header::Number, Header::Hash), + /// Known changes trie roots for the range of blocks [tries_roots.0..max_block]. + /// Proofs for roots of ascendants of tries_roots.0 are provided by the remote node. + pub tries_roots: (Header::Number, Header::Hash, Vec), + /// Optional Child Storage key to read. + pub storage_key: Option>, + /// Storage key to read. + pub key: Vec, + /// Number of times to retry request. None means that default RETRY_COUNT is used. + pub retry_count: Option, +} + +/// Key changes read proof. +#[derive(Debug, PartialEq, Eq)] +pub struct ChangesProof { + /// Max block that has been used in changes query. + pub max_block: Header::Number, + /// All touched nodes of all changes tries. + pub proof: Vec>, + /// All changes tries roots that have been touched AND are missing from + /// the requester' node. It is a map of block number => changes trie root. + pub roots: BTreeMap, + /// The proofs for all changes tries roots that have been touched AND are + /// missing from the requester' node. It is a map of CHT number => proof. + pub roots_proof: StorageProof, +} + +/// Remote block body request +#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)] +pub struct RemoteBodyRequest { + /// Header of the requested block body + pub header: Header, + /// Number of times to retry request. None means that default RETRY_COUNT is used. + pub retry_count: Option, +} + +/// Light client data fetcher. Implementations of this trait must check if remote data +/// is correct (see FetchedDataChecker) and return already checked data. +pub trait Fetcher: Send + Sync { + /// Remote header future. + type RemoteHeaderResult: Future> + Send + 'static; + /// Remote storage read future. + type RemoteReadResult: Future, Option>>, ClientError>> + Send + 'static; + /// Remote call result future. + type RemoteCallResult: Future, ClientError>> + Send + 'static; + /// Remote changes result future. + type RemoteChangesResult: Future, u32)>, ClientError>> + Send + 'static; + /// Remote block body result future. + type RemoteBodyResult: Future, ClientError>> + Send + 'static; + + /// Fetch remote header. + fn remote_header(&self, request: RemoteHeaderRequest) -> Self::RemoteHeaderResult; + /// Fetch remote storage value. + fn remote_read( + &self, + request: RemoteReadRequest + ) -> Self::RemoteReadResult; + /// Fetch remote storage child value. + fn remote_read_child( + &self, + request: RemoteReadChildRequest + ) -> Self::RemoteReadResult; + /// Fetch remote call result. + fn remote_call(&self, request: RemoteCallRequest) -> Self::RemoteCallResult; + /// Fetch remote changes ((block number, extrinsic index)) where given key has been changed + /// at a given blocks range. + fn remote_changes(&self, request: RemoteChangesRequest) -> Self::RemoteChangesResult; + /// Fetch remote block body + fn remote_body(&self, request: RemoteBodyRequest) -> Self::RemoteBodyResult; +} + +/// Light client remote data checker. +/// +/// Implementations of this trait should not use any prunable blockchain data +/// except that is passed to its methods. +pub trait FetchChecker: Send + Sync { + /// Check remote header proof. + fn check_header_proof( + &self, + request: &RemoteHeaderRequest, + header: Option, + remote_proof: StorageProof, + ) -> ClientResult; + /// Check remote storage read proof. + fn check_read_proof( + &self, + request: &RemoteReadRequest, + remote_proof: StorageProof, + ) -> ClientResult, Option>>>; + /// Check remote storage read proof. + fn check_read_child_proof( + &self, + request: &RemoteReadChildRequest, + remote_proof: StorageProof, + ) -> ClientResult, Option>>>; + /// Check remote method execution proof. + fn check_execution_proof( + &self, + request: &RemoteCallRequest, + remote_proof: StorageProof, + ) -> ClientResult>; + /// Check remote changes query proof. + fn check_changes_proof( + &self, + request: &RemoteChangesRequest, + proof: ChangesProof + ) -> ClientResult, u32)>>; + /// Check remote body proof. + fn check_body_proof( + &self, + request: &RemoteBodyRequest, + body: Vec + ) -> ClientResult>; +} + + +/// Light client blockchain storage. +pub trait Storage: AuxStore + HeaderBackend + HeaderMetadata { + /// Store new header. Should refuse to revert any finalized blocks. + /// + /// Takes new authorities, the leaf state of the new block, and + /// any auxiliary storage updates to place in the same operation. + fn import_header( + &self, + header: Block::Header, + cache: HashMap>, + state: NewBlockState, + aux_ops: Vec<(Vec, Option>)>, + ) -> ClientResult<()>; + + /// Set an existing block as new best block. + fn set_head(&self, block: BlockId) -> ClientResult<()>; + + /// Mark historic header as finalized. + fn finalize_header(&self, block: BlockId) -> ClientResult<()>; + + /// Get last finalized header. + fn last_finalized(&self) -> ClientResult; + + /// Get headers CHT root for given block. Fails if the block is not pruned (not a part of any CHT). + fn header_cht_root( + &self, + cht_size: NumberFor, + block: NumberFor, + ) -> ClientResult; + + /// Get changes trie CHT root for given block. Fails if the block is not pruned (not a part of any CHT). + fn changes_trie_cht_root( + &self, + cht_size: NumberFor, + block: NumberFor, + ) -> ClientResult; + + /// Get storage cache. + fn cache(&self) -> Option>>; +} + +/// Remote header. +#[derive(Debug)] +pub enum LocalOrRemote { + /// When data is available locally, it is returned. + Local(Data), + /// When data is unavailable locally, the request to fetch it from remote node is returned. + Remote(Request), + /// When data is unknown. + Unknown, +} + +/// Futures-based blockchain backend that either resolves blockchain data +/// locally, or fetches required data from remote node. +pub trait RemoteBlockchain: Send + Sync { + /// Get block header. + fn header(&self, id: BlockId) -> ClientResult, + >>; +} + + + +#[cfg(test)] +pub mod tests { + use futures03::future::Ready; + use parking_lot::Mutex; + use crate::error::Error as ClientError; + use test_primitives::{Block, Header, Extrinsic}; + use super::*; + + pub type OkCallFetcher = Mutex>; + + fn not_implemented_in_tests() -> Ready> + where + E: std::convert::From<&'static str>, + { + futures03::future::ready(Err("Not implemented on test node".into())) + } + + impl Fetcher for OkCallFetcher { + type RemoteHeaderResult = Ready>; + type RemoteReadResult = Ready, Option>>, ClientError>>; + type RemoteCallResult = Ready, ClientError>>; + type RemoteChangesResult = Ready, u32)>, ClientError>>; + type RemoteBodyResult = Ready, ClientError>>; + + fn remote_header(&self, _request: RemoteHeaderRequest
) -> Self::RemoteHeaderResult { + not_implemented_in_tests() + } + + fn remote_read(&self, _request: RemoteReadRequest
) -> Self::RemoteReadResult { + not_implemented_in_tests() + } + + fn remote_read_child(&self, _request: RemoteReadChildRequest
) -> Self::RemoteReadResult { + not_implemented_in_tests() + } + + fn remote_call(&self, _request: RemoteCallRequest
) -> Self::RemoteCallResult { + futures03::future::ready(Ok((*self.lock()).clone())) + } + + fn remote_changes(&self, _request: RemoteChangesRequest
) -> Self::RemoteChangesResult { + not_implemented_in_tests() + } + + fn remote_body(&self, _request: RemoteBodyRequest
) -> Self::RemoteBodyResult { + not_implemented_in_tests() + } + } +} \ No newline at end of file diff --git a/core/client/src/notifications.rs b/client/api/src/notifications.rs similarity index 100% rename from core/client/src/notifications.rs rename to client/api/src/notifications.rs diff --git a/client/api/src/offchain.rs b/client/api/src/offchain.rs new file mode 100644 index 0000000000000..761241efe7996 --- /dev/null +++ b/client/api/src/offchain.rs @@ -0,0 +1,77 @@ +// Copyright 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 . + +use std::collections::hash_map::{HashMap, Entry}; + +/// Offchain workers local storage. +pub trait OffchainStorage: Clone + Send + Sync { + /// Persist a value in storage under given key and prefix. + fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8]); + + /// Retrieve a value from storage under given key and prefix. + fn get(&self, prefix: &[u8], key: &[u8]) -> Option>; + + /// Replace the value in storage if given old_value matches the current one. + /// + /// Returns `true` if the value has been set and false otherwise. + fn compare_and_set( + &mut self, + prefix: &[u8], + key: &[u8], + old_value: Option<&[u8]>, + new_value: &[u8], + ) -> bool; +} + +/// In-memory storage for offchain workers. +#[derive(Debug, Clone, Default)] +pub struct InMemOffchainStorage { + storage: HashMap, Vec>, +} + +impl OffchainStorage for InMemOffchainStorage { + fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8]) { + let key = prefix.iter().chain(key).cloned().collect(); + self.storage.insert(key, value.to_vec()); + } + + fn get(&self, prefix: &[u8], key: &[u8]) -> Option> { + let key: Vec = prefix.iter().chain(key).cloned().collect(); + self.storage.get(&key).cloned() + } + + fn compare_and_set( + &mut self, + prefix: &[u8], + key: &[u8], + old_value: Option<&[u8]>, + new_value: &[u8], + ) -> bool { + let key = prefix.iter().chain(key).cloned().collect(); + + match self.storage.entry(key) { + Entry::Vacant(entry) => if old_value.is_none() { + entry.insert(new_value.to_vec()); + true + } else { false }, + Entry::Occupied(ref mut entry) if Some(entry.get().as_slice()) == old_value => { + entry.insert(new_value.to_vec()); + true + }, + _ => false, + } + } +} \ No newline at end of file diff --git a/core/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml similarity index 60% rename from core/authority-discovery/Cargo.toml rename to client/authority-discovery/Cargo.toml index 5d720c195342a..e9c918500bb74 100644 --- a/core/authority-discovery/Cargo.toml +++ b/client/authority-discovery/Cargo.toml @@ -9,9 +9,9 @@ build = "build.rs" prost-build = "0.5.0" [dependencies] -authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", path = "./primitives" } +authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", path = "../../primitives/authority-discovery" } bytes = "0.4.12" -client = { package = "substrate-client", path = "../../core/client" } +client-api = { package = "substrate-client-api", path = "../api" } codec = { package = "parity-scale-codec", default-features = false, version = "1.0.3" } derive_more = "0.15.0" futures-preview = "0.3.0-alpha.19" @@ -19,14 +19,14 @@ futures-timer = "0.4" keystore = { package = "substrate-keystore", path = "../keystore" } libp2p = { version = "0.13.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] } log = "0.4.8" -network = { package = "substrate-network", path = "../../core/network" } -primitives = { package = "substrate-primitives", path = "../primitives" } +network = { package = "substrate-network", path = "../network" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } prost = "0.5.0" serde_json = "1.0.41" -sr-primitives = { path = "../../core/sr-primitives" } +sr-primitives = { path = "../../primitives/sr-primitives" } [dev-dependencies] parking_lot = "0.9.0" -peerset = { package = "substrate-peerset", path = "../../core/peerset" } -test-client = { package = "substrate-test-runtime-client", path = "../../core/test-runtime/client" } -sr-api = { path = "../sr-api" } +peerset = { package = "substrate-peerset", path = "../../primitives/peerset" } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" } +sr-api = { path = "../../primitives/sr-api" } diff --git a/core/authority-discovery/build.rs b/client/authority-discovery/build.rs similarity index 100% rename from core/authority-discovery/build.rs rename to client/authority-discovery/build.rs diff --git a/core/authority-discovery/src/error.rs b/client/authority-discovery/src/error.rs similarity index 97% rename from core/authority-discovery/src/error.rs rename to client/authority-discovery/src/error.rs index 3e50ce54816f6..a05bc3b68005d 100644 --- a/core/authority-discovery/src/error.rs +++ b/client/authority-discovery/src/error.rs @@ -27,7 +27,7 @@ pub enum Error { /// Failed to hash the authority id to be used as a dht key. HashingAuthorityId(libp2p::core::multiaddr::multihash::EncodeError), /// Failed calling into the Substrate runtime. - CallingRuntime(client::error::Error), + CallingRuntime(client_api::error::Error), /// From the Dht we only get the hashed authority id. In order to retrieve the actual authority id and to ensure it /// is actually an authority, we match the hash against the hash of the authority id of all other authorities. This /// error is the result of the above failing. diff --git a/core/authority-discovery/src/lib.rs b/client/authority-discovery/src/lib.rs similarity index 96% rename from core/authority-discovery/src/lib.rs rename to client/authority-discovery/src/lib.rs index 76cb069b73e37..57805d0add18b 100644 --- a/core/authority-discovery/src/lib.rs +++ b/client/authority-discovery/src/lib.rs @@ -56,7 +56,7 @@ use futures_timer::Interval; use futures::prelude::*; use authority_discovery_primitives::{AuthorityDiscoveryApi, AuthorityId, AuthoritySignature, AuthorityPair}; -use client::blockchain::HeaderBackend; +use client_api::blockchain::HeaderBackend; use codec::{Decode, Encode}; use error::{Error, Result}; use log::{debug, error, log_enabled, warn}; @@ -116,7 +116,7 @@ where Block: BlockT + Unpin + 'static, Network: NetworkProvider, Client: ProvideRuntimeApi + Send + Sync + 'static + HeaderBackend, - ::Api: AuthorityDiscoveryApi, + ::Api: AuthorityDiscoveryApi, Self: Future, { /// Return a new authority discovery. @@ -357,7 +357,7 @@ where Block: BlockT + Unpin + 'static, Network: NetworkProvider, Client: ProvideRuntimeApi + Send + Sync + 'static + HeaderBackend, - ::Api: AuthorityDiscoveryApi, + ::Api: AuthorityDiscoveryApi, { type Output = (); @@ -486,12 +486,12 @@ mod tests { fn header( &self, _id: BlockId, - ) -> std::result::Result, client::error::Error> { + ) -> std::result::Result, client_api::error::Error> { Ok(None) } - fn info(&self) -> client::blockchain::Info { - client::blockchain::Info { + fn info(&self) -> client_api::blockchain::Info { + client_api::blockchain::Info { best_hash: Default::default(), best_number: Zero::zero(), finalized_hash: Default::default(), @@ -503,21 +503,21 @@ mod tests { fn status( &self, _id: BlockId, - ) -> std::result::Result { - Ok(client::blockchain::BlockStatus::Unknown) + ) -> std::result::Result { + Ok(client_api::blockchain::BlockStatus::Unknown) } fn number( &self, _hash: Block::Hash, - ) -> std::result::Result>, client::error::Error> { + ) -> std::result::Result>, client_api::error::Error> { Ok(None) } fn hash( &self, _number: NumberFor, - ) -> std::result::Result, client::error::Error> { + ) -> std::result::Result, client_api::error::Error> { Ok(None) } } @@ -533,7 +533,7 @@ mod tests { _: ExecutionContext, _: Option<()>, _: Vec, - ) -> std::result::Result, client::error::Error> { + ) -> std::result::Result, client_api::error::Error> { unimplemented!("Not required for testing!") } @@ -543,7 +543,7 @@ mod tests { _: ExecutionContext, _: Option<(Block)>, _: Vec, - ) -> std::result::Result, client::error::Error> { + ) -> std::result::Result, client_api::error::Error> { unimplemented!("Not required for testing!") } @@ -553,13 +553,13 @@ mod tests { _: ExecutionContext, _: Option<&::Header>, _: Vec, - ) -> std::result::Result, client::error::Error> { + ) -> std::result::Result, client_api::error::Error> { unimplemented!("Not required for testing!") } } impl ApiExt for RuntimeApi { - type Error = client::error::Error; + type Error = client_api::error::Error; fn map_api_result std::result::Result, R, E>( &self, @@ -571,7 +571,7 @@ mod tests { fn runtime_version_at( &self, _: &BlockId, - ) -> std::result::Result { + ) -> std::result::Result { unimplemented!("Not required for testing!") } @@ -591,7 +591,7 @@ mod tests { _: ExecutionContext, _: Option<()>, _: Vec, - ) -> std::result::Result>, client::error::Error> { + ) -> std::result::Result>, client_api::error::Error> { return Ok(NativeOrEncoded::Native(self.authorities.clone())); } } diff --git a/core/authority-discovery/src/schema/dht.proto b/client/authority-discovery/src/schema/dht.proto similarity index 100% rename from core/authority-discovery/src/schema/dht.proto rename to client/authority-discovery/src/schema/dht.proto diff --git a/core/basic-authorship/Cargo.toml b/client/basic-authorship/Cargo.toml similarity index 59% rename from core/basic-authorship/Cargo.toml rename to client/basic-authorship/Cargo.toml index a1f629da8a0de..3104b70043b0c 100644 --- a/core/basic-authorship/Cargo.toml +++ b/client/basic-authorship/Cargo.toml @@ -8,14 +8,15 @@ edition = "2018" log = "0.4.8" futures-preview = "0.3.0-alpha.19" codec = { package = "parity-scale-codec", version = "1.0.0" } -sr-primitives = { path = "../../core/sr-primitives" } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -client = { package = "substrate-client", path = "../../core/client" } -consensus_common = { package = "substrate-consensus-common", path = "../../core/consensus/common" } -inherents = { package = "substrate-inherents", path = "../inherents" } +sr-primitives = { path = "../../primitives/sr-primitives" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +client = { package = "substrate-client", path = "../" } +client-api = { package = "substrate-client-api", path = "../api" } +consensus_common = { package = "substrate-consensus-common", path = "../../primitives/consensus/common" } +inherents = { package = "substrate-inherents", path = "../../primitives/inherents" } substrate-telemetry = { path = "../telemetry" } transaction_pool = { package = "substrate-transaction-pool", path = "../transaction-pool" } block-builder = { package = "substrate-block-builder", path = "../block-builder" } [dev-dependencies] -test-client = { package = "substrate-test-runtime-client", path = "../../core/test-runtime/client" } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" } diff --git a/core/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs similarity index 95% rename from core/basic-authorship/src/basic_authorship.rs rename to client/basic-authorship/src/basic_authorship.rs index a54c5b52ae9e0..7d8956152c13f 100644 --- a/core/basic-authorship/src/basic_authorship.rs +++ b/client/basic-authorship/src/basic_authorship.rs @@ -20,7 +20,8 @@ // use std::{time, sync::Arc}; -use client::{error, Client as SubstrateClient, CallExecutor}; +use client_api::{error, CallExecutor}; +use client::Client as SubstrateClient; use codec::Decode; use consensus_common::{evaluation}; use inherents::InherentData; @@ -48,13 +49,13 @@ impl consensus_common::Environment for ProposerFactory, A> where A: txpool::ChainApi, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + Clone + 'static, Block: BlockT, RA: Send + Sync + 'static, SubstrateClient: ProvideRuntimeApi, as ProvideRuntimeApi>::Api: - BlockBuilderApi, + BlockBuilderApi, { type Proposer = Proposer, A>; type Error = error::Error; @@ -96,13 +97,13 @@ impl consensus_common::Proposer for Proposer, A> where A: txpool::ChainApi, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + Clone + 'static, Block: BlockT, RA: Send + Sync + 'static, SubstrateClient: ProvideRuntimeApi, as ProvideRuntimeApi>::Api: - BlockBuilderApi, + BlockBuilderApi, { type Create = futures::future::Ready>; type Error = error::Error; @@ -121,13 +122,13 @@ where impl Proposer, A> where A: txpool::ChainApi, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + Clone + 'static, Block: BlockT, RA: Send + Sync + 'static, SubstrateClient: ProvideRuntimeApi, as ProvideRuntimeApi>::Api: - BlockBuilderApi, + BlockBuilderApi, { fn propose_with( &self, diff --git a/core/basic-authorship/src/lib.rs b/client/basic-authorship/src/lib.rs similarity index 100% rename from core/basic-authorship/src/lib.rs rename to client/basic-authorship/src/lib.rs diff --git a/core/block-builder/Cargo.toml b/client/block-builder/Cargo.toml similarity index 56% rename from core/block-builder/Cargo.toml rename to client/block-builder/Cargo.toml index e70522e5d5ac3..34bfac17bf774 100644 --- a/core/block-builder/Cargo.toml +++ b/client/block-builder/Cargo.toml @@ -5,10 +5,10 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -state-machine = { package = "substrate-state-machine", path = "../state-machine" } -sr-primitives = { path = "../sr-primitives" } -primitives = { package = "substrate-primitives", path = "../primitives" } +state-machine = { package = "substrate-state-machine", path = "../../primitives/state-machine" } +sr-primitives = { path = "../../primitives/sr-primitives" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } codec = { package = "parity-scale-codec", version = "1.0.6", features = ["derive"] } -runtime_api = { package = "substrate-block-builder-runtime-api", path = "runtime-api" } -sr-api = { path = "../sr-api" } +runtime_api = { package = "substrate-block-builder-runtime-api", path = "../../primitives/block-builder/runtime-api" } +sr-api = { path = "../../primitives/sr-api" } diff --git a/core/block-builder/src/lib.rs b/client/block-builder/src/lib.rs similarity index 100% rename from core/block-builder/src/lib.rs rename to client/block-builder/src/lib.rs diff --git a/core/chain-spec/Cargo.toml b/client/chain-spec/Cargo.toml similarity index 51% rename from core/chain-spec/Cargo.toml rename to client/chain-spec/Cargo.toml index 1ab78a18dd13c..da9543e398774 100644 --- a/core/chain-spec/Cargo.toml +++ b/client/chain-spec/Cargo.toml @@ -7,11 +7,9 @@ edition = "2018" [dependencies] substrate-chain-spec-derive = { path = "./derive" } impl-trait-for-tuples = "0.1.3" -network = { package = "substrate-network", path = "../../core/network" } -primitives = { package = "substrate-primitives", path = "../primitives" } +network = { package = "substrate-network", path = "../network" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" -sr-primitives = { path = "../../core/sr-primitives" } -tel = { package = "substrate-telemetry", path = "../../core/telemetry" } - -[dev-dependencies] +sr-primitives = { path = "../../primitives/sr-primitives" } +tel = { package = "substrate-telemetry", path = "../telemetry" } diff --git a/core/chain-spec/derive/Cargo.toml b/client/chain-spec/derive/Cargo.toml similarity index 100% rename from core/chain-spec/derive/Cargo.toml rename to client/chain-spec/derive/Cargo.toml diff --git a/core/chain-spec/derive/src/impls.rs b/client/chain-spec/derive/src/impls.rs similarity index 100% rename from core/chain-spec/derive/src/impls.rs rename to client/chain-spec/derive/src/impls.rs diff --git a/core/chain-spec/derive/src/lib.rs b/client/chain-spec/derive/src/lib.rs similarity index 100% rename from core/chain-spec/derive/src/lib.rs rename to client/chain-spec/derive/src/lib.rs diff --git a/core/chain-spec/res/chain_spec.json b/client/chain-spec/res/chain_spec.json similarity index 100% rename from core/chain-spec/res/chain_spec.json rename to client/chain-spec/res/chain_spec.json diff --git a/core/chain-spec/res/chain_spec2.json b/client/chain-spec/res/chain_spec2.json similarity index 100% rename from core/chain-spec/res/chain_spec2.json rename to client/chain-spec/res/chain_spec2.json diff --git a/core/chain-spec/src/chain_spec.rs b/client/chain-spec/src/chain_spec.rs similarity index 100% rename from core/chain-spec/src/chain_spec.rs rename to client/chain-spec/src/chain_spec.rs diff --git a/core/chain-spec/src/extension.rs b/client/chain-spec/src/extension.rs similarity index 100% rename from core/chain-spec/src/extension.rs rename to client/chain-spec/src/extension.rs diff --git a/core/chain-spec/src/lib.rs b/client/chain-spec/src/lib.rs similarity index 100% rename from core/chain-spec/src/lib.rs rename to client/chain-spec/src/lib.rs diff --git a/core/cli/Cargo.toml b/client/cli/Cargo.toml similarity index 60% rename from core/cli/Cargo.toml rename to client/cli/Cargo.toml index 9fb528e66cf56..e156339cdf4d1 100644 --- a/core/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -22,16 +22,16 @@ futures03 = { package = "futures-preview", version = "=0.3.0-alpha.19", features fdlimit = "0.1.1" exit-future = "0.1.4" serde_json = "1.0.41" -panic-handler = { package = "substrate-panic-handler", path = "../../core/panic-handler" } -client = { package = "substrate-client", path = "../../core/client" } -header-metadata = { package = "substrate-header-metadata", path = "../../core/client/header-metadata" } -network = { package = "substrate-network", path = "../../core/network" } -sr-primitives = { path = "../../core/sr-primitives" } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -service = { package = "substrate-service", path = "../../core/service", default-features = false } -state-machine = { package = "substrate-state-machine", path = "../../core/state-machine" } -substrate-telemetry = { path = "../../core/telemetry" } -keyring = { package = "substrate-keyring", path = "../keyring" } +panic-handler = { package = "substrate-panic-handler", path = "../../primitives/panic-handler" } +client-api = { package = "substrate-client-api", path = "../api" } +header-metadata = { package = "substrate-header-metadata", path = "../header-metadata" } +network = { package = "substrate-network", path = "../network" } +sr-primitives = { path = "../../primitives/sr-primitives" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +service = { package = "substrate-service", path = "../service", default-features = false } +state-machine = { package = "substrate-state-machine", path = "../../primitives/state-machine" } +substrate-telemetry = { path = "../telemetry" } +keyring = { package = "substrate-keyring", path = "../../primitives/keyring" } names = "0.11.0" structopt = "0.3.3" rpassword = "4.0.1" diff --git a/core/cli/README.adoc b/client/cli/README.adoc similarity index 100% rename from core/cli/README.adoc rename to client/cli/README.adoc diff --git a/core/cli/src/error.rs b/client/cli/src/error.rs similarity index 97% rename from core/cli/src/error.rs rename to client/cli/src/error.rs index 600e73d44fe73..6b42773bb833a 100644 --- a/core/cli/src/error.rs +++ b/client/cli/src/error.rs @@ -16,7 +16,7 @@ //! Initialization errors. -use client; +use client_api; /// Result type alias for the CLI. pub type Result = std::result::Result; @@ -31,7 +31,7 @@ pub enum Error { /// Service error Service(service::Error), /// Client error - Client(client::error::Error), + Client(client_api::error::Error), /// Input error Input(String), /// Invalid listen multiaddress diff --git a/core/cli/src/execution_strategy.rs b/client/cli/src/execution_strategy.rs similarity index 100% rename from core/cli/src/execution_strategy.rs rename to client/cli/src/execution_strategy.rs diff --git a/core/cli/src/informant.rs b/client/cli/src/informant.rs similarity index 98% rename from core/cli/src/informant.rs rename to client/cli/src/informant.rs index f7c23ba47918a..4e9572522c331 100644 --- a/core/cli/src/informant.rs +++ b/client/cli/src/informant.rs @@ -16,7 +16,7 @@ //! Console informant. Prints sync progress and block events. Runs on the calling thread. -use client::BlockchainEvents; +use client_api::BlockchainEvents; use futures::{Future, Stream}; use futures03::{StreamExt as _, TryStreamExt as _}; use log::{info, warn}; diff --git a/core/cli/src/informant/display.rs b/client/cli/src/informant/display.rs similarity index 99% rename from core/cli/src/informant/display.rs rename to client/cli/src/informant/display.rs index c7cf9bfc930b9..76d326047253a 100644 --- a/core/cli/src/informant/display.rs +++ b/client/cli/src/informant/display.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . use ansi_term::Colour; -use client::ClientInfo; +use client_api::ClientInfo; use log::info; use network::SyncState; use sr_primitives::traits::{Block as BlockT, CheckedDiv, NumberFor, Zero, Saturating}; diff --git a/core/cli/src/lib.rs b/client/cli/src/lib.rs similarity index 99% rename from core/cli/src/lib.rs rename to client/cli/src/lib.rs index 4bcffac112c44..1209518cbaf65 100644 --- a/core/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -26,7 +26,7 @@ mod execution_strategy; pub mod error; pub mod informant; -use client::ExecutionStrategies; +use client_api::ExecutionStrategies; use service::{ config::{Configuration, DatabaseConfig}, ServiceBuilderExport, ServiceBuilderImport, ServiceBuilderRevert, diff --git a/core/cli/src/params.rs b/client/cli/src/params.rs similarity index 98% rename from core/cli/src/params.rs rename to client/cli/src/params.rs index dc4a9f759b1d8..f9b36e9a7f771 100644 --- a/core/cli/src/params.rs +++ b/client/cli/src/params.rs @@ -32,13 +32,13 @@ macro_rules! impl_get_log_filter { } } -impl Into for ExecutionStrategy { - fn into(self) -> client::ExecutionStrategy { +impl Into for ExecutionStrategy { + fn into(self) -> client_api::ExecutionStrategy { match self { - ExecutionStrategy::Native => client::ExecutionStrategy::NativeWhenPossible, - ExecutionStrategy::Wasm => client::ExecutionStrategy::AlwaysWasm, - ExecutionStrategy::Both => client::ExecutionStrategy::Both, - ExecutionStrategy::NativeElseWasm => client::ExecutionStrategy::NativeElseWasm, + ExecutionStrategy::Native => client_api::ExecutionStrategy::NativeWhenPossible, + ExecutionStrategy::Wasm => client_api::ExecutionStrategy::AlwaysWasm, + ExecutionStrategy::Both => client_api::ExecutionStrategy::Both, + ExecutionStrategy::NativeElseWasm => client_api::ExecutionStrategy::NativeElseWasm, } } } diff --git a/core/cli/src/traits.rs b/client/cli/src/traits.rs similarity index 100% rename from core/cli/src/traits.rs rename to client/cli/src/traits.rs diff --git a/core/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml similarity index 57% rename from core/consensus/aura/Cargo.toml rename to client/consensus/aura/Cargo.toml index ddef391db1ddf..6fc90032c4426 100644 --- a/core/consensus/aura/Cargo.toml +++ b/client/consensus/aura/Cargo.toml @@ -6,36 +6,36 @@ description = "Aura consensus algorithm for substrate" edition = "2018" [dependencies] +app-crypto = { package = "substrate-application-crypto", path = "../../../primitives/application-crypto" } +aura_primitives = { package = "substrate-consensus-aura-primitives", path = "../../../primitives/consensus/aura" } +block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../../primitives/block-builder/runtime-api" } +client = { package = "substrate-client", path = "../../" } +client-api = { package = "substrate-client-api", path = "../../api" } codec = { package = "parity-scale-codec", version = "1.0.0" } -primitives = { package = "substrate-primitives", path = "../../primitives" } -app-crypto = { package = "substrate-application-crypto", path = "../../application-crypto" } -runtime_support = { package = "srml-support", path = "../../../srml/support" } -runtime_version = { package = "sr-version", path = "../../sr-version" } -runtime_io = { package = "sr-io", path = "../../sr-io" } -slots = { package = "substrate-consensus-slots", path = "../slots" } -aura_primitives = { package = "substrate-consensus-aura-primitives", path = "primitives" } -inherents = { package = "substrate-inherents", path = "../../inherents" } -srml-aura = { path = "../../../srml/aura" } -client = { package = "substrate-client", path = "../../client" } -substrate-telemetry = { path = "../../telemetry" } -keystore = { package = "substrate-keystore", path = "../../keystore" } -consensus_common = { package = "substrate-consensus-common", path = "../common" } -sr-primitives = { path = "../../sr-primitives" } -sr-api = { path = "../../sr-api" } +consensus_common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" } +derive_more = "0.15.0" futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] } -futures01 = { package = "futures", version = "0.1" } futures-timer = "0.4.0" -parking_lot = "0.9.0" +futures01 = { package = "futures", version = "0.1" } +inherents = { package = "substrate-inherents", path = "../../../primitives/inherents" } +keystore = { package = "substrate-keystore", path = "../../keystore" } log = "0.4.8" -derive_more = "0.15.0" -block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../block-builder/runtime-api" } +parking_lot = "0.9.0" +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +runtime_io = { package = "sr-io", path = "../../../primitives/sr-io" } +runtime_version = { package = "sr-version", path = "../../../primitives/sr-version" } +slots = { package = "substrate-consensus-slots", path = "../slots" } +sr-api = { path = "../../../primitives/sr-api" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +paint-aura = { path = "../../../paint/aura" } +substrate-telemetry = { path = "../../telemetry" } [dev-dependencies] -keyring = { package = "substrate-keyring", path = "../../keyring" } +keyring = { package = "substrate-keyring", path = "../../../primitives/keyring" } substrate-executor = { path = "../../executor" } network = { package = "substrate-network", path = "../../network", features = ["test-helpers"]} service = { package = "substrate-service", path = "../../service" } -test-client = { package = "substrate-test-runtime-client", path = "../../test-runtime/client" } +test-client = { package = "substrate-test-runtime-client", path = "../../../test/utils/runtime/client" } tokio = "0.1.22" env_logger = "0.7.0" tempfile = "3.1.0" diff --git a/core/consensus/aura/src/digest.rs b/client/consensus/aura/src/digest.rs similarity index 100% rename from core/consensus/aura/src/digest.rs rename to client/consensus/aura/src/digest.rs diff --git a/core/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs similarity index 98% rename from core/consensus/aura/src/lib.rs rename to client/consensus/aura/src/lib.rs index 0953ea6c973a3..a6b9c11bc361a 100644 --- a/core/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -38,8 +38,9 @@ use consensus_common::{self, BlockImport, Environment, Proposer, use consensus_common::import_queue::{ Verifier, BasicQueue, BoxBlockImport, BoxJustificationImport, BoxFinalityProofImport, }; +use client_api::{ error::Result as CResult, backend::AuxStore }; use client::{ - blockchain::ProvideCache, error::Result as CResult, backend::AuxStore, BlockOf, + blockchain::ProvideCache, BlockOf, well_known_cache_keys::{self, Id as CacheKeyId}, }; @@ -55,7 +56,7 @@ use futures::prelude::*; use parking_lot::Mutex; use log::{debug, info, trace}; -use srml_aura::{ +use paint_aura::{ InherentType as AuraInherent, AuraInherentData, timestamp::{TimestampInherentData, InherentType as TimestampInherent, InherentError as TIError} }; @@ -372,7 +373,7 @@ fn check_header( ) -> Result)>, Error> where DigestItemFor: CompatibleDigestItem

, P::Signature: Decode, - C: client::backend::AuxStore, + C: client_api::backend::AuxStore, P::Public: Encode + Decode + PartialEq + Clone, T: Send + Sync + 'static, { @@ -487,7 +488,7 @@ impl AuraVerifier #[forbid(deprecated)] impl Verifier for AuraVerifier where - C: ProvideRuntimeApi + Send + Sync + client::backend::AuxStore + ProvideCache + BlockOf, + C: ProvideRuntimeApi + Send + Sync + client_api::backend::AuxStore + ProvideCache + BlockOf, C::Api: BlockBuilderApi + AuraApi> + ApiExt, DigestItemFor: CompatibleDigestItem

, P: Pair + Send + Sync + 'static, @@ -653,9 +654,9 @@ fn register_aura_inherent_data_provider( inherent_data_providers: &InherentDataProviders, slot_duration: u64, ) -> Result<(), consensus_common::Error> { - if !inherent_data_providers.has_provider(&srml_aura::INHERENT_IDENTIFIER) { + if !inherent_data_providers.has_provider(&paint_aura::INHERENT_IDENTIFIER) { inherent_data_providers - .register_provider(srml_aura::InherentDataProvider::new(slot_duration)) + .register_provider(paint_aura::InherentDataProvider::new(slot_duration)) .map_err(Into::into) .map_err(consensus_common::Error::InherentData) } else { diff --git a/core/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml similarity index 62% rename from core/consensus/babe/Cargo.toml rename to client/consensus/babe/Cargo.toml index 45dd96a18aa7e..a4a92f04f0247 100644 --- a/core/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -7,28 +7,28 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } -babe_primitives = { package = "substrate-consensus-babe-primitives", path = "primitives" } -primitives = { package = "substrate-primitives", path = "../../primitives" } -app-crypto = { package = "substrate-application-crypto", path = "../../application-crypto" } +babe_primitives = { package = "substrate-consensus-babe-primitives", path = "../../../primitives/consensus/babe" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +app-crypto = { package = "substrate-application-crypto", path = "../../../primitives/application-crypto" } num-bigint = "0.2.3" num-rational = "0.2.2" num-traits = "0.2.8" -runtime-support = { package = "srml-support", path = "../../../srml/support" } -runtime-version = { package = "sr-version", path = "../../sr-version" } -runtime-io = { package = "sr-io", path = "../../sr-io" } -inherents = { package = "substrate-inherents", path = "../../inherents" } +runtime-version = { package = "sr-version", path = "../../../primitives/sr-version" } +runtime-io = { package = "sr-io", path = "../../../primitives/sr-io" } +inherents = { package = "substrate-inherents", path = "../../../primitives/inherents" } substrate-telemetry = { path = "../../telemetry" } keystore = { package = "substrate-keystore", path = "../../keystore" } -srml-babe = { path = "../../../srml/babe" } -client = { package = "substrate-client", path = "../../client" } -sr-api = { path = "../../sr-api" } -block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../block-builder/runtime-api" } -header-metadata = { package = "substrate-header-metadata", path = "../../client/header-metadata" } -consensus-common = { package = "substrate-consensus-common", path = "../common" } +paint-babe = { path = "../../../paint/babe" } +client-api = { package = "substrate-client-api", path = "../../api" } +client = { package = "substrate-client", path = "../../" } +sr-api = { path = "../../../primitives/sr-api" } +block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../../primitives/block-builder/runtime-api" } +header-metadata = { package = "substrate-header-metadata", path = "../../header-metadata" } +consensus-common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" } uncles = { package = "substrate-consensus-uncles", path = "../uncles" } slots = { package = "substrate-consensus-slots", path = "../slots" } -sr-primitives = { path = "../../sr-primitives" } -fork-tree = { path = "../../utils/fork-tree" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +fork-tree = { path = "../../../utils/fork-tree" } futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] } futures01 = { package = "futures", version = "0.1" } futures-timer = "0.4.0" @@ -41,11 +41,11 @@ pdqselect = "0.1.0" derive_more = "0.15.0" [dev-dependencies] -keyring = { package = "substrate-keyring", path = "../../keyring" } +keyring = { package = "substrate-keyring", path = "../../../primitives/keyring" } substrate-executor = { path = "../../executor" } network = { package = "substrate-network", path = "../../network", features = ["test-helpers"]} service = { package = "substrate-service", path = "../../service" } -test-client = { package = "substrate-test-runtime-client", path = "../../test-runtime/client" } +test-client = { package = "substrate-test-runtime-client", path = "../../../test/utils/runtime/client" } block-builder = { package = "substrate-block-builder", path = "../../block-builder" } tokio = "0.1.22" env_logger = "0.7.0" diff --git a/core/consensus/babe/src/authorship.rs b/client/consensus/babe/src/authorship.rs similarity index 100% rename from core/consensus/babe/src/authorship.rs rename to client/consensus/babe/src/authorship.rs diff --git a/core/consensus/babe/src/aux_schema.rs b/client/consensus/babe/src/aux_schema.rs similarity index 96% rename from core/consensus/babe/src/aux_schema.rs rename to client/consensus/babe/src/aux_schema.rs index 6290d5cf31643..04e9f81e5cffe 100644 --- a/core/consensus/babe/src/aux_schema.rs +++ b/client/consensus/babe/src/aux_schema.rs @@ -19,8 +19,10 @@ use log::info; use codec::{Decode, Encode}; -use client::backend::AuxStore; -use client::error::{Result as ClientResult, Error as ClientError}; +use client_api::{ + backend::AuxStore, + error::{Result as ClientResult, Error as ClientError}, +}; use sr_primitives::traits::Block as BlockT; use babe_primitives::BabeBlockWeight; diff --git a/core/consensus/babe/src/epoch_changes.rs b/client/consensus/babe/src/epoch_changes.rs similarity index 99% rename from core/consensus/babe/src/epoch_changes.rs rename to client/consensus/babe/src/epoch_changes.rs index 09a14d286426d..a5621efcd15a3 100644 --- a/core/consensus/babe/src/epoch_changes.rs +++ b/client/consensus/babe/src/epoch_changes.rs @@ -25,9 +25,11 @@ use fork_tree::ForkTree; use parking_lot::{Mutex, MutexGuard}; use sr_primitives::traits::{Block as BlockT, NumberFor, One, Zero}; use codec::{Encode, Decode}; -use client::error::Error as ClientError; -use client::utils as client_utils; -use client::blockchain::HeaderBackend; +use client_api::{ + error::Error as ClientError, + utils::is_descendent_of, + blockchain::HeaderBackend +}; use header_metadata::HeaderMetadata; use primitives::H256; use std::ops::Add; @@ -72,7 +74,7 @@ impl<'a, H, Block> IsDescendentOfBuilder fn build_is_descendent_of(&self, current: Option<(H256, H256)>) -> Self::IsDescendentOf { - Box::new(client_utils::is_descendent_of(self.0, current)) + Box::new(is_descendent_of(self.0, current)) } } diff --git a/core/consensus/babe/src/lib.rs b/client/consensus/babe/src/lib.rs similarity index 97% rename from core/consensus/babe/src/lib.rs rename to client/consensus/babe/src/lib.rs index 04d0f5930589a..dbfd3dbfa4b54 100644 --- a/core/consensus/babe/src/lib.rs +++ b/client/consensus/babe/src/lib.rs @@ -80,17 +80,20 @@ use consensus_common::{ self, BlockImport, Environment, Proposer, BlockCheckParams, ForkChoiceStrategy, BlockImportParams, BlockOrigin, Error as ConsensusError, }; -use srml_babe::{ +use paint_babe::{ BabeInherentData, timestamp::{TimestampInherentData, InherentType as TimestampInherent} }; use consensus_common::SelectChain; use consensus_common::import_queue::{Verifier, BasicQueue, CacheKeyId}; -use client::{ - blockchain::{self, HeaderBackend, ProvideCache}, BlockchainEvents, CallExecutor, Client, - error::Result as ClientResult, error::Error as ClientError, backend::{AuxStore, Backend}, - ProvideUncles, +use client_api::{ + backend::{AuxStore, Backend}, + call_executor::CallExecutor, + error::{Result as ClientResult, Error as ClientError}, + blockchain::{self, HeaderBackend, ProvideCache}, + BlockchainEvents, ProvideUncles, }; +use client::Client; use block_builder_api::BlockBuilder as BlockBuilderApi; @@ -153,11 +156,11 @@ enum Error { #[display(fmt = "VRF verification failed: {:?}", _0)] VRFVerificationFailed(SignatureError), #[display(fmt = "Could not fetch parent header: {:?}", _0)] - FetchParentHeader(client::error::Error), + FetchParentHeader(client_api::error::Error), #[display(fmt = "Expected epoch change to happen at {:?}, s{}", _0, _1)] ExpectedEpochChange(B::Hash, u64), #[display(fmt = "Could not look up epoch: {:?}", _0)] - CouldNotLookUpEpoch(Box>), + CouldNotLookUpEpoch(Box>), #[display(fmt = "Block {} is not valid under any epoch.", _0)] BlockNotValid(B::Hash), #[display(fmt = "Unexpected epoch change")] @@ -166,9 +169,9 @@ enum Error { ParentBlockNoAssociatedWeight(B::Hash), #[display(fmt = "Checking inherents failed: {}", _0)] CheckInherents(String), - Client(client::error::Error), + Client(client_api::error::Error), Runtime(inherents::Error), - ForkTree(Box>), + ForkTree(Box>), } impl std::convert::From> for String { @@ -202,7 +205,7 @@ impl Config { /// Either fetch the slot duration from disk or compute it from the genesis /// state. pub fn get_or_compute(client: &C) -> ClientResult where - C: AuxStore + ProvideRuntimeApi, C::Api: BabeApi, + C: AuxStore + ProvideRuntimeApi, C::Api: BabeApi, { trace!(target: "babe", "Getting slot duration"); match slots::SlotDuration::get_or_compute(client, |a, b| a.configuration(b)).map(Self) { @@ -554,7 +557,7 @@ impl BabeVerifier { block_id: BlockId, inherent_data: InherentData, ) -> Result<(), Error> - where PRA: ProvideRuntimeApi, PRA::Api: BlockBuilderApi + where PRA: ProvideRuntimeApi, PRA::Api: BlockBuilderApi { let inherent_res = self.api.runtime_api().check_inherents( &block_id, @@ -623,8 +626,8 @@ impl Verifier for BabeVerifier + 'static + Clone + Send + Sync, RA: Send + Sync, PRA: ProvideRuntimeApi + Send + Sync + AuxStore + ProvideCache, - PRA::Api: BlockBuilderApi - + BabeApi, + PRA::Api: BlockBuilderApi + + BabeApi, { fn verify( &mut self, @@ -768,9 +771,9 @@ fn register_babe_inherent_data_provider( slot_duration: u64, ) -> Result<(), consensus_common::Error> { debug!(target: "babe", "Registering"); - if !inherent_data_providers.has_provider(&srml_babe::INHERENT_IDENTIFIER) { + if !inherent_data_providers.has_provider(&paint_babe::INHERENT_IDENTIFIER) { inherent_data_providers - .register_provider(srml_babe::InherentDataProvider::new(slot_duration)) + .register_provider(paint_babe::InherentDataProvider::new(slot_duration)) .map_err(Into::into) .map_err(consensus_common::Error::InherentData) } else { @@ -903,7 +906,7 @@ impl BlockImport for BabeBlockImport| ConsensusError::ChainLookup( + .map_err(|e: fork_tree::Error| ConsensusError::ChainLookup( babe_err(Error::::CouldNotLookUpEpoch(Box::new(e))).into() ))? .ok_or_else(|| ConsensusError::ClientImport( @@ -1142,7 +1145,7 @@ pub fn import_queue, I, RA, PRA>( E: CallExecutor + Clone + Send + Sync + 'static, RA: Send + Sync + 'static, PRA: ProvideRuntimeApi + ProvideCache + Send + Sync + AuxStore + 'static, - PRA::Api: BlockBuilderApi + BabeApi + ApiExt, + PRA::Api: BlockBuilderApi + BabeApi + ApiExt, { register_babe_inherent_data_provider(&inherent_data_providers, babe_link.config.slot_duration)?; diff --git a/core/consensus/babe/src/tests.rs b/client/consensus/babe/src/tests.rs similarity index 99% rename from core/consensus/babe/src/tests.rs rename to client/consensus/babe/src/tests.rs index 7fdf70045ec49..19c5844511288 100644 --- a/core/consensus/babe/src/tests.rs +++ b/client/consensus/babe/src/tests.rs @@ -34,7 +34,7 @@ use network::config::BoxFinalityProofRequestBuilder; use sr_primitives::{generic::DigestItem, traits::{Block as BlockT, DigestFor}}; use network::config::ProtocolConfig; use tokio::runtime::current_thread; -use client::BlockchainEvents; +use client_api::BlockchainEvents; use test_client; use log::debug; use std::{time::Duration, cell::RefCell}; @@ -633,7 +633,7 @@ fn importing_block_one_sets_genesis_epoch() { #[test] fn importing_epoch_change_block_prunes_tree() { - use client::backend::Finalizer; + use client_api::Finalizer; let mut net = BabeTestNet::new(1); diff --git a/core/consensus/babe/src/verification.rs b/client/consensus/babe/src/verification.rs similarity index 100% rename from core/consensus/babe/src/verification.rs rename to client/consensus/babe/src/verification.rs diff --git a/core/consensus/pow/Cargo.toml b/client/consensus/pow/Cargo.toml similarity index 53% rename from core/consensus/pow/Cargo.toml rename to client/consensus/pow/Cargo.toml index d57881c422a2b..9d510cc6da67a 100644 --- a/core/consensus/pow/Cargo.toml +++ b/client/consensus/pow/Cargo.toml @@ -7,14 +7,14 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } -primitives = { package = "substrate-primitives", path = "../../primitives" } -sr-primitives = { path = "../../sr-primitives" } -client = { package = "substrate-client", path = "../../client" } -block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../block-builder/runtime-api" } -srml-timestamp = { path = "../../../srml/timestamp" } -inherents = { package = "substrate-inherents", path = "../../inherents" } -pow-primitives = { package = "substrate-consensus-pow-primitives", path = "primitives" } -consensus-common = { package = "substrate-consensus-common", path = "../common" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +client-api = { package = "substrate-client-api", path = "../../api" } +block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../../primitives/block-builder/runtime-api" } +paint-timestamp = { path = "../../../paint/timestamp" } +inherents = { package = "substrate-inherents", path = "../../../primitives/inherents" } +pow-primitives = { package = "substrate-consensus-pow-primitives", path = "../../../primitives/consensus/pow" } +consensus-common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" } log = "0.4.8" futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] } derive_more = "0.15.0" diff --git a/core/consensus/pow/src/lib.rs b/client/consensus/pow/src/lib.rs similarity index 97% rename from core/consensus/pow/src/lib.rs rename to client/consensus/pow/src/lib.rs index b6e94411fdcbf..57d05fcc450be 100644 --- a/core/consensus/pow/src/lib.rs +++ b/client/consensus/pow/src/lib.rs @@ -32,7 +32,7 @@ use std::sync::Arc; use std::thread; use std::collections::HashMap; -use client::{ +use client_api::{ BlockOf, blockchain::{HeaderBackend, ProvideCache}, backend::AuxStore, well_known_cache_keys::Id as CacheKeyId, }; @@ -40,7 +40,7 @@ use block_builder_api::BlockBuilder as BlockBuilderApi; use sr_primitives::{Justification, RuntimeString}; use sr_primitives::generic::{BlockId, Digest, DigestItem}; use sr_primitives::traits::{Block as BlockT, Header as HeaderT, ProvideRuntimeApi}; -use srml_timestamp::{TimestampInherentData, InherentError as TIError}; +use paint_timestamp::{TimestampInherentData, InherentError as TIError}; use pow_primitives::{Seal, TotalDifficulty, POW_ENGINE_ID}; use primitives::H256; use inherents::{InherentDataProviders, InherentData}; @@ -50,6 +50,7 @@ use consensus_common::{ }; use consensus_common::import_queue::{BoxBlockImport, BasicQueue, Verifier}; use codec::{Encode, Decode}; +use client_api; use log::*; #[derive(derive_more::Display, Debug)] @@ -65,7 +66,7 @@ pub enum Error { #[display(fmt = "Fetching best header failed using select chain: {:?}", _0)] BestHeaderSelectChain(ConsensusError), #[display(fmt = "Fetching best header failed: {:?}", _0)] - BestHeader(client::error::Error), + BestHeader(client_api::error::Error), #[display(fmt = "Best header does not exist")] NoBestHeader, #[display(fmt = "Block proposing error: {:?}", _0)] @@ -78,7 +79,7 @@ pub enum Error { CreateInherents(inherents::Error), #[display(fmt = "Checking inherents failed: {}", _0)] CheckInherents(String), - Client(client::error::Error), + Client(client_api::error::Error), Codec(codec::Error), Environment(String), Runtime(RuntimeString) @@ -210,7 +211,7 @@ impl, C, S, Algorithm> PowVerifier { inherent_data: InherentData, timestamp_now: u64, ) -> Result<(), Error> where - C: ProvideRuntimeApi, C::Api: BlockBuilderApi + C: ProvideRuntimeApi, C::Api: BlockBuilderApi { const MAX_TIMESTAMP_DRIFT_SECS: u64 = 60; @@ -248,7 +249,7 @@ impl, C, S, Algorithm> PowVerifier { impl, C, S, Algorithm> Verifier for PowVerifier where C: ProvideRuntimeApi + Send + Sync + HeaderBackend + AuxStore + ProvideCache + BlockOf, - C::Api: BlockBuilderApi, + C::Api: BlockBuilderApi, S: SelectChain, Algorithm: PowAlgorithm + Send + Sync, { @@ -315,9 +316,9 @@ impl, C, S, Algorithm> Verifier for PowVerifier Result<(), consensus_common::Error> { - if !inherent_data_providers.has_provider(&srml_timestamp::INHERENT_IDENTIFIER) { + if !inherent_data_providers.has_provider(&paint_timestamp::INHERENT_IDENTIFIER) { inherent_data_providers - .register_provider(srml_timestamp::InherentDataProvider) + .register_provider(paint_timestamp::InherentDataProvider) .map_err(Into::into) .map_err(consensus_common::Error::InherentData) } else { @@ -340,7 +341,7 @@ pub fn import_queue( B: BlockT, C: ProvideRuntimeApi + HeaderBackend + BlockOf + ProvideCache + AuxStore, C: Send + Sync + AuxStore + 'static, - C::Api: BlockBuilderApi, + C::Api: BlockBuilderApi, Algorithm: PowAlgorithm + Send + Sync + 'static, S: SelectChain + 'static, { diff --git a/core/consensus/slots/Cargo.toml b/client/consensus/slots/Cargo.toml similarity index 59% rename from core/consensus/slots/Cargo.toml rename to client/consensus/slots/Cargo.toml index 4074242502b71..5e9af2f29a474 100644 --- a/core/consensus/slots/Cargo.toml +++ b/client/consensus/slots/Cargo.toml @@ -8,16 +8,16 @@ build = "build.rs" [dependencies] codec = { package = "parity-scale-codec", version = "1.0.0" } -client = { package = "substrate-client", path = "../../client" } -primitives = { package = "substrate-primitives", path = "../../primitives" } -sr-primitives = { path = "../../sr-primitives" } +client-api = { package = "substrate-client-api", path = "../../api" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +sr-primitives = { path = "../../../primitives/sr-primitives" } substrate-telemetry = { path = "../../telemetry" } -consensus_common = { package = "substrate-consensus-common", path = "../common" } -inherents = { package = "substrate-inherents", path = "../../inherents" } +consensus_common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" } +inherents = { package = "substrate-inherents", path = "../../../primitives/inherents" } futures-preview = "0.3.0-alpha.19" futures-timer = "0.4.0" parking_lot = "0.9.0" log = "0.4.8" [dev-dependencies] -test-client = { package = "substrate-test-runtime-client", path = "../../test-runtime/client" } +test-client = { package = "substrate-test-runtime-client", path = "../../../test/utils/runtime/client" } diff --git a/core/consensus/slots/build.rs b/client/consensus/slots/build.rs similarity index 100% rename from core/consensus/slots/build.rs rename to client/consensus/slots/build.rs diff --git a/core/consensus/slots/src/aux_schema.rs b/client/consensus/slots/src/aux_schema.rs similarity index 98% rename from core/consensus/slots/src/aux_schema.rs rename to client/consensus/slots/src/aux_schema.rs index 186288c174432..1e777f35a17ed 100644 --- a/core/consensus/slots/src/aux_schema.rs +++ b/client/consensus/slots/src/aux_schema.rs @@ -17,8 +17,8 @@ //! Schema for slots in the aux-db. use codec::{Encode, Decode}; -use client::backend::AuxStore; -use client::error::{Result as ClientResult, Error as ClientError}; +use client_api::backend::AuxStore; +use client_api::error::{Result as ClientResult, Error as ClientError}; use sr_primitives::traits::Header; const SLOT_HEADER_MAP_KEY: &[u8] = b"slot_header_map"; diff --git a/core/consensus/slots/src/lib.rs b/client/consensus/slots/src/lib.rs similarity index 98% rename from core/consensus/slots/src/lib.rs rename to client/consensus/slots/src/lib.rs index ebcd3351bc569..5897f88c77c29 100644 --- a/core/consensus/slots/src/lib.rs +++ b/client/consensus/slots/src/lib.rs @@ -41,6 +41,7 @@ use sr_primitives::traits::{ApiRef, Block as BlockT, Header, ProvideRuntimeApi}; use std::{fmt::Debug, ops::Deref, pin::Pin, sync::Arc}; use substrate_telemetry::{telemetry, CONSENSUS_DEBUG, CONSENSUS_WARN, CONSENSUS_INFO}; use parking_lot::Mutex; +use client_api; /// A worker that should be invoked at every new slot. pub trait SlotWorker { @@ -389,17 +390,17 @@ impl SlotDuration { /// /// `slot_key` is marked as `'static`, as it should really be a /// compile-time constant. - pub fn get_or_compute(client: &C, cb: CB) -> ::client::error::Result where - C: client::backend::AuxStore, + pub fn get_or_compute(client: &C, cb: CB) -> client_api::error::Result where + C: client_api::backend::AuxStore, C: ProvideRuntimeApi, - CB: FnOnce(ApiRef, &BlockId) -> ::client::error::Result, + CB: FnOnce(ApiRef, &BlockId) -> client_api::error::Result, T: SlotData + Encode + Decode + Debug, { match client.get_aux(T::SLOT_KEY)? { Some(v) => ::decode(&mut &v[..]) .map(SlotDuration) .map_err(|_| { - client::error::Error::Backend({ + client_api::error::Error::Backend({ error!(target: "slots", "slot duration kept in invalid format"); "slot duration kept in invalid format".to_string() }) diff --git a/core/consensus/slots/src/slots.rs b/client/consensus/slots/src/slots.rs similarity index 100% rename from core/consensus/slots/src/slots.rs rename to client/consensus/slots/src/slots.rs diff --git a/client/consensus/uncles/Cargo.toml b/client/consensus/uncles/Cargo.toml new file mode 100644 index 0000000000000..1212449a55d60 --- /dev/null +++ b/client/consensus/uncles/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "substrate-consensus-uncles" +version = "2.0.0" +authors = ["Parity Technologies "] +description = "Generic uncle inclusion utilities for consensus" +edition = "2018" + +[dependencies] +client-api = { package = "substrate-client-api", path = "../../api" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +paint-authorship = { path = "../../../paint/authorship" } +consensus_common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" } +inherents = { package = "substrate-inherents", path = "../../../primitives/inherents" } +log = "0.4.8" diff --git a/core/consensus/uncles/src/lib.rs b/client/consensus/uncles/src/lib.rs similarity index 91% rename from core/consensus/uncles/src/lib.rs rename to client/consensus/uncles/src/lib.rs index 5638a23175d56..63d4f584a31aa 100644 --- a/core/consensus/uncles/src/lib.rs +++ b/client/consensus/uncles/src/lib.rs @@ -22,7 +22,7 @@ use consensus_common::SelectChain; use inherents::{InherentDataProviders}; use log::warn; -use client::ProvideUncles; +use client_api::ProvideUncles; use sr_primitives::traits::{Block as BlockT, Header}; use std::sync::Arc; @@ -39,9 +39,9 @@ pub fn register_uncles_inherent_data_provider( C: ProvideUncles + Send + Sync + 'static, SC: SelectChain + 'static, { - if !inherent_data_providers.has_provider(&srml_authorship::INHERENT_IDENTIFIER) { + if !inherent_data_providers.has_provider(&paint_authorship::INHERENT_IDENTIFIER) { inherent_data_providers - .register_provider(srml_authorship::InherentDataProvider::new(move || { + .register_provider(paint_authorship::InherentDataProvider::new(move || { { let chain_head = match select_chain.best_chain() { Ok(x) => x, diff --git a/core/client/db/Cargo.toml b/client/db/Cargo.toml similarity index 68% rename from core/client/db/Cargo.toml rename to client/db/Cargo.toml index a1d9f2395c536..f03fde576e21b 100644 --- a/core/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -13,20 +13,21 @@ kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common", rev="b0317 kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" } linked-hash-map = "0.5.2" hash-db = "0.15.2" -primitives = { package = "substrate-primitives", path = "../../primitives" } -sr-primitives = { path = "../../sr-primitives" } -client = { package = "substrate-client", path = "../../client" } -state-machine = { package = "substrate-state-machine", path = "../../state-machine" } +client-api = { package = "substrate-client-api", path = "../api" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +sr-primitives = { path = "../../primitives/sr-primitives" } +client = { package = "substrate-client", path = "../" } +state-machine = { package = "substrate-state-machine", path = "../../primitives/state-machine" } codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } -executor = { package = "substrate-executor", path = "../../executor" } -state_db = { package = "substrate-state-db", path = "../../state-db" } -trie = { package = "substrate-trie", path = "../../trie" } -consensus_common = { package = "substrate-consensus-common", path = "../../consensus/common" } +executor = { package = "substrate-executor", path = "../executor" } +state_db = { package = "substrate-state-db", path = "../state-db" } +trie = { package = "substrate-trie", path = "../../primitives/trie" } +consensus_common = { package = "substrate-consensus-common", path = "../../primitives/consensus/common" } header_metadata = { package = "substrate-header-metadata", path = "../header-metadata" } [dev-dependencies] -substrate-keyring = { path = "../../keyring" } -test-client = { package = "substrate-test-runtime-client", path = "../../test-runtime/client" } +substrate-keyring = { path = "../../primitives/keyring" } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" } env_logger = "0.7.0" quickcheck = "0.8" diff --git a/core/client/db/src/cache/list_cache.rs b/client/db/src/cache/list_cache.rs similarity index 99% rename from core/client/db/src/cache/list_cache.rs rename to client/db/src/cache/list_cache.rs index 7a4fcc448e0e5..a51e6045c02fb 100644 --- a/core/client/db/src/cache/list_cache.rs +++ b/client/db/src/cache/list_cache.rs @@ -43,7 +43,7 @@ use std::collections::{BTreeSet, BTreeMap}; use log::warn; -use client::error::{Error as ClientError, Result as ClientResult}; +use client_api::error::{Error as ClientError, Result as ClientResult}; use sr_primitives::traits::{ Block as BlockT, NumberFor, Zero, Bounded, CheckedSub }; diff --git a/core/client/db/src/cache/list_entry.rs b/client/db/src/cache/list_entry.rs similarity index 99% rename from core/client/db/src/cache/list_entry.rs rename to client/db/src/cache/list_entry.rs index 6de369ecf56d2..afb2899362f91 100644 --- a/core/client/db/src/cache/list_entry.rs +++ b/client/db/src/cache/list_entry.rs @@ -16,7 +16,7 @@ //! List-cache storage entries. -use client::error::Result as ClientResult; +use client_api::error::Result as ClientResult; use sr_primitives::traits::{Block as BlockT, NumberFor}; use codec::{Encode, Decode}; diff --git a/core/client/db/src/cache/list_storage.rs b/client/db/src/cache/list_storage.rs similarity index 99% rename from core/client/db/src/cache/list_storage.rs rename to client/db/src/cache/list_storage.rs index 4fd9ecaced25e..d689619053d46 100644 --- a/core/client/db/src/cache/list_storage.rs +++ b/client/db/src/cache/list_storage.rs @@ -20,7 +20,7 @@ use std::sync::Arc; use kvdb::{KeyValueDB, DBTransaction}; -use client::error::{Error as ClientError, Result as ClientResult}; +use client_api::error::{Error as ClientError, Result as ClientResult}; use codec::{Encode, Decode}; use sr_primitives::generic::BlockId; use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor}; diff --git a/core/client/db/src/cache/mod.rs b/client/db/src/cache/mod.rs similarity index 98% rename from core/client/db/src/cache/mod.rs rename to client/db/src/cache/mod.rs index 9aaea57b0cdb2..b3ff1a4ea6dbc 100644 --- a/core/client/db/src/cache/mod.rs +++ b/client/db/src/cache/mod.rs @@ -21,8 +21,8 @@ use parking_lot::RwLock; use kvdb::{KeyValueDB, DBTransaction}; -use client::blockchain::{well_known_cache_keys::{self, Id as CacheKeyId}, Cache as BlockchainCache}; -use client::error::Result as ClientResult; +use client_api::blockchain::{well_known_cache_keys::{self, Id as CacheKeyId}, Cache as BlockchainCache}; +use client_api::error::Result as ClientResult; use codec::{Encode, Decode}; use sr_primitives::generic::BlockId; use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero}; @@ -211,7 +211,7 @@ impl<'a, Block: BlockT> DbCacheTransaction<'a, Block> { .cloned() .collect::>(); - let mut insert_op = |name: CacheKeyId, value: Option>| -> Result<(), client::error::Error> { + let mut insert_op = |name: CacheKeyId, value: Option>| -> Result<(), client_api::error::Error> { let cache = self.cache.get_cache(name); let op = cache.on_block_insert( &mut self::list_storage::DbStorageTransaction::new( diff --git a/core/client/src/children.rs b/client/db/src/children.rs similarity index 99% rename from core/client/src/children.rs rename to client/db/src/children.rs index 3128f860869ce..f6dd7299e43f5 100644 --- a/core/client/src/children.rs +++ b/client/db/src/children.rs @@ -18,7 +18,7 @@ use kvdb::{KeyValueDB, DBTransaction}; use codec::{Encode, Decode}; -use crate::error; +use client_api::error; use std::hash::Hash; diff --git a/core/client/db/src/lib.rs b/client/db/src/lib.rs similarity index 98% rename from core/client/db/src/lib.rs rename to client/db/src/lib.rs index 5902afff0de93..90d8aadccc1ae 100644 --- a/core/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -29,6 +29,7 @@ pub mod light; pub mod offchain; +mod children; mod cache; mod storage_cache; mod utils; @@ -38,11 +39,11 @@ use std::path::PathBuf; use std::io; use std::collections::{HashMap, HashSet}; -use client::backend::NewBlockState; -use client::blockchain::{well_known_cache_keys, HeaderBackend}; -use client::{ForkBlocks, ExecutionStrategies}; -use client::backend::{StorageCollection, ChildStorageCollection}; -use client::error::{Result as ClientResult, Error as ClientError}; +use client_api::backend::NewBlockState; +use client_api::blockchain::{well_known_cache_keys, HeaderBackend}; +use client_api::{ForkBlocks, ExecutionStrategies}; +use client_api::backend::{StorageCollection, ChildStorageCollection}; +use client_api::error::{Result as ClientResult, Error as ClientError}; use codec::{Decode, Encode}; use hash_db::{Hasher, Prefix}; use kvdb::{KeyValueDB, DBTransaction}; @@ -64,7 +65,6 @@ use state_machine::{ }; use crate::utils::{Meta, db_err, meta_keys, read_db, read_meta}; use client::leaves::{LeafSet, FinalizationDisplaced}; -use client::children; use state_db::StateDb; use header_metadata::{CachedHeaderMetadata, HeaderMetadata, HeaderMetadataCache}; use crate::storage_cache::{CachingState, SharedCache, new_shared_cache}; @@ -471,7 +471,7 @@ impl BlockImportOperation { } } -impl client::backend::BlockImportOperation +impl client_api::backend::BlockImportOperation for BlockImportOperation where Block: BlockT, { type State = CachingState, Block>; @@ -661,7 +661,7 @@ impl> DbChangesTrieStorage { } } -impl client::backend::PrunableStateChangesTrieStorage +impl client_api::backend::PrunableStateChangesTrieStorage for DbChangesTrieStorage where Block: BlockT, @@ -853,7 +853,7 @@ impl> Backend { /// Returns in-memory blockchain that contains the same set of blocks that the self. #[cfg(feature = "test-helpers")] pub fn as_in_memory(&self) -> InMemoryBackend { - use client::backend::{Backend as ClientBackend, BlockImportOperation}; + use client_api::backend::{Backend as ClientBackend, BlockImportOperation}; use client::blockchain::Backend as BlockchainBackend; let inmem = InMemoryBackend::::new(); @@ -913,7 +913,7 @@ impl> Backend { match cached_changes_trie_config.clone() { Some(cached_changes_trie_config) => Ok(cached_changes_trie_config), None => { - use client::backend::Backend; + use client_api::backend::Backend; let changes_trie_config = self .state_at(BlockId::Hash(block))? .storage(well_known_keys::CHANGES_TRIE_CONFIG)? @@ -1318,7 +1318,7 @@ fn apply_state_commit(transaction: &mut DBTransaction, commit: state_db::CommitS } } -impl client::backend::AuxStore for Backend where Block: BlockT { +impl client_api::backend::AuxStore for Backend where Block: BlockT { fn insert_aux< 'a, 'b: 'a, @@ -1342,7 +1342,7 @@ impl client::backend::AuxStore for Backend where Block: BlockT client::backend::Backend for Backend where Block: BlockT { +impl client_api::backend::Backend for Backend where Block: BlockT { type BlockImportOperation = BlockImportOperation; type Blockchain = BlockchainDb; type State = CachingState, Block>; @@ -1538,7 +1538,7 @@ impl client::backend::Backend for Backend whe } } -impl client::backend::LocalBackend for Backend +impl client_api::backend::LocalBackend for Backend where Block: BlockT {} /// TODO: remove me in #3201 @@ -1552,9 +1552,8 @@ mod tests { use hash_db::{HashDB, EMPTY_PREFIX}; use super::*; use crate::columns; - use client::backend::Backend as BTrait; + use client_api::backend::{Backend as BTrait, BlockImportOperation as Op}; use client::blockchain::Backend as BLBTrait; - use client::backend::BlockImportOperation as Op; use sr_primitives::testing::{Header, Block as RawBlock, ExtrinsicWrapper}; use sr_primitives::traits::{Hash, BlakeTwo256}; use state_machine::{TrieMut, TrieDBMut, ChangesTrieRootsStorage, ChangesTrieStorage}; diff --git a/core/client/db/src/light.rs b/client/db/src/light.rs similarity index 99% rename from core/client/db/src/light.rs rename to client/db/src/light.rs index 6e71b88ae73f9..bdce0e638428e 100644 --- a/core/client/db/src/light.rs +++ b/client/db/src/light.rs @@ -22,7 +22,7 @@ use parking_lot::RwLock; use kvdb::{KeyValueDB, DBTransaction}; -use client::backend::{AuxStore, NewBlockState}; +use client_api::backend::{AuxStore, NewBlockState}; use client::blockchain::{ BlockStatus, Cache as BlockchainCache, HeaderBackend as BlockchainHeaderBackend, Info as BlockchainInfo, diff --git a/core/client/db/src/offchain.rs b/client/db/src/offchain.rs similarity index 97% rename from core/client/db/src/offchain.rs rename to client/db/src/offchain.rs index 0640fb6c29bd6..09578f5f6b1d0 100644 --- a/core/client/db/src/offchain.rs +++ b/client/db/src/offchain.rs @@ -56,7 +56,7 @@ impl LocalStorage { } } -impl client::backend::OffchainStorage for LocalStorage { +impl client_api::OffchainStorage for LocalStorage { fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8]) { let key: Vec = prefix.iter().chain(key).cloned().collect(); let mut tx = self.db.transaction(); @@ -117,7 +117,7 @@ impl client::backend::OffchainStorage for LocalStorage { #[cfg(test)] mod tests { use super::*; - use client::backend::OffchainStorage; + use client_api::OffchainStorage; #[test] fn should_compare_and_set_and_clear_the_locks_map() { diff --git a/core/client/db/src/storage_cache.rs b/client/db/src/storage_cache.rs similarity index 99% rename from core/client/db/src/storage_cache.rs rename to client/db/src/storage_cache.rs index 3d8fcc612071c..9888dfbe647a5 100644 --- a/core/client/db/src/storage_cache.rs +++ b/client/db/src/storage_cache.rs @@ -25,7 +25,7 @@ use sr_primitives::traits::{Block as BlockT, Header}; use primitives::hexdisplay::HexDisplay; use state_machine::{backend::Backend as StateBackend, TrieBackend}; use log::trace; -use super::{StorageCollection, ChildStorageCollection}; +use client_api::backend::{StorageCollection, ChildStorageCollection}; use std::hash::Hash as StdHash; const STATE_CACHE_BLOCKS: usize = 12; diff --git a/core/client/db/src/utils.rs b/client/db/src/utils.rs similarity index 100% rename from core/client/db/src/utils.rs rename to client/db/src/utils.rs diff --git a/core/executor/Cargo.toml b/client/executor/Cargo.toml similarity index 74% rename from core/executor/Cargo.toml rename to client/executor/Cargo.toml index e0f2b8258043e..df023d9aa9a93 100644 --- a/core/executor/Cargo.toml +++ b/client/executor/Cargo.toml @@ -7,18 +7,18 @@ edition = "2018" [dependencies] derive_more = "0.15.0" codec = { package = "parity-scale-codec", version = "1.0.0" } -runtime_io = { package = "sr-io", path = "../sr-io" } -primitives = { package = "substrate-primitives", path = "../primitives" } -trie = { package = "substrate-trie", path = "../trie" } -serializer = { package = "substrate-serializer", path = "../serializer" } -runtime_version = { package = "sr-version", path = "../sr-version" } -panic-handler = { package = "substrate-panic-handler", path = "../panic-handler" } +runtime_io = { package = "sr-io", path = "../../primitives/sr-io" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +trie = { package = "substrate-trie", path = "../../primitives/trie" } +serializer = { package = "substrate-serializer", path = "../../primitives/serializer" } +runtime_version = { package = "sr-version", path = "../../primitives/sr-version" } +panic-handler = { package = "substrate-panic-handler", path = "../../primitives/panic-handler" } wasmi = "0.6.2" parity-wasm = "0.40.3" lazy_static = "1.4.0" -wasm-interface = { package = "substrate-wasm-interface", path = "../wasm-interface" } -runtime-interface = { package = "substrate-runtime-interface", path = "../runtime-interface" } -externalities = { package = "substrate-externalities", path = "../externalities" } +wasm-interface = { package = "substrate-wasm-interface", path = "../../primitives/wasm-interface" } +runtime-interface = { package = "substrate-runtime-interface", path = "../../primitives/runtime-interface" } +externalities = { package = "substrate-externalities", path = "../../primitives/externalities" } parking_lot = "0.9.0" log = "0.4.8" libsecp256k1 = "0.3.2" @@ -37,9 +37,9 @@ assert_matches = "1.3.0" wabt = "0.9.2" hex-literal = "0.2.1" runtime-test = { package = "substrate-runtime-test", path = "runtime-test" } -substrate-client = { path = "../client" } +client-api = { package = "substrate-client-api", path = "../api" } substrate-offchain = { path = "../offchain/" } -state_machine = { package = "substrate-state-machine", path = "../state-machine" } +state_machine = { package = "substrate-state-machine", path = "../../primitives/state-machine" } test-case = "0.3.3" [features] diff --git a/client/executor/runtime-test/Cargo.toml b/client/executor/runtime-test/Cargo.toml new file mode 100644 index 0000000000000..610db4545800e --- /dev/null +++ b/client/executor/runtime-test/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "substrate-runtime-test" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" +build = "build.rs" + +[dependencies] +rstd = { package = "sr-std", path = "../../../primitives/sr-std", default-features = false } +runtime_io = { package = "sr-io", path = "../../../primitives/sr-io", default-features = false } +sandbox = { package = "sr-sandbox", path = "../../../primitives/sr-sandbox", default-features = false } +primitives = { package = "substrate-primitives", path = "../../../primitives/core", default-features = false } +sr-primitives = { package = "sr-primitives", path = "../../../primitives/sr-primitives", default-features = false } + +[build-dependencies] +wasm-builder-runner = { package = "substrate-wasm-builder-runner", path = "../../../client/utils/wasm-builder-runner", version = "1.0.4" } + +[features] +default = [ "std" ] +std = ["runtime_io/std", "sandbox/std", "rstd/std"] diff --git a/node/runtime/build.rs b/client/executor/runtime-test/build.rs similarity index 96% rename from node/runtime/build.rs rename to client/executor/runtime-test/build.rs index f5c2f98a75c8a..d6b0ae626facb 100644 --- a/node/runtime/build.rs +++ b/client/executor/runtime-test/build.rs @@ -20,7 +20,7 @@ fn main() { build_current_project_with_rustflags( "wasm_binary.rs", WasmBuilderSource::CratesOrPath { - path: "../../core/utils/wasm-builder", + path: "../../../utils/wasm-builder", version: "1.0.8", }, // This instructs LLD to export __heap_base as a global variable, which is used by the diff --git a/core/executor/runtime-test/src/lib.rs b/client/executor/runtime-test/src/lib.rs similarity index 100% rename from core/executor/runtime-test/src/lib.rs rename to client/executor/runtime-test/src/lib.rs diff --git a/core/executor/src/allocator.rs b/client/executor/src/allocator.rs similarity index 100% rename from core/executor/src/allocator.rs rename to client/executor/src/allocator.rs diff --git a/core/executor/src/deprecated_host_interface.rs b/client/executor/src/deprecated_host_interface.rs similarity index 100% rename from core/executor/src/deprecated_host_interface.rs rename to client/executor/src/deprecated_host_interface.rs diff --git a/core/executor/src/error.rs b/client/executor/src/error.rs similarity index 100% rename from core/executor/src/error.rs rename to client/executor/src/error.rs diff --git a/client/executor/src/host_interface.rs b/client/executor/src/host_interface.rs new file mode 100644 index 0000000000000..0499cad5663ce --- /dev/null +++ b/client/executor/src/host_interface.rs @@ -0,0 +1,1075 @@ +// 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 . + +//! Definition and implementation of the old and deprecated Substrate runtime interface for the host. + +use codec::Encode; +use std::{convert::TryFrom, str}; +use primitives::{ + blake2_128, blake2_256, twox_64, twox_128, twox_256, ed25519, sr25519, Blake2Hasher, Pair, + crypto::KeyTypeId, offchain, +}; +use trie::{TrieConfiguration, trie_types::Layout}; +use wasm_interface::{ + Pointer, WordSize, WritePrimitive, ReadPrimitive, FunctionContext, Result as WResult, +}; + +#[cfg(feature="wasm-extern-trace")] +macro_rules! debug_trace { + ( $( $x:tt )* ) => ( trace!( $( $x )* ) ) +} + +#[cfg(not(feature="wasm-extern-trace"))] +macro_rules! debug_trace { + ( $( $x:tt )* ) => () +} + +/// The old and deprecated Substrate externals. These are still required for backwards compatibility +/// reasons. +pub struct SubstrateExternals; + +enum RecoverResult { + Invalid(u32), + Valid(secp256k1::PublicKey), +} + +fn secp256k1_recover( + context: &mut dyn FunctionContext, + msg_data: Pointer, + sig_data: Pointer, +) -> WResult { + let mut sig = [0u8; 65]; + context.read_memory_into(sig_data, &mut sig[..]) + .map_err(|_| "Invalid attempt to get signature in ext_secp256k1_ecdsa_recover")?; + let rs = match secp256k1::Signature::parse_slice(&sig[0..64]) { + Ok(rs) => rs, + _ => return Ok(RecoverResult::Invalid(1)), + }; + + let recovery_id = if sig[64] > 26 { sig[64] - 27 } else { sig[64] } as u8; + let v = match secp256k1::RecoveryId::parse(recovery_id) { + Ok(v) => v, + _ => return Ok(RecoverResult::Invalid(2)), + }; + + let mut msg = [0u8; 32]; + context.read_memory_into(msg_data, &mut msg[..]) + .map_err(|_| "Invalid attempt to get message in ext_secp256k1_ecdsa_recover")?; + + Ok(match secp256k1::recover(&secp256k1::Message::parse(&msg), &rs, &v) { + Ok(pubkey) => RecoverResult::Valid(pubkey), + Err(_) => RecoverResult::Invalid(3), + }) +} + +impl_wasm_host_interface! { + impl SubstrateExternals where context { + ext_malloc(size: WordSize) -> Pointer { + let r = context.allocate_memory(size)?; + debug_trace!(target: "sr-io", "malloc {} bytes at {:?}", size, r); + Ok(r) + } + + ext_free(addr: Pointer) { + context.deallocate_memory(addr)?; + debug_trace!(target: "sr-io", "free {:?}", addr); + Ok(()) + } + + ext_sandbox_instantiate( + dispatch_thunk_idx: u32, + wasm_ptr: Pointer, + wasm_len: WordSize, + imports_ptr: Pointer, + imports_len: WordSize, + state: u32, + ) -> u32 { + let wasm = context.read_memory(wasm_ptr, wasm_len) + .map_err(|_| "OOB while ext_sandbox_instantiate: wasm")?; + let raw_env_def = context.read_memory(imports_ptr, imports_len) + .map_err(|_| "OOB while ext_sandbox_instantiate: imports")?; + + context.sandbox().instance_new(dispatch_thunk_idx, &wasm, &raw_env_def, state) + } + + ext_sandbox_instance_teardown(instance_idx: u32) { + context.sandbox().instance_teardown(instance_idx) + } + + ext_sandbox_invoke( + instance_idx: u32, + export_ptr: Pointer, + export_len: WordSize, + args_ptr: Pointer, + args_len: WordSize, + return_val_ptr: Pointer, + return_val_len: WordSize, + state: u32, + ) -> u32 { + let export = context.read_memory(export_ptr, export_len) + .map_err(|_| "OOB while ext_sandbox_invoke: export") + .and_then(|b| + String::from_utf8(b) + .map_err(|_| "Export name should be a valid utf-8 sequence") + )?; + + // Deserialize arguments and convert them into wasmi types. + let serialized_args = context.read_memory(args_ptr, args_len) + .map_err(|_| "OOB while ext_sandbox_invoke: args")?; + + context.sandbox().invoke( + instance_idx, + &export, + &serialized_args, + return_val_ptr, + return_val_len, + state, + ) + } + + ext_sandbox_memory_new(initial: WordSize, maximum: WordSize) -> u32 { + context.sandbox().memory_new(initial, maximum) + } + + ext_sandbox_memory_get( + memory_idx: u32, + offset: WordSize, + buf_ptr: Pointer, + buf_len: WordSize, + ) -> u32 { + context.sandbox().memory_get(memory_idx, offset, buf_ptr, buf_len) + } + + ext_sandbox_memory_set( + memory_idx: u32, + offset: WordSize, + val_ptr: Pointer, + val_len: WordSize, + ) -> u32 { + context.sandbox().memory_set(memory_idx, offset, val_ptr, val_len) + } + + ext_sandbox_memory_teardown(memory_idx: u32) { + context.sandbox().memory_teardown(memory_idx) + } + + ext_print_utf8(utf8_data: Pointer, utf8_len: WordSize) { + if let Ok(utf8) = context.read_memory(utf8_data, utf8_len) { + runtime_io::misc::print_utf8(&utf8); + } + Ok(()) + } + + ext_print_hex(data: Pointer, len: WordSize) { + if let Ok(hex) = context.read_memory(data, len) { + runtime_io::misc::print_hex(&hex); + } + Ok(()) + } + + ext_print_num(number: u64) { + runtime_io::misc::print_num(number); + Ok(()) + } + + ext_log( + level: u32, + target_data: Pointer, + target_len: WordSize, + message_data: Pointer, + message_len: WordSize, + ) { + let target = context.read_memory(target_data, target_len) + .map_err(|_| "Invalid attempt to determine target in ext_log")?; + let message = context.read_memory(message_data, message_len) + .map_err(|_| "Invalid attempt to determine message in ext_log")?; + + let target_str = std::str::from_utf8(&target) + .map_err(|_| "Target invalid utf8 in ext_log")?; + + runtime_io::logging::log(level.into(), &target_str, &message); + Ok(()) + } + + ext_set_storage( + key_data: Pointer, + key_len: WordSize, + value_data: Pointer, + value_len: WordSize, + ) { + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to determine key in ext_set_storage")?; + let value = context.read_memory(value_data, value_len) + .map_err(|_| "Invalid attempt to determine value in ext_set_storage")?; + Ok(runtime_io::storage::set(&key, &value)) + } + + ext_set_child_storage( + storage_key_data: Pointer, + storage_key_len: WordSize, + key_data: Pointer, + key_len: WordSize, + value_data: Pointer, + value_len: WordSize, + ) { + let storage_key = context.read_memory(storage_key_data, storage_key_len) + .map_err(|_| "Invalid attempt to determine storage_key in ext_set_child_storage")?; + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to determine key in ext_set_child_storage")?; + let value = context.read_memory(value_data, value_len) + .map_err(|_| "Invalid attempt to determine value in ext_set_child_storage")?; + + Ok(runtime_io::storage::child_set(&storage_key, &key, &value)) + } + + ext_clear_child_storage( + storage_key_data: Pointer, + storage_key_len: WordSize, + key_data: Pointer, + key_len: WordSize, + ) { + let storage_key = context.read_memory(storage_key_data, storage_key_len) + .map_err(|_| "Invalid attempt to determine storage_key in ext_clear_child_storage")?; + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to determine key in ext_clear_child_storage")?; + + Ok(runtime_io::storage::child_clear(&storage_key, &key)) + } + + ext_clear_storage(key_data: Pointer, key_len: WordSize) { + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to determine key in ext_clear_storage")?; + Ok(runtime_io::storage::clear(&key)) + } + + ext_exists_storage(key_data: Pointer, key_len: WordSize) -> u32 { + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to determine key in ext_exists_storage")?; + Ok(if runtime_io::storage::exists(&key) { 1 } else { 0 }) + } + + ext_exists_child_storage( + storage_key_data: Pointer, + storage_key_len: WordSize, + key_data: Pointer, + key_len: WordSize, + ) -> u32 { + let storage_key = context.read_memory(storage_key_data, storage_key_len) + .map_err(|_| "Invalid attempt to determine storage_key in ext_exists_child_storage")?; + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to determine key in ext_exists_child_storage")?; + + Ok(if runtime_io::storage::child_exists(&storage_key, &key) { 1 } else { 0 }) + } + + ext_clear_prefix(prefix_data: Pointer, prefix_len: WordSize) { + let prefix = context.read_memory(prefix_data, prefix_len) + .map_err(|_| "Invalid attempt to determine prefix in ext_clear_prefix")?; + Ok(runtime_io::storage::clear_prefix(&prefix)) + } + + ext_clear_child_prefix( + storage_key_data: Pointer, + storage_key_len: WordSize, + prefix_data: Pointer, + prefix_len: WordSize, + ) { + let storage_key = context.read_memory(storage_key_data, storage_key_len) + .map_err(|_| "Invalid attempt to determine storage_key in ext_clear_child_prefix")?; + let prefix = context.read_memory(prefix_data, prefix_len) + .map_err(|_| "Invalid attempt to determine prefix in ext_clear_child_prefix")?; + Ok(runtime_io::storage::child_clear_prefix(&storage_key, &prefix)) + } + + ext_kill_child_storage(storage_key_data: Pointer, storage_key_len: WordSize) { + let storage_key = context.read_memory(storage_key_data, storage_key_len) + .map_err(|_| "Invalid attempt to determine storage_key in ext_kill_child_storage")?; + Ok(runtime_io::storage::child_storage_kill(&storage_key)) + } + + ext_get_allocated_storage( + key_data: Pointer, + key_len: WordSize, + written_out: Pointer, + ) -> Pointer { + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to determine key in ext_get_allocated_storage")?; + + if let Some(value) = runtime_io::storage::get(&key) { + let offset = context.allocate_memory(value.len() as u32)?; + context.write_memory(offset, &value) + .map_err(|_| "Invalid attempt to set memory in ext_get_allocated_storage")?; + context.write_primitive(written_out, value.len() as u32) + .map_err(|_| "Invalid attempt to write written_out in ext_get_allocated_storage")?; + Ok(offset) + } else { + context.write_primitive(written_out, u32::max_value()) + .map_err(|_| "Invalid attempt to write failed written_out in ext_get_allocated_storage")?; + Ok(Pointer::null()) + } + } + + ext_get_allocated_child_storage( + storage_key_data: Pointer, + storage_key_len: WordSize, + key_data: Pointer, + key_len: WordSize, + written_out: Pointer, + ) -> Pointer { + let storage_key = context.read_memory(storage_key_data, storage_key_len) + .map_err(|_| "Invalid attempt to determine storage_key in ext_get_allocated_child_storage")?; + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to determine key in ext_get_allocated_child_storage")?; + + if let Some(value) = runtime_io::storage::child_get(&storage_key, &key) { + let offset = context.allocate_memory(value.len() as u32)?; + context.write_memory(offset, &value) + .map_err(|_| "Invalid attempt to set memory in ext_get_allocated_child_storage")?; + context.write_primitive(written_out, value.len() as u32) + .map_err(|_| "Invalid attempt to write written_out in ext_get_allocated_child_storage")?; + Ok(offset) + } else { + context.write_primitive(written_out, u32::max_value()) + .map_err(|_| "Invalid attempt to write failed written_out in ext_get_allocated_child_storage")?; + Ok(Pointer::null()) + } + } + + ext_get_storage_into( + key_data: Pointer, + key_len: WordSize, + value_data: Pointer, + value_len: WordSize, + value_offset: WordSize, + ) -> WordSize { + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to get key in ext_get_storage_into")?; + + if let Some(value) = runtime_io::storage::get(&key) { + let data = &value[value.len().min(value_offset as usize)..]; + let written = std::cmp::min(value_len as usize, data.len()); + context.write_memory(value_data, &data[..written]) + .map_err(|_| "Invalid attempt to set value in ext_get_storage_into")?; + Ok(value.len() as u32) + } else { + Ok(u32::max_value()) + } + } + + ext_get_child_storage_into( + storage_key_data: Pointer, + storage_key_len: WordSize, + key_data: Pointer, + key_len: WordSize, + value_data: Pointer, + value_len: WordSize, + value_offset: WordSize, + ) -> WordSize { + let storage_key = context.read_memory(storage_key_data, storage_key_len) + .map_err(|_| "Invalid attempt to determine storage_key in ext_get_child_storage_into")?; + let key = context.read_memory(key_data, key_len) + .map_err(|_| "Invalid attempt to get key in ext_get_child_storage_into")?; + + if let Some(value) = runtime_io::storage::child_get(&storage_key, &key) { + let data = &value[value.len().min(value_offset as usize)..]; + let written = std::cmp::min(value_len as usize, data.len()); + context.write_memory(value_data, &data[..written]) + .map_err(|_| "Invalid attempt to get value in ext_get_child_storage_into")?; + Ok(value.len() as u32) + } else { + Ok(u32::max_value()) + } + } + + ext_storage_root(result: Pointer) { + context.write_memory(result, runtime_io::storage::root().as_ref()) + .map_err(|_| "Invalid attempt to set memory in ext_storage_root".into()) + } + + ext_child_storage_root( + storage_key_data: Pointer, + storage_key_len: WordSize, + written_out: Pointer, + ) -> Pointer { + let storage_key = context.read_memory(storage_key_data, storage_key_len) + .map_err(|_| "Invalid attempt to determine storage_key in ext_child_storage_root")?; + let value = runtime_io::storage::child_root(&storage_key); + + let offset = context.allocate_memory(value.len() as u32)?; + context.write_memory(offset, &value) + .map_err(|_| "Invalid attempt to set memory in ext_child_storage_root")?; + context.write_primitive(written_out, value.len() as u32) + .map_err(|_| "Invalid attempt to write written_out in ext_child_storage_root")?; + Ok(offset) + } + + ext_storage_changes_root( + parent_hash_data: Pointer, + _len: WordSize, + result: Pointer, + ) -> u32 { + let mut parent_hash = [0u8; 32]; + context.read_memory_into(parent_hash_data, &mut parent_hash[..]) + .map_err(|_| "Invalid attempt to get parent_hash in ext_storage_changes_root")?; + + if let Some(r) = runtime_io::storage::changes_root(parent_hash) { + context.write_memory(result, &r[..]) + .map_err(|_| "Invalid attempt to set memory in ext_storage_changes_root")?; + Ok(1) + } else { + Ok(0) + } + } + + ext_blake2_256_enumerated_trie_root( + values_data: Pointer, + lens_data: Pointer, + lens_len: WordSize, + result: Pointer, + ) { + let values = (0..lens_len) + .map(|i| context.read_primitive(lens_data.offset(i).ok_or("Pointer overflow")?)) + .collect::, _>>()? + .into_iter() + .scan(0u32, |acc, v| { let o = *acc; *acc += v; Some((o, v)) }) + .map(|(offset, len)| + context.read_memory(values_data.offset(offset).ok_or("Pointer overflow")?, len) + .map_err(|_| + "Invalid attempt to get memory in ext_blake2_256_enumerated_trie_root" + ) + ) + .collect::, _>>()?; + let r = Layout::::ordered_trie_root(values.into_iter()); + context.write_memory(result, &r[..]) + .map_err(|_| "Invalid attempt to set memory in ext_blake2_256_enumerated_trie_root")?; + Ok(()) + } + + ext_chain_id() -> u64 { + Ok(runtime_io::misc::chain_id()) + } + + ext_twox_64(data: Pointer, len: WordSize, out: Pointer) { + let result: [u8; 8] = if len == 0 { + let hashed = twox_64(&[0u8; 0]); + hashed + } else { + let key = context.read_memory(data, len) + .map_err(|_| "Invalid attempt to get key in ext_twox_64")?; + let hashed_key = twox_64(&key); + hashed_key + }; + + context.write_memory(out, &result) + .map_err(|_| "Invalid attempt to set result in ext_twox_64")?; + Ok(()) + } + + ext_twox_128(data: Pointer, len: WordSize, out: Pointer) { + let result: [u8; 16] = if len == 0 { + let hashed = twox_128(&[0u8; 0]); + hashed + } else { + let key = context.read_memory(data, len) + .map_err(|_| "Invalid attempt to get key in ext_twox_128")?; + let hashed_key = twox_128(&key); + hashed_key + }; + + context.write_memory(out, &result) + .map_err(|_| "Invalid attempt to set result in ext_twox_128")?; + Ok(()) + } + + ext_twox_256(data: Pointer, len: WordSize, out: Pointer) { + let result: [u8; 32] = if len == 0 { + twox_256(&[0u8; 0]) + } else { + let mem = context.read_memory(data, len) + .map_err(|_| "Invalid attempt to get data in ext_twox_256")?; + twox_256(&mem) + }; + context.write_memory(out, &result) + .map_err(|_| "Invalid attempt to set result in ext_twox_256")?; + Ok(()) + } + + ext_blake2_128(data: Pointer, len: WordSize, out: Pointer) { + let result: [u8; 16] = if len == 0 { + let hashed = blake2_128(&[0u8; 0]); + hashed + } else { + let key = context.read_memory(data, len) + .map_err(|_| "Invalid attempt to get key in ext_blake2_128")?; + let hashed_key = blake2_128(&key); + hashed_key + }; + + context.write_memory(out, &result) + .map_err(|_| "Invalid attempt to set result in ext_blake2_128")?; + Ok(()) + } + + ext_blake2_256(data: Pointer, len: WordSize, out: Pointer) { + let result: [u8; 32] = if len == 0 { + blake2_256(&[0u8; 0]) + } else { + let mem = context.read_memory(data, len) + .map_err(|_| "Invalid attempt to get data in ext_blake2_256")?; + blake2_256(&mem) + }; + context.write_memory(out, &result) + .map_err(|_| "Invalid attempt to set result in ext_blake2_256")?; + Ok(()) + } + + ext_keccak_256(data: Pointer, len: WordSize, out: Pointer) { + let result: [u8; 32] = if len == 0 { + tiny_keccak::keccak256(&[0u8; 0]) + } else { + let mem = context.read_memory(data, len) + .map_err(|_| "Invalid attempt to get data in ext_keccak_256")?; + tiny_keccak::keccak256(&mem) + }; + context.write_memory(out, &result) + .map_err(|_| "Invalid attempt to set result in ext_keccak_256")?; + Ok(()) + } + + ext_ed25519_public_keys(id_data: Pointer, result_len: Pointer) -> Pointer { + let mut id = [0u8; 4]; + context.read_memory_into(id_data, &mut id[..]) + .map_err(|_| "Invalid attempt to get id in ext_ed25519_public_keys")?; + let key_type = KeyTypeId(id); + + let keys = runtime_io::crypto::ed25519_public_keys(key_type).encode(); + + let len = keys.len() as u32; + let offset = context.allocate_memory(len)?; + + context.write_memory(offset, keys.as_ref()) + .map_err(|_| "Invalid attempt to set memory in ext_ed25519_public_keys")?; + context.write_primitive(result_len, len) + .map_err(|_| "Invalid attempt to write result_len in ext_ed25519_public_keys")?; + + Ok(offset) + } + + ext_ed25519_verify( + msg_data: Pointer, + msg_len: WordSize, + sig_data: Pointer, + pubkey_data: Pointer, + ) -> u32 { + let mut sig = [0u8; 64]; + context.read_memory_into(sig_data, &mut sig[..]) + .map_err(|_| "Invalid attempt to get signature in ext_ed25519_verify")?; + let mut pubkey = [0u8; 32]; + context.read_memory_into(pubkey_data, &mut pubkey[..]) + .map_err(|_| "Invalid attempt to get pubkey in ext_ed25519_verify")?; + let msg = context.read_memory(msg_data, msg_len) + .map_err(|_| "Invalid attempt to get message in ext_ed25519_verify")?; + + Ok(if ed25519::Pair::verify_weak(&sig, &msg, &pubkey) { + 0 + } else { + 1 + }) + } + + ext_ed25519_generate( + id_data: Pointer, + seed: Pointer, + seed_len: WordSize, + out: Pointer, + ) { + let mut id = [0u8; 4]; + context.read_memory_into(id_data, &mut id[..]) + .map_err(|_| "Invalid attempt to get id in ext_ed25519_generate")?; + let key_type = KeyTypeId(id); + + let seed = if seed_len == 0 { + None + } else { + Some( + context.read_memory(seed, seed_len) + .map_err(|_| "Invalid attempt to get seed in ext_ed25519_generate")? + ) + }; + + let pubkey = runtime_io::crypto::ed25519_generate(key_type, seed); + + context.write_memory(out, pubkey.as_ref()) + .map_err(|_| "Invalid attempt to set out in ext_ed25519_generate".into()) + } + + ext_ed25519_sign( + id_data: Pointer, + pubkey_data: Pointer, + msg_data: Pointer, + msg_len: WordSize, + out: Pointer, + ) -> u32 { + let mut id = [0u8; 4]; + context.read_memory_into(id_data, &mut id[..]) + .map_err(|_| "Invalid attempt to get id in ext_ed25519_sign")?; + let key_type = KeyTypeId(id); + + let mut pubkey = [0u8; 32]; + context.read_memory_into(pubkey_data, &mut pubkey[..]) + .map_err(|_| "Invalid attempt to get pubkey in ext_ed25519_sign")?; + + let msg = context.read_memory(msg_data, msg_len) + .map_err(|_| "Invalid attempt to get message in ext_ed25519_sign")?; + + let pub_key = ed25519::Public::try_from(pubkey.as_ref()) + .map_err(|_| "Invalid `ed25519` public key")?; + + let signature = runtime_io::crypto::ed25519_sign(key_type, &pub_key, &msg); + + match signature { + Some(signature) => { + context.write_memory(out, signature.as_ref()) + .map_err(|_| "Invalid attempt to set out in ext_ed25519_sign")?; + Ok(0) + }, + None => Ok(1), + } + } + + ext_sr25519_public_keys(id_data: Pointer, result_len: Pointer) -> Pointer { + let mut id = [0u8; 4]; + context.read_memory_into(id_data, &mut id[..]) + .map_err(|_| "Invalid attempt to get id in ext_sr25519_public_keys")?; + let key_type = KeyTypeId(id); + + let keys = runtime_io::crypto::sr25519_public_keys(key_type).encode(); + + let len = keys.len() as u32; + let offset = context.allocate_memory(len)?; + + context.write_memory(offset, keys.as_ref()) + .map_err(|_| "Invalid attempt to set memory in ext_sr25519_public_keys")?; + context.write_primitive(result_len, len) + .map_err(|_| "Invalid attempt to write result_len in ext_sr25519_public_keys")?; + + Ok(offset) + } + + ext_sr25519_verify( + msg_data: Pointer, + msg_len: WordSize, + sig_data: Pointer, + pubkey_data: Pointer, + ) -> u32 { + let mut sig = [0u8; 64]; + context.read_memory_into(sig_data, &mut sig[..]) + .map_err(|_| "Invalid attempt to get signature in ext_sr25519_verify")?; + let mut pubkey = [0u8; 32]; + context.read_memory_into(pubkey_data, &mut pubkey[..]) + .map_err(|_| "Invalid attempt to get pubkey in ext_sr25519_verify")?; + let msg = context.read_memory(msg_data, msg_len) + .map_err(|_| "Invalid attempt to get message in ext_sr25519_verify")?; + + Ok(if sr25519::Pair::verify_weak(&sig, &msg, &pubkey) { + 0 + } else { + 1 + }) + } + + ext_sr25519_generate( + id_data: Pointer, + seed: Pointer, + seed_len: WordSize, + out: Pointer, + ) { + let mut id = [0u8; 4]; + context.read_memory_into(id_data, &mut id[..]) + .map_err(|_| "Invalid attempt to get id in ext_sr25519_generate")?; + let key_type = KeyTypeId(id); + let seed = if seed_len == 0 { + None + } else { + Some( + context.read_memory(seed, seed_len) + .map_err(|_| "Invalid attempt to get seed in ext_sr25519_generate")? + ) + }; + + let pubkey = runtime_io::crypto::sr25519_generate(key_type, seed); + + context.write_memory(out, pubkey.as_ref()) + .map_err(|_| "Invalid attempt to set out in ext_sr25519_generate".into()) + } + + ext_sr25519_sign( + id_data: Pointer, + pubkey_data: Pointer, + msg_data: Pointer, + msg_len: WordSize, + out: Pointer, + ) -> u32 { + let mut id = [0u8; 4]; + context.read_memory_into(id_data, &mut id[..]) + .map_err(|_| "Invalid attempt to get id in ext_sr25519_sign")?; + let key_type = KeyTypeId(id); + + let mut pubkey = [0u8; 32]; + context.read_memory_into(pubkey_data, &mut pubkey[..]) + .map_err(|_| "Invalid attempt to get pubkey in ext_sr25519_sign")?; + + let msg = context.read_memory(msg_data, msg_len) + .map_err(|_| "Invalid attempt to get message in ext_sr25519_sign")?; + + let pub_key = sr25519::Public::try_from(pubkey.as_ref()) + .map_err(|_| "Invalid `sr25519` public key")?; + + let signature = runtime_io::crypto::sr25519_sign(key_type, &pub_key, &msg); + + match signature { + Some(signature) => { + context.write_memory(out, signature.as_ref()) + .map_err(|_| "Invalid attempt to set out in ext_sr25519_sign")?; + Ok(0) + }, + None => Ok(1), + } + } + + ext_secp256k1_ecdsa_recover( + msg_data: Pointer, + sig_data: Pointer, + pubkey_data: Pointer, + ) -> u32 { + match secp256k1_recover(context, msg_data, sig_data)? { + RecoverResult::Invalid(c) => Ok(c), + RecoverResult::Valid(pubkey) => { + context.write_memory(pubkey_data, &pubkey.serialize()[1..65]) + .map_err(|_| "Invalid attempt to set pubkey in ext_secp256k1_ecdsa_recover")?; + Ok(0) + } + } + } + + ext_secp256k1_ecdsa_recover_compressed( + msg_data: Pointer, + sig_data: Pointer, + pubkey_data: Pointer, + ) -> u32 { + match secp256k1_recover(context, msg_data, sig_data)? { + RecoverResult::Invalid(c) => Ok(c), + RecoverResult::Valid(pubkey) => { + context.write_memory(pubkey_data, &pubkey.serialize_compressed()[..]) + .map_err(|_| "Invalid attempt to set pubkey in ext_secp256k1_ecdsa_recover")?; + Ok(0) + } + } + } + + ext_is_validator() -> u32 { + if runtime_io::offchain::is_validator() { Ok(1) } else { Ok(0) } + } + + ext_submit_transaction(msg_data: Pointer, len: WordSize) -> u32 { + let extrinsic = context.read_memory(msg_data, len) + .map_err(|_| "OOB while ext_submit_transaction: wasm")?; + + let res = runtime_io::offchain::submit_transaction(extrinsic); + + Ok(if res.is_ok() { 0 } else { 1 }) + } + + ext_network_state(written_out: Pointer) -> Pointer { + let res = runtime_io::offchain::network_state(); + + let encoded = res.encode(); + let len = encoded.len() as u32; + let offset = context.allocate_memory(len)?; + context.write_memory(offset, &encoded) + .map_err(|_| "Invalid attempt to set memory in ext_network_state")?; + + context.write_primitive(written_out, len) + .map_err(|_| "Invalid attempt to write written_out in ext_network_state")?; + + Ok(offset) + } + + ext_timestamp() -> u64 { + Ok(runtime_io::offchain::timestamp().unix_millis()) + } + + ext_sleep_until(deadline: u64) { + runtime_io::offchain::sleep_until(offchain::Timestamp::from_unix_millis(deadline)); + Ok(()) + } + + ext_random_seed(seed_data: Pointer) { + // NOTE the runtime as assumptions about seed size. + let seed = runtime_io::offchain::random_seed(); + + context.write_memory(seed_data, &seed) + .map_err(|_| "Invalid attempt to set value in ext_random_seed")?; + Ok(()) + } + + ext_local_storage_set( + kind: u32, + key: Pointer, + key_len: WordSize, + value: Pointer, + value_len: WordSize, + ) { + let kind = offchain::StorageKind::try_from(kind) + .map_err(|_| "storage kind OOB while ext_local_storage_set: wasm")?; + let key = context.read_memory(key, key_len) + .map_err(|_| "OOB while ext_local_storage_set: wasm")?; + let value = context.read_memory(value, value_len) + .map_err(|_| "OOB while ext_local_storage_set: wasm")?; + + runtime_io::offchain::local_storage_set(kind, &key, &value); + + Ok(()) + } + + ext_local_storage_get( + kind: u32, + key: Pointer, + key_len: WordSize, + value_len: Pointer, + ) -> Pointer { + let kind = offchain::StorageKind::try_from(kind) + .map_err(|_| "storage kind OOB while ext_local_storage_get: wasm")?; + let key = context.read_memory(key, key_len) + .map_err(|_| "OOB while ext_local_storage_get: wasm")?; + + let maybe_value = runtime_io::offchain::local_storage_get(kind, &key); + + let (offset, len) = if let Some(value) = maybe_value { + let offset = context.allocate_memory(value.len() as u32)?; + context.write_memory(offset, &value) + .map_err(|_| "Invalid attempt to set memory in ext_local_storage_get")?; + (offset, value.len() as u32) + } else { + (Pointer::null(), u32::max_value()) + }; + + context.write_primitive(value_len, len) + .map_err(|_| "Invalid attempt to write value_len in ext_local_storage_get")?; + + Ok(offset) + } + + ext_local_storage_compare_and_set( + kind: u32, + key: Pointer, + key_len: WordSize, + old_value: Pointer, + old_value_len: WordSize, + new_value: Pointer, + new_value_len: WordSize, + ) -> u32 { + let kind = offchain::StorageKind::try_from(kind) + .map_err(|_| "storage kind OOB while ext_local_storage_compare_and_set: wasm")?; + let key = context.read_memory(key, key_len) + .map_err(|_| "OOB while ext_local_storage_compare_and_set: wasm")?; + let new_value = context.read_memory(new_value, new_value_len) + .map_err(|_| "OOB while ext_local_storage_compare_and_set: wasm")?; + + let old_value = if old_value_len == u32::max_value() { + None + } else { + Some( + context.read_memory(old_value, old_value_len) + .map_err(|_| "OOB while ext_local_storage_compare_and_set: wasm")? + ) + }; + + let res = runtime_io::offchain::local_storage_compare_and_set( + kind, + &key, + old_value, + &new_value, + ); + + Ok(if res { 0 } else { 1 }) + } + + ext_http_request_start( + method: Pointer, + method_len: WordSize, + url: Pointer, + url_len: WordSize, + meta: Pointer, + meta_len: WordSize, + ) -> u32 { + let method = context.read_memory(method, method_len) + .map_err(|_| "OOB while ext_http_request_start: wasm")?; + let url = context.read_memory(url, url_len) + .map_err(|_| "OOB while ext_http_request_start: wasm")?; + let meta = context.read_memory(meta, meta_len) + .map_err(|_| "OOB while ext_http_request_start: wasm")?; + + let method_str = str::from_utf8(&method) + .map_err(|_| "invalid str while ext_http_request_start: wasm")?; + let url_str = str::from_utf8(&url) + .map_err(|_| "invalid str while ext_http_request_start: wasm")?; + + let id = runtime_io::offchain::http_request_start(method_str, url_str, &meta); + + if let Ok(id) = id { + Ok(id.into()) + } else { + Ok(u32::max_value()) + } + } + + ext_http_request_add_header( + request_id: u32, + name: Pointer, + name_len: WordSize, + value: Pointer, + value_len: WordSize, + ) -> u32 { + let name = context.read_memory(name, name_len) + .map_err(|_| "OOB while ext_http_request_add_header: wasm")?; + let value = context.read_memory(value, value_len) + .map_err(|_| "OOB while ext_http_request_add_header: wasm")?; + + let name_str = str::from_utf8(&name) + .map_err(|_| "Invalid str while ext_http_request_add_header: wasm")?; + let value_str = str::from_utf8(&value) + .map_err(|_| "Invalid str while ext_http_request_add_header: wasm")?; + + let res = runtime_io::offchain::http_request_add_header( + offchain::HttpRequestId(request_id as u16), + name_str, + value_str, + ); + + Ok(if res.is_ok() { 0 } else { 1 }) + } + + ext_http_request_write_body( + request_id: u32, + chunk: Pointer, + chunk_len: WordSize, + deadline: u64, + ) -> u32 { + let chunk = context.read_memory(chunk, chunk_len) + .map_err(|_| "OOB while ext_http_request_write_body: wasm")?; + + let res = runtime_io::offchain::http_request_write_body( + offchain::HttpRequestId(request_id as u16), + &chunk, + deadline_to_timestamp(deadline), + ); + + Ok(match res { + Ok(()) => 0, + Err(e) => e.into(), + }) + } + + ext_http_response_wait( + ids: Pointer, + ids_len: WordSize, + statuses: Pointer, + deadline: u64, + ) { + let ids = (0..ids_len) + .map(|i| + context.read_primitive(ids.offset(i).ok_or("Point overflow")?) + .map(|id: u32| offchain::HttpRequestId(id as u16)) + .map_err(|_| "OOB while ext_http_response_wait: wasm") + ) + .collect::, _>>()?; + + let res = runtime_io::offchain::http_response_wait(&ids, deadline_to_timestamp(deadline)) + .into_iter() + .map(|status| u32::from(status)) + .enumerate() + // make sure to take up to `ids_len` to avoid exceeding the mem. + .take(ids_len as usize); + + for (i, status) in res { + context.write_primitive(statuses.offset(i as u32).ok_or("Point overflow")?, status) + .map_err(|_| "Invalid attempt to set memory in ext_http_response_wait")?; + } + + Ok(()) + } + + ext_http_response_headers( + request_id: u32, + written_out: Pointer, + ) -> Pointer { + use codec::Encode; + + let headers = runtime_io::offchain::http_response_headers( + offchain::HttpRequestId(request_id as u16), + ); + + let encoded = headers.encode(); + let len = encoded.len() as u32; + let offset = context.allocate_memory(len)?; + + context.write_memory(offset, &encoded) + .map_err(|_| "Invalid attempt to set memory in ext_http_response_headers")?; + context.write_primitive(written_out, len) + .map_err(|_| "Invalid attempt to write written_out in ext_http_response_headers")?; + + Ok(offset) + } + + ext_http_response_read_body( + request_id: u32, + buffer: Pointer, + buffer_len: WordSize, + deadline: u64, + ) -> WordSize { + let mut internal_buffer = Vec::with_capacity(buffer_len as usize); + internal_buffer.resize(buffer_len as usize, 0); + + let res = runtime_io::offchain::http_response_read_body( + offchain::HttpRequestId(request_id as u16), + &mut internal_buffer, + deadline_to_timestamp(deadline), + ); + + Ok(match res { + Ok(read) => { + context.write_memory(buffer, &internal_buffer[..read as usize]) + .map_err(|_| "Invalid attempt to set memory in ext_http_response_read_body")?; + + read as u32 + }, + Err(err) => { + u32::max_value() - u32::from(err) + 1 + } + }) + } + } +} + +fn deadline_to_timestamp(deadline: u64) -> Option { + if deadline == 0 { + None + } else { + Some(offchain::Timestamp::from_unix_millis(deadline)) + } +} + diff --git a/core/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs similarity index 99% rename from core/executor/src/integration_tests/mod.rs rename to client/executor/src/integration_tests/mod.rs index 6db9911d44ab4..71df0b8d8cc9e 100644 --- a/core/executor/src/integration_tests/mod.rs +++ b/client/executor/src/integration_tests/mod.rs @@ -401,7 +401,7 @@ fn ordered_trie_root_should_work(wasm_method: WasmExecutionMethod) { #[test_case(WasmExecutionMethod::Interpreted)] #[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))] fn offchain_local_storage_should_work(wasm_method: WasmExecutionMethod) { - use substrate_client::backend::OffchainStorage; + use client_api::OffchainStorage; let mut ext = TestExternalities::default(); let (offchain, state) = testing::TestOffchainExt::new(); diff --git a/core/executor/src/integration_tests/sandbox.rs b/client/executor/src/integration_tests/sandbox.rs similarity index 100% rename from core/executor/src/integration_tests/sandbox.rs rename to client/executor/src/integration_tests/sandbox.rs diff --git a/core/executor/src/lib.rs b/client/executor/src/lib.rs similarity index 100% rename from core/executor/src/lib.rs rename to client/executor/src/lib.rs diff --git a/core/executor/src/native_executor.rs b/client/executor/src/native_executor.rs similarity index 100% rename from core/executor/src/native_executor.rs rename to client/executor/src/native_executor.rs diff --git a/core/executor/src/sandbox.rs b/client/executor/src/sandbox.rs similarity index 99% rename from core/executor/src/sandbox.rs rename to client/executor/src/sandbox.rs index 87edae8c3037d..da71b06672465 100644 --- a/core/executor/src/sandbox.rs +++ b/client/executor/src/sandbox.rs @@ -211,7 +211,7 @@ pub trait SandboxCapabilities { /// Implementation of [`Externals`] that allows execution of guest module with /// [externals][`Externals`] that might refer functions defined by supervisor. /// -/// [`Externals`]: ../../wasmi/trait.Externals.html +/// [`Externals`]: ../wasmi/trait.Externals.html pub struct GuestExternals<'a, FE: SandboxCapabilities + 'a> { supervisor_externals: &'a mut FE, sandbox_instance: &'a SandboxInstance, @@ -432,7 +432,7 @@ fn decode_environment_definition( /// - `raw_env_def` can't be deserialized as a [`EnvironmentDefinition`]. /// - Module in `wasm` is invalid or couldn't be instantiated. /// -/// [`EnvironmentDefinition`]: ../../sandbox/struct.EnvironmentDefinition.html +/// [`EnvironmentDefinition`]: ../sandbox/struct.EnvironmentDefinition.html pub fn instantiate( supervisor_externals: &mut FE, dispatch_thunk: FE::SupervisorFuncRef, diff --git a/core/executor/src/wasm_runtime.rs b/client/executor/src/wasm_runtime.rs similarity index 100% rename from core/executor/src/wasm_runtime.rs rename to client/executor/src/wasm_runtime.rs diff --git a/core/executor/src/wasm_utils.rs b/client/executor/src/wasm_utils.rs similarity index 100% rename from core/executor/src/wasm_utils.rs rename to client/executor/src/wasm_utils.rs diff --git a/core/executor/src/wasmi_execution.rs b/client/executor/src/wasmi_execution.rs similarity index 100% rename from core/executor/src/wasmi_execution.rs rename to client/executor/src/wasmi_execution.rs diff --git a/core/executor/src/wasmtime/function_executor.rs b/client/executor/src/wasmtime/function_executor.rs similarity index 100% rename from core/executor/src/wasmtime/function_executor.rs rename to client/executor/src/wasmtime/function_executor.rs diff --git a/core/executor/src/wasmtime/mod.rs b/client/executor/src/wasmtime/mod.rs similarity index 100% rename from core/executor/src/wasmtime/mod.rs rename to client/executor/src/wasmtime/mod.rs diff --git a/core/executor/src/wasmtime/runtime.rs b/client/executor/src/wasmtime/runtime.rs similarity index 100% rename from core/executor/src/wasmtime/runtime.rs rename to client/executor/src/wasmtime/runtime.rs diff --git a/core/executor/src/wasmtime/trampoline.rs b/client/executor/src/wasmtime/trampoline.rs similarity index 100% rename from core/executor/src/wasmtime/trampoline.rs rename to client/executor/src/wasmtime/trampoline.rs diff --git a/core/executor/src/wasmtime/util.rs b/client/executor/src/wasmtime/util.rs similarity index 100% rename from core/executor/src/wasmtime/util.rs rename to client/executor/src/wasmtime/util.rs diff --git a/core/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml similarity index 62% rename from core/finality-grandpa/Cargo.toml rename to client/finality-grandpa/Cargo.toml index d9b7fd176d639..d8320327a9fb0 100644 --- a/core/finality-grandpa/Cargo.toml +++ b/client/finality-grandpa/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -fork-tree = { path = "../../core/utils/fork-tree" } +fork-tree = { path = "../../utils/fork-tree" } futures = "0.1.29" futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } log = "0.4.8" @@ -14,28 +14,29 @@ tokio-executor = "0.1.8" tokio-timer = "0.2.11" rand = "0.7.2" codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } -sr-primitives = { path = "../sr-primitives" } -consensus_common = { package = "substrate-consensus-common", path = "../consensus/common" } -primitives = { package = "substrate-primitives", path = "../primitives" } +sr-primitives = { path = "../../primitives/sr-primitives" } +consensus_common = { package = "substrate-consensus-common", path = "../../primitives/consensus/common" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } substrate-telemetry = { path = "../telemetry" } keystore = { package = "substrate-keystore", path = "../keystore" } serde_json = "1.0.41" -client = { package = "substrate-client", path = "../client" } -header-metadata = { package = "substrate-header-metadata", path = "../client/header-metadata" } -inherents = { package = "substrate-inherents", path = "../../core/inherents" } +client-api = { package = "substrate-client-api", path = "../api" } +client = { package = "substrate-client", path = "../" } +header-metadata = { package = "substrate-header-metadata", path = "../header-metadata" } +inherents = { package = "substrate-inherents", path = "../../primitives/inherents" } network = { package = "substrate-network", path = "../network" } -srml-finality-tracker = { path = "../../srml/finality-tracker" } -fg_primitives = { package = "substrate-finality-grandpa-primitives", path = "primitives" } +paint-finality-tracker = { path = "../../paint/finality-tracker" } +fg_primitives = { package = "substrate-finality-grandpa-primitives", path = "../../primitives/finality-grandpa" } grandpa = { package = "finality-grandpa", version = "0.9.0", features = ["derive-codec"] } [dev-dependencies] grandpa = { package = "finality-grandpa", version = "0.9.0", features = ["derive-codec", "test-helpers"] } network = { package = "substrate-network", path = "../network", features = ["test-helpers"] } -keyring = { package = "substrate-keyring", path = "../keyring" } -test-client = { package = "substrate-test-runtime-client", path = "../test-runtime/client"} -babe_primitives = { package = "substrate-consensus-babe-primitives", path = "../consensus/babe/primitives" } -state_machine = { package = "substrate-state-machine", path = "../state-machine" } +keyring = { package = "substrate-keyring", path = "../../primitives/keyring" } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client"} +babe_primitives = { package = "substrate-consensus-babe-primitives", path = "../../primitives/consensus/babe" } +state_machine = { package = "substrate-state-machine", path = "../../primitives/state-machine" } env_logger = "0.7.0" tokio = "0.1.22" tempfile = "3.1.0" -sr-api = { path = "../sr-api" } +sr-api = { path = "../../primitives/sr-api" } diff --git a/core/finality-grandpa/src/authorities.rs b/client/finality-grandpa/src/authorities.rs similarity index 100% rename from core/finality-grandpa/src/authorities.rs rename to client/finality-grandpa/src/authorities.rs diff --git a/core/finality-grandpa/src/aux_schema.rs b/client/finality-grandpa/src/aux_schema.rs similarity index 99% rename from core/finality-grandpa/src/aux_schema.rs rename to client/finality-grandpa/src/aux_schema.rs index 1aed0b95aba28..9857367dc99e6 100644 --- a/core/finality-grandpa/src/aux_schema.rs +++ b/client/finality-grandpa/src/aux_schema.rs @@ -19,8 +19,8 @@ use std::fmt::Debug; use std::sync::Arc; use codec::{Encode, Decode}; -use client::backend::AuxStore; -use client::error::{Result as ClientResult, Error as ClientError}; +use client_api::backend::AuxStore; +use client_api::error::{Result as ClientResult, Error as ClientError}; use fork_tree::ForkTree; use grandpa::round::State as RoundState; use sr_primitives::traits::{Block as BlockT, NumberFor}; diff --git a/core/finality-grandpa/src/communication/gossip.rs b/client/finality-grandpa/src/communication/gossip.rs similarity index 100% rename from core/finality-grandpa/src/communication/gossip.rs rename to client/finality-grandpa/src/communication/gossip.rs diff --git a/core/finality-grandpa/src/communication/mod.rs b/client/finality-grandpa/src/communication/mod.rs similarity index 100% rename from core/finality-grandpa/src/communication/mod.rs rename to client/finality-grandpa/src/communication/mod.rs diff --git a/core/finality-grandpa/src/communication/periodic.rs b/client/finality-grandpa/src/communication/periodic.rs similarity index 100% rename from core/finality-grandpa/src/communication/periodic.rs rename to client/finality-grandpa/src/communication/periodic.rs diff --git a/core/finality-grandpa/src/communication/tests.rs b/client/finality-grandpa/src/communication/tests.rs similarity index 100% rename from core/finality-grandpa/src/communication/tests.rs rename to client/finality-grandpa/src/communication/tests.rs diff --git a/core/finality-grandpa/src/consensus_changes.rs b/client/finality-grandpa/src/consensus_changes.rs similarity index 95% rename from core/finality-grandpa/src/consensus_changes.rs rename to client/finality-grandpa/src/consensus_changes.rs index 4d942248920f7..e276b287dd18f 100644 --- a/core/finality-grandpa/src/consensus_changes.rs +++ b/client/finality-grandpa/src/consensus_changes.rs @@ -47,11 +47,11 @@ impl ConsensusChanges { /// Finalize all pending consensus changes that are finalized by given block. /// Returns true if there any changes were finalized. - pub(crate) fn finalize ::client::error::Result>>( + pub(crate) fn finalize ::client_api::error::Result>>( &mut self, block: (N, H), canonical_at_height: F, - ) -> ::client::error::Result<(bool, bool)> { + ) -> ::client_api::error::Result<(bool, bool)> { let (split_idx, has_finalized_changes) = self.pending_changes.iter() .enumerate() .take_while(|(_, &(at_height, _))| at_height <= block.0) diff --git a/core/finality-grandpa/src/environment.rs b/client/finality-grandpa/src/environment.rs similarity index 99% rename from core/finality-grandpa/src/environment.rs rename to client/finality-grandpa/src/environment.rs index 149b00e80f920..883dc0e35c0d6 100644 --- a/core/finality-grandpa/src/environment.rs +++ b/client/finality-grandpa/src/environment.rs @@ -25,10 +25,16 @@ use futures::prelude::*; use tokio_timer::Delay; use parking_lot::RwLock; +use client_api::{ + HeaderBackend, BlockchainEvents, + backend::{Backend}, + Finalizer, + call_executor::CallExecutor, + error::Error as ClientError, + utils::is_descendent_of, +}; use client::{ - backend::Backend, apply_aux, BlockchainEvents, CallExecutor, - Client, error::Error as ClientError, utils::is_descendent_of, - blockchain::HeaderBackend, backend::Finalizer, + apply_aux, Client, }; use grandpa::{ BlockNumberOps, Equivocation, Error as GrandpaError, round::State as RoundState, diff --git a/core/finality-grandpa/src/finality_proof.rs b/client/finality-grandpa/src/finality_proof.rs similarity index 99% rename from core/finality-grandpa/src/finality_proof.rs rename to client/finality-grandpa/src/finality_proof.rs index aa7207b422881..f81c4c9d93ed2 100644 --- a/core/finality-grandpa/src/finality_proof.rs +++ b/client/finality-grandpa/src/finality_proof.rs @@ -38,11 +38,13 @@ use std::iter; use std::sync::Arc; use log::{trace, warn}; -use client::{ - backend::Backend, blockchain::Backend as BlockchainBackend, CallExecutor, Client, +use client_api::{ + backend::Backend, blockchain::Backend as BlockchainBackend, CallExecutor, error::{Error as ClientError, Result as ClientResult}, - light::fetcher::{FetchChecker, RemoteReadRequest, StorageProof}, + light::{FetchChecker, RemoteReadRequest}, + StorageProof, }; +use client::Client; use codec::{Encode, Decode}; use grandpa::BlockNumberOps; use sr_primitives::{ @@ -257,7 +259,7 @@ pub(crate) fn prove_finality, B: BlockchainBackend ::client::error::Result>> +) -> ::client_api::error::Result>> where J: ProvableJustification, { @@ -576,7 +578,7 @@ impl> ProvableJustification for GrandpaJ #[cfg(test)] pub(crate) mod tests { use test_client::runtime::{Block, Header, H256}; - use test_client::client::{backend::NewBlockState}; + use client_api::NewBlockState; use test_client::client::in_mem::Blockchain as InMemoryBlockchain; use super::*; use primitives::crypto::Public; diff --git a/core/finality-grandpa/src/import.rs b/client/finality-grandpa/src/import.rs similarity index 99% rename from core/finality-grandpa/src/import.rs rename to client/finality-grandpa/src/import.rs index 32501ec986b21..d6a3ea6e94bbf 100644 --- a/core/finality-grandpa/src/import.rs +++ b/client/finality-grandpa/src/import.rs @@ -21,10 +21,12 @@ use codec::Encode; use futures::sync::mpsc; use parking_lot::RwLockWriteGuard; -use client::{blockchain, CallExecutor, Client, well_known_cache_keys}; -use client::blockchain::HeaderBackend; -use client::backend::Backend; -use client::utils::is_descendent_of; +use client_api::{ + backend::Backend, blockchain, + CallExecutor, blockchain::HeaderBackend, well_known_cache_keys, + utils::is_descendent_of, +}; +use client::Client; use consensus_common::{ BlockImport, Error as ConsensusError, BlockCheckParams, BlockImportParams, ImportResult, JustificationImport, diff --git a/core/finality-grandpa/src/justification.rs b/client/finality-grandpa/src/justification.rs similarity index 98% rename from core/finality-grandpa/src/justification.rs rename to client/finality-grandpa/src/justification.rs index f5965df3e1228..eff06776bdb92 100644 --- a/core/finality-grandpa/src/justification.rs +++ b/client/finality-grandpa/src/justification.rs @@ -16,9 +16,8 @@ use std::collections::{HashMap, HashSet}; -use client::{CallExecutor, Client}; -use client::backend::Backend; -use client::error::Error as ClientError; +use client::Client; +use client_api::{CallExecutor, backend::Backend, error::Error as ClientError}; use codec::{Encode, Decode}; use grandpa::voter_set::VoterSet; use grandpa::{Error as GrandpaError}; diff --git a/core/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs similarity index 98% rename from core/finality-grandpa/src/lib.rs rename to client/finality-grandpa/src/lib.rs index 88d7fbec07622..80d2350982481 100644 --- a/core/finality-grandpa/src/lib.rs +++ b/client/finality-grandpa/src/lib.rs @@ -55,11 +55,11 @@ use futures::prelude::*; use log::{debug, error, info}; use futures::sync::mpsc; -use client::{ - BlockchainEvents, CallExecutor, Client, backend::Backend, error::Error as ClientError, - ExecutionStrategy, +use client_api::{ + BlockchainEvents, CallExecutor, backend::Backend, error::Error as ClientError, + ExecutionStrategy, HeaderBackend }; -use client::blockchain::HeaderBackend; +use client::Client; use codec::{Decode, Encode}; use sr_primitives::generic::BlockId; use sr_primitives::traits::{NumberFor, Block as BlockT, DigestFor, Zero}; @@ -70,7 +70,7 @@ use primitives::{H256, Blake2Hasher, Pair}; use substrate_telemetry::{telemetry, CONSENSUS_INFO, CONSENSUS_DEBUG, CONSENSUS_WARN}; use serde_json; -use srml_finality_tracker; +use paint_finality_tracker; use grandpa::Error as GrandpaError; use grandpa::{voter, BlockNumberOps, voter_set::VoterSet}; @@ -505,9 +505,9 @@ fn register_finality_tracker_inherent_data_provider + Send + Sync + 'static, RA: Send + Sync + 'static, { - if !inherent_data_providers.has_provider(&srml_finality_tracker::INHERENT_IDENTIFIER) { + if !inherent_data_providers.has_provider(&paint_finality_tracker::INHERENT_IDENTIFIER) { inherent_data_providers - .register_provider(srml_finality_tracker::InherentDataProvider::new(move || { + .register_provider(paint_finality_tracker::InherentDataProvider::new(move || { #[allow(deprecated)] { let info = client.info().chain; @@ -546,7 +546,7 @@ pub struct GrandpaParams, N, RA, SC, VR, X> { /// block import worker that has already been instantiated with `block_import`. pub fn run_grandpa_voter, N, RA, SC, VR, X>( grandpa_params: GrandpaParams, -) -> client::error::Result + Send + 'static> where +) -> client_api::error::Result + Send + 'static> where Block::Hash: Ord, B: Backend + 'static, E: CallExecutor + Send + Sync + 'static, @@ -879,7 +879,7 @@ where #[deprecated(since = "1.1.0", note = "Please switch to run_grandpa_voter.")] pub fn run_grandpa, N, RA, SC, VR, X>( grandpa_params: GrandpaParams, -) -> ::client::error::Result + Send + 'static> where +) -> ::client_api::error::Result + Send + 'static> where Block::Hash: Ord, B: Backend + 'static, E: CallExecutor + Send + Sync + 'static, diff --git a/core/finality-grandpa/src/light_import.rs b/client/finality-grandpa/src/light_import.rs similarity index 99% rename from core/finality-grandpa/src/light_import.rs rename to client/finality-grandpa/src/light_import.rs index d769b2fad9a21..5ab9082c90707 100644 --- a/core/finality-grandpa/src/light_import.rs +++ b/client/finality-grandpa/src/light_import.rs @@ -18,9 +18,9 @@ use std::collections::HashMap; use std::sync::Arc; use log::{info, trace, warn}; use parking_lot::RwLock; - -use client::{ - CallExecutor, Client, +use client::Client; +use client_api::{ + CallExecutor, backend::{AuxStore, Backend, Finalizer}, blockchain::HeaderBackend, error::Error as ClientError, diff --git a/core/finality-grandpa/src/observer.rs b/client/finality-grandpa/src/observer.rs similarity index 98% rename from core/finality-grandpa/src/observer.rs rename to client/finality-grandpa/src/observer.rs index e4d90ddc22e77..b182eaaaa5e61 100644 --- a/core/finality-grandpa/src/observer.rs +++ b/client/finality-grandpa/src/observer.rs @@ -25,7 +25,8 @@ use grandpa::{ use log::{debug, info, warn}; use consensus_common::SelectChain; -use client::{CallExecutor, Client, backend::Backend}; +use client_api::{CallExecutor, backend::Backend}; +use client::Client; use sr_primitives::traits::{NumberFor, Block as BlockT}; use primitives::{H256, Blake2Hasher}; @@ -155,7 +156,7 @@ pub fn run_grandpa_observer, N, RA, SC>( link: LinkHalf, network: N, on_exit: impl Future + Clone + Send + 'static, -) -> ::client::error::Result + Send + 'static> where +) -> ::client_api::error::Result + Send + 'static> where B: Backend + 'static, E: CallExecutor + Send + Sync + 'static, N: Network + Send + Sync + 'static, diff --git a/core/finality-grandpa/src/tests.rs b/client/finality-grandpa/src/tests.rs similarity index 99% rename from core/finality-grandpa/src/tests.rs rename to client/finality-grandpa/src/tests.rs index 0e2f2b02b3c94..6d4d439a9fb34 100644 --- a/core/finality-grandpa/src/tests.rs +++ b/client/finality-grandpa/src/tests.rs @@ -25,7 +25,8 @@ use parking_lot::Mutex; use futures03::{StreamExt as _, TryStreamExt as _}; use tokio::runtime::current_thread; use keyring::Ed25519Keyring; -use client::{error::Result, LongestChain}; +use client::LongestChain; +use client_api::error::Result; use sr_api::{Core, RuntimeVersion, ApiExt, StorageProof}; use test_client::{self, runtime::BlockNumber}; use consensus_common::{BlockOrigin, ForkChoiceStrategy, ImportedAux, BlockImportParams, ImportResult}; @@ -241,7 +242,7 @@ impl Core for RuntimeApi { } impl ApiExt for RuntimeApi { - type Error = client::error::Error; + type Error = client_api::error::Error; fn map_api_result result::Result, R, E>( &self, diff --git a/core/finality-grandpa/src/until_imported.rs b/client/finality-grandpa/src/until_imported.rs similarity index 99% rename from core/finality-grandpa/src/until_imported.rs rename to client/finality-grandpa/src/until_imported.rs index 5fca476a82b6a..fca67ab195e54 100644 --- a/core/finality-grandpa/src/until_imported.rs +++ b/client/finality-grandpa/src/until_imported.rs @@ -29,7 +29,7 @@ use super::{ }; use log::{debug, warn}; -use client::{BlockImportNotification, ImportNotifications}; +use client_api::{BlockImportNotification, ImportNotifications}; use futures::prelude::*; use futures::stream::Fuse; use futures03::{StreamExt as _, TryStreamExt as _}; @@ -474,7 +474,7 @@ mod tests { use tokio_timer::Delay; use test_client::runtime::{Block, Hash, Header}; use consensus_common::BlockOrigin; - use client::BlockImportNotification; + use client_api::BlockImportNotification; use futures::future::Either; use futures03::channel::mpsc; use grandpa::Precommit; diff --git a/core/finality-grandpa/src/voting_rule.rs b/client/finality-grandpa/src/voting_rule.rs similarity index 99% rename from core/finality-grandpa/src/voting_rule.rs rename to client/finality-grandpa/src/voting_rule.rs index 355fa0cd2d080..7907515074466 100644 --- a/core/finality-grandpa/src/voting_rule.rs +++ b/client/finality-grandpa/src/voting_rule.rs @@ -22,7 +22,7 @@ use std::sync::Arc; -use client::blockchain::HeaderBackend; +use client_api::blockchain::HeaderBackend; use sr_primitives::generic::BlockId; use sr_primitives::traits::{Block as BlockT, Header, NumberFor, One, Zero}; diff --git a/core/client/header-metadata/Cargo.toml b/client/header-metadata/Cargo.toml similarity index 78% rename from core/client/header-metadata/Cargo.toml rename to client/header-metadata/Cargo.toml index 43fcebb25bf96..d9917c93f1178 100644 --- a/core/client/header-metadata/Cargo.toml +++ b/client/header-metadata/Cargo.toml @@ -7,4 +7,4 @@ edition = "2018" [dependencies] lru-cache = { version = "0.1.2" } parking_lot = { version = "0.9.0" } -sr-primitives = { path = "../../sr-primitives" } +sr-primitives = { path = "../../primitives/sr-primitives" } diff --git a/core/client/header-metadata/src/lib.rs b/client/header-metadata/src/lib.rs similarity index 100% rename from core/client/header-metadata/src/lib.rs rename to client/header-metadata/src/lib.rs diff --git a/core/keystore/Cargo.toml b/client/keystore/Cargo.toml similarity index 74% rename from core/keystore/Cargo.toml rename to client/keystore/Cargo.toml index cc491337cf83a..9923a7f357d1f 100644 --- a/core/keystore/Cargo.toml +++ b/client/keystore/Cargo.toml @@ -6,8 +6,8 @@ edition = "2018" [dependencies] derive_more = "0.15.0" -primitives = { package = "substrate-primitives", path = "../primitives" } -app-crypto = { package = "substrate-application-crypto", path = "../application-crypto" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +app-crypto = { package = "substrate-application-crypto", path = "../../primitives/application-crypto" } hex = "0.3.2" rand = "0.7.2" serde_json = "1.0.41" diff --git a/core/keystore/src/lib.rs b/client/keystore/src/lib.rs similarity index 100% rename from core/keystore/src/lib.rs rename to client/keystore/src/lib.rs diff --git a/core/network/Cargo.toml b/client/network/Cargo.toml similarity index 66% rename from core/network/Cargo.toml rename to client/network/Cargo.toml index 56de91b281f6d..19c720c15011f 100644 --- a/core/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -23,15 +23,17 @@ lru-cache = "0.1.2" rustc-hex = "2.0.1" rand = "0.7.2" libp2p = { version = "0.13.0", default-features = false, features = ["libp2p-websocket"] } -fork-tree = { path = "../../core/utils/fork-tree" } -consensus = { package = "substrate-consensus-common", path = "../../core/consensus/common" } -client = { package = "substrate-client", path = "../../core/client" } -block-builder = { package = "substrate-block-builder", path = "../../core/block-builder" } -header_metadata = { package = "substrate-header-metadata", path = "../../core/client/header-metadata" } -sr-primitives = { path = "../../core/sr-primitives" } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } +fork-tree = { path = "../../utils/fork-tree" } +consensus = { package = "substrate-consensus-common", path = "../../primitives/consensus/common" } +client = { package = "substrate-client", path = "../" } +client-api = { package = "substrate-client-api", path = "../api" } +header_metadata = { package = "substrate-header-metadata", path = "../header-metadata" } +sr-primitives = { path = "../../primitives/sr-primitives" } +sr-arithmetic = { path = "../../primitives/sr-arithmetic" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +block-builder = { package = "substrate-block-builder", path = "../block-builder" } codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } -peerset = { package = "substrate-peerset", path = "../../core/peerset" } +peerset = { package = "substrate-peerset", path = "../../primitives/peerset" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" slog = { version = "2.5.2", features = ["nested-values"] } @@ -40,21 +42,21 @@ smallvec = "0.6.10" tokio-io = "0.1.12" tokio = { version = "0.1.22", optional = true } unsigned-varint = { version = "0.2.2", features = ["codec"] } -keyring = { package = "substrate-keyring", path = "../../core/keyring", optional = true } -test_client = { package = "substrate-test-client", path = "../../core/test-client", optional = true } -test-client = { package = "substrate-test-runtime-client", path = "../../core/test-runtime/client", optional = true } +keyring = { package = "substrate-keyring", path = "../../primitives/keyring", optional = true } +test_client = { package = "substrate-test-client", path = "../../test/utils/client", optional = true } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client", optional = true } erased-serde = "0.3.9" void = "1.0.2" zeroize = "0.10.1" -babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../consensus/babe/primitives" } +babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../primitives/consensus/babe" } [dev-dependencies] env_logger = "0.7.0" -keyring = { package = "substrate-keyring", path = "../../core/keyring" } +keyring = { package = "substrate-keyring", path = "../../primitives/keyring" } quickcheck = "0.9.0" rand = "0.7.2" -test-client = { package = "substrate-test-runtime-client", path = "../../core/test-runtime/client" } -test_runtime = { package = "substrate-test-runtime", path = "../../core/test-runtime" } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" } +test_runtime = { package = "substrate-test-runtime", path = "../../test/utils/runtime" } tempdir = "0.3.7" tokio = "0.1.22" diff --git a/core/network/src/behaviour.rs b/client/network/src/behaviour.rs similarity index 100% rename from core/network/src/behaviour.rs rename to client/network/src/behaviour.rs diff --git a/core/network/src/chain.rs b/client/network/src/chain.rs similarity index 96% rename from core/network/src/chain.rs rename to client/network/src/chain.rs index 2b32c07009fc7..5207a24bf9d30 100644 --- a/core/network/src/chain.rs +++ b/client/network/src/chain.rs @@ -16,9 +16,9 @@ //! Blockchain access trait -use client::{self, Client as SubstrateClient, ClientInfo, CallExecutor}; -use client::error::Error; -use client::light::fetcher::{ChangesProof, StorageProof}; +use client::Client as SubstrateClient; +use client_api::error::Error; +use client_api::{ChangesProof, StorageProof, ClientInfo, CallExecutor}; use consensus::{BlockImport, BlockStatus, Error as ConsensusError}; use sr_primitives::traits::{Block as BlockT, Header as HeaderT}; use sr_primitives::generic::{BlockId}; @@ -91,7 +91,7 @@ impl FinalityProofProvider for () { } impl Client for SubstrateClient where - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + 'static, Self: BlockImport, Block: BlockT, diff --git a/core/network/src/config.rs b/client/network/src/config.rs similarity index 100% rename from core/network/src/config.rs rename to client/network/src/config.rs diff --git a/core/network/src/debug_info.rs b/client/network/src/debug_info.rs similarity index 100% rename from core/network/src/debug_info.rs rename to client/network/src/debug_info.rs diff --git a/core/network/src/discovery.rs b/client/network/src/discovery.rs similarity index 100% rename from core/network/src/discovery.rs rename to client/network/src/discovery.rs diff --git a/core/network/src/error.rs b/client/network/src/error.rs similarity index 97% rename from core/network/src/error.rs rename to client/network/src/error.rs index c3f89e43c1710..a33f0280abd42 100644 --- a/core/network/src/error.rs +++ b/client/network/src/error.rs @@ -16,7 +16,7 @@ //! Substrate network possible errors. -use client; +use client_api; use libp2p::{PeerId, Multiaddr}; @@ -31,7 +31,7 @@ pub enum Error { /// Io error Io(std::io::Error), /// Client error - Client(client::error::Error), + Client(client_api::error::Error), /// The same bootnode (based on address) is registered with two different peer ids. #[display( fmt = "The same bootnode (`{}`) is registered with two different peer ids: `{}` and `{}`", diff --git a/core/network/src/legacy_proto/behaviour.rs b/client/network/src/legacy_proto/behaviour.rs similarity index 100% rename from core/network/src/legacy_proto/behaviour.rs rename to client/network/src/legacy_proto/behaviour.rs diff --git a/core/network/src/legacy_proto/handler.rs b/client/network/src/legacy_proto/handler.rs similarity index 100% rename from core/network/src/legacy_proto/handler.rs rename to client/network/src/legacy_proto/handler.rs diff --git a/core/network/src/legacy_proto/mod.rs b/client/network/src/legacy_proto/mod.rs similarity index 100% rename from core/network/src/legacy_proto/mod.rs rename to client/network/src/legacy_proto/mod.rs diff --git a/core/network/src/legacy_proto/tests.rs b/client/network/src/legacy_proto/tests.rs similarity index 100% rename from core/network/src/legacy_proto/tests.rs rename to client/network/src/legacy_proto/tests.rs diff --git a/core/network/src/legacy_proto/upgrade.rs b/client/network/src/legacy_proto/upgrade.rs similarity index 100% rename from core/network/src/legacy_proto/upgrade.rs rename to client/network/src/legacy_proto/upgrade.rs diff --git a/core/network/src/lib.rs b/client/network/src/lib.rs similarity index 100% rename from core/network/src/lib.rs rename to client/network/src/lib.rs diff --git a/core/network/src/on_demand_layer.rs b/client/network/src/on_demand_layer.rs similarity index 98% rename from core/network/src/on_demand_layer.rs rename to client/network/src/on_demand_layer.rs index cdcb99a25f99e..4a5ec4adcfb40 100644 --- a/core/network/src/on_demand_layer.rs +++ b/client/network/src/on_demand_layer.rs @@ -22,8 +22,8 @@ use std::sync::Arc; use futures::{prelude::*, sync::mpsc, sync::oneshot}; use futures03::compat::{Compat01As03, Future01CompatExt as _}; use parking_lot::Mutex; -use client::error::Error as ClientError; -use client::light::fetcher::{Fetcher, FetchChecker, RemoteHeaderRequest, +use client_api::error::Error as ClientError; +use client_api::{Fetcher, FetchChecker, RemoteHeaderRequest, RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest, RemoteReadChildRequest, RemoteBodyRequest}; use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor}; diff --git a/core/network/src/protocol.rs b/client/network/src/protocol.rs similarity index 99% rename from core/network/src/protocol.rs rename to client/network/src/protocol.rs index 40494637c14c1..780a071505a65 100644 --- a/core/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -32,9 +32,9 @@ use consensus::{ use codec::{Decode, Encode}; use sr_primitives::{generic::BlockId, ConsensusEngineId, Justification}; use sr_primitives::traits::{ - Block as BlockT, Header as HeaderT, NumberFor, One, Zero, - CheckedSub, SaturatedConversion + Block as BlockT, Header as HeaderT, NumberFor, One, Zero, CheckedSub }; +use sr_arithmetic::traits::SaturatedConversion; use message::{BlockAnnounce, BlockAttributes, Direction, FromBlock, Message, RequestId}; use message::generic::{Message as GenericMessage, ConsensusMessage}; use consensus_gossip::{ConsensusGossip, MessageRecipient as GossipMessageRecipient}; @@ -50,7 +50,7 @@ use std::fmt::Write; use std::{cmp, num::NonZeroUsize, time}; use log::{trace, debug, warn, error}; use crate::chain::{Client, FinalityProofProvider}; -use client::light::fetcher::{FetchChecker, ChangesProof, StorageProof}; +use client_api::{FetchChecker, ChangesProof, StorageProof}; use crate::error; use util::LruHashSet; diff --git a/core/network/src/protocol/consensus_gossip.rs b/client/network/src/protocol/consensus_gossip.rs similarity index 100% rename from core/network/src/protocol/consensus_gossip.rs rename to client/network/src/protocol/consensus_gossip.rs diff --git a/core/network/src/protocol/event.rs b/client/network/src/protocol/event.rs similarity index 100% rename from core/network/src/protocol/event.rs rename to client/network/src/protocol/event.rs diff --git a/core/network/src/protocol/light_dispatch.rs b/client/network/src/protocol/light_dispatch.rs similarity index 99% rename from core/network/src/protocol/light_dispatch.rs rename to client/network/src/protocol/light_dispatch.rs index 3c0185da87346..280495c0c41b6 100644 --- a/core/network/src/protocol/light_dispatch.rs +++ b/client/network/src/protocol/light_dispatch.rs @@ -25,8 +25,8 @@ use std::time::{Instant, Duration}; use log::{trace, info}; use futures::sync::oneshot::{Sender as OneShotSender}; use linked_hash_map::{Entry, LinkedHashMap}; -use client::error::Error as ClientError; -use client::light::fetcher::{FetchChecker, RemoteHeaderRequest, +use client_api::error::Error as ClientError; +use client_api::{FetchChecker, RemoteHeaderRequest, RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest, ChangesProof, RemoteReadChildRequest, RemoteBodyRequest, StorageProof}; use crate::message::{self, BlockAttributes, Direction, FromBlock, RequestId}; @@ -677,8 +677,8 @@ pub mod tests { use std::time::Instant; use futures::{Future, sync::oneshot}; use sr_primitives::traits::{Block as BlockT, NumberFor, Header as HeaderT}; - use client::{error::{Error as ClientError, Result as ClientResult}}; - use client::light::fetcher::{FetchChecker, RemoteHeaderRequest, + use client_api::{error::{Error as ClientError, Result as ClientResult}}; + use client_api::{FetchChecker, RemoteHeaderRequest, ChangesProof, RemoteCallRequest, RemoteReadRequest, RemoteReadChildRequest, RemoteChangesRequest, RemoteBodyRequest}; use crate::config::Roles; diff --git a/core/network/src/protocol/message.rs b/client/network/src/protocol/message.rs similarity index 99% rename from core/network/src/protocol/message.rs rename to client/network/src/protocol/message.rs index 82ff791800ee0..847c03f680d7c 100644 --- a/core/network/src/protocol/message.rs +++ b/client/network/src/protocol/message.rs @@ -26,7 +26,7 @@ pub use self::generic::{ FinalityProofRequest, FinalityProofResponse, FromBlock, RemoteReadChildRequest, }; -use client::light::fetcher::StorageProof; +use client_api::StorageProof; /// A unique ID of a request. pub type RequestId = u64; diff --git a/core/network/src/protocol/specialization.rs b/client/network/src/protocol/specialization.rs similarity index 100% rename from core/network/src/protocol/specialization.rs rename to client/network/src/protocol/specialization.rs diff --git a/core/network/src/protocol/sync.rs b/client/network/src/protocol/sync.rs similarity index 99% rename from core/network/src/protocol/sync.rs rename to client/network/src/protocol/sync.rs index c962e39158d01..6f1255cd8ab9f 100644 --- a/core/network/src/protocol/sync.rs +++ b/client/network/src/protocol/sync.rs @@ -28,7 +28,7 @@ //! use blocks::BlockCollection; -use client::{ClientInfo, error::Error as ClientError}; +use client_api::{ClientInfo, error::Error as ClientError}; use consensus::{BlockOrigin, BlockStatus, block_validation::{BlockAnnounceValidator, Validation}, import_queue::{IncomingBlock, BlockImportResult, BlockImportError} diff --git a/core/network/src/protocol/sync/blocks.rs b/client/network/src/protocol/sync/blocks.rs similarity index 100% rename from core/network/src/protocol/sync/blocks.rs rename to client/network/src/protocol/sync/blocks.rs diff --git a/core/network/src/protocol/sync/extra_requests.rs b/client/network/src/protocol/sync/extra_requests.rs similarity index 99% rename from core/network/src/protocol/sync/extra_requests.rs rename to client/network/src/protocol/sync/extra_requests.rs index 28ed5fed9f682..5bfeeba2a5c3a 100644 --- a/core/network/src/protocol/sync/extra_requests.rs +++ b/client/network/src/protocol/sync/extra_requests.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use client::error::Error as ClientError; +use client_api::error::Error as ClientError; use crate::protocol::sync::{PeerSync, PeerSyncState}; use fork_tree::ForkTree; use libp2p::PeerId; @@ -283,7 +283,7 @@ impl<'a, B: BlockT> Matcher<'a, B> { #[cfg(test)] mod tests { use crate::protocol::sync::PeerSync; - use client::error::Error as ClientError; + use client_api::error::Error as ClientError; use quickcheck::{Arbitrary, Gen, QuickCheck, StdThreadGen}; use rand::Rng; use std::collections::{HashMap, HashSet}; diff --git a/core/network/src/protocol/util.rs b/client/network/src/protocol/util.rs similarity index 100% rename from core/network/src/protocol/util.rs rename to client/network/src/protocol/util.rs diff --git a/core/network/src/service.rs b/client/network/src/service.rs similarity index 100% rename from core/network/src/service.rs rename to client/network/src/service.rs diff --git a/core/network/src/test/block_import.rs b/client/network/src/test/block_import.rs similarity index 100% rename from core/network/src/test/block_import.rs rename to client/network/src/test/block_import.rs diff --git a/core/network/src/test/mod.rs b/client/network/src/test/mod.rs similarity index 99% rename from core/network/src/test/mod.rs rename to client/network/src/test/mod.rs index c292b24be4514..964f27051a47d 100644 --- a/core/network/src/test/mod.rs +++ b/client/network/src/test/mod.rs @@ -27,15 +27,16 @@ use std::sync::Arc; use crate::config::build_multiaddr; use log::trace; use crate::chain::FinalityProofProvider; -use client::{ - self, ClientInfo, BlockchainEvents, BlockImportNotification, +use client_api::{ + ClientInfo, BlockchainEvents, BlockImportNotification, FinalityNotifications, ImportNotifications, - FinalityNotification, LongestChain, + FinalityNotification, error::Result as ClientResult, well_known_cache_keys::{self, Id as CacheKeyId}, + backend::{AuxStore, Backend, Finalizer} }; use block_builder::BlockBuilder; -use client::backend::{AuxStore, Backend, Finalizer}; +use client::LongestChain; use crate::config::Roles; use consensus::block_validation::DefaultBlockAnnounceValidator; use consensus::import_queue::BasicQueue; diff --git a/core/network/src/test/sync.rs b/client/network/src/test/sync.rs similarity index 100% rename from core/network/src/test/sync.rs rename to client/network/src/test/sync.rs diff --git a/core/network/src/transport.rs b/client/network/src/transport.rs similarity index 100% rename from core/network/src/transport.rs rename to client/network/src/transport.rs diff --git a/core/offchain/Cargo.toml b/client/offchain/Cargo.toml similarity index 65% rename from core/offchain/Cargo.toml rename to client/offchain/Cargo.toml index 2ca7e32f177fc..29621d8502bc1 100644 --- a/core/offchain/Cargo.toml +++ b/client/offchain/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" [dependencies] bytes = "0.4.12" -client = { package = "substrate-client", path = "../client" } -sr-api = { path = "../sr-api" } +client-api = { package = "substrate-client-api", path = "../api" } +sr-api = { path = "../../primitives/sr-api" } fnv = "1.0.6" futures01 = { package = "futures", version = "0.1" } futures-preview = "0.3.0-alpha.19" @@ -17,14 +17,14 @@ futures-timer = "0.4.0" log = "0.4.8" threadpool = "1.7" num_cpus = "1.10" -offchain-primitives = { package = "substrate-offchain-primitives", path = "./primitives" } +offchain-primitives = { package = "substrate-offchain-primitives", path = "../../primitives/offchain" } codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } parking_lot = "0.9.0" -primitives = { package = "substrate-primitives", path = "../../core/primitives" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } rand = "0.7.2" -sr-primitives = { path = "../../core/sr-primitives" } -transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" } -network = { package = "substrate-network", path = "../../core/network" } +sr-primitives = { path = "../../primitives/sr-primitives" } +transaction_pool = { package = "substrate-transaction-pool", path = "../transaction-pool" } +network = { package = "substrate-network", path = "../network" } keystore = { package = "substrate-keystore", path = "../keystore" } [target.'cfg(not(target_os = "unknown"))'.dependencies] @@ -33,8 +33,8 @@ hyper-rustls = "0.17.1" [dev-dependencies] env_logger = "0.7.0" -client-db = { package = "substrate-client-db", path = "../../core/client/db/", default-features = true } -test-client = { package = "substrate-test-runtime-client", path = "../../core/test-runtime/client" } +client-db = { package = "substrate-client-db", path = "../db/", default-features = true } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" } tokio = "0.1.22" [features] diff --git a/core/offchain/src/api.rs b/client/offchain/src/api.rs similarity index 99% rename from core/offchain/src/api.rs rename to client/offchain/src/api.rs index b4d55e5f06823..25d4fc267ae4d 100644 --- a/core/offchain/src/api.rs +++ b/client/offchain/src/api.rs @@ -21,7 +21,7 @@ use std::{ thread::sleep, }; -use client::backend::OffchainStorage; +use client_api::OffchainStorage; use futures::{StreamExt as _, Future, FutureExt as _, future, channel::mpsc}; use log::{info, debug, warn, error}; use network::{PeerId, Multiaddr, NetworkStateInfo}; diff --git a/core/offchain/src/api/http.rs b/client/offchain/src/api/http.rs similarity index 100% rename from core/offchain/src/api/http.rs rename to client/offchain/src/api/http.rs diff --git a/core/offchain/src/api/http_dummy.rs b/client/offchain/src/api/http_dummy.rs similarity index 100% rename from core/offchain/src/api/http_dummy.rs rename to client/offchain/src/api/http_dummy.rs diff --git a/core/offchain/src/api/timestamp.rs b/client/offchain/src/api/timestamp.rs similarity index 100% rename from core/offchain/src/api/timestamp.rs rename to client/offchain/src/api/timestamp.rs diff --git a/core/offchain/src/lib.rs b/client/offchain/src/lib.rs similarity index 98% rename from core/offchain/src/lib.rs rename to client/offchain/src/lib.rs index 345ef17b07ea3..e253a6d9234fb 100644 --- a/core/offchain/src/lib.rs +++ b/client/offchain/src/lib.rs @@ -44,6 +44,7 @@ use network::NetworkStateInfo; use primitives::{offchain, ExecutionContext}; use sr_primitives::{generic::BlockId, traits::{self, ProvideRuntimeApi}}; use transaction_pool::txpool::{Pool, ChainApi}; +use client_api::{OffchainStorage}; mod api; @@ -89,7 +90,7 @@ impl OffchainWorkers< Block: traits::Block, Client: ProvideRuntimeApi + Send + Sync + 'static, Client::Api: OffchainWorkerApi, - Storage: client::backend::OffchainStorage + 'static, + Storage: OffchainStorage + 'static, { /// Start the offchain workers after given block. #[must_use] diff --git a/core/offchain/src/testing.rs b/client/offchain/src/testing.rs similarity index 98% rename from core/offchain/src/testing.rs rename to client/offchain/src/testing.rs index 3f4415efa7a1d..b1699a94ca37f 100644 --- a/core/offchain/src/testing.rs +++ b/client/offchain/src/testing.rs @@ -20,7 +20,7 @@ use std::{ collections::BTreeMap, sync::Arc, }; -use client::backend::OffchainStorage; +use client_api::{OffchainStorage, InMemOffchainStorage}; use parking_lot::RwLock; use primitives::offchain::{ self, @@ -64,9 +64,9 @@ pub struct State { pub requests: BTreeMap, expected_requests: BTreeMap, /// Persistent local storage - pub persistent_storage: client::in_mem::OffchainStorage, + pub persistent_storage: InMemOffchainStorage, /// Local storage - pub local_storage: client::in_mem::OffchainStorage, + pub local_storage: InMemOffchainStorage, /// A vector of transactions submitted from the runtime. pub transactions: Vec>, } diff --git a/core/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml similarity index 88% rename from core/rpc-servers/Cargo.toml rename to client/rpc-servers/Cargo.toml index 8fdf31db328d2..c3b9802f567cf 100644 --- a/core/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -10,7 +10,7 @@ pubsub = { package = "jsonrpc-pubsub", version = "14.0.3" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" -sr-primitives = { path = "../sr-primitives" } +sr-primitives = { path = "../../primitives/sr-primitives" } [target.'cfg(not(target_os = "unknown"))'.dependencies] http = { package = "jsonrpc-http-server", version = "14.0.3" } diff --git a/core/rpc-servers/src/lib.rs b/client/rpc-servers/src/lib.rs similarity index 100% rename from core/rpc-servers/src/lib.rs rename to client/rpc-servers/src/lib.rs diff --git a/core/rpc/Cargo.toml b/client/rpc/Cargo.toml similarity index 64% rename from core/rpc/Cargo.toml rename to client/rpc/Cargo.toml index 31391568a58e4..4bd0f84b5f029 100644 --- a/core/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -6,20 +6,21 @@ edition = "2018" [dependencies] api = { package = "substrate-rpc-api", path = "./api" } -client = { package = "substrate-client", path = "../client" } -sr-api = { path = "../sr-api" } +client-api = { package = "substrate-client-api", path = "../api" } +client = { package = "substrate-client", path = "../" } +sr-api = { path = "../../primitives/sr-api" } codec = { package = "parity-scale-codec", version = "1.0.0" } futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } jsonrpc-pubsub = "14.0.3" log = "0.4.8" -primitives = { package = "substrate-primitives", path = "../primitives" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } rpc = { package = "jsonrpc-core", version = "14.0.3" } -runtime_version = { package = "sr-version", path = "../sr-version" } +runtime_version = { package = "sr-version", path = "../../primitives/sr-version" } serde_json = "1.0.41" -session = { package = "substrate-session", path = "../session" } -sr-primitives = { path = "../sr-primitives" } -rpc-primitives = { package = "substrate-rpc-primitives", path = "primitives" } -state_machine = { package = "substrate-state-machine", path = "../state-machine" } +session = { package = "substrate-session", path = "../../primitives/session" } +sr-primitives = { path = "../../primitives/sr-primitives" } +rpc-primitives = { package = "substrate-rpc-primitives", path = "../../primitives/rpc" } +state_machine = { package = "substrate-state-machine", path = "../../primitives/state-machine" } substrate-executor = { path = "../executor" } substrate-keystore = { path = "../keystore" } transaction_pool = { package = "substrate-transaction-pool", path = "../transaction-pool" } @@ -31,6 +32,6 @@ assert_matches = "1.3.0" futures = "0.1.29" network = { package = "substrate-network", path = "../network" } rustc-hex = "2.0.1" -sr-io = { path = "../sr-io" } -test-client = { package = "substrate-test-runtime-client", path = "../test-runtime/client" } +sr-io = { path = "../../primitives/sr-io" } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" } tokio = "0.1.22" diff --git a/core/rpc/api/Cargo.toml b/client/rpc/api/Cargo.toml similarity index 77% rename from core/rpc/api/Cargo.toml rename to client/rpc/api/Cargo.toml index 5fb0e4cbaec71..053e58d031548 100644 --- a/core/rpc/api/Cargo.toml +++ b/client/rpc/api/Cargo.toml @@ -14,9 +14,9 @@ jsonrpc-derive = "14.0.3" jsonrpc-pubsub = "14.0.3" log = "0.4.8" parking_lot = "0.9.0" -primitives = { package = "substrate-primitives", path = "../../primitives" } -runtime_version = { package = "sr-version", path = "../../sr-version" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +runtime_version = { package = "sr-version", path = "../../../primitives/sr-version" } serde = { version = "1.0.101", features = ["derive"] } serde_json = "1.0.41" txpool = { package = "substrate-transaction-graph", path = "../../transaction-pool/graph" } -rpc-primitives = { package = "substrate-rpc-primitives", path = "../../rpc/primitives" } +rpc-primitives = { package = "substrate-rpc-primitives", path = "../../../primitives/rpc" } diff --git a/core/rpc/api/src/author/error.rs b/client/rpc/api/src/author/error.rs similarity index 100% rename from core/rpc/api/src/author/error.rs rename to client/rpc/api/src/author/error.rs diff --git a/core/rpc/api/src/author/hash.rs b/client/rpc/api/src/author/hash.rs similarity index 100% rename from core/rpc/api/src/author/hash.rs rename to client/rpc/api/src/author/hash.rs diff --git a/core/rpc/api/src/author/mod.rs b/client/rpc/api/src/author/mod.rs similarity index 100% rename from core/rpc/api/src/author/mod.rs rename to client/rpc/api/src/author/mod.rs diff --git a/core/rpc/api/src/chain/error.rs b/client/rpc/api/src/chain/error.rs similarity index 100% rename from core/rpc/api/src/chain/error.rs rename to client/rpc/api/src/chain/error.rs diff --git a/core/rpc/api/src/chain/mod.rs b/client/rpc/api/src/chain/mod.rs similarity index 100% rename from core/rpc/api/src/chain/mod.rs rename to client/rpc/api/src/chain/mod.rs diff --git a/core/rpc/api/src/errors.rs b/client/rpc/api/src/errors.rs similarity index 100% rename from core/rpc/api/src/errors.rs rename to client/rpc/api/src/errors.rs diff --git a/core/rpc/api/src/helpers.rs b/client/rpc/api/src/helpers.rs similarity index 100% rename from core/rpc/api/src/helpers.rs rename to client/rpc/api/src/helpers.rs diff --git a/core/rpc/api/src/lib.rs b/client/rpc/api/src/lib.rs similarity index 100% rename from core/rpc/api/src/lib.rs rename to client/rpc/api/src/lib.rs diff --git a/core/rpc/api/src/state/error.rs b/client/rpc/api/src/state/error.rs similarity index 100% rename from core/rpc/api/src/state/error.rs rename to client/rpc/api/src/state/error.rs diff --git a/core/rpc/api/src/state/mod.rs b/client/rpc/api/src/state/mod.rs similarity index 100% rename from core/rpc/api/src/state/mod.rs rename to client/rpc/api/src/state/mod.rs diff --git a/core/rpc/api/src/subscriptions.rs b/client/rpc/api/src/subscriptions.rs similarity index 100% rename from core/rpc/api/src/subscriptions.rs rename to client/rpc/api/src/subscriptions.rs diff --git a/core/rpc/api/src/system/error.rs b/client/rpc/api/src/system/error.rs similarity index 100% rename from core/rpc/api/src/system/error.rs rename to client/rpc/api/src/system/error.rs diff --git a/core/rpc/api/src/system/helpers.rs b/client/rpc/api/src/system/helpers.rs similarity index 100% rename from core/rpc/api/src/system/helpers.rs rename to client/rpc/api/src/system/helpers.rs diff --git a/core/rpc/api/src/system/mod.rs b/client/rpc/api/src/system/mod.rs similarity index 100% rename from core/rpc/api/src/system/mod.rs rename to client/rpc/api/src/system/mod.rs diff --git a/core/rpc/src/author/mod.rs b/client/rpc/src/author/mod.rs similarity index 96% rename from core/rpc/src/author/mod.rs rename to client/rpc/src/author/mod.rs index 790576710ca18..e0d7cc10d7890 100644 --- a/core/rpc/src/author/mod.rs +++ b/client/rpc/src/author/mod.rs @@ -23,7 +23,8 @@ use std::{sync::Arc, convert::TryInto}; use futures03::future::{FutureExt, TryFutureExt}; use log::warn; -use client::{Client, error::Error as ClientError}; +use client::Client; +use client_api::error::Error as ClientError; use rpc::futures::{ Sink, Future, @@ -81,8 +82,8 @@ impl Author where P: PoolChainApi + Sync + Send + 'sta } impl AuthorApi, BlockHash

> for Author where - B: client::backend::Backend<

::Block, Blake2Hasher> + Send + Sync + 'static, - E: client::CallExecutor<

::Block, Blake2Hasher> + Send + Sync + 'static, + B: client_api::backend::Backend<

::Block, Blake2Hasher> + Send + Sync + 'static, + E: client_api::CallExecutor<

::Block, Blake2Hasher> + Send + Sync + 'static, P: PoolChainApi + Sync + Send + 'static, P::Block: traits::Block, P::Error: 'static, diff --git a/core/rpc/src/author/tests.rs b/client/rpc/src/author/tests.rs similarity index 100% rename from core/rpc/src/author/tests.rs rename to client/rpc/src/author/tests.rs diff --git a/core/rpc/src/chain/chain_full.rs b/client/rpc/src/chain/chain_full.rs similarity index 97% rename from core/rpc/src/chain/chain_full.rs rename to client/rpc/src/chain/chain_full.rs index ad359a9300cdd..945ed19838db2 100644 --- a/core/rpc/src/chain/chain_full.rs +++ b/client/rpc/src/chain/chain_full.rs @@ -20,7 +20,8 @@ use std::sync::Arc; use rpc::futures::future::result; use api::Subscriptions; -use client::{backend::Backend, CallExecutor, Client}; +use client_api::{CallExecutor, backend::Backend}; +use client::Client; use primitives::{H256, Blake2Hasher}; use sr_primitives::{ generic::{BlockId, SignedBlock}, diff --git a/core/rpc/src/chain/chain_light.rs b/client/rpc/src/chain/chain_light.rs similarity index 97% rename from core/rpc/src/chain/chain_light.rs rename to client/rpc/src/chain/chain_light.rs index d969d6ca93702..5c2f1f803a438 100644 --- a/core/rpc/src/chain/chain_light.rs +++ b/client/rpc/src/chain/chain_light.rs @@ -68,7 +68,7 @@ impl> LightChain impl ChainBackend for LightChain where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static, RA: Send + Sync + 'static, F: Fetcher + Send + Sync + 'static, diff --git a/core/rpc/src/chain/mod.rs b/client/rpc/src/chain/mod.rs similarity index 95% rename from core/rpc/src/chain/mod.rs rename to client/rpc/src/chain/mod.rs index 61ecf96711383..e846f7b59c441 100644 --- a/core/rpc/src/chain/mod.rs +++ b/client/rpc/src/chain/mod.rs @@ -51,7 +51,7 @@ pub use api::chain::*; trait ChainBackend: Send + Sync + 'static where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static, { /// Get client reference. @@ -156,7 +156,7 @@ pub fn new_full( ) -> Chain where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static + Clone, RA: Send + Sync + 'static, { @@ -174,7 +174,7 @@ pub fn new_light>( ) -> Chain where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static + Clone, RA: Send + Sync + 'static, F: Send + Sync + 'static, @@ -196,7 +196,7 @@ pub struct Chain { impl ChainApi, Block::Hash, Block::Header, SignedBlock> for Chain where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static, RA: Send + Sync + 'static { @@ -245,7 +245,7 @@ fn subscribe_headers( stream: F, ) where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static, F: FnOnce() -> S, G: FnOnce() -> Block::Hash, diff --git a/core/rpc/src/chain/tests.rs b/client/rpc/src/chain/tests.rs similarity index 100% rename from core/rpc/src/chain/tests.rs rename to client/rpc/src/chain/tests.rs diff --git a/core/rpc/src/lib.rs b/client/rpc/src/lib.rs similarity index 100% rename from core/rpc/src/lib.rs rename to client/rpc/src/lib.rs diff --git a/core/rpc/src/metadata.rs b/client/rpc/src/metadata.rs similarity index 100% rename from core/rpc/src/metadata.rs rename to client/rpc/src/metadata.rs diff --git a/core/rpc/src/state/mod.rs b/client/rpc/src/state/mod.rs similarity index 96% rename from core/rpc/src/state/mod.rs rename to client/rpc/src/state/mod.rs index 91e10c18b32d4..8e15c488070fd 100644 --- a/core/rpc/src/state/mod.rs +++ b/client/rpc/src/state/mod.rs @@ -47,7 +47,7 @@ pub use api::state::*; pub trait StateBackend: Send + Sync + 'static where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static, RA: Send + Sync + 'static, { @@ -179,7 +179,7 @@ pub fn new_full( ) -> State where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + 'static + Clone, RA: Send + Sync + 'static, Client: ProvideRuntimeApi, @@ -200,7 +200,7 @@ pub fn new_light>( ) -> State where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + 'static + Clone, RA: Send + Sync + 'static, F: Send + Sync + 'static, @@ -223,7 +223,7 @@ pub struct State { impl StateApi for State where Block: BlockT + 'static, - B: client::backend::Backend + Send + Sync + 'static, + B: client_api::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + 'static + Clone, RA: Send + Sync + 'static, { diff --git a/core/rpc/src/state/state_full.rs b/client/rpc/src/state/state_full.rs similarity index 99% rename from core/rpc/src/state/state_full.rs rename to client/rpc/src/state/state_full.rs index d91a2288954e3..7c4382210ce8f 100644 --- a/core/rpc/src/state/state_full.rs +++ b/client/rpc/src/state/state_full.rs @@ -28,8 +28,9 @@ use rpc::{ }; use api::Subscriptions; +use client_api::{backend::Backend, error::Result as ClientResult}; use client::{ - Client, CallExecutor, BlockchainEvents, backend::Backend, error::Result as ClientResult, + Client, CallExecutor, BlockchainEvents, }; use primitives::{ H256, Blake2Hasher, Bytes, storage::{well_known_keys, StorageKey, StorageData, StorageChangeSet}, diff --git a/core/rpc/src/state/state_light.rs b/client/rpc/src/state/state_light.rs similarity index 99% rename from core/rpc/src/state/state_light.rs rename to client/rpc/src/state/state_light.rs index 3d0c7979e3995..2c8e59c5b6aac 100644 --- a/core/rpc/src/state/state_light.rs +++ b/client/rpc/src/state/state_light.rs @@ -39,8 +39,9 @@ use rpc::{ }; use api::Subscriptions; +use client_api::backend::Backend; use client::{ - BlockchainEvents, Client, CallExecutor, backend::Backend, + BlockchainEvents, Client, CallExecutor, error::Error as ClientError, light::{ blockchain::{future_header, RemoteBlockchain}, diff --git a/core/rpc/src/state/tests.rs b/client/rpc/src/state/tests.rs similarity index 100% rename from core/rpc/src/state/tests.rs rename to client/rpc/src/state/tests.rs diff --git a/core/rpc/src/system/mod.rs b/client/rpc/src/system/mod.rs similarity index 100% rename from core/rpc/src/system/mod.rs rename to client/rpc/src/system/mod.rs diff --git a/core/rpc/src/system/tests.rs b/client/rpc/src/system/tests.rs similarity index 100% rename from core/rpc/src/system/tests.rs rename to client/rpc/src/system/tests.rs diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml new file mode 100644 index 0000000000000..f7ede13471383 --- /dev/null +++ b/client/service/Cargo.toml @@ -0,0 +1,62 @@ +[package] +name = "substrate-service" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" + +[features] +default = ["rocksdb"] +# The RocksDB feature activates the RocksDB database backend. If it is not activated, and you pass +# a path to a database, an error will be produced at runtime. +rocksdb = ["client_db/kvdb-rocksdb"] +wasmtime = [ + "substrate-executor/wasmtime", +] + +[dependencies] +derive_more = "0.15.0" +futures = "0.1.29" +futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } +parking_lot = "0.9.0" +lazy_static = "1.4.0" +log = "0.4.8" +slog = { version = "2.5.2", features = ["nested-values"] } +tokio-executor = "0.1.8" +tokio-timer = "0.2.11" +exit-future = "0.1.4" +serde = "1.0.101" +serde_json = "1.0.41" +sysinfo = "0.9.5" +target_info = "0.1.0" +keystore = { package = "substrate-keystore", path = "../keystore" } +sr-io = { path = "../../primitives/sr-io" } +sr-primitives = { path = "../../primitives/sr-primitives" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +session = { package = "substrate-session", path = "../../primitives/session" } +app-crypto = { package = "substrate-application-crypto", path = "../../primitives/application-crypto" } +consensus_common = { package = "substrate-consensus-common", path = "../../primitives/consensus/common" } +network = { package = "substrate-network", path = "../network" } +chain-spec = { package = "substrate-chain-spec", path = "../chain-spec" } +client-api = { package = "substrate-client-api", path = "../api" } +client = { package = "substrate-client", path = "../" } +sr-api = { path = "../../primitives/sr-api" } +tx-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../../primitives/transaction-pool/runtime-api" } +client_db = { package = "substrate-client-db", path = "../db" } +codec = { package = "parity-scale-codec", version = "1.0.0" } +substrate-executor = { path = "../executor" } +transaction_pool = { package = "substrate-transaction-pool", path = "../transaction-pool" } +rpc-servers = { package = "substrate-rpc-servers", path = "../rpc-servers" } +rpc = { package = "substrate-rpc", path = "../rpc" } +tel = { package = "substrate-telemetry", path = "../telemetry" } +offchain = { package = "substrate-offchain", path = "../offchain" } +parity-multiaddr = { package = "parity-multiaddr", version = "0.5.0" } + +[dev-dependencies] +substrate-test-runtime-client = { path = "../../test/utils/runtime/client" } +node-executor = { path = "../../bin/node/executor" } +node-primitives = { path = "../../bin/node/primitives" } +node-runtime = { path = "../../bin/node/runtime" } +babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../primitives/consensus/babe" } +grandpa = { package = "substrate-finality-grandpa", path = "../finality-grandpa" } +grandpa-primitives = { package = "substrate-finality-grandpa-primitives", path = "../../primitives/finality-grandpa" } +tokio = "0.1" diff --git a/core/service/src/builder.rs b/client/service/src/builder.rs similarity index 98% rename from core/service/src/builder.rs rename to client/service/src/builder.rs index f188f77a4acf6..679b11c224ff5 100644 --- a/core/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -18,9 +18,12 @@ use crate::{Service, NetworkStatus, NetworkState, error::{self, Error}, DEFAULT_ use crate::{SpawnTaskHandle, start_rpc_servers, build_network_future, TransactionPoolAdapter}; use crate::status_sinks; use crate::config::{Configuration, DatabaseConfig}; -use client::{ - BlockchainEvents, Client, backend::RemoteBackend, light::blockchain::RemoteBlockchain, +use client_api::{ + self, + BlockchainEvents, + backend::RemoteBackend, light::RemoteBlockchain, }; +use client::Client; use chain_spec::{RuntimeGenesis, Extension}; use codec::{Decode, Encode, IoReader}; use consensus_common::import_queue::ImportQueue; @@ -677,7 +680,7 @@ impl< TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend > where TBl: BlockT::Out>, - TBackend: 'static + client::backend::Backend + Send, + TBackend: 'static + client_api::backend::Backend + Send, TExec: 'static + client::CallExecutor + Send + Sync + Clone, TImpQu: 'static + ImportQueue, TRtApi: 'static + Send + Sync, @@ -699,7 +702,7 @@ impl where TBl: BlockT::Out>, - TBackend: 'static + client::backend::Backend + Send, + TBackend: 'static + client_api::backend::Backend + Send, TExec: 'static + client::CallExecutor + Send + Sync + Clone { type Block = TBl; @@ -722,7 +725,7 @@ impl where TBl: BlockT::Out>, - TBackend: 'static + client::backend::Backend + Send, + TBackend: 'static + client_api::backend::Backend + Send, TExec: 'static + client::CallExecutor + Send + Sync + Clone { type Block = TBl; @@ -766,7 +769,7 @@ ServiceBuilder< TCfg: Default, TGen: RuntimeGenesis, TCSExt: Extension, - TBackend: 'static + client::backend::Backend + Send, + TBackend: 'static + client_api::backend::Backend + Send, TExec: 'static + client::CallExecutor + Send + Sync + Clone, TSc: Clone, TImpQu: 'static + ImportQueue, @@ -1161,7 +1164,7 @@ pub(crate) fn maintain_transaction_pool( retracted: &[Block::Hash], ) -> error::Result + Send>> where Block: BlockT::Out>, - Backend: 'static + client::backend::Backend, + Backend: 'static + client_api::backend::Backend, Client: ProvideRuntimeApi, as ProvideRuntimeApi>::Api: tx_pool_api::TaggedTransactionQueue, diff --git a/core/service/src/chain_ops.rs b/client/service/src/chain_ops.rs similarity index 100% rename from core/service/src/chain_ops.rs rename to client/service/src/chain_ops.rs diff --git a/core/service/src/config.rs b/client/service/src/config.rs similarity index 100% rename from core/service/src/config.rs rename to client/service/src/config.rs diff --git a/core/service/src/error.rs b/client/service/src/error.rs similarity index 100% rename from core/service/src/error.rs rename to client/service/src/error.rs diff --git a/core/service/src/lib.rs b/client/service/src/lib.rs similarity index 98% rename from core/service/src/lib.rs rename to client/service/src/lib.rs index f45fe0f9641cf..2bc56647a6092 100644 --- a/core/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -136,7 +136,7 @@ pub trait AbstractService: 'static + Future + /// Type of block of this chain. type Block: BlockT; /// Backend storage for the client. - type Backend: 'static + client::backend::Backend; + type Backend: 'static + client_api::backend::Backend; /// How to execute calls towards the runtime. type CallExecutor: 'static + client::CallExecutor + Send + Sync + Clone; /// API that the runtime provides. @@ -203,7 +203,7 @@ impl AbstractServi NetworkService, TransactionPool, TOc> where TBl: BlockT, - TBackend: 'static + client::backend::Backend, + TBackend: 'static + client_api::backend::Backend, TExec: 'static + client::CallExecutor + Send + Sync + Clone, TRtApi: 'static + Send + Sync, TSc: consensus_common::SelectChain + 'static + Clone + Send, @@ -442,7 +442,7 @@ fn build_network_future< while let Ok(Async::Ready(Some(Event::Dht(event)))) = network.poll().map_err(|err| { warn!(target: "service", "Error in network: {:?}", err); }) { - // Given that core/authority-discovery is the only upper stack consumer of Dht events at the moment, all Dht + // Given that client/authority-discovery is the only upper stack consumer of Dht events at the moment, all Dht // events are being passed on to the authority-discovery module. In the future there might be multiple // consumers of these events. In that case this would need to be refactored to properly dispatch the events, // e.g. via a subscriber model. diff --git a/core/service/src/status_sinks.rs b/client/service/src/status_sinks.rs similarity index 100% rename from core/service/src/status_sinks.rs rename to client/service/src/status_sinks.rs diff --git a/core/service/test/Cargo.toml b/client/service/test/Cargo.toml similarity index 56% rename from core/service/test/Cargo.toml rename to client/service/test/Cargo.toml index 4415369a6a1d3..82b39ce767e38 100644 --- a/core/service/test/Cargo.toml +++ b/client/service/test/Cargo.toml @@ -12,9 +12,9 @@ log = "0.4.8" env_logger = "0.7.0" fdlimit = "0.1.1" futures03 = { package = "futures-preview", version = "=0.3.0-alpha.19", features = ["compat"] } -service = { package = "substrate-service", path = "../../../core/service", default-features = false } -network = { package = "substrate-network", path = "../../../core/network" } -consensus = { package = "substrate-consensus-common", path = "../../../core/consensus/common" } -client = { package = "substrate-client", path = "../../../core/client" } -sr-primitives = { path = "../../../core/sr-primitives" } -primitives = { package = "substrate-primitives", path = "../../../core/primitives" } +service = { package = "substrate-service", path = "../../service", default-features = false } +network = { package = "substrate-network", path = "../../network" } +consensus = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" } +client = { package = "substrate-client", path = "../../" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } diff --git a/core/service/test/src/lib.rs b/client/service/test/src/lib.rs similarity index 100% rename from core/service/test/src/lib.rs rename to client/service/test/src/lib.rs diff --git a/core/client/src/call_executor.rs b/client/src/call_executor.rs similarity index 68% rename from core/client/src/call_executor.rs rename to client/src/call_executor.rs index f66ae25476b0e..9e7c89c8390dd 100644 --- a/core/client/src/call_executor.rs +++ b/client/src/call_executor.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use std::{sync::Arc, cmp::Ord, panic::UnwindSafe, result, cell::RefCell}; +use std::{sync::Arc, panic::UnwindSafe, result, cell::RefCell}; use codec::{Encode, Decode}; use sr_primitives::{ generic::BlockId, traits::Block as BlockT, traits::NumberFor, @@ -31,125 +31,9 @@ use primitives::{ }; use sr_api::{ProofRecorder, InitializeBlock}; -use crate::backend; -use crate::error; - -/// Method call executor. -pub trait CallExecutor -where - B: BlockT, - H: Hasher, - H::Out: Ord, -{ - /// Externalities error type. - type Error: state_machine::Error; - - /// Execute a call to a contract on top of state in a block of given hash. - /// - /// No changes are made. - fn call( - &self, - id: &BlockId, - method: &str, - call_data: &[u8], - strategy: ExecutionStrategy, - side_effects_handler: Option, - ) -> Result, error::Error>; - - /// Execute a contextual call on top of state in a block of a given hash. - /// - /// No changes are made. - /// Before executing the method, passed header is installed as the current header - /// of the execution context. - fn contextual_call< - 'a, - IB: Fn() -> error::Result<()>, - EM: Fn( - Result, Self::Error>, - Result, Self::Error> - ) -> Result, Self::Error>, - R: Encode + Decode + PartialEq, - NC: FnOnce() -> result::Result + UnwindSafe, - >( - &self, - initialize_block_fn: IB, - at: &BlockId, - method: &str, - call_data: &[u8], - changes: &RefCell, - initialize_block: InitializeBlock<'a, B>, - execution_manager: ExecutionManager, - native_call: Option, - side_effects_handler: Option, - proof_recorder: &Option>, - enable_keystore: bool, - ) -> error::Result> where ExecutionManager: Clone; - - /// Extract RuntimeVersion of given block - /// - /// No changes are made. - fn runtime_version(&self, id: &BlockId) -> Result; - - /// Execute a call to a contract on top of given state. - /// - /// No changes are made. - fn call_at_state< - S: state_machine::Backend, - F: FnOnce( - Result, Self::Error>, - Result, Self::Error>, - ) -> Result, Self::Error>, - R: Encode + Decode + PartialEq, - NC: FnOnce() -> result::Result + UnwindSafe, - >(&self, - state: &S, - overlay: &mut OverlayedChanges, - method: &str, - call_data: &[u8], - manager: ExecutionManager, - native_call: Option, - side_effects_handler: Option, - ) -> Result< - ( - NativeOrEncoded, - (S::Transaction, H::Out), - Option>> - ), - error::Error, - >; - - /// Execute a call to a contract on top of given state, gathering execution proof. - /// - /// No changes are made. - fn prove_at_state>( - &self, - mut state: S, - overlay: &mut OverlayedChanges, - method: &str, - call_data: &[u8] - ) -> Result<(Vec, StorageProof), error::Error> { - let trie_state = state.as_trie_backend() - .ok_or_else(|| - Box::new(state_machine::ExecutionError::UnableToGenerateProof) - as Box - )?; - self.prove_at_trie_state(trie_state, overlay, method, call_data) - } - - /// Execute a call to a contract on top of given trie state, gathering execution proof. - /// - /// No changes are made. - fn prove_at_trie_state>( - &self, - trie_state: &state_machine::TrieBackend, - overlay: &mut OverlayedChanges, - method: &str, - call_data: &[u8] - ) -> Result<(Vec, StorageProof), error::Error>; - - /// Get runtime version if supported. - fn native_runtime_version(&self) -> Option<&NativeVersion>; -} +use client_api::{ + error, backend, call_executor::CallExecutor, +}; /// Call executor that executes methods locally, querying all required /// data from local backend. diff --git a/core/client/src/cht.rs b/client/src/cht.rs similarity index 99% rename from core/client/src/cht.rs rename to client/src/cht.rs index aff875032d357..874ea02c2a1a3 100644 --- a/core/client/src/cht.rs +++ b/client/src/cht.rs @@ -33,7 +33,7 @@ use state_machine::backend::InMemory as InMemoryState; use state_machine::{MemoryDB, TrieBackend, Backend as StateBackend, StorageProof, prove_read_on_trie_backend, read_proof_check, read_proof_check_on_proving_backend}; -use crate::error::{Error as ClientError, Result as ClientResult}; +use client_api::error::{Error as ClientError, Result as ClientResult}; /// The size of each CHT. This value is passed to every CHT-related function from /// production code. Other values are passed from tests. diff --git a/core/client/src/client.rs b/client/src/client.rs similarity index 94% rename from core/client/src/client.rs rename to client/src/client.rs index c7d0dffd7b261..def038fb3e022 100644 --- a/core/client/src/client.rs +++ b/client/src/client.rs @@ -56,27 +56,32 @@ use header_metadata::{HeaderMetadata, CachedHeaderMetadata}; use sr_api::{CallRuntimeAt, ConstructRuntimeApi, Core as CoreApi, ProofRecorder, InitializeBlock}; use block_builder::BlockBuilderApi; -use crate::{ +pub use client_api::{ backend::{ self, BlockImportOperation, PrunableStateChangesTrieStorage, - ClientImportOperation, Finalizer, ImportSummary, + ClientImportOperation, Finalizer, ImportSummary, NewBlockState, }, blockchain::{ - self, Info as ChainInfo, Backend as ChainBackend, + self, Backend as ChainBackend, HeaderBackend as ChainHeaderBackend, ProvideCache, Cache, well_known_cache_keys::Id as CacheKeyId, }, - call_executor::{CallExecutor, LocalCallExecutor}, + client::{ + ImportNotifications, FinalityNotification, FinalityNotifications, BlockImportNotification, + ClientInfo, BlockchainEvents, BlockBody, ProvideUncles, ExecutionStrategies, ForkBlocks, + BlockOf, + }, notifications::{StorageNotifications, StorageEventStream}, - light::{call_executor::prove_execution, fetcher::ChangesProof}, - error::Error, cht, error, in_mem, genesis + error::Error, + error, + CallExecutor }; -/// Type that implements `futures::Stream` of block import events. -pub type ImportNotifications = mpsc::UnboundedReceiver>; - -/// A stream of block finality notifications. -pub type FinalityNotifications = mpsc::UnboundedReceiver>; +use crate::{ + call_executor::LocalCallExecutor, + light::{call_executor::prove_execution, fetcher::ChangesProof}, + in_mem, genesis, cht, +}; type StorageUpdate = < < @@ -85,38 +90,6 @@ type StorageUpdate = < >::State as state_machine::Backend>::Transaction; type ChangesUpdate = ChangesTrieTransaction>; -/// Expected hashes of blocks at given heights. -/// -/// This may be used as chain spec extension to filter out known, unwanted forks. -pub type ForkBlocks = Option, ::Hash>>; - -/// Execution strategies settings. -#[derive(Debug, Clone)] -pub struct ExecutionStrategies { - /// Execution strategy used when syncing. - pub syncing: ExecutionStrategy, - /// Execution strategy used when importing blocks. - pub importing: ExecutionStrategy, - /// Execution strategy used when constructing blocks. - pub block_construction: ExecutionStrategy, - /// Execution strategy used for offchain workers. - pub offchain_worker: ExecutionStrategy, - /// Execution strategy used in other cases. - pub other: ExecutionStrategy, -} - -impl Default for ExecutionStrategies { - fn default() -> ExecutionStrategies { - ExecutionStrategies { - syncing: ExecutionStrategy::NativeElseWasm, - importing: ExecutionStrategy::NativeElseWasm, - block_construction: ExecutionStrategy::AlwaysWasm, - offchain_worker: ExecutionStrategy::NativeWhenPossible, - other: ExecutionStrategy::NativeElseWasm, - } - } -} - /// Substrate Client pub struct Client where Block: BlockT { backend: Arc, @@ -131,74 +104,6 @@ pub struct Client where Block: BlockT { _phantom: PhantomData, } -/// A source of blockchain events. -pub trait BlockchainEvents { - /// Get block import event stream. Not guaranteed to be fired for every - /// imported block. - fn import_notification_stream(&self) -> ImportNotifications; - - /// Get a stream of finality notifications. Not guaranteed to be fired for every - /// finalized block. - fn finality_notification_stream(&self) -> FinalityNotifications; - - /// Get storage changes event stream. - /// - /// Passing `None` as `filter_keys` subscribes to all storage changes. - fn storage_changes_notification_stream( - &self, - filter_keys: Option<&[StorageKey]>, - child_filter_keys: Option<&[(StorageKey, Option>)]>, - ) -> error::Result>; -} - -/// Fetch block body by ID. -pub trait BlockBody { - /// Get block body by ID. Returns `None` if the body is not stored. - fn block_body(&self, - id: &BlockId - ) -> error::Result::Extrinsic>>>; -} - -/// Provide a list of potential uncle headers for a given block. -pub trait ProvideUncles { - /// Gets the uncles of the block with `target_hash` going back `max_generation` ancestors. - fn uncles(&self, target_hash: Block::Hash, max_generation: NumberFor) - -> error::Result>; -} - -/// Client info -#[derive(Debug)] -pub struct ClientInfo { - /// Best block hash. - pub chain: ChainInfo, - /// State Cache Size currently used by the backend - pub used_state_cache_size: Option, -} - -/// Summary of an imported block -#[derive(Clone, Debug)] -pub struct BlockImportNotification { - /// Imported block header hash. - pub hash: Block::Hash, - /// Imported block origin. - pub origin: BlockOrigin, - /// Imported block header. - pub header: Block::Header, - /// Is this the new best block. - pub is_new_best: bool, - /// List of retracted blocks ordered by block number. - pub retracted: Vec, -} - -/// Summary of a finalized block. -#[derive(Clone, Debug)] -pub struct FinalityNotification { - /// Imported block header hash. - pub hash: Block::Hash, - /// Imported block header. - pub header: Block::Header, -} - // used in importing a block, where additional changes are made after the runtime // executed. enum PrePostHeader { @@ -270,12 +175,6 @@ pub fn new_with_backend( Client::new(backend, call_executor, build_genesis_storage, Default::default(), Default::default()) } -/// Figure out the block type for a given type (for now, just a `Client`). -pub trait BlockOf { - /// The type of the block. - type Type: BlockT; -} - impl BlockOf for Client where B: backend::Backend, E: CallExecutor, @@ -311,7 +210,7 @@ impl Client where genesis_block.deconstruct().0, Some(vec![]), None, - crate::backend::NewBlockState::Final + NewBlockState::Final )?; backend.commit_operation(op)?; } @@ -992,11 +891,11 @@ impl Client where }; let leaf_state = if finalized { - crate::backend::NewBlockState::Final + NewBlockState::Final } else if is_new_best { - crate::backend::NewBlockState::Best + NewBlockState::Best } else { - crate::backend::NewBlockState::Normal + NewBlockState::Normal }; let retracted = if is_new_best { @@ -1817,7 +1716,7 @@ impl backend::AuxStore for Client } /// Query auxiliary data from key-value store. fn get_aux(&self, key: &[u8]) -> error::Result>> { - crate::backend::AuxStore::get_aux(&*self.backend, key) + backend::AuxStore::get_aux(&*self.backend, key) } } @@ -1864,49 +1763,6 @@ where ) } -/// Utility methods for the client. -pub mod utils { - use super::*; - use crate::error; - use primitives::H256; - use std::borrow::Borrow; - - /// Returns a function for checking block ancestry, the returned function will - /// return `true` if the given hash (second parameter) is a descendent of the - /// base (first parameter). If the `current` parameter is defined, it should - /// represent the current block `hash` and its `parent hash`, if given the - /// function that's returned will assume that `hash` isn't part of the local DB - /// yet, and all searches in the DB will instead reference the parent. - pub fn is_descendent_of<'a, Block: BlockT, T, H: Borrow + 'a>( - client: &'a T, - current: Option<(H, H)>, - ) -> impl Fn(&H256, &H256) -> Result + 'a - where T: ChainHeaderBackend + HeaderMetadata, - { - move |base, hash| { - if base == hash { return Ok(false); } - - let current = current.as_ref().map(|(c, p)| (c.borrow(), p.borrow())); - - let mut hash = hash; - if let Some((current_hash, current_parent_hash)) = current { - if base == current_hash { return Ok(false); } - if hash == current_hash { - if base == current_parent_hash { - return Ok(true); - } else { - hash = current_parent_hash; - } - } - } - - let ancestor = header_metadata::lowest_common_ancestor(client, *hash, *base)?; - - Ok(ancestor.hash == *base) - } - } -} - impl consensus::block_validation::Chain for Client where BE: backend::Backend, E: CallExecutor, @@ -1926,6 +1782,7 @@ pub(crate) mod tests { use consensus::{BlockOrigin, SelectChain, BlockImport}; use test_client::{ prelude::*, + client_ext::ClientExt, client_db::{Backend, DatabaseSettings, DatabaseSettingsSrc, PruningMode}, runtime::{self, Block, Transfer, RuntimeApi, TestAPI}, }; @@ -2709,7 +2566,7 @@ pub(crate) mod tests { // we finalize block B1 which is on a different branch from current best // which should trigger a re-org. - client.finalize_block(BlockId::Hash(b1.hash()), None).unwrap(); + ClientExt::finalize_block(&client, BlockId::Hash(b1.hash()), None).unwrap(); // B1 should now be the latest finalized assert_eq!( @@ -2855,7 +2712,7 @@ pub(crate) mod tests { // we will finalize A2 which should make it impossible to import a new // B3 at the same height but that doesnt't include it - client.finalize_block(BlockId::Hash(a2.hash()), None).unwrap(); + ClientExt::finalize_block(&client, BlockId::Hash(a2.hash()), None).unwrap(); let b3 = client.new_block_at(&BlockId::Hash(b2.hash()), Default::default()) .unwrap().bake().unwrap(); diff --git a/core/client/src/genesis.rs b/client/src/genesis.rs similarity index 100% rename from core/client/src/genesis.rs rename to client/src/genesis.rs diff --git a/core/client/src/in_mem.rs b/client/src/in_mem.rs similarity index 94% rename from core/client/src/in_mem.rs rename to client/src/in_mem.rs index 5c35400d7743c..4c74943189020 100644 --- a/core/client/src/in_mem.rs +++ b/client/src/in_mem.rs @@ -29,13 +29,17 @@ use hash_db::{Hasher, Prefix}; use trie::MemoryDB; use header_metadata::{CachedHeaderMetadata, HeaderMetadata}; -use crate::error; -use crate::backend::{self, NewBlockState, StorageCollection, ChildStorageCollection}; -use crate::light; -use crate::leaves::LeafSet; -use crate::blockchain::{ - self, BlockStatus, HeaderBackend, well_known_cache_keys::Id as CacheKeyId +use client_api::{ + error, + backend::{self, NewBlockState, StorageCollection, ChildStorageCollection}, + blockchain::{ + self, BlockStatus, HeaderBackend, well_known_cache_keys::Id as CacheKeyId + }, + offchain::{ + InMemOffchainStorage as OffchainStorage + } }; +use crate::leaves::LeafSet; struct PendingBlock { block: StoredBlock, @@ -154,7 +158,7 @@ impl Blockchain { justification: Option, body: Option::Extrinsic>>, new_state: NewBlockState, - ) -> crate::error::Result<()> { + ) -> client_api::error::Result<()> { let number = header.number().clone(); if new_state.is_best() { self.apply_head(&header)?; @@ -395,7 +399,7 @@ impl backend::AuxStore for Blockchain { } } -impl light::blockchain::Storage for Blockchain +impl client_api::light::Storage for Blockchain where Block::Hash: From<[u8; 32]>, { @@ -805,50 +809,9 @@ pub fn check_genesis_storage(top: &StorageOverlay, children: &ChildrenStorageOve Ok(()) } -/// In-memory storage for offchain workers. -#[derive(Debug, Clone, Default)] -pub struct OffchainStorage { - storage: HashMap, Vec>, -} - -impl backend::OffchainStorage for OffchainStorage { - fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8]) { - let key = prefix.iter().chain(key).cloned().collect(); - self.storage.insert(key, value.to_vec()); - } - - fn get(&self, prefix: &[u8], key: &[u8]) -> Option> { - let key: Vec = prefix.iter().chain(key).cloned().collect(); - self.storage.get(&key).cloned() - } - - fn compare_and_set( - &mut self, - prefix: &[u8], - key: &[u8], - old_value: Option<&[u8]>, - new_value: &[u8], - ) -> bool { - use std::collections::hash_map::Entry; - let key = prefix.iter().chain(key).cloned().collect(); - - match self.storage.entry(key) { - Entry::Vacant(entry) => if old_value.is_none() { - entry.insert(new_value.to_vec()); - true - } else { false }, - Entry::Occupied(ref mut entry) if Some(entry.get().as_slice()) == old_value => { - entry.insert(new_value.to_vec()); - true - }, - _ => false, - } - } -} - #[cfg(test)] mod tests { - use super::*; + use client_api::offchain::{OffchainStorage, InMemOffchainStorage}; use std::sync::Arc; use test_client; use primitives::Blake2Hasher; @@ -871,9 +834,8 @@ mod tests { #[test] fn in_memory_offchain_storage() { - use crate::backend::OffchainStorage as _; - let mut storage = OffchainStorage::default(); + let mut storage = InMemOffchainStorage::default(); assert_eq!(storage.get(b"A", b"B"), None); assert_eq!(storage.get(b"B", b"A"), None); diff --git a/core/client/src/leaves.rs b/client/src/leaves.rs similarity index 99% rename from core/client/src/leaves.rs rename to client/src/leaves.rs index 825c1bf7c0bb5..bc42e83a66f57 100644 --- a/core/client/src/leaves.rs +++ b/client/src/leaves.rs @@ -21,7 +21,7 @@ use std::cmp::Reverse; use kvdb::{KeyValueDB, DBTransaction}; use sr_primitives::traits::SimpleArithmetic; use codec::{Encode, Decode}; -use crate::error; +use client_api::error; #[derive(Debug, Clone, PartialEq, Eq)] struct LeafSetItem { diff --git a/core/client/src/lib.rs b/client/src/lib.rs similarity index 90% rename from core/client/src/lib.rs rename to client/src/lib.rs index 048af17952c41..21a1c415d54a5 100644 --- a/core/client/src/lib.rs +++ b/client/src/lib.rs @@ -76,31 +76,30 @@ #![warn(missing_docs)] #![recursion_limit="128"] -pub mod error; -pub mod blockchain; -pub mod backend; pub mod cht; pub mod in_mem; pub mod genesis; pub mod light; pub mod leaves; -pub mod children; mod call_executor; mod client; -mod notifications; - -pub use crate::blockchain::Info as ChainInfo; -pub use crate::call_executor::{CallExecutor, LocalCallExecutor}; +pub use client_api::{ + error, + blockchain, + blockchain::well_known_cache_keys, + blockchain::Info as ChainInfo, + notifications::{StorageEventStream, StorageChangeSet}, + call_executor::CallExecutor, + utils, +}; +pub use crate::call_executor::LocalCallExecutor; pub use crate::client::{ new_with_backend, new_in_mem, BlockBody, ImportNotifications, FinalityNotifications, BlockchainEvents, BlockImportNotification, Client, ClientInfo, ExecutionStrategies, FinalityNotification, - LongestChain, BlockOf, ProvideUncles, ForkBlocks, - utils, apply_aux, + LongestChain, BlockOf, ProvideUncles, ForkBlocks, apply_aux, }; -pub use crate::notifications::{StorageEventStream, StorageChangeSet}; pub use state_machine::{ExecutionStrategy, StorageProof}; pub use crate::leaves::LeafSet; -pub use crate::blockchain::well_known_cache_keys; diff --git a/core/client/src/light/backend.rs b/client/src/light/backend.rs similarity index 96% rename from core/client/src/light/backend.rs rename to client/src/light/backend.rs index 300d140630d85..ec4543191896e 100644 --- a/core/client/src/light/backend.rs +++ b/client/src/light/backend.rs @@ -25,13 +25,21 @@ use sr_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenSto use state_machine::{Backend as StateBackend, TrieBackend, backend::InMemory as InMemoryState, ChangesTrieTransaction}; use sr_primitives::traits::{Block as BlockT, NumberFor, Zero, Header}; use crate::in_mem::{self, check_genesis_storage}; -use crate::backend::{ - AuxStore, Backend as ClientBackend, BlockImportOperation, RemoteBackend, NewBlockState, - StorageCollection, ChildStorageCollection, +use client_api::{ + backend::{ + AuxStore, Backend as ClientBackend, BlockImportOperation, RemoteBackend, NewBlockState, + StorageCollection, ChildStorageCollection, + }, + blockchain::{ + HeaderBackend as BlockchainHeaderBackend, well_known_cache_keys, + }, + error::{ + Error as ClientError, Result as ClientResult + }, + light::Storage as BlockchainStorage, + InMemOffchainStorage, }; -use crate::blockchain::{HeaderBackend as BlockchainHeaderBackend, well_known_cache_keys}; -use crate::error::{Error as ClientError, Result as ClientResult}; -use crate::light::blockchain::{Blockchain, Storage as BlockchainStorage}; +use crate::light::blockchain::{Blockchain}; use hash_db::Hasher; use trie::MemoryDB; @@ -107,7 +115,7 @@ impl ClientBackend for Backend where type Blockchain = Blockchain; type State = GenesisOrUnavailableState; type ChangesTrieStorage = in_mem::ChangesTrieStorage; - type OffchainStorage = in_mem::OffchainStorage; + type OffchainStorage = InMemOffchainStorage; fn begin_operation(&self) -> ClientResult { Ok(ImportOperation { @@ -442,7 +450,7 @@ impl StateBackend for GenesisOrUnavailableState mod tests { use primitives::Blake2Hasher; use test_client::{self, runtime::Block}; - use crate::backend::NewBlockState; + use client_api::backend::NewBlockState; use crate::light::blockchain::tests::{DummyBlockchain, DummyStorage}; use super::*; diff --git a/core/client/src/light/blockchain.rs b/client/src/light/blockchain.rs similarity index 78% rename from core/client/src/light/blockchain.rs rename to client/src/light/blockchain.rs index 202f94cd74fed..aa1866ae4d789 100644 --- a/core/client/src/light/blockchain.rs +++ b/client/src/light/blockchain.rs @@ -18,85 +18,31 @@ //! blocks. CHT roots are stored for headers of ancient blocks. use std::future::Future; -use std::{sync::Arc, collections::HashMap}; +use std::sync::Arc; use sr_primitives::{Justification, generic::BlockId}; use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero}; use header_metadata::{HeaderMetadata, CachedHeaderMetadata}; - -use crate::backend::{AuxStore, NewBlockState}; -use crate::blockchain::{ - Backend as BlockchainBackend, BlockStatus, Cache as BlockchainCache, - HeaderBackend as BlockchainHeaderBackend, Info as BlockchainInfo, ProvideCache, - well_known_cache_keys +pub use client_api::{ + backend::{ + AuxStore, NewBlockState + }, + blockchain::{ + Backend as BlockchainBackend, BlockStatus, Cache as BlockchainCache, + HeaderBackend as BlockchainHeaderBackend, Info as BlockchainInfo, ProvideCache, + well_known_cache_keys, + }, + error::{ + Error as ClientError, Result as ClientResult + }, + light::{ + RemoteBlockchain, LocalOrRemote, Storage + } }; use crate::cht; -use crate::error::{Error as ClientError, Result as ClientResult}; use crate::light::fetcher::{Fetcher, RemoteHeaderRequest}; -/// Light client blockchain storage. -pub trait Storage: AuxStore + BlockchainHeaderBackend + HeaderMetadata { - /// Store new header. Should refuse to revert any finalized blocks. - /// - /// Takes new authorities, the leaf state of the new block, and - /// any auxiliary storage updates to place in the same operation. - fn import_header( - &self, - header: Block::Header, - cache: HashMap>, - state: NewBlockState, - aux_ops: Vec<(Vec, Option>)>, - ) -> ClientResult<()>; - - /// Set an existing block as new best block. - fn set_head(&self, block: BlockId) -> ClientResult<()>; - - /// Mark historic header as finalized. - fn finalize_header(&self, block: BlockId) -> ClientResult<()>; - - /// Get last finalized header. - fn last_finalized(&self) -> ClientResult; - - /// Get headers CHT root for given block. Fails if the block is not pruned (not a part of any CHT). - fn header_cht_root( - &self, - cht_size: NumberFor, - block: NumberFor, - ) -> ClientResult; - - /// Get changes trie CHT root for given block. Fails if the block is not pruned (not a part of any CHT). - fn changes_trie_cht_root( - &self, - cht_size: NumberFor, - block: NumberFor, - ) -> ClientResult; - - /// Get storage cache. - fn cache(&self) -> Option>>; -} - -/// Remote header. -#[derive(Debug)] -pub enum LocalOrRemote { - /// When data is available locally, it is returned. - Local(Data), - /// When data is unavailable locally, the request to fetch it from remote node is returned. - Remote(Request), - /// When data is unknown. - Unknown, -} - -/// Futures-based blockchain backend that either resolves blockchain data -/// locally, or fetches required data from remote node. -pub trait RemoteBlockchain: Send + Sync { - /// Get block header. - fn header(&self, id: BlockId) -> ClientResult, - >>; -} - /// Light client blockchain. pub struct Blockchain { storage: S, @@ -250,7 +196,7 @@ pub mod tests { use std::collections::HashMap; use parking_lot::Mutex; use test_client::runtime::{Hash, Block, Header}; - use crate::blockchain::Info; + use client_api::blockchain::Info; use super::*; pub type DummyBlockchain = Blockchain; diff --git a/core/client/src/light/call_executor.rs b/client/src/light/call_executor.rs similarity index 98% rename from core/client/src/light/call_executor.rs rename to client/src/light/call_executor.rs index d951bf3f93d98..9d48cfebbe53d 100644 --- a/core/client/src/light/call_executor.rs +++ b/client/src/light/call_executor.rs @@ -37,10 +37,12 @@ use hash_db::Hasher; use sr_api::{ProofRecorder, InitializeBlock}; -use crate::backend::RemoteBackend; -use crate::call_executor::CallExecutor; -use crate::error::{Error as ClientError, Result as ClientResult}; -use crate::light::fetcher::RemoteCallRequest; +use client_api::{ + backend::RemoteBackend, + error::{Error as ClientError, Result as ClientResult}, + light::RemoteCallRequest, + call_executor::CallExecutor +}; use executor::{RuntimeVersion, NativeVersion}; /// Call executor that is able to execute calls only on genesis state. @@ -297,7 +299,7 @@ mod tests { use test_client::{self, runtime::{Header, Digest, Block}, ClientExt, TestClient}; use executor::{NativeExecutor, WasmExecutionMethod}; use primitives::Blake2Hasher; - use crate::backend::{Backend, NewBlockState}; + use client_api::backend::{Backend, NewBlockState}; use crate::in_mem::Backend as InMemBackend; struct DummyCallExecutor; @@ -452,7 +454,7 @@ mod tests { ), ); match execution_result { - Err(crate::error::Error::Execution(_)) => (), + Err(client_api::error::Error::Execution(_)) => (), _ => panic!("Unexpected execution result: {:?}", execution_result), } } diff --git a/core/client/src/light/fetcher.rs b/client/src/light/fetcher.rs similarity index 75% rename from core/client/src/light/fetcher.rs rename to client/src/light/fetcher.rs index 6ae28b748c527..e8b88e93b9bab 100644 --- a/core/client/src/light/fetcher.rs +++ b/client/src/light/fetcher.rs @@ -19,11 +19,10 @@ use std::sync::Arc; use std::collections::{BTreeMap, HashMap}; use std::marker::PhantomData; -use std::future::Future; use hash_db::{HashDB, Hasher, EMPTY_PREFIX}; use codec::{Decode, Encode}; -use primitives::{ChangesTrieConfiguration, convert_hash, traits::CodeExecutor, H256}; +use primitives::{convert_hash, traits::CodeExecutor, H256}; use sr_primitives::traits::{ Block as BlockT, Header as HeaderT, Hash, HashFor, NumberFor, SimpleArithmetic, CheckedConversion, Zero, @@ -36,191 +35,19 @@ use state_machine::{ pub use state_machine::StorageProof; use crate::cht; -use crate::error::{Error as ClientError, Result as ClientResult}; -use crate::light::blockchain::{Blockchain, Storage as BlockchainStorage}; +pub use client_api::{ + error::{ + Error as ClientError, Result as ClientResult + }, + light::{ + RemoteCallRequest, RemoteHeaderRequest, RemoteReadRequest, RemoteReadChildRequest, + RemoteChangesRequest, ChangesProof, RemoteBodyRequest, Fetcher, FetchChecker, + Storage as BlockchainStorage, + }, +}; +use crate::light::blockchain::{Blockchain}; use crate::light::call_executor::check_execution_proof; -/// Remote call request. -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -pub struct RemoteCallRequest { - /// Call at state of given block. - pub block: Header::Hash, - /// Header of block at which call is performed. - pub header: Header, - /// Method to call. - pub method: String, - /// Call data. - pub call_data: Vec, - /// Number of times to retry request. None means that default RETRY_COUNT is used. - pub retry_count: Option, -} - -/// Remote canonical header request. -#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] -pub struct RemoteHeaderRequest { - /// The root of CHT this block is included in. - pub cht_root: Header::Hash, - /// Number of the header to query. - pub block: Header::Number, - /// Number of times to retry request. None means that default RETRY_COUNT is used. - pub retry_count: Option, -} - -/// Remote storage read request. -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -pub struct RemoteReadRequest { - /// Read at state of given block. - pub block: Header::Hash, - /// Header of block at which read is performed. - pub header: Header, - /// Storage key to read. - pub keys: Vec>, - /// Number of times to retry request. None means that default RETRY_COUNT is used. - pub retry_count: Option, -} - -/// Remote storage read child request. -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -pub struct RemoteReadChildRequest { - /// Read at state of given block. - pub block: Header::Hash, - /// Header of block at which read is performed. - pub header: Header, - /// Storage key for child. - pub storage_key: Vec, - /// Child storage key to read. - pub keys: Vec>, - /// Number of times to retry request. None means that default RETRY_COUNT is used. - pub retry_count: Option, -} - -/// Remote key changes read request. -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct RemoteChangesRequest { - /// Changes trie configuration. - pub changes_trie_config: ChangesTrieConfiguration, - /// Query changes from range of blocks, starting (and including) with this hash... - pub first_block: (Header::Number, Header::Hash), - /// ...ending (and including) with this hash. Should come after first_block and - /// be the part of the same fork. - pub last_block: (Header::Number, Header::Hash), - /// Only use digests from blocks up to this hash. Should be last_block OR come - /// after this block and be the part of the same fork. - pub max_block: (Header::Number, Header::Hash), - /// Known changes trie roots for the range of blocks [tries_roots.0..max_block]. - /// Proofs for roots of ascendants of tries_roots.0 are provided by the remote node. - pub tries_roots: (Header::Number, Header::Hash, Vec), - /// Optional Child Storage key to read. - pub storage_key: Option>, - /// Storage key to read. - pub key: Vec, - /// Number of times to retry request. None means that default RETRY_COUNT is used. - pub retry_count: Option, -} - -/// Key changes read proof. -#[derive(Debug, PartialEq, Eq)] -pub struct ChangesProof { - /// Max block that has been used in changes query. - pub max_block: Header::Number, - /// All touched nodes of all changes tries. - pub proof: Vec>, - /// All changes tries roots that have been touched AND are missing from - /// the requester' node. It is a map of block number => changes trie root. - pub roots: BTreeMap, - /// The proofs for all changes tries roots that have been touched AND are - /// missing from the requester' node. It is a map of CHT number => proof. - pub roots_proof: StorageProof, -} - -/// Remote block body request -#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)] -pub struct RemoteBodyRequest { - /// Header of the requested block body - pub header: Header, - /// Number of times to retry request. None means that default RETRY_COUNT is used. - pub retry_count: Option, -} - -/// Light client data fetcher. Implementations of this trait must check if remote data -/// is correct (see FetchedDataChecker) and return already checked data. -pub trait Fetcher: Send + Sync { - /// Remote header future. - type RemoteHeaderResult: Future> + Send + 'static; - /// Remote storage read future. - type RemoteReadResult: Future, Option>>, ClientError>> + Send + 'static; - /// Remote call result future. - type RemoteCallResult: Future, ClientError>> + Send + 'static; - /// Remote changes result future. - type RemoteChangesResult: Future, u32)>, ClientError>> + Send + 'static; - /// Remote block body result future. - type RemoteBodyResult: Future, ClientError>> + Send + 'static; - - /// Fetch remote header. - fn remote_header(&self, request: RemoteHeaderRequest) -> Self::RemoteHeaderResult; - /// Fetch remote storage value. - fn remote_read( - &self, - request: RemoteReadRequest - ) -> Self::RemoteReadResult; - /// Fetch remote storage child value. - fn remote_read_child( - &self, - request: RemoteReadChildRequest - ) -> Self::RemoteReadResult; - /// Fetch remote call result. - fn remote_call(&self, request: RemoteCallRequest) -> Self::RemoteCallResult; - /// Fetch remote changes ((block number, extrinsic index)) where given key has been changed - /// at a given blocks range. - fn remote_changes(&self, request: RemoteChangesRequest) -> Self::RemoteChangesResult; - /// Fetch remote block body - fn remote_body(&self, request: RemoteBodyRequest) -> Self::RemoteBodyResult; -} - -/// Light client remote data checker. -/// -/// Implementations of this trait should not use any prunable blockchain data -/// except that is passed to its methods. -pub trait FetchChecker: Send + Sync { - /// Check remote header proof. - fn check_header_proof( - &self, - request: &RemoteHeaderRequest, - header: Option, - remote_proof: StorageProof, - ) -> ClientResult; - /// Check remote storage read proof. - fn check_read_proof( - &self, - request: &RemoteReadRequest, - remote_proof: StorageProof, - ) -> ClientResult, Option>>>; - /// Check remote storage read proof. - fn check_read_child_proof( - &self, - request: &RemoteReadChildRequest, - remote_proof: StorageProof, - ) -> ClientResult, Option>>>; - /// Check remote method execution proof. - fn check_execution_proof( - &self, - request: &RemoteCallRequest, - remote_proof: StorageProof, - ) -> ClientResult>; - /// Check remote changes query proof. - fn check_changes_proof( - &self, - request: &RemoteChangesRequest, - proof: ChangesProof - ) -> ClientResult, u32)>>; - /// Check remote body proof. - fn check_body_proof( - &self, - request: &RemoteBodyRequest, - body: Vec - ) -> ClientResult>; -} - /// Remote data checker. pub struct LightDataChecker> { blockchain: Arc>, @@ -499,12 +326,13 @@ impl<'a, H, Number, Hash> ChangesTrieRootsStorage for RootsStorage<'a #[cfg(test)] pub mod tests { - use futures03::future::Ready; - use parking_lot::Mutex; use codec::Decode; use crate::client::tests::prepare_client_with_key_changes; use executor::{NativeExecutor, WasmExecutionMethod}; - use crate::error::Error as ClientError; + use client_api::{ + backend::NewBlockState, + error::Error as ClientError, + }; use test_client::{ self, ClientExt, blockchain::HeaderBackend, AccountKeyring, runtime::{self, Hash, Block, Header, Extrinsic} @@ -512,8 +340,7 @@ pub mod tests { use consensus::BlockOrigin; use crate::in_mem::{Blockchain as InMemoryBlockchain}; - use crate::light::fetcher::{Fetcher, FetchChecker, LightDataChecker, - RemoteCallRequest, RemoteHeaderRequest}; + use crate::light::fetcher::{FetchChecker, LightDataChecker, RemoteHeaderRequest}; use crate::light::blockchain::tests::{DummyStorage, DummyBlockchain}; use primitives::{blake2_256, Blake2Hasher, H256}; use primitives::storage::{well_known_keys, StorageKey}; @@ -521,47 +348,6 @@ pub mod tests { use state_machine::Backend; use super::*; - pub type OkCallFetcher = Mutex>; - - fn not_implemented_in_tests() -> Ready> - where - E: std::convert::From<&'static str>, - { - futures03::future::ready(Err("Not implemented on test node".into())) - } - - impl Fetcher for OkCallFetcher { - type RemoteHeaderResult = Ready>; - type RemoteReadResult = Ready, Option>>, ClientError>>; - type RemoteCallResult = Ready, ClientError>>; - type RemoteChangesResult = Ready, u32)>, ClientError>>; - type RemoteBodyResult = Ready, ClientError>>; - - fn remote_header(&self, _request: RemoteHeaderRequest

) -> Self::RemoteHeaderResult { - not_implemented_in_tests() - } - - fn remote_read(&self, _request: RemoteReadRequest
) -> Self::RemoteReadResult { - not_implemented_in_tests() - } - - fn remote_read_child(&self, _request: RemoteReadChildRequest
) -> Self::RemoteReadResult { - not_implemented_in_tests() - } - - fn remote_call(&self, _request: RemoteCallRequest
) -> Self::RemoteCallResult { - futures03::future::ready(Ok((*self.lock()).clone())) - } - - fn remote_changes(&self, _request: RemoteChangesRequest
) -> Self::RemoteChangesResult { - not_implemented_in_tests() - } - - fn remote_body(&self, _request: RemoteBodyRequest
) -> Self::RemoteBodyResult { - not_implemented_in_tests() - } - } - type TestChecker = LightDataChecker< NativeExecutor, Blake2Hasher, @@ -598,7 +384,7 @@ pub mod tests { remote_block_header.clone(), None, None, - crate::backend::NewBlockState::Final, + NewBlockState::Final, ).unwrap(); let local_checker = LightDataChecker::new( Arc::new(DummyBlockchain::new(DummyStorage::new())), @@ -640,7 +426,7 @@ pub mod tests { remote_block_header.clone(), None, None, - crate::backend::NewBlockState::Final, + NewBlockState::Final, ).unwrap(); let local_checker = LightDataChecker::new( Arc::new(DummyBlockchain::new(DummyStorage::new())), diff --git a/core/client/src/light/mod.rs b/client/src/light/mod.rs similarity index 95% rename from core/client/src/light/mod.rs rename to client/src/light/mod.rs index d06a9ae9dd93c..7db1bff58900f 100644 --- a/core/client/src/light/mod.rs +++ b/client/src/light/mod.rs @@ -30,9 +30,12 @@ use sr_primitives::traits::Block as BlockT; use crate::call_executor::LocalCallExecutor; use crate::client::Client; -use crate::error::Result as ClientResult; +use client_api::{ + error::Result as ClientResult, + light::Storage as BlockchainStorage, +}; use crate::light::backend::Backend; -use crate::light::blockchain::{Blockchain, Storage as BlockchainStorage}; +use crate::light::blockchain::Blockchain; use crate::light::call_executor::GenesisCallExecutor; use crate::light::fetcher::LightDataChecker; diff --git a/core/state-db/Cargo.toml b/client/state-db/Cargo.toml similarity index 78% rename from core/state-db/Cargo.toml rename to client/state-db/Cargo.toml index d271a0e179d6d..d2752c14dd9c8 100644 --- a/core/state-db/Cargo.toml +++ b/client/state-db/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] parking_lot = "0.9.0" log = "0.4.8" -primitives = { package = "substrate-primitives", path = "../../core/primitives" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } [dev-dependencies] diff --git a/core/state-db/src/lib.rs b/client/state-db/src/lib.rs similarity index 100% rename from core/state-db/src/lib.rs rename to client/state-db/src/lib.rs diff --git a/core/state-db/src/noncanonical.rs b/client/state-db/src/noncanonical.rs similarity index 100% rename from core/state-db/src/noncanonical.rs rename to client/state-db/src/noncanonical.rs diff --git a/core/state-db/src/pruning.rs b/client/state-db/src/pruning.rs similarity index 100% rename from core/state-db/src/pruning.rs rename to client/state-db/src/pruning.rs diff --git a/core/state-db/src/test.rs b/client/state-db/src/test.rs similarity index 100% rename from core/state-db/src/test.rs rename to client/state-db/src/test.rs diff --git a/core/telemetry/Cargo.toml b/client/telemetry/Cargo.toml similarity index 100% rename from core/telemetry/Cargo.toml rename to client/telemetry/Cargo.toml diff --git a/core/telemetry/src/lib.rs b/client/telemetry/src/lib.rs similarity index 100% rename from core/telemetry/src/lib.rs rename to client/telemetry/src/lib.rs diff --git a/core/telemetry/src/worker.rs b/client/telemetry/src/worker.rs similarity index 100% rename from core/telemetry/src/worker.rs rename to client/telemetry/src/worker.rs diff --git a/core/telemetry/src/worker/node.rs b/client/telemetry/src/worker/node.rs similarity index 100% rename from core/telemetry/src/worker/node.rs rename to client/telemetry/src/worker/node.rs diff --git a/core/transaction-pool/Cargo.toml b/client/transaction-pool/Cargo.toml similarity index 59% rename from core/transaction-pool/Cargo.toml rename to client/transaction-pool/Cargo.toml index c0222f9a00db3..1060dcd2a3ed3 100644 --- a/core/transaction-pool/Cargo.toml +++ b/client/transaction-pool/Cargo.toml @@ -5,17 +5,17 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] +codec = { package = "parity-scale-codec", version = "1.0.0" } derive_more = "0.15.0" -log = "0.4.8" futures = { version = "0.3.0", features = ["thread-pool"] } -codec = { package = "parity-scale-codec", version = "1.0.0" } +log = "0.4.8" parking_lot = "0.9.0" -sr-primitives = { path = "../sr-primitives" } -primitives = { package = "substrate-primitives", path = "../primitives" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +sr-api = { path = "../../primitives/sr-api" } +sr-primitives = { path = "../../primitives/sr-primitives" } +tx-runtime-api = { package = "substrate-transaction-pool-runtime-api", path = "../../primitives/transaction-pool/runtime-api" } txpool = { package = "substrate-transaction-graph", path = "./graph" } -tx-runtime-api = { package = "substrate-transaction-pool-runtime-api", path = "runtime-api" } -sr-api = { path = "../sr-api" } [dev-dependencies] -keyring = { package = "substrate-keyring", path = "../../core/keyring" } -test-client = { package = "substrate-test-runtime-client", path = "../../core/test-runtime/client" } +keyring = { package = "substrate-keyring", path = "../../primitives/keyring" } +test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" } diff --git a/core/transaction-pool/graph/Cargo.toml b/client/transaction-pool/graph/Cargo.toml similarity index 84% rename from core/transaction-pool/graph/Cargo.toml rename to client/transaction-pool/graph/Cargo.toml index 4b628079cd3ce..93068c514add0 100644 --- a/core/transaction-pool/graph/Cargo.toml +++ b/client/transaction-pool/graph/Cargo.toml @@ -10,14 +10,14 @@ futures-preview = "0.3.0-alpha.19" log = "0.4.8" parking_lot = "0.9.0" serde = { version = "1.0.101", features = ["derive"] } -primitives = { package = "substrate-primitives", path = "../../primitives" } -sr-primitives = { path = "../../sr-primitives" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +sr-primitives = { path = "../../../primitives/sr-primitives" } [dev-dependencies] assert_matches = "1.3.0" env_logger = "0.7.0" codec = { package = "parity-scale-codec", version = "1.0.0" } -test_runtime = { package = "substrate-test-runtime", path = "../../test-runtime" } +test_runtime = { package = "substrate-test-runtime", path = "../../../test/utils/runtime" } criterion = "0.3" [[bench]] diff --git a/core/transaction-pool/graph/benches/basics.rs b/client/transaction-pool/graph/benches/basics.rs similarity index 100% rename from core/transaction-pool/graph/benches/basics.rs rename to client/transaction-pool/graph/benches/basics.rs diff --git a/core/transaction-pool/graph/src/base_pool.rs b/client/transaction-pool/graph/src/base_pool.rs similarity index 100% rename from core/transaction-pool/graph/src/base_pool.rs rename to client/transaction-pool/graph/src/base_pool.rs diff --git a/core/transaction-pool/graph/src/error.rs b/client/transaction-pool/graph/src/error.rs similarity index 100% rename from core/transaction-pool/graph/src/error.rs rename to client/transaction-pool/graph/src/error.rs diff --git a/core/transaction-pool/graph/src/future.rs b/client/transaction-pool/graph/src/future.rs similarity index 100% rename from core/transaction-pool/graph/src/future.rs rename to client/transaction-pool/graph/src/future.rs diff --git a/core/transaction-pool/graph/src/lib.rs b/client/transaction-pool/graph/src/lib.rs similarity index 100% rename from core/transaction-pool/graph/src/lib.rs rename to client/transaction-pool/graph/src/lib.rs diff --git a/core/transaction-pool/graph/src/listener.rs b/client/transaction-pool/graph/src/listener.rs similarity index 100% rename from core/transaction-pool/graph/src/listener.rs rename to client/transaction-pool/graph/src/listener.rs diff --git a/core/transaction-pool/graph/src/pool.rs b/client/transaction-pool/graph/src/pool.rs similarity index 100% rename from core/transaction-pool/graph/src/pool.rs rename to client/transaction-pool/graph/src/pool.rs diff --git a/core/transaction-pool/graph/src/ready.rs b/client/transaction-pool/graph/src/ready.rs similarity index 100% rename from core/transaction-pool/graph/src/ready.rs rename to client/transaction-pool/graph/src/ready.rs diff --git a/core/transaction-pool/graph/src/rotator.rs b/client/transaction-pool/graph/src/rotator.rs similarity index 100% rename from core/transaction-pool/graph/src/rotator.rs rename to client/transaction-pool/graph/src/rotator.rs diff --git a/core/transaction-pool/graph/src/validated_pool.rs b/client/transaction-pool/graph/src/validated_pool.rs similarity index 100% rename from core/transaction-pool/graph/src/validated_pool.rs rename to client/transaction-pool/graph/src/validated_pool.rs diff --git a/core/transaction-pool/graph/src/watcher.rs b/client/transaction-pool/graph/src/watcher.rs similarity index 100% rename from core/transaction-pool/graph/src/watcher.rs rename to client/transaction-pool/graph/src/watcher.rs diff --git a/core/transaction-pool/src/api.rs b/client/transaction-pool/src/api.rs similarity index 100% rename from core/transaction-pool/src/api.rs rename to client/transaction-pool/src/api.rs diff --git a/core/transaction-pool/src/error.rs b/client/transaction-pool/src/error.rs similarity index 100% rename from core/transaction-pool/src/error.rs rename to client/transaction-pool/src/error.rs diff --git a/core/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs similarity index 100% rename from core/transaction-pool/src/lib.rs rename to client/transaction-pool/src/lib.rs diff --git a/core/transaction-pool/src/tests.rs b/client/transaction-pool/src/tests.rs similarity index 100% rename from core/transaction-pool/src/tests.rs rename to client/transaction-pool/src/tests.rs diff --git a/core/utils/wasm-builder-runner/Cargo.toml b/client/utils/wasm-builder-runner/Cargo.toml similarity index 100% rename from core/utils/wasm-builder-runner/Cargo.toml rename to client/utils/wasm-builder-runner/Cargo.toml diff --git a/core/utils/wasm-builder-runner/README.md b/client/utils/wasm-builder-runner/README.md similarity index 100% rename from core/utils/wasm-builder-runner/README.md rename to client/utils/wasm-builder-runner/README.md diff --git a/core/utils/wasm-builder-runner/src/lib.rs b/client/utils/wasm-builder-runner/src/lib.rs similarity index 98% rename from core/utils/wasm-builder-runner/src/lib.rs rename to client/utils/wasm-builder-runner/src/lib.rs index 1739c5eff211e..706b623fc3445 100644 --- a/core/utils/wasm-builder-runner/src/lib.rs +++ b/client/utils/wasm-builder-runner/src/lib.rs @@ -149,9 +149,9 @@ pub fn build_current_project(file_name: &str, wasm_builder_source: WasmBuilderSo build_current_project_with_rustflags(file_name, wasm_builder_source, ""); } -/// Returns the root path of the wasm-builder-runner workspace. +/// Returns the root path of the wasm-builder workspace. /// -/// The wasm-builder-runner workspace contains all wasm-builder-runner's projects. +/// The wasm-builder workspace contains all wasm-builder's projects. fn get_workspace_root() -> PathBuf { let out_dir_env = env::var("OUT_DIR").expect("`OUT_DIR` is set by cargo!"); let mut out_dir = PathBuf::from(&out_dir_env); diff --git a/core/consensus/aura/primitives/Cargo.toml b/core/consensus/aura/primitives/Cargo.toml deleted file mode 100644 index 3cd5ff81b9b35..0000000000000 --- a/core/consensus/aura/primitives/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "substrate-consensus-aura-primitives" -version = "2.0.0" -authors = ["Parity Technologies "] -description = "Primitives for Aura consensus" -edition = "2018" - -[dependencies] -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } -sr-api = { path = "../../../sr-api", default-features = false } -app-crypto = { package = "substrate-application-crypto", path = "../../../application-crypto", default-features = false } -rstd = { package = "sr-std", path = "../../../sr-std", default-features = false } -sr-primitives = { path = "../../../sr-primitives", default-features = false } - -[features] -default = ["std"] -std = [ - "rstd/std", - "codec/std", - "sr-primitives/std", - "sr-api/std", - "app-crypto/std", -] diff --git a/core/consensus/rhd/Cargo.toml b/core/consensus/rhd/Cargo.toml deleted file mode 100644 index 48d0840b5592d..0000000000000 --- a/core/consensus/rhd/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "substrate-consensus-rhd" -version = "2.0.0" -authors = ["Parity Technologies "] -description = "Rhododendron Round-Based consensus-algorithm for substrate" -edition = "2018" - -[dependencies] -derive_more = "0.15.0" -futures = "0.1.29" -codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } -primitives = { package = "substrate-primitives", path = "../../primitives" } -consensus = { package = "substrate-consensus-common", path = "../common" } -client = { package = "substrate-client", path = "../../client" } -transaction_pool = { package = "substrate-transaction-pool", path = "../../transaction-pool" } -runtime_support = { package = "srml-support", path = "../../../srml/support" } -srml-system = { path = "../../../srml/system" } -sr-primitives = { path = "../../sr-primitives" } -runtime_version = { package = "sr-version", path = "../../sr-version" } -runtime_io = { package = "sr-io", path = "../../sr-io" } -tokio = "0.1.22" -parking_lot = "0.9.0" -log = "0.4.8" -rhododendron = { version = "0.7.0", features = ["codec"] } -exit-future = "0.1.4" - -[dev-dependencies] -keyring = { package = "substrate-keyring", path = "../../keyring" } - -[features] -default = ["std"] -std = [ - "primitives/std", - "runtime_support/std", - "sr-primitives/std", - "runtime_version/std", -] diff --git a/core/consensus/rhd/src/error.rs b/core/consensus/rhd/src/error.rs deleted file mode 100644 index 601cf1c963a58..0000000000000 --- a/core/consensus/rhd/src/error.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2018-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 . - -//! Error types in the rhododendron Consensus service. -use consensus::error::{Error as CommonError}; -use primitives::AuthorityId; -use client; - -/// A result alias. -pub type Result = std::result::Result; - -/// A RHD error type. -#[derive(Debug, derive_more::Display, derive_more::From)] -pub enum Error { - /// Client error. - Client(client::error::Error), - /// Consensus error. - Common(CommonError), - /// Local account ID not a validator at this block. - #[display(fmt="Local account ID ({:?}) not a validator at this block.", _0)] - NotValidator(AuthorityId), - /// Proposer destroyed before finishing proposing or evaluating - #[display(fmt="Proposer destroyed before finishing proposing or evaluating")] - PrematureDestruction, - /// Failed to register or resolve async timer. - #[display(fmt="Timer failed: {}", _0)] - Timer(tokio::timer::Error), - /// Unable to dispatch agreement future - #[display(fmt="Unable to dispatch agreement future: {:?}", _0)] - Executor(futures::future::ExecuteErrorKind), -} - -impl From<::rhododendron::InputStreamConcluded> for Error { - fn from(_: ::rhododendron::InputStreamConcluded) -> Self { - CommonError::IoTerminated.into() - } -} diff --git a/core/consensus/rhd/src/lib.rs b/core/consensus/rhd/src/lib.rs deleted file mode 100644 index 3bcd1346d47c9..0000000000000 --- a/core/consensus/rhd/src/lib.rs +++ /dev/null @@ -1,1699 +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 . - -//! BFT Agreement based on a rotating proposer in different rounds. -//! -//! Where this crate refers to input stream, should never logically conclude. -//! The logic in this crate assumes that messages flushed to the output stream -//! will eventually reach other nodes and that our own messages are not included -//! in the input stream. -//! -//! Note that it is possible to witness agreement being reached without ever -//! seeing the candidate. Any candidates seen will be checked for validity. -//! -//! Although technically the agreement will always complete (given the eventual -//! delivery of messages), in practice it is possible for this future to -//! conclude without having witnessed the conclusion. -//! In general, this future should be pre-empted by the import of a justification -//! set for this block height. - -#![cfg(feature="rhd")] -// FIXME #1020 doesn't compile -// NOTE: this is the legacy constant used for transaction size. No longer used except -// for the rhd code which is not updated. Placed here for compatibility. -const MAX_TRANSACTIONS_SIZE: u32 = 4 * 1024 * 1024; - -use std::sync::Arc; -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::time::{self, Instant, Duration}; - -use codec::{Decode, Encode}; -use consensus::offline_tracker::OfflineTracker; -use consensus::error::{ErrorKind as CommonErrorKind}; -use consensus::{Authorities, BlockImport, Environment, Proposer as BaseProposer}; -use client::{Client as SubstrateClient, CallExecutor}; -use client::runtime_api::{Core, BlockBuilder as BlockBuilderAPI, OldTxQueue, BlockBuilderError}; -use sr_primitives::generic::{BlockId, Era, ImportResult, BlockImportParams, BlockOrigin}; -use sr_primitives::traits::{Block, Header}; -use sr_primitives::traits::{ - Block as BlockT, Hash as HashT, Header as HeaderT, - BlockNumberToHash, SaturatedConversion -}; -use sr_primitives::Justification; -use primitives::{AuthorityId, ed25519, Blake2Hasher, ed25519::LocalizedSignature}; -use srml_system::Trait as SystemT; - -use node_runtime::Runtime; -use transaction_pool::txpool::{self, Pool as TransactionPool}; - -use futures::prelude::*; -use futures::future; -use futures::sync::oneshot; -use tokio::runtime::TaskExecutor; -use tokio::timer::Delay; -use parking_lot::{RwLock, Mutex}; - -pub use rhododendron::{ - self, InputStreamConcluded, AdvanceRoundReason, Message as RhdMessage, - Vote as RhdMessageVote, Communication as RhdCommunication, -}; -pub use self::error::{Error, ErrorKind}; - -// pub mod misbehavior_check; -mod error; -mod service; - -// statuses for an agreement -mod status { - pub const LIVE: usize = 0; - pub const BAD: usize = 1; - pub const GOOD: usize = 2; -} - -pub type Timestamp = u64; - -pub type AccountId = ::primitives::H256; - -/// Localized message type. -pub type LocalizedMessage = rhododendron::LocalizedMessage< - B, - ::Hash, - AuthorityId, - LocalizedSignature ->; - -/// Justification of some hash. -pub struct RhdJustification(rhododendron::Justification); - -/// Justification of a prepare message. -pub struct PrepareJustification(rhododendron::PrepareJustification); - -/// Unchecked justification. -#[derive(Encode, Decode)] -pub struct UncheckedJustification(rhododendron::UncheckedJustification); - -impl UncheckedJustification { - /// Create a new, unchecked justification. - pub fn new(digest: H, signatures: Vec, round_number: u32) -> Self { - UncheckedJustification(rhododendron::UncheckedJustification { - digest, - signatures, - round_number, - }) - } -} - -impl UncheckedJustification { - /// Decode a justification. - pub fn decode_justification(justification: Justification) -> Option { - let inner: rhododendron::UncheckedJustification<_, _> = Decode::decode(&mut &justification[..])?; - - Some(UncheckedJustification(inner)) - } -} - -impl Into for UncheckedJustification { - fn into(self) -> Justification { - self.0.encode() - } -} - -impl From> for UncheckedJustification { - fn from(inner: rhododendron::UncheckedJustification) -> Self { - UncheckedJustification(inner) - } -} - -/// Result of a committed round of BFT -pub type Committed = rhododendron::Committed::Hash, LocalizedSignature>; - -/// Communication between BFT participants. -pub type Communication = rhododendron::Communication::Hash, AuthorityId, LocalizedSignature>; - -/// Misbehavior observed from BFT participants. -pub type Misbehavior = rhododendron::Misbehavior; - -/// Shared offline validator tracker. -pub type SharedOfflineTracker = Arc>; - -/// A proposer for a rhododendron instance. This must implement the base proposer logic. -pub trait LocalProposer: BaseProposer { - /// Import witnessed rhododendron misbehavior. - fn import_misbehavior(&self, misbehavior: Vec<(AuthorityId, Misbehavior)>); - - /// Determine the proposer for a given round. This should be a deterministic function - /// with consistent results across all authorities. - fn round_proposer(&self, round_number: u32, authorities: &[AuthorityId]) -> AuthorityId; - - /// Hook called when a BFT round advances without a proposal. - fn on_round_end(&self, _round_number: u32, _proposed: bool) { } -} - - -/// Build new blocks. -pub trait BlockBuilder { - /// Push an extrinsic onto the block. Fails if the extrinsic is invalid. - fn push_extrinsic(&mut self, extrinsic: ::Extrinsic) -> Result<(), Error>; -} - -/// Local client abstraction for the consensus. -pub trait AuthoringApi: - Send - + Sync - + BlockBuilderAPI<::Block, InherentData, Error=::Error> - + Core<::Block, AuthorityId, Error=::Error> - + OldTxQueue<::Block, Error=::Error> -{ - /// The block used for this API type. - type Block: BlockT; - /// The error used by this API type. - type Error: std::error::Error; - - /// Build a block on top of the given, with inherent extrinsics pre-pushed. - fn build_block) -> ()>( - &self, - at: &BlockId, - inherent_data: InherentData, - build_ctx: F, - ) -> Result; -} - -/// A long-lived network which can create BFT message routing processes on demand. -pub trait Network { - /// The block used for this API type. - type Block: BlockT; - /// The input stream of BFT messages. Should never logically conclude. - type Input: Stream,Error=Error>; - /// The output sink of BFT messages. Messages sent here should eventually pass to all - /// current authorities. - type Output: Sink,SinkError=Error>; - - /// Instantiate input and output streams. - fn communication_for( - &self, - validators: &[AuthorityId], - local_id: AuthorityId, - parent_hash: ::Hash, - task_executor: TaskExecutor - ) -> (Self::Input, Self::Output); -} - - -// caches the round number to start at if we end up with BFT consensus on the same -// parent hash more than once (happens if block is bad). -// -// this will force a committed but locally-bad block to be considered analogous to -// a round advancement vote. -#[derive(Debug)] -struct RoundCache { - hash: Option, - start_round: u32, -} - -/// Instance of BFT agreement. -struct BftInstance { - key: Arc, - authorities: Vec, - parent_hash: B::Hash, - round_timeout_multiplier: u64, - cache: Arc>>, - proposer: P, -} - -impl> BftInstance - where - B: Clone + Eq, - B::Hash: ::std::hash::Hash - -{ - fn round_timeout_duration(&self, round: u32) -> Duration { - // 2^(min(6, x/8)) * 10 - // Grows exponentially starting from 10 seconds, capped at 640 seconds. - const ROUND_INCREMENT_STEP: u32 = 8; - - let round = round / ROUND_INCREMENT_STEP; - let round = ::std::cmp::min(6, round); - - let timeout = 1u64.checked_shl(round) - .unwrap_or_else(u64::max_value) - .saturating_mul(self.round_timeout_multiplier); - - Duration::from_secs(timeout) - } - - fn update_round_cache(&self, current_round: u32) { - let mut cache = self.cache.lock(); - if cache.hash.as_ref() == Some(&self.parent_hash) { - cache.start_round = current_round + 1; - } - } -} - -impl> rhododendron::Context for BftInstance - where - B: Clone + Eq, - B::Hash: ::std::hash::Hash, -{ - type Error = P::Error; - type AuthorityId = AuthorityId; - type Digest = B::Hash; - type Signature = LocalizedSignature; - type Candidate = B; - type RoundTimeout = Box>; - type CreateProposal = ::Future; - type EvaluateProposal = ::Future; - - fn local_id(&self) -> AuthorityId { - self.key.public().into() - } - - fn proposal(&self) -> Self::CreateProposal { - self.proposer.propose().into_future() - } - - fn candidate_digest(&self, proposal: &B) -> B::Hash { - proposal.hash() - } - - fn sign_local(&self, message: RhdMessage) -> LocalizedMessage { - sign_message(message, &*self.key, self.parent_hash.clone()) - } - - fn round_proposer(&self, round: u32) -> AuthorityId { - self.proposer.round_proposer(round, &self.authorities[..]) - } - - fn proposal_valid(&self, proposal: &B) -> Self::EvaluateProposal { - self.proposer.evaluate(proposal).into_future() - } - - fn begin_round_timeout(&self, round: u32) -> Self::RoundTimeout { - let timeout = self.round_timeout_duration(round); - let fut = Delay::new(Instant::now() + timeout) - .map_err(|e| Error::from(CommonErrorKind::FaultyTimer(e))) - .map_err(Into::into); - - Box::new(fut) - } - - fn on_advance_round( - &self, - accumulator: &rhododendron::Accumulator, - round: u32, - next_round: u32, - reason: AdvanceRoundReason, - ) { - use std::collections::HashSet; - - let collect_pubkeys = |participants: HashSet<&Self::AuthorityId>| participants.into_iter() - .map(|p| ::ed25519::Public::from_raw(p.0)) - .collect::>(); - - let round_timeout = self.round_timeout_duration(next_round); - debug!(target: "rhd", "Advancing to round {} from {}", next_round, round); - debug!(target: "rhd", "Participating authorities: {:?}", - collect_pubkeys(accumulator.participants())); - debug!(target: "rhd", "Voting authorities: {:?}", - collect_pubkeys(accumulator.voters())); - debug!(target: "rhd", "Round {} should end in at most {} seconds from now", next_round, round_timeout.as_secs()); - - self.update_round_cache(next_round); - - if let AdvanceRoundReason::Timeout = reason { - self.proposer.on_round_end(round, accumulator.proposal().is_some()); - } - } -} - -/// A future that resolves either when canceled (witnessing a block from the network at same height) -/// or when agreement completes. -pub struct BftFuture where - B: Block + Clone + Eq, - B::Hash: ::std::hash::Hash, - P: LocalProposer, - P: BaseProposer, - InStream: Stream, Error=Error>, - OutSink: Sink, SinkError=Error>, -{ - inner: rhododendron::Agreement, InStream, OutSink>, - status: Arc, - cancel: oneshot::Receiver<()>, - import: Arc, -} - -impl Future for BftFuture where - B: Block + Clone + Eq, - B::Hash: ::std::hash::Hash, - P: LocalProposer, - P: BaseProposer, - I: BlockImport, - InStream: Stream, Error=Error>, - OutSink: Sink, SinkError=Error>, -{ - type Item = (); - type Error = (); - - fn poll(&mut self) -> ::futures::Poll<(), ()> { - // service has canceled the future. bail - let cancel = match self.cancel.poll() { - Ok(Async::Ready(())) | Err(_) => true, - Ok(Async::NotReady) => false, - }; - - let committed = match self.inner.poll().map_err(|_| ()) { - Ok(Async::Ready(x)) => x, - Ok(Async::NotReady) => - return Ok(if cancel { Async::Ready(()) } else { Async::NotReady }), - Err(()) => return Err(()), - }; - - // if something was committed, the round leader must have proposed. - self.inner.context().proposer.on_round_end(committed.round_number, true); - - // If we didn't see the proposal (very unlikely), - // we will get the block from the network later. - if let Some(justified_block) = committed.candidate { - let hash = justified_block.hash(); - info!(target: "rhd", "Importing block #{} ({}) directly from BFT consensus", - justified_block.header().number(), hash); - let just: Justification = UncheckedJustification(committed.justification.uncheck()).into(); - let (header, body) = justified_block.deconstruct(); - let import_block = BlockImportParams { - origin: BlockOrigin::ConsensusBroadcast, - header: header, - justification: Some(just), - body: Some(body), - finalized: true, - post_digests: Default::default(), - auxiliary: Default::default() - }; - - let new_status = match self.import.import_block(import_block, None) { - Err(e) => { - warn!(target: "rhd", "Error importing block {:?} in round #{}: {:?}", - hash, committed.round_number, e); - status::BAD - } - Ok(ImportResult::KnownBad) => { - warn!(target: "rhd", "{:?} was bad block agreed on in round #{}", - hash, committed.round_number); - status::BAD - } - _ => status::GOOD - }; - - self.status.store(new_status, Ordering::Release); - - } else { - // assume good unless we received the proposal. - self.status.store(status::GOOD, Ordering::Release); - } - - self.inner.context().update_round_cache(committed.round_number); - - Ok(Async::Ready(())) - } -} - -impl Drop for BftFuture where - B: Block + Clone + Eq, - B::Hash: ::std::hash::Hash, - P: LocalProposer, - P: BaseProposer, - InStream: Stream, Error=Error>, - OutSink: Sink, SinkError=Error>, -{ - fn drop(&mut self) { - let misbehavior = self.inner.drain_misbehavior().collect::>(); - self.inner.context().proposer.import_misbehavior(misbehavior); - } -} - -struct AgreementHandle { - status: Arc, - send_cancel: Option>, -} - -impl AgreementHandle { - fn status(&self) -> usize { - self.status.load(Ordering::Acquire) - } -} - -impl Drop for AgreementHandle { - fn drop(&mut self) { - if let Some(sender) = self.send_cancel.take() { - let _ = sender.send(()); - } - } -} - -/// The BftService kicks off the agreement process on top of any blocks it -/// is notified of. -/// -/// This assumes that it is being run in the context of a tokio runtime. -pub struct BftService { - client: Arc, - live_agreement: Mutex>, - round_cache: Arc>>, - round_timeout_multiplier: u64, - key: Arc, - factory: P, -} - -impl BftService - where - B: Block + Clone + Eq, - P: Environment, - P::Proposer: LocalProposer, - P::Proposer: BaseProposer, - I: BlockImport + Authorities, -{ - /// Create a new service instance. - pub fn new(client: Arc, key: Arc, factory: P) -> BftService { - BftService { - client: client, - live_agreement: Mutex::new(None), - round_cache: Arc::new(Mutex::new(RoundCache { - hash: None, - start_round: 0, - })), - round_timeout_multiplier: 10, - key: key, - factory, - } - } - - /// Get the local Authority ID. - pub fn local_id(&self) -> AuthorityId { - self.key.public().into() - } - - /// Signal that a valid block with the given header has been imported. - /// Provide communication streams that are localized to this block. - /// It's recommended to use the communication primitives provided by this - /// module for signature checking and decoding. See `CheckedStream` and - /// `SigningSink` for more details. - /// - /// Messages received on the stream that don't match the expected format - /// will be dropped. - /// - /// If the local signing key is an authority, this will begin the consensus process to build a - /// block on top of it. If the executor fails to run the future, an error will be returned. - /// Returns `None` if the agreement on the block with given parent is already in progress. - pub fn build_upon(&self, header: &B::Header, input: In, output: Out) - -> Result>::Proposer, - I, - In, - Out, - >>, P::Error> - where - In: Stream, Error=Error>, - Out: Sink, SinkError=Error>, - { - let hash = header.hash(); - - let mut live_agreement = self.live_agreement.lock(); - let can_build = live_agreement.as_ref() - .map_or(true, |x| self.can_build_on_inner(header, x)); - - if !can_build { - return Ok(None) - } - - let authorities = self.client.authorities(&BlockId::Hash(hash.clone())) - .map_err(|e| CommonErrorKind::Other(Box::new(e)).into())?; - - let n = authorities.len(); - let max_faulty = max_faulty_of(n); - trace!(target: "rhd", "Initiating agreement on top of #{}, {:?}", header.number(), hash); - trace!(target: "rhd", "max_faulty_of({})={}", n, max_faulty); - - let local_id = self.local_id(); - - if !authorities.contains(&local_id) { - // cancel current agreement - live_agreement.take(); - Err(CommonErrorKind::InvalidAuthority(local_id).into())?; - } - - let proposer = self.factory.init(header, &authorities, self.key.clone())?; - - let bft_instance = BftInstance { - proposer, - parent_hash: hash.clone(), - cache: self.round_cache.clone(), - round_timeout_multiplier: self.round_timeout_multiplier, - key: self.key.clone(), - authorities: authorities, - }; - - let mut agreement = rhododendron::agree( - bft_instance, - n, - max_faulty, - input, - output, - ); - - // fast forward round number if necessary. - { - let mut cache = self.round_cache.lock(); - trace!(target: "rhd", "Round cache: {:?}", &*cache); - if cache.hash.as_ref() == Some(&hash) { - trace!(target: "rhd", "Fast-forwarding to round {}", cache.start_round); - let start_round = cache.start_round; - cache.start_round += 1; - - drop(cache); - agreement.fast_forward(start_round); - } else { - *cache = RoundCache { - hash: Some(hash.clone()), - start_round: 1, - }; - } - } - - let status = Arc::new(AtomicUsize::new(status::LIVE)); - let (tx, rx) = oneshot::channel(); - - // cancel current agreement. - *live_agreement = Some((header.clone(), AgreementHandle { - send_cancel: Some(tx), - status: status.clone(), - })); - - Ok(Some(BftFuture { - inner: agreement, - status: status, - cancel: rx, - import: self.client.clone(), - })) - } - - /// Cancel current agreement if any. - pub fn cancel_agreement(&self) { - self.live_agreement.lock().take(); - } - - /// Whether we can build using the given header. - pub fn can_build_on(&self, header: &B::Header) -> bool { - self.live_agreement.lock().as_ref() - .map_or(true, |x| self.can_build_on_inner(header, x)) - } - - /// Get a reference to the underlying client. - pub fn client(&self) -> &I { &*self.client } - - fn can_build_on_inner(&self, header: &B::Header, live: &(B::Header, AgreementHandle)) -> bool { - let hash = header.hash(); - let &(ref live_header, ref handle) = live; - match handle.status() { - _ if *header != *live_header && *live_header.parent_hash() != hash => true, // can always follow with next block. - status::BAD => hash == live_header.hash(), // bad block can be re-agreed on. - _ => false, // canceled won't appear since we overwrite the handle before returning. - } - } -} - -/// Stream that decodes rhododendron messages and checks signatures. -/// -/// This stream is localized to a specific parent block-hash, as all messages -/// will be signed in a way that accounts for it. When using this with -/// `BftService::build_upon`, the user should take care to use the same hash as for that. -pub struct CheckedStream { - inner: S, - local_id: AuthorityId, - authorities: Vec, - parent_hash: B::Hash, -} - -impl CheckedStream { - /// Construct a new checked stream. - pub fn new( - inner: S, - local_id: AuthorityId, - authorities: Vec, - parent_hash: B::Hash, - ) -> Self { - CheckedStream { - inner, - local_id, - authorities, - parent_hash, - } - } -} - -impl>> Stream for CheckedStream - where S::Error: From, -{ - type Item = Communication; - type Error = S::Error; - - fn poll(&mut self) -> Poll, Self::Error> { - use rhododendron::LocalizedMessage as RhdLocalized; - loop { - match self.inner.poll()? { - Async::Ready(Some(item)) => { - let comms: Communication = match Decode::decode(&mut &item[..]) { - Some(x) => x, - None => continue, - }; - - match comms { - RhdCommunication::Auxiliary(prepare_just) => { - let checked = check_prepare_justification::( - &self.authorities, - self.parent_hash, - UncheckedJustification(prepare_just.uncheck()), - ); - if let Ok(checked) = checked { - return Ok(Async::Ready( - Some(RhdCommunication::Auxiliary(checked.0)) - )); - } - } - RhdCommunication::Consensus(RhdLocalized::Propose(p)) => { - if p.sender == self.local_id { continue } - - let checked = check_proposal::( - &self.authorities, - &self.parent_hash, - &p, - ); - - if let Ok(()) = checked { - return Ok(Async::Ready( - Some(RhdCommunication::Consensus(RhdLocalized::Propose(p))) - )); - } - } - RhdCommunication::Consensus(RhdLocalized::Vote(v)) => { - if v.sender == self.local_id { continue } - - let checked = check_vote::( - &self.authorities, - &self.parent_hash, - &v, - ); - - if let Ok(()) = checked { - return Ok(Async::Ready( - Some(RhdCommunication::Consensus(RhdLocalized::Vote(v))) - )); - } - } - } - } - Async::Ready(None) => return Ok(Async::Ready(None)), - Async::NotReady => return Ok(Async::NotReady), - } - } - } -} - -/// Given a total number of authorities, yield the maximum faulty that would be allowed. -/// This will always be under 1/3. -pub fn max_faulty_of(n: usize) -> usize { - n.saturating_sub(1) / 3 -} - -/// Given a total number of authorities, yield the minimum required signatures. -/// This will always be over 2/3. -pub fn bft_threshold(n: usize) -> usize { - n - max_faulty_of(n) -} - -// actions in the signature scheme. -#[derive(Encode)] -enum Action { - Prepare(u32, H), - Commit(u32, H), - AdvanceRound(u32), - // signatures of header hash and full candidate are both included. - ProposeHeader(u32, H), - Propose(u32, B), -} - -// encode something in a way which is localized to a specific parent-hash -fn localized_encode(parent_hash: H, value: E) -> Vec { - (parent_hash, value).encode() -} - -fn check_justification_signed_message( - authorities: &[AuthorityId], - message: &[u8], - just: UncheckedJustification) --> Result, UncheckedJustification> { - // additional error information could be useful here. - just.0.check(authorities.len() - max_faulty_of(authorities.len()), |_, _, sig| { - let auth_id = sig.signer.clone().into(); - if !authorities.contains(&auth_id) { return None } - - if ed25519::Pair::verify(&sig.signature, message, &sig.signer) { - Some(sig.signer.0) - } else { - None - } - }).map(RhdJustification).map_err(UncheckedJustification) -} - -/// Check a full justification for a header hash. -/// Provide all valid authorities. -/// -/// On failure, returns the justification back. -pub fn check_justification( - authorities: &[AuthorityId], - parent: B::Hash, - just: UncheckedJustification -) -> Result, UncheckedJustification> { - let vote: Action = Action::Commit(just.0.round_number as u32, just.0.digest.clone()); - let message = localized_encode(parent, vote); - - check_justification_signed_message(authorities, &message[..], just) -} - -/// Check a prepare justification for a header hash. -/// Provide all valid authorities. -/// -/// On failure, returns the justification back. -pub fn check_prepare_justification( - authorities: &[AuthorityId], - parent: B::Hash, - just: UncheckedJustification -) -> Result, UncheckedJustification> { - let vote: Action = Action::Prepare(just.0.round_number as u32, just.0.digest.clone()); - let message = localized_encode(parent, vote); - - check_justification_signed_message(authorities, &message[..], just).map(|e| PrepareJustification(e.0)) -} - -/// Check proposal message signatures and authority. -/// Provide all valid authorities. -pub fn check_proposal( - authorities: &[AuthorityId], - parent_hash: &B::Hash, - propose: &rhododendron::LocalizedProposal) - -> Result<(), Error> -{ - if !authorities.contains(&propose.sender) { - return Err(CommonErrorKind::InvalidAuthority(propose.sender.into()).into()); - } - - let action_header = Action::ProposeHeader(propose.round_number as u32, propose.digest.clone()); - let action_propose = Action::Propose(propose.round_number as u32, propose.proposal.clone()); - check_action::(action_header, parent_hash, &propose.digest_signature)?; - check_action::(action_propose, parent_hash, &propose.full_signature) -} - -/// Check vote message signatures and authority. -/// Provide all valid authorities. -pub fn check_vote( - authorities: &[AuthorityId], - parent_hash: &B::Hash, - vote: &rhododendron::LocalizedVote) - -> Result<(), Error> -{ - if !authorities.contains(&vote.sender) { - return Err(CommonErrorKind::InvalidAuthority(vote.sender.into()).into()); - } - - let action = match vote.vote { - rhododendron::Vote::Prepare(r, ref h) => Action::Prepare(r as u32, h.clone()), - rhododendron::Vote::Commit(r, ref h) => Action::Commit(r as u32, h.clone()), - rhododendron::Vote::AdvanceRound(r) => Action::AdvanceRound(r as u32), - }; - check_action::(action, parent_hash, &vote.signature) -} - -fn check_action( - action: Action, - parent_hash: &B::Hash, - sig: &LocalizedSignature -) -> Result<(), Error> { - let message = localized_encode(*parent_hash, action); - if ed25519::Pair::verify(&sig.signature, &message, &sig.signer) { - Ok(()) - } else { - Err(CommonErrorKind::InvalidSignature(sig.signature.into(), sig.signer.clone().into()).into()) - } -} - -/// Sign a BFT message with the given key. -pub fn sign_message( - message: RhdMessage, - key: &ed25519::Pair, - parent_hash: B::Hash -) -> LocalizedMessage { - let signer = key.public(); - - let sign_action = |action: Action| { - let to_sign = localized_encode(parent_hash.clone(), action); - - LocalizedSignature { - signer: signer.clone(), - signature: key.sign(&to_sign), - } - }; - - match message { - RhdMessage::Propose(r, proposal) => { - let header_hash = proposal.hash(); - let action_header = Action::ProposeHeader(r as u32, header_hash.clone()); - let action_propose = Action::Propose(r as u32, proposal.clone()); - - rhododendron::LocalizedMessage::Propose(rhododendron::LocalizedProposal { - round_number: r, - proposal, - digest: header_hash, - sender: signer.clone().into(), - digest_signature: sign_action(action_header), - full_signature: sign_action(action_propose), - }) - } - RhdMessage::Vote(vote) => rhododendron::LocalizedMessage::Vote({ - let action = match vote { - RhdMessageVote::Prepare(r, h) => Action::Prepare(r as u32, h), - RhdMessageVote::Commit(r, h) => Action::Commit(r as u32, h), - RhdMessageVote::AdvanceRound(r) => Action::AdvanceRound(r as u32), - }; - - rhododendron::LocalizedVote { - vote: vote, - sender: signer.clone().into(), - signature: sign_action(action), - } - }) - } -} - - -impl<'a, B, E, Block> BlockBuilder for client::block_builder::BlockBuilder<'a, B, E, Block, Blake2Hasher> where - B: client::backend::Backend + Send + Sync + 'static, - E: CallExecutor + Send + Sync + Clone + 'static, - Block: BlockT -{ - fn push_extrinsic(&mut self, extrinsic: ::Extrinsic) -> Result<(), Error> { - client::block_builder::BlockBuilder::push(self, extrinsic).map_err(Into::into) - } -} - -impl<'a, B, E, Block> AuthoringApi for SubstrateClient where - B: client::backend::Backend + Send + Sync + 'static, - E: CallExecutor + Send + Sync + Clone + 'static, - Block: BlockT, -{ - type Block = Block; - type Error = client::error::Error; - - fn build_block) -> ()>( - &self, - at: &BlockId, - inherent_data: InherentData, - mut build_ctx: F, - ) -> Result { - let runtime_version = self.runtime_version_at(at)?; - - let mut block_builder = self.new_block_at(at)?; - if runtime_version.has_api(*b"blkbuild", 1) { - for inherent in self.inherent_extrinsics(at, &inherent_data)? { - block_builder.push(inherent)?; - } - } - - build_ctx(&mut block_builder); - - block_builder.bake().map_err(Into::into) - } -} - - -/// Proposer factory. -pub struct ProposerFactory where - C: AuthoringApi, - A: txpool::ChainApi, -{ - /// The client instance. - pub client: Arc, - /// The transaction pool. - pub transaction_pool: Arc>, - /// The backing network handle. - pub network: N, - /// handle to remote task executor - pub handle: TaskExecutor, - /// Offline-tracker. - pub offline: SharedOfflineTracker, - /// Force delay in evaluation this long. - pub force_delay: u64, -} - -impl consensus::Environment<::Block> for ProposerFactory where - N: Network::Block>, - C: AuthoringApi + BlockNumberToHash, - A: txpool::ChainApi::Block>, - // <::Block as BlockT>::Hash: - // Into<::Hash> + PartialEq + Into, - Error: From<::Error> -{ - type Proposer = Proposer; - type Error = Error; - - fn init( - &self, - parent_header: &<::Block as BlockT>::Header, - authorities: &[AuthorityId], - sign_with: Arc, - ) -> Result { - use sr_primitives::traits::Hash as HashT; - let parent_hash = parent_header.hash(); - - let id = BlockId::hash(parent_hash); - let random_seed = self.client.random_seed(&id)?; - let random_seed = <<::Block as BlockT>::Header as HeaderT> - ::Hashing::hash(random_seed.as_ref()); - - let validators = self.client.validators(&id)?; - self.offline.write().note_new_block(&validators[..]); - - info!("Starting consensus session on top of parent {:?}", parent_hash); - - let local_id = sign_with.public().0.into(); - let (input, output) = self.network.communication_for( - authorities, - local_id, - parent_hash.clone(), - self.handle.clone(), - ); - let now = Instant::now(); - let proposer = Proposer { - client: self.client.clone(), - start: now, - local_key: sign_with, - parent_hash, - parent_id: id, - parent_number: *parent_header.number(), - random_seed, - transaction_pool: self.transaction_pool.clone(), - offline: self.offline.clone(), - validators, - minimum_timestamp: current_timestamp() + self.force_delay, - network: self.network.clone() - }; - - Ok(proposer) - } -} - -/// The proposer logic. -pub struct Proposer { - client: Arc, - start: Instant, - local_key: Arc, - parent_hash: <::Block as BlockT>::Hash, - parent_id: BlockId<::Block>, - parent_number: <<::Block as BlockT>::Header as HeaderT>::Number, - random_seed: <::Block as BlockT>::Hash, - transaction_pool: Arc>, - offline: SharedOfflineTracker, - validators: Vec, - minimum_timestamp: u64, - network: N, -} - -impl Proposer { - fn primary_index(&self, round_number: u32, len: usize) -> usize { - use primitives::uint::U256; - - let big_len = U256::from(len); - let offset = U256::from_big_endian(self.random_seed.as_ref()) % big_len; - let offset = offset.low_u64() as usize + round_number as usize; - offset % len - } -} - -impl BaseProposer<::Block> for Proposer where - C: AuthoringApi + BlockNumberToHash, - A: txpool::ChainApi::Block>, - <::Block as BlockT>::Hash: - Into<::Hash> + PartialEq + Into, - error::Error: From<::Error> -{ - type Create = Result<::Block, Error>; - type Error = Error; - type Evaluate = Box>; - - fn propose(&self) -> Self::Create { - use sr_primitives::traits::BlakeTwo256; - - const MAX_VOTE_OFFLINE_SECONDS: Duration = Duration::from_secs(60); - - let timestamp = ::std::cmp::max(self.minimum_timestamp, current_timestamp()); - - let elapsed_since_start = self.start.elapsed(); - let offline_indices = if elapsed_since_start > MAX_VOTE_OFFLINE_SECONDS { - Vec::new() - } else { - self.offline.read().reports(&self.validators[..]) - }; - - if !offline_indices.is_empty() { - info!( - "Submitting offline validators {:?} for slash-vote", - offline_indices.iter().map(|&i| self.validators[i as usize]).collect::>(), - ) - } - - let inherent_data = InherentData { - timestamp, - offline_indices, - }; - - let block = self.client.build_block( - &self.parent_id, - inherent_data, - |block_builder| { - let mut unqueue_invalid = Vec::new(); - self.transaction_pool.ready(|pending_iterator| { - let mut pending_size = 0; - for pending in pending_iterator { - let encoded_size = pending.data.encode().len(); - if pending_size + encoded_size >= MAX_TRANSACTIONS_SIZE { break } - - match block_builder.push_extrinsic(pending.data.clone()) { - Ok(()) => { - pending_size += encoded_size; - } - Err(e) => { - trace!(target: "transaction-pool", "Invalid transaction: {}", e); - unqueue_invalid.push(pending.hash.clone()); - } - } - } - }); - - self.transaction_pool.remove_invalid(&unqueue_invalid); - })?; - - info!("Proposing block [number: {}; hash: {}; parent_hash: {}; extrinsics: [{}]]", - block.header().number(), - <::Block as BlockT>::Hash::from(block.header().hash()), - block.header().parent_hash(), - block.extrinsics().iter() - .map(|xt| format!("{}", BlakeTwo256::hash_of(xt))) - .collect::>() - .join(", ") - ); - - let substrate_block = Decode::decode(&mut block.encode().as_slice()) - .expect("blocks are defined to serialize to substrate blocks correctly; qed"); - - assert!(evaluation::evaluate_initial( - &substrate_block, - &self.parent_hash, - self.parent_number, - ).is_ok()); - - Ok(substrate_block) - } - - fn evaluate(&self, unchecked_proposal: &::Block) -> Self::Evaluate { - debug!(target: "rhd", "evaluating block on top of parent ({}, {:?})", self.parent_number, self.parent_hash); - - // do initial serialization and structural integrity checks. - if let Err(e) = evaluation::evaluate_initial( - unchecked_proposal, - &self.parent_hash, - self.parent_number, - ) { - debug!(target: "rhd", "Invalid proposal: {:?}", e); - return Box::new(future::ok(false)); - }; - - let current_timestamp = current_timestamp(); - let inherent = InherentData::new( - current_timestamp, - self.offline.read().reports(&self.validators) - ); - let proposed_timestamp = match self.client.check_inherents( - &self.parent_id, - &unchecked_proposal, - &inherent, - ) { - Ok(Ok(())) => None, - Ok(Err(BlockBuilderError::ValidAtTimestamp(timestamp))) => Some(timestamp), - Ok(Err(e)) => { - debug!(target: "rhd", "Invalid proposal (check_inherents): {:?}", e); - return Box::new(future::ok(false)); - }, - Err(e) => { - debug!(target: "rhd", "Could not call into runtime: {:?}", e); - return Box::new(future::ok(false)); - } - }; - - let vote_delays = { - - // the duration until the given timestamp is current - let proposed_timestamp = ::std::cmp::max(self.minimum_timestamp, proposed_timestamp.unwrap_or(0)); - let timestamp_delay = if proposed_timestamp > current_timestamp { - let delay_s = proposed_timestamp - current_timestamp; - debug!(target: "rhd", "Delaying evaluation of proposal for {} seconds", delay_s); - Some(Instant::now() + Duration::from_secs(delay_s)) - } else { - None - }; - - match timestamp_delay { - Some(duration) => future::Either::A( - Delay::new(duration).map_err(|e| ErrorKind::Timer(e).into()) - ), - None => future::Either::B(future::ok(())), - } - }; - - // evaluate whether the block is actually valid. - // it may be better to delay this until the delays are finished - let evaluated = match self.client.execute_block(&self.parent_id, &unchecked_proposal.clone()) - .map_err(Error::from) { - Ok(()) => Ok(true), - Err(err) => match err.kind() { - error::ErrorKind::Client(client::error::ErrorKind::Execution(_)) => Ok(false), - _ => Err(err) - } - }; - - let future = future::result(evaluated).and_then(move |good| { - let end_result = future::ok(good); - if good { - // delay a "good" vote. - future::Either::A(vote_delays.and_then(|_| end_result)) - } else { - // don't delay a "bad" evaluation. - future::Either::B(end_result) - } - }); - - Box::new(future) as Box<_> - } -} - -impl LocalProposer<::Block> for Proposer where - C: AuthoringApi + BlockNumberToHash, - A: txpool::ChainApi::Block>, - Self: BaseProposer<::Block, Error=Error>, - <::Block as BlockT>::Hash: - Into<::Hash> + PartialEq + Into, - error::Error: From<::Error> -{ - - fn round_proposer(&self, round_number: u32, authorities: &[AuthorityId]) -> AuthorityId { - let offset = self.primary_index(round_number, authorities.len()); - let proposer = authorities[offset as usize].clone(); - trace!(target: "rhd", "proposer for round {} is {}", round_number, proposer); - - proposer - } - - fn import_misbehavior( - &self, - _misbehavior: Vec<(AuthorityId, Misbehavior<<::Block as BlockT>::Hash>)> - ) { - use rhododendron::Misbehavior as GenericMisbehavior; - use sr_primitives::bft::{MisbehaviorKind, MisbehaviorReport}; - use node_runtime::{Call, UncheckedExtrinsic, ConsensusCall}; - - let mut next_index = { - let local_id = self.local_key.public().0; - let cur_index = self.transaction_pool.cull_and_get_pending(&BlockId::hash(self.parent_hash), |pending| pending - .filter(|tx| tx.verified.sender == local_id) - .last() - .map(|tx| Ok(tx.verified.index())) - .unwrap_or_else(|| self.client.account_nonce(&self.parent_id, local_id)) - .map_err(Error::from) - ); - - match cur_index { - Ok(cur_index) => cur_index + 1, - Err(e) => { - warn!(target: "consensus", "Error computing next transaction index: {:?}", e); - return; - } - } - }; - - for (target, misbehavior) in misbehavior { - let report = MisbehaviorReport { - parent_hash: self.parent_hash.into(), - parent_number: self.parent_number.saturated_into::(), - target, - misbehavior: match misbehavior { - GenericMisbehavior::ProposeOutOfTurn(_, _, _) => continue, - GenericMisbehavior::DoublePropose(_, _, _) => continue, - GenericMisbehavior::DoublePrepare(round, (h1, s1), (h2, s2)) - => MisbehaviorKind::BftDoublePrepare(round as u32, (h1.into(), s1.signature), (h2.into(), s2.signature)), - GenericMisbehavior::DoubleCommit(round, (h1, s1), (h2, s2)) - => MisbehaviorKind::BftDoubleCommit(round as u32, (h1.into(), s1.signature), (h2.into(), s2.signature)), - } - }; - let payload = ( - next_index, - Call::Consensus(ConsensusCall::report_misbehavior(report)), - Era::immortal(), - self.client.genesis_hash() - ); - let signature = self.local_key.sign(&payload.encode()).into(); - next_index += 1; - - let local_id = self.local_key.public().0.into(); - let extrinsic = UncheckedExtrinsic { - signature: Some((node_runtime::RawAddress::Id(local_id), signature, payload.0, Era::immortal())), - function: payload.1, - }; - let uxt: <::Block as BlockT>::Extrinsic = Decode::decode( - &mut extrinsic.encode().as_slice()).expect("Encoded extrinsic is valid"); - let hash = BlockId::<::Block>::hash(self.parent_hash); - if let Err(e) = self.transaction_pool.submit_one(&hash, uxt) { - warn!("Error importing misbehavior report: {:?}", e); - } - } - } - - fn on_round_end(&self, round_number: u32, was_proposed: bool) { - let primary_validator = self.validators[ - self.primary_index(round_number, self.validators.len()) - ]; - - // alter the message based on whether we think the empty proposer was forced to skip the round. - // this is determined by checking if our local validator would have been forced to skip the round. - if !was_proposed { - let public = ed25519::Public::from_raw(primary_validator.0); - info!( - "Potential Offline Validator: {} failed to propose during assigned slot: {}", - public, - round_number, - ); - } - - self.offline.write().note_round_end(primary_validator, was_proposed); - } -} - -fn current_timestamp() -> u64 { - time::SystemTime::now().duration_since(time::UNIX_EPOCH) - .expect("now always later than unix epoch; qed") - .as_secs() -} - - -#[cfg(test)] -mod tests { - use super::*; - use std::collections::HashSet; - use std::marker::PhantomData; - - use sr_primitives::testing::{Block as GenericTestBlock, Header as TestHeader}; - use primitives::H256; - use keyring::Ed25519Keyring; - - type TestBlock = GenericTestBlock<()>; - - struct FakeClient { - authorities: Vec, - imported_heights: Mutex> - } - - impl BlockImport for FakeClient { - type Error = Error; - - fn import_block(&self, - block: BlockImportParams, - _new_authorities: Option> - ) -> Result { - assert!(self.imported_heights.lock().insert(block.header.number)); - Ok(ImportResult::Queued) - } - } - - impl Authorities for FakeClient { - type Error = Error; - - fn authorities(&self, _at: &BlockId) -> Result, Self::Error> { - Ok(self.authorities.clone()) - } - } - - // "black hole" output sink. - struct Comms(::std::marker::PhantomData); - - impl Sink for Comms { - type SinkItem = Communication; - type SinkError = E; - - fn start_send(&mut self, _item: Communication) -> ::futures::StartSend, E> { - Ok(::futures::AsyncSink::Ready) - } - - fn poll_complete(&mut self) -> ::futures::Poll<(), E> { - Ok(Async::Ready(())) - } - } - - impl Stream for Comms { - type Item = Communication; - type Error = E; - - fn poll(&mut self) -> ::futures::Poll, Self::Error> { - Ok(::futures::Async::NotReady) - } - } - - struct DummyFactory; - struct DummyProposer(u64); - - impl Environment for DummyFactory { - type Proposer = DummyProposer; - type Error = Error; - - fn init(&mut self, parent_header: &TestHeader, _authorities: &[AuthorityId], _sign_with: Arc) - -> Result - { - Ok(DummyProposer(parent_header.number + 1)) - } - } - - impl BaseProposer for DummyProposer { - type Error = Error; - type Create = Result; - type Evaluate = Result; - - fn propose(&self) -> Result { - - Ok(TestBlock { - header: from_block_number(self.0), - extrinsics: Default::default() - }) - } - - fn evaluate(&self, proposal: &TestBlock) -> Result { - Ok(proposal.header.number == self.0) - } - } - - impl LocalProposer for DummyProposer { - fn import_misbehavior(&self, _misbehavior: Vec<(AuthorityId, Misbehavior)>) {} - - fn round_proposer(&self, round_number: u32, authorities: &[AuthorityId]) -> AuthorityId { - authorities[(round_number as usize) % authorities.len()].clone() - } - } - - fn make_service(client: FakeClient) - -> BftService - { - BftService { - client: Arc::new(client), - live_agreement: Mutex::new(None), - round_cache: Arc::new(Mutex::new(RoundCache { - hash: None, - start_round: 0, - })), - round_timeout_multiplier: 10, - key: Arc::new(Ed25519Keyring::One.into()), - factory: DummyFactory - } - } - - fn sign_vote(vote: rhododendron::Vote, key: &ed25519::Pair, parent_hash: H256) -> LocalizedSignature { - match sign_message::(vote.into(), key, parent_hash) { - rhododendron::LocalizedMessage::Vote(vote) => vote.signature, - _ => panic!("signing vote leads to signed vote"), - } - } - - fn from_block_number(num: u64) -> TestHeader { - TestHeader::new( - num, - Default::default(), - Default::default(), - Default::default(), - Default::default(), - ) - } - - #[test] - fn future_gets_preempted() { - let client = FakeClient { - authorities: vec![ - Ed25519Keyring::One.into(), - Ed25519Keyring::Two.into(), - Ed25519Keyring::Alice.into(), - Ed25519Keyring::Eve.into(), - ], - imported_heights: Mutex::new(HashSet::new()), - }; - - let service = make_service(client); - - let first = from_block_number(2); - let first_hash = first.hash(); - - let mut second = from_block_number(3); - second.parent_hash = first_hash; - let _second_hash = second.hash(); - - let mut first_bft = service.build_upon(&first, Comms(PhantomData), Comms(PhantomData)).unwrap().unwrap(); - assert!(service.live_agreement.lock().as_ref().unwrap().0 == first); - - let _second_bft = service.build_upon(&second, Comms(PhantomData), Comms(PhantomData)).unwrap(); - assert!(service.live_agreement.lock().as_ref().unwrap().0 != first); - assert!(service.live_agreement.lock().as_ref().unwrap().0 == second); - - // first_bft has been cancelled. need to swap out so we can check it. - let (_tx, mut rx) = oneshot::channel(); - ::std::mem::swap(&mut rx, &mut first_bft.cancel); - - assert!(rx.wait().is_ok()); - } - - #[test] - fn max_faulty() { - assert_eq!(max_faulty_of(3), 0); - assert_eq!(max_faulty_of(4), 1); - assert_eq!(max_faulty_of(100), 33); - assert_eq!(max_faulty_of(0), 0); - assert_eq!(max_faulty_of(11), 3); - assert_eq!(max_faulty_of(99), 32); - } - - #[test] - fn justification_check_works() { - let parent_hash = Default::default(); - let hash = [0xff; 32].into(); - - let authorities = vec![ - Ed25519Keyring::One.into(), - Ed25519Keyring::Two.into(), - Ed25519Keyring::Alice.into(), - Ed25519Keyring::Eve.into(), - ]; - - let authorities_keys = vec![ - Ed25519Keyring::One.into(), - Ed25519Keyring::Two.into(), - Ed25519Keyring::Alice.into(), - Ed25519Keyring::Eve.into(), - ]; - - let unchecked = UncheckedJustification(rhododendron::UncheckedJustification { - digest: hash, - round_number: 1, - signatures: authorities_keys.iter().take(3).map(|key| { - sign_vote(rhododendron::Vote::Commit(1, hash).into(), key, parent_hash) - }).collect(), - }); - - assert!(check_justification::(&authorities, parent_hash, unchecked).is_ok()); - - let unchecked = UncheckedJustification(rhododendron::UncheckedJustification { - digest: hash, - round_number: 0, // wrong round number (vs. the signatures) - signatures: authorities_keys.iter().take(3).map(|key| { - sign_vote(rhododendron::Vote::Commit(1, hash).into(), key, parent_hash) - }).collect(), - }); - - assert!(check_justification::(&authorities, parent_hash, unchecked).is_err()); - - // not enough signatures. - let unchecked = UncheckedJustification(rhododendron::UncheckedJustification { - digest: hash, - round_number: 1, - signatures: authorities_keys.iter().take(2).map(|key| { - sign_vote(rhododendron::Vote::Commit(1, hash).into(), key, parent_hash) - }).collect(), - }); - - assert!(check_justification::(&authorities, parent_hash, unchecked).is_err()); - - // wrong hash. - let unchecked = UncheckedJustification(rhododendron::UncheckedJustification { - digest: [0xfe; 32].into(), - round_number: 1, - signatures: authorities_keys.iter().take(3).map(|key| { - sign_vote(rhododendron::Vote::Commit(1, hash).into(), key, parent_hash) - }).collect(), - }); - - assert!(check_justification::(&authorities, parent_hash, unchecked).is_err()); - } - - #[test] - fn propose_check_works() { - let parent_hash = Default::default(); - - let authorities = vec![ - Ed25519Keyring::Alice.into(), - Ed25519Keyring::Eve.into(), - ]; - - let block = TestBlock { - header: from_block_number(1), - extrinsics: Default::default() - }; - - let proposal = sign_message( - rhododendron::Message::Propose(1, block.clone()), - &Ed25519Keyring::Alice.pair(), - parent_hash, - ); - if let rhododendron::LocalizedMessage::Propose(proposal) = proposal { - assert!(check_proposal(&authorities, &parent_hash, &proposal).is_ok()); - let mut invalid_round = proposal.clone(); - invalid_round.round_number = 0; - assert!(check_proposal(&authorities, &parent_hash, &invalid_round).is_err()); - let mut invalid_digest = proposal.clone(); - invalid_digest.digest = [0xfe; 32].into(); - assert!(check_proposal(&authorities, &parent_hash, &invalid_digest).is_err()); - } else { - assert!(false); - } - - // Not an authority - let proposal = sign_message::( - rhododendron::Message::Propose(1, block), - &Ed25519Keyring::Bob.pair(), - parent_hash, - ); - if let rhododendron::LocalizedMessage::Propose(proposal) = proposal { - assert!(check_proposal(&authorities, &parent_hash, &proposal).is_err()); - } else { - assert!(false); - } - } - - #[test] - fn vote_check_works() { - let parent_hash: H256 = Default::default(); - let hash: H256 = [0xff; 32].into(); - - let authorities = vec![ - Ed25519Keyring::Alice.into(), - Ed25519Keyring::Eve.into(), - ]; - - let vote = sign_message::(rhododendron::Message::Vote(rhododendron::Vote::Prepare(1, hash)), &Keyring::Alice.pair(), parent_hash);; - if let rhododendron::LocalizedMessage::Vote(vote) = vote { - assert!(check_vote::(&authorities, &parent_hash, &vote).is_ok()); - let mut invalid_sender = vote.clone(); - invalid_sender.signature.signer = Keyring::Eve.into(); - assert!(check_vote::(&authorities, &parent_hash, &invalid_sender).is_err()); - } else { - assert!(false); - } - - // Not an authority - let vote = sign_message::(rhododendron::Message::Vote(rhododendron::Vote::Prepare(1, hash)), &Keyring::Bob.pair(), parent_hash);; - if let rhododendron::LocalizedMessage::Vote(vote) = vote { - assert!(check_vote::(&authorities, &parent_hash, &vote).is_err()); - } else { - assert!(false); - } - } - - #[test] - fn drop_bft_future_does_not_deadlock() { - let client = FakeClient { - authorities: vec![ - Ed25519Keyring::One.into(), - Ed25519Keyring::Two.into(), - Ed25519Keyring::Alice.into(), - Ed25519Keyring::Eve.into(), - ], - imported_heights: Mutex::new(HashSet::new()), - }; - - let service = make_service(client); - - let first = from_block_number(2); - let first_hash = first.hash(); - - let mut second = from_block_number(3); - second.parent_hash = first_hash; - - let _ = service.build_upon(&first, Comms(PhantomData), Comms(PhantomData)).unwrap(); - assert!(service.live_agreement.lock().as_ref().unwrap().0 == first); - service.live_agreement.lock().take(); - } - - #[test] - fn bft_can_build_though_skipped() { - let client = FakeClient { - authorities: vec![ - Ed25519Keyring::One.into(), - Ed25519Keyring::Two.into(), - Ed25519Keyring::Alice.into(), - Ed25519Keyring::Eve.into(), - ], - imported_heights: Mutex::new(HashSet::new()), - }; - - let service = make_service(client); - - let first = from_block_number(2); - let first_hash = first.hash(); - - let mut second = from_block_number(3); - second.parent_hash = first_hash; - - let mut third = from_block_number(4); - third.parent_hash = second.hash(); - - let _ = service.build_upon(&first, Comms(PhantomData), Comms(PhantomData)).unwrap(); - assert!(service.live_agreement.lock().as_ref().unwrap().0 == first); - // BFT has not seen second, but will move forward on third - service.build_upon(&third, Comms(PhantomData), Comms(PhantomData)).unwrap(); - assert!(service.live_agreement.lock().as_ref().unwrap().0 == third); - - // but we are not walking backwards - service.build_upon(&second, Comms(PhantomData), Comms(PhantomData)).unwrap(); - assert!(service.live_agreement.lock().as_ref().unwrap().0 == third); - } -} diff --git a/core/consensus/rhd/src/misbehaviour_check.rs b/core/consensus/rhd/src/misbehaviour_check.rs deleted file mode 100644 index bde3976c19b09..0000000000000 --- a/core/consensus/rhd/src/misbehaviour_check.rs +++ /dev/null @@ -1,191 +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 . - -//! Utility for substrate-based runtimes that want to check misbehavior reports. - -use codec::{Codec, Encode}; -use primitives::{AuthorityId, Signature}; - -use rhododendron::messages::{Action, Message, MisbehaviorKind}; -use runtime_io; - -// check a message signature. returns true if signed by that authority. -fn check_message_sig( - message: Message, - signature: &Signature, - from: &AuthorityId, -) -> bool { - let msg: Vec = message.encode(); - runtime_io::ed25519_verify(&signature.0, &msg, from) -} - -fn prepare(parent: H, round_number: u32, hash: H) -> Message { - Message { - parent, - action: Action::Prepare(round_number, hash), - } -} - -fn commit(parent: H, round_number: u32, hash: H) -> Message { - Message { - parent, - action: Action::Commit(round_number, hash), - } -} - -/// Evaluate misbehavior. -/// -/// Doesn't check that the header hash in question is -/// valid or whether the misbehaving authority was part of -/// the set at that block. -pub fn evaluate_misbehavior( - misbehaved: &AuthorityId, - parent_hash: H, - kind: &MisbehaviorKind, -) -> bool { - match *kind { - MisbehaviorKind::BftDoublePrepare(round, (h_1, ref s_1), (h_2, ref s_2)) => { - s_1 != s_2 && - check_message_sig::(prepare::(parent_hash, round, h_1), s_1, misbehaved) && - check_message_sig::(prepare::(parent_hash, round, h_2), s_2, misbehaved) - } - MisbehaviorKind::BftDoubleCommit(round, (h_1, ref s_1), (h_2, ref s_2)) => { - s_1 != s_2 && - check_message_sig::(commit::(parent_hash, round, h_1), s_1, misbehaved) && - check_message_sig::(commit::(parent_hash, round, h_2), s_2, misbehaved) - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - use keyring::Ed25519Keyring; - use rhododendron; - - use sr_primitives::testing::{H256, Block as RawBlock}; - - type Block = RawBlock; - - fn sign_prepare(key: &ed25519::Pair, round: u32, hash: H256, parent_hash: H256) -> (H256, Signature) { - let msg = ::sign_message::( - rhododendron::Message::Vote(rhododendron::Vote::Prepare(round as _, hash)), - key, - parent_hash - ); - - match msg { - rhododendron::LocalizedMessage::Vote(vote) => (hash, vote.signature.signature), - _ => panic!("signing vote leads to signed vote"), - } - } - - fn sign_commit(key: &ed25519::Pair, round: u32, hash: H256, parent_hash: H256) -> (H256, Signature) { - let msg = ::sign_message::( - rhododendron::Message::Vote(rhododendron::Vote::Commit(round as _, hash)), - key, - parent_hash - ); - - match msg { - rhododendron::LocalizedMessage::Vote(vote) => (hash, vote.signature.signature), - _ => panic!("signing vote leads to signed vote"), - } - } - - #[test] - fn evaluates_double_prepare() { - let key = Ed25519Keyring::One.pair(); - let parent_hash = [0xff; 32].into(); - let hash_1 = [0; 32].into(); - let hash_2 = [1; 32].into(); - - assert!(evaluate_misbehavior::( - &key.public().into(), - parent_hash, - &MisbehaviorKind::BftDoublePrepare( - 1, - sign_prepare(&key, 1, hash_1, parent_hash), - sign_prepare(&key, 1, hash_2, parent_hash) - ) - )); - - // same signature twice is not misbehavior. - let signed = sign_prepare(&key, 1, hash_1, parent_hash); - assert!(!evaluate_misbehavior::( - &key.public().into(), - parent_hash, - &MisbehaviorKind::BftDoublePrepare( - 1, - signed, - signed, - ) - )); - - // misbehavior has wrong target. - assert!(!evaluate_misbehavior::( - &Ed25519Keyring::Two.into(), - parent_hash, - &MisbehaviorKind::BftDoublePrepare( - 1, - sign_prepare(&key, 1, hash_1, parent_hash), - sign_prepare(&key, 1, hash_2, parent_hash), - ) - )); - } - - #[test] - fn evaluates_double_commit() { - let key = Ed25519Keyring::One.pair(); - let parent_hash = [0xff; 32].into(); - let hash_1 = [0; 32].into(); - let hash_2 = [1; 32].into(); - - assert!(evaluate_misbehavior::( - &key.public().into(), - parent_hash, - &MisbehaviorKind::BftDoubleCommit( - 1, - sign_commit(&key, 1, hash_1, parent_hash), - sign_commit(&key, 1, hash_2, parent_hash) - ) - )); - - // same signature twice is not misbehavior. - let signed = sign_commit(&key, 1, hash_1, parent_hash); - assert!(!evaluate_misbehavior::( - &key.public().into(), - parent_hash, - &MisbehaviorKind::BftDoubleCommit( - 1, - signed, - signed, - ) - )); - - // misbehavior has wrong target. - assert!(!evaluate_misbehavior::( - &Ed25519Keyring::Two.into(), - parent_hash, - &MisbehaviorKind::BftDoubleCommit( - 1, - sign_commit(&key, 1, hash_1, parent_hash), - sign_commit(&key, 1, hash_2, parent_hash), - ) - )); - } -} diff --git a/core/consensus/rhd/src/service.rs b/core/consensus/rhd/src/service.rs deleted file mode 100644 index 641a97fe06e9b..0000000000000 --- a/core/consensus/rhd/src/service.rs +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright 2018-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 . - -//! Consensus service. - -/// Consensus service. A long running service that manages BFT agreement -/// the network. -use std::thread; -use std::time::{Duration, Instant}; -use std::sync::Arc; - -use client::{BlockchainEvents, BlockBody}; -use futures::prelude::*; -use transaction_pool::txpool::{Pool as TransactionPool, ChainApi as PoolChainApi}; -use sr_primitives::traits::{Block as BlockT, Header as HeaderT, BlockNumberToHash}; - -use tokio::executor::current_thread::TaskExecutor as LocalThreadHandle; -use tokio::runtime::TaskExecutor as ThreadPoolHandle; -use tokio::runtime::current_thread::Runtime as LocalRuntime; -use tokio::timer::Interval; - -use parking_lot::RwLock; -use consensus::{self, offline_tracker::OfflineTracker}; - -use super::{Network, ProposerFactory, AuthoringApi}; -use {consensus, primitives, ed25519, error, BftService, LocalProposer}; - -const TIMER_DELAY_MS: u64 = 5000; -const TIMER_INTERVAL_MS: u64 = 500; - -// spin up an instance of BFT agreement on the current thread's executor. -// panics if there is no current thread executor. -fn start_bft( - header: ::Header, - bft_service: Arc>, -) where - F: consensus::Environment + 'static, - C: consensus::BlockImport + consensus::Authorities + 'static, - F::Error: ::std::fmt::Debug, - >::Error: ::std::fmt::Display + Into, - >::Proposer : LocalProposer, - >::Error: ::std::fmt::Display, - Block: BlockT, -{ - let mut handle = LocalThreadHandle::current(); - match bft_service.build_upon(&header) { - Ok(Some(bft_work)) => if let Err(e) = handle.spawn_local(Box::new(bft_work)) { - warn!(target: "bft", "Couldn't initialize BFT agreement: {:?}", e); - } - Ok(None) => trace!(target: "bft", "Could not start agreement on top of {}", header.hash()), - Err(e) => warn!(target: "bft", "BFT agreement error: {}", e), - } -} - -/// Consensus service. Starts working when created. -pub struct Service { - thread: Option>, - exit_signal: Option<::exit_future::Signal>, -} - -impl Service { - /// Create and start a new instance. - pub fn new( - client: Arc, - api: Arc, - network: N, - transaction_pool: Arc>, - thread_pool: ThreadPoolHandle, - key: ed25519::Pair, - block_delay: u64, - ) -> Service - where - error::Error: From<::Error>, - A: AuthoringApi + BlockNumberToHash + 'static, - P: PoolChainApi::Block> + 'static, - C: BlockchainEvents<::Block> - + BlockBody<::Block> - + consensus::SelectChain<::Block> - + consensus::BlockImport<::Block> - + consensus::Authorities<::Block> + Send + Sync + 'static, - primitives::H256: From<<::Block as BlockT>::Hash>, - <::Block as BlockT>::Hash: PartialEq + PartialEq, - N: Network::Block> + Send + 'static, - { - - let (signal, exit) = ::exit_future::signal(); - let thread = thread::spawn(move || { - let mut runtime = LocalRuntime::new().expect("Could not create local runtime"); - let key = Arc::new(key); - - let factory = ProposerFactory { - client: api.clone(), - transaction_pool: transaction_pool.clone(), - network, - handle: thread_pool.clone(), - offline: Arc::new(RwLock::new(OfflineTracker::new())), - force_delay: block_delay, - }; - let bft_service = Arc::new(BftService::new(client.clone(), key, factory)); - - let notifications = { - let client = client.clone(); - let bft_service = bft_service.clone(); - - client.import_notification_stream().for_each(move |notification| { - if notification.is_new_best { - start_bft(notification.header, bft_service.clone()); - } - Ok(()) - }) - }; - - let interval = Interval::new( - Instant::now() + Duration::from_millis(TIMER_DELAY_MS), - Duration::from_millis(TIMER_INTERVAL_MS), - ); - - let mut prev_best = match client.best_block_header() { - Ok(header) => header.hash(), - Err(e) => { - warn!("Cant's start consensus service. Error reading best block header: {:?}", e); - return; - } - }; - - let timed = { - let c = client.clone(); - let s = bft_service.clone(); - - interval.map_err(|e| debug!(target: "bft", "Timer error: {:?}", e)).for_each(move |_| { - if let Ok(best_block) = c.best_block_header() { - let hash = best_block.hash(); - - if hash == prev_best { - debug!(target: "bft", "Starting consensus round after a timeout"); - start_bft(best_block, s.clone()); - } - prev_best = hash; - } - Ok(()) - }) - }; - - runtime.spawn(notifications); - runtime.spawn(timed); - - if let Err(e) = runtime.block_on(exit) { - debug!("BFT event loop error {:?}", e); - } - }); - Service { - thread: Some(thread), - exit_signal: Some(signal), - } - } -} - -impl Drop for Service { - fn drop(&mut self) { - if let Some(signal) = self.exit_signal.take() { - signal.fire(); - } - - if let Some(thread) = self.thread.take() { - thread.join().expect("The service thread has panicked"); - } - } -} diff --git a/core/consensus/uncles/Cargo.toml b/core/consensus/uncles/Cargo.toml deleted file mode 100644 index 4820324870929..0000000000000 --- a/core/consensus/uncles/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "substrate-consensus-uncles" -version = "2.0.0" -authors = ["Parity Technologies "] -description = "Generic uncle inclusion utilities for consensus" -edition = "2018" - -[dependencies] -client = { package = "substrate-client", path = "../../client" } -primitives = { package = "substrate-primitives", path = "../../primitives" } -sr-primitives = { path = "../../sr-primitives" } -srml-authorship = { path = "../../../srml/authorship" } -consensus_common = { package = "substrate-consensus-common", path = "../common" } -inherents = { package = "substrate-inherents", path = "../../inherents" } -log = "0.4.8" diff --git a/core/executor/runtime-test/Cargo.toml b/core/executor/runtime-test/Cargo.toml deleted file mode 100644 index 72041218bf9f2..0000000000000 --- a/core/executor/runtime-test/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "substrate-runtime-test" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" -build = "build.rs" - -[dependencies] -rstd = { package = "sr-std", path = "../../sr-std", default-features = false } -runtime_io = { package = "sr-io", path = "../../sr-io", default-features = false } -sandbox = { package = "sr-sandbox", path = "../../sr-sandbox", default-features = false } -primitives = { package = "substrate-primitives", path = "../../primitives", default-features = false } -sr-primitives = { package = "sr-primitives", path = "../../sr-primitives", default-features = false } - -[build-dependencies] -wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.4", path = "../../utils/wasm-builder-runner" } - -[features] -default = [ "std" ] -std = ["runtime_io/std", "sandbox/std", "rstd/std"] diff --git a/core/service/Cargo.toml b/core/service/Cargo.toml deleted file mode 100644 index 14739b93c5778..0000000000000 --- a/core/service/Cargo.toml +++ /dev/null @@ -1,61 +0,0 @@ -[package] -name = "substrate-service" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[features] -default = ["rocksdb"] -# The RocksDB feature activates the RocksDB database backend. If it is not activated, and you pass -# a path to a database, an error will be produced at runtime. -rocksdb = ["client_db/kvdb-rocksdb"] -wasmtime = [ - "substrate-executor/wasmtime", -] - -[dependencies] -derive_more = "0.15.0" -futures = "0.1.29" -futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] } -parking_lot = "0.9.0" -lazy_static = "1.4.0" -log = "0.4.8" -slog = { version = "2.5.2", features = ["nested-values"] } -tokio-executor = "0.1.8" -tokio-timer = "0.2.11" -exit-future = "0.1.4" -serde = "1.0.101" -serde_json = "1.0.41" -sysinfo = "0.9.5" -target_info = "0.1.0" -keystore = { package = "substrate-keystore", path = "../../core/keystore" } -sr-io = { path = "../../core/sr-io" } -sr-primitives = { path = "../../core/sr-primitives" } -primitives = { package = "substrate-primitives", path = "../primitives" } -session = { package = "substrate-session", path = "../session" } -app-crypto = { package = "substrate-application-crypto", path = "../application-crypto" } -consensus_common = { package = "substrate-consensus-common", path = "../../core/consensus/common" } -network = { package = "substrate-network", path = "../../core/network" } -chain-spec = { package = "substrate-chain-spec", path = "../chain-spec" } -client = { package = "substrate-client", path = "../../core/client" } -sr-api = { path = "../sr-api" } -tx-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../transaction-pool/runtime-api" } -client_db = { package = "substrate-client-db", path = "../../core/client/db" } -codec = { package = "parity-scale-codec", version = "1.0.0" } -substrate-executor = { path = "../../core/executor" } -transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" } -rpc-servers = { package = "substrate-rpc-servers", path = "../../core/rpc-servers" } -rpc = { package = "substrate-rpc", path = "../../core/rpc" } -tel = { package = "substrate-telemetry", path = "../../core/telemetry" } -offchain = { package = "substrate-offchain", path = "../../core/offchain" } -parity-multiaddr = { package = "parity-multiaddr", version = "0.5.0" } - -[dev-dependencies] -substrate-test-runtime-client = { path = "../test-runtime/client" } -node-executor = { path = "../../node/executor" } -node-primitives = { path = "../../node/primitives" } -node-runtime = { path = "../../node/runtime" } -babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../core/consensus/babe/primitives" } -grandpa = { package = "substrate-finality-grandpa", path = "../../core/finality-grandpa" } -grandpa-primitives = { package = "substrate-finality-grandpa-primitives", path = "../../core/finality-grandpa/primitives" } -tokio = "0.1" diff --git a/core/test-client/Cargo.toml b/core/test-client/Cargo.toml deleted file mode 100644 index de13b34d69753..0000000000000 --- a/core/test-client/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "substrate-test-client" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -client = { package = "substrate-client", path = "../client" } -client-db = { package = "substrate-client-db", path = "../client/db", features = ["test-helpers"] } -consensus = { package = "substrate-consensus-common", path = "../consensus/common" } -executor = { package = "substrate-executor", path = "../executor" } -futures-preview = "0.3.0-alpha.19" -hash-db = "0.15.2" -keyring = { package = "substrate-keyring", path = "../keyring" } -codec = { package = "parity-scale-codec", version = "1.0.0" } -primitives = { package = "substrate-primitives", path = "../primitives" } -sr-primitives = { path = "../sr-primitives" } -state_machine = { package = "substrate-state-machine", path = "../state-machine" } diff --git a/core/test-runtime/Cargo.toml b/core/test-runtime/Cargo.toml deleted file mode 100644 index 022b6d8c196ea..0000000000000 --- a/core/test-runtime/Cargo.toml +++ /dev/null @@ -1,83 +0,0 @@ -[package] -name = "substrate-test-runtime" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" -build = "build.rs" - -[dependencies] -log = { version = "0.4.8", optional = true } -serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -keyring = { package = "substrate-keyring", path = "../keyring", optional = true } -sr-api = { path = "../sr-api", default-features = false } -substrate-client = { path = "../client", optional = true } -primitives = { package = "substrate-primitives", path = "../primitives", default-features = false } -app-crypto = { package = "substrate-application-crypto", path = "../application-crypto", default-features = false } -inherents = { package = "substrate-inherents", path = "../inherents", default-features = false } -aura-primitives = { package = "substrate-consensus-aura-primitives", path = "../consensus/aura/primitives", default-features = false } -babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../consensus/babe/primitives", default-features = false } -rstd = { package = "sr-std", path = "../sr-std", default-features = false } -runtime_io = { package = "sr-io", path = "../sr-io", default-features = false } -sr-primitives = { path = "../sr-primitives", default-features = false } -session = { package = "substrate-session", path = "../session", default-features = false } -runtime_version = { package = "sr-version", path = "../sr-version", default-features = false } -runtime_support = { package = "srml-support", path = "../../srml/support", default-features = false } -substrate-trie = { path = "../trie", default-features = false } -trie-db = { version = "0.15.2", default-features = false } -memory-db = { version = "0.15.2", default-features = false } -offchain-primitives = { package = "substrate-offchain-primitives", path = "../offchain/primitives", default-features = false} -runtime-interface = { package = "substrate-runtime-interface", path = "../runtime-interface", default-features = false} -executive = { package = "srml-executive", path = "../../srml/executive", default-features = false } -cfg-if = "0.1.10" -srml-babe = { path = "../../srml/babe", default-features = false } -srml-timestamp = { path = "../../srml/timestamp", default-features = false } -srml-system = { path = "../../srml/system", default-features = false } -srml-system-rpc-runtime-api = { path = "../../srml/system/rpc/runtime-api", default-features = false } -transaction-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../transaction-pool/runtime-api", default-features = false } -block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../block-builder/runtime-api", default-features = false } - -[dev-dependencies] -substrate-executor = { path = "../executor" } -substrate-test-runtime-client = { path = "./client" } -state_machine = { package = "substrate-state-machine", path = "../state-machine" } - -[build-dependencies] -wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.4", path = "../utils/wasm-builder-runner" } - -[features] -default = [ - "std", -] -std = [ - "log", - "serde", - "sr-api/std", - "keyring", - "codec/std", - "rstd/std", - "runtime_io/std", - "runtime_support/std", - "primitives/std", - "inherents/std", - "sr-primitives/std", - "runtime_version/std", - "aura-primitives/std", - "babe-primitives/std", - "primitives/std", - "substrate-trie/std", - "trie-db/std", - "memory-db/std", - "offchain-primitives/std", - "executive/std", - "srml-babe/std", - "srml-timestamp/std", - "srml-system/std", - "srml-system-rpc-runtime-api/std", - "app-crypto/std", - "session/std", - "runtime-interface/std", - "transaction-pool-api/std", - "block-builder-api/std", - "substrate-client", -] diff --git a/core/test-runtime/client/Cargo.toml b/core/test-runtime/client/Cargo.toml deleted file mode 100644 index c2f8b4346bef9..0000000000000 --- a/core/test-runtime/client/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "substrate-test-runtime-client" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -generic-test-client = { package = "substrate-test-client", path = "../../test-client" } -primitives = { package = "substrate-primitives", path = "../../primitives" } -block-builder = { package = "substrate-block-builder", path = "../../block-builder" } -runtime = { package = "substrate-test-runtime", path = "../../test-runtime" } -sr-primitives = { path = "../../sr-primitives" } -codec = { package = "parity-scale-codec", version = "1.0.0" } - diff --git a/CODEOWNERS b/docs/CODEOWNERS similarity index 85% rename from CODEOWNERS rename to docs/CODEOWNERS index 866f16522316b..f61da029bc8ab 100644 --- a/CODEOWNERS +++ b/docs/CODEOWNERS @@ -41,22 +41,22 @@ /core/rpc-servers/ @tomusdrw # GRANDPA, BABE, consensus stuff -/srml/babe/ @andresilva @DemiMarie-parity -/srml/grandpa/ @andresilva @DemiMarie-parity +/paint/babe/ @andresilva @DemiMarie-parity +/paint/grandpa/ @andresilva @DemiMarie-parity /core/finality-grandpa/ @andresilva @DemiMarie-parity /core/consensus/babe/ @andresilva @DemiMarie-parity /core/consensus/slots/ @andresilva @DemiMarie-parity # Contracts -/srml/contracts/ @pepyakin @thiolliere @jimpo -/srml/contracts/src/wasm/runtime.rs @Robbepop +/paint/contracts/ @pepyakin @thiolliere @jimpo +/paint/contracts/src/wasm/runtime.rs @Robbepop # Inflation points -/srml/staking/src/inflation.rs @thiolliere +/paint/staking/src/inflation.rs @thiolliere # NPoS and Governance -/srml/staking/ @kianenigma -/srml/election/ @kianenigma +/paint/staking/ @kianenigma +/paint/election/ @kianenigma # End to end testing of substrate node /node/executor/ @kianenigma @@ -65,4 +65,4 @@ /core/sr-primitives/weights.rs @kianenigma # Support crates -/srml/support/ @thiolliere @kianenigma +/paint/support/ @thiolliere @kianenigma diff --git a/CODE_OF_CONDUCT.adoc b/docs/CODE_OF_CONDUCT.adoc similarity index 100% rename from CODE_OF_CONDUCT.adoc rename to docs/CODE_OF_CONDUCT.adoc diff --git a/CONTRIBUTING.adoc b/docs/CONTRIBUTING.adoc similarity index 100% rename from CONTRIBUTING.adoc rename to docs/CONTRIBUTING.adoc diff --git a/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from PULL_REQUEST_TEMPLATE.md rename to docs/PULL_REQUEST_TEMPLATE.md diff --git a/docs/README.adoc b/docs/README.adoc new file mode 100644 index 0000000000000..05eb7e3f814ae --- /dev/null +++ b/docs/README.adoc @@ -0,0 +1,528 @@ += Substrate +:Author: Substrate developers +:Revision: 0.2.0 +:toc: +:sectnums: + +== Intro in one sentence + +Substrate is a next-generation framework for blockchain innovation. + +== Description + +At its heart, Substrate is a combination of three technologies: https://webassembly.org/[WebAssembly], https://libp2p.io/[Libp2p] and GRANDPA Consensus. About GRANDPA, see this https://hackmd.io/Jd0byWX0RiqFiXUVC78Bdw?view#GRANDPA[definition], https://medium.com/polkadot-network/grandpa-block-finality-in-polkadot-an-introduction-part-1-d08a24a021b5[introduction] and https://github.com/w3f/consensus/blob/master/pdf/grandpa.pdf[formal specification]. It is both a library for building new blockchains and a "skeleton key" of a blockchain client, able to synchronize to any Substrate-based chain. + +Substrate chains have three distinct features that make them "next-generation": a dynamic, self-defining state-transition function; light-client functionality from day one; and a progressive consensus algorithm with fast block production and adaptive, definite finality. The STF, encoded in WebAssembly, is known as the "runtime". This defines the `execute_block` function, and can specify everything from the staking algorithm, transaction semantics, logging mechanisms and procedures for replacing any aspect of itself or of the blockchain's state ("governance"). Because the runtime is entirely dynamic all of these can be switched out or upgraded at any time. A Substrate chain is very much a "living organism". + +See also https://www.parity.io/what-is-substrate/. + +== Usage + +Substrate is still an early stage project, and while it has already been used as the basis of major projects like Polkadot, using it is still a significant undertaking. In particular, you should have a good knowledge of blockchain concepts and basic cryptography. Terminology like header, block, client, hash, transaction and signature should be familiar. At present you will need a working knowledge of Rust to be able to do anything interesting (though eventually, we aim for this not to be the case). + +Substrate is designed for use in one of three ways: + +**1. Trivial**: By running the Substrate binary `substrate` and configuring it with a genesis block that includes the current demonstration runtime. In this case, you just build Substrate, configure a JSON file, and launch your own blockchain. This affords you the least amount of customizability, primarily allowing you to change the genesis parameters of the various included runtime modules such as balances, staking, block-period, fees, and governance. + +**2. Modular**: By hacking together modules from the Substrate Runtime Module Library (SRML) into a new runtime and possibly altering or reconfiguring the Substrate client's block authoring logic. This affords you a very large amount of freedom over your blockchain's logic, letting you change datatypes, add or remove modules, and crucially, add your own modules. Much can be changed without touching the block authoring logic (since it is generic). If this is the case, then the existing Substrate binary can be used for block authoring and syncing. If the block authoring logic needs to be tweaked, then a new, altered block authoring binary must be built as a separate project and used by validators. This is how the Polkadot relay chain is built and should suffice for almost all circumstances in the near to mid-term. + +**3. Generic**: The entire SRML can be ignored and the entire runtime designed and implemented from scratch. If desired, this can be done in a language other than Rust, provided it can target WebAssembly. If the runtime can be made compatible with the existing client's block authoring logic, then you can simply construct a new genesis block from your Wasm blob and launch your chain with the existing Rust-based Substrate client. If not, then you'll need to alter the client's block authoring logic accordingly. This is probably a useless option for most projects right now, but provides complete flexibility allowing for a long-term, far-reaching upgrade path for the Substrate paradigm. + +=== The Basics of Substrate + +Substrate is a blockchain platform with a completely generic state transition function. That said, it does come with both standards and conventions (particularly regarding the Runtime Module Library) regarding underlying data structures. Roughly speaking, these core datatypes correspond to +trait+s in terms of the actual non-negotiable standard and generic +struct+s in terms of the convention. + +``` +Header := Parent + ExtrinsicsRoot + StorageRoot + Digest +Block := Header + Extrinsics + Justifications +``` + +=== Extrinsics + +Extrinsics in Substrate are pieces of information from "the outside world" that are contained in the blocks of the chain. You might think "ahh, that means *transactions*": in fact, no. Extrinsics fall into two broad categories of which only one is *transactions*. The other is known as *inherents*. The difference between these two is that transactions are signed and gossiped on the network and can be deemed useful *per se*. This fits the mold of what you would call transactions in Bitcoin or Ethereum. + +Inherents, meanwhile, are not passed on the network and are not signed. They represent data which describes the environment but which cannot call upon anything to prove it such as a signature. Rather they are assumed to be "true" simply because a sufficiently large number of validators have agreed on them being reasonable. + +To give an example, there is the timestamp inherent, which sets the current timestamp of the block. This is not a fixed part of Substrate, but does come as part of the Substrate Runtime Module Library to be used as desired. No signature could fundamentally prove that a block were authored at a given time in quite the same way that a signature can "prove" the desire to spend some particular funds. Rather, it is the business of each validator to ensure that they believe the timestamp is set to something reasonable before they agree that the block candidate is valid. + +Other examples include the parachain-heads extrinsic in Polkadot and the "note-missed-proposal" extrinsic used in the Substrate Runtime Module Library to determine and punish or deactivate offline validators. + + +=== Runtime and API + +Substrate chains all have a runtime. The runtime is a WebAssembly "blob" that includes a number of entry-points. Some entry-points are required as part of the underlying Substrate specification. Others are merely convention and required for the default implementation of the Substrate client to be able to author blocks. + +If you want to develop a chain with Substrate, you will need to implement the `Core` trait. This `Core` trait generates an API with the minimum necessary functionality to interact with your runtime. A special macro is provided called `impl_runtime_apis!` that help you implement runtime API traits. All runtime API trait implementations need to be done in one call of the `impl_runtime_apis!` macro. All parameters and return values need to implement https://crates.io/crates/parity-codec[`parity-codec`] to be encodable and decodable. + +Here's a snippet of the Polkadot API implementation as of PoC-3: + +```rust +impl_runtime_apis! { + impl client_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialize_block(header: ::Header) { + Executive::initialize_block(&header) + } + } + // ---snip--- +} +``` + + +=== Inherent Extrinsics + +The Substrate Runtime Module Library includes functionality for timestamps and slashing. If used, these rely on "trusted" external information being passed in via inherent extrinsics. The Substrate reference block authoring client software will expect to be able to call into the runtime API with collated data (in the case of the reference Substrate authoring client, this is merely the current timestamp and which nodes were offline) in order to return the appropriate extrinsics ready for inclusion. If new inherent extrinsic types and data are to be used in a modified runtime, then it is this function (and its argument type) that would change. + +=== Block-authoring Logic + +In Substrate, there is a major distinction between blockchain *syncing* and block *authoring* ("authoring" is a more general term for what is called "mining" in Bitcoin). The first case might be referred to as a "full node" (or "light node" - Substrate supports both): authoring necessarily requires a synced node and, therefore, all authoring clients must necessarily be able to synchronize. However, the reverse is not true. The primary functionality that authoring nodes have which is not in "sync nodes" is threefold: transaction queue logic, inherent transaction knowledge and BFT consensus logic. BFT consensus logic is provided as a core element of Substrate and can be ignored since it is only exposed in the SDK under the `authorities()` API entry. + +Transaction queue logic in Substrate is designed to be as generic as possible, allowing a runtime to express which transactions are fit for inclusion in a block through the `initialize_block` and `apply_extrinsic` calls. However, more subtle aspects like prioritization and replacement policy must currently be expressed "hard coded" as part of the blockchain's authoring code. That said, Substrate's reference implementation for a transaction queue should be sufficient for an initial chain implementation. + +Inherent extrinsic knowledge is again somewhat generic, and the actual construction of the extrinsics is, by convention, delegated to the "soft code" in the runtime. If ever there needs to be additional extrinsic information in the chain, then both the block authoring logic will need to be altered to provide it into the runtime and the runtime's `inherent_extrinsics` call will need to use this extra information in order to construct any additional extrinsic transactions for inclusion in the block. + +== Roadmap + +=== So far + +- 0.1 "PoC-1": PBFT consensus, Wasm runtime engine, basic runtime modules. +- 0.2 "PoC-2": Libp2p + +=== In progress + +- AfG consensus +- Improved PoS +- Smart contract runtime module + +=== The future + +- Splitting out runtime modules into separate repo +- Introduce substrate executable (the skeleton-key runtime) +- Introduce basic but extensible transaction queue and block-builder and place them in the executable. +- DAO runtime module +- Audit + +== Trying out Substrate Node + +Substrate Node is Substrate's pre-baked blockchain client. You can run a development node locally or configure a new chain and launch your own global testnet. + +=== On Mac and Ubuntu + +To get going as fast as possible, there is a simple script that installs all required dependencies and installs Substrate into your path. Just open a terminal and run: + +[source, shell] +---- +curl https://getsubstrate.io -sSf | bash +---- + +You can start a local Substrate development chain with running `substrate --dev`. + +To create your own global network/cryptocurrency, you'll need to make a new Substrate Node chain specification file ("chainspec"). + +First let's get a template chainspec that you can edit. We'll use the "staging" chain, a sort of default chain that the node comes pre-configured with: + +[source, shell] +---- +substrate build-spec --chain=staging > ~/chainspec.json +---- + +Now, edit `~/chainspec.json` in your editor. There are a lot of individual fields for each module, and one very large one which contains the WebAssembly code blob for this chain. The easiest field to edit is the block `period`. Change it to 10 (seconds): + +[source, json] +---- + "timestamp": { + "minimumPeriod": 10 + }, +---- + +Now with this new chainspec file, you can build a "raw" chain definition for your new chain: + +[source, shell] +---- +substrate build-spec --chain ~/chainspec.json --raw > ~/mychain.json +---- + +This can be fed into Substrate: + +[source, shell] +---- +substrate --chain ~/mychain.json +---- + +It won't do much until you start producing blocks though, so to do that you'll need to use the `--validator` option together with passing the seed for the account(s) that is configured to be the initial authorities: + +[source, shell] +---- +substrate --chain ~/mychain.json --validator +---- + +You can distribute `mychain.json` so that everyone can synchronize and (depending on your authorities list) validate on your chain. + + +== Building + +=== Hacking on Substrate + +If you'd actually like to hack on Substrate, you can just grab the source code and +build it. Ensure you have Rust and the support software installed: + +==== Linux and Mac + +For Unix-based operating systems, you should run the following commands: + +[source, shell] +---- +curl https://sh.rustup.rs -sSf | sh + +rustup update nightly +rustup target add wasm32-unknown-unknown --toolchain nightly +rustup update stable +---- + +You will also need to install the following packages: + + - Linux: +[source, shell] +sudo apt install cmake pkg-config libssl-dev git clang libclang-dev + +- Linux on ARM: +`rust-lld` is required for linking wasm, but is missing on non Tier 1 platforms. +So, use this https://github.com/Plume-org/Plume/blob/master/script/wasm-deps.sh[script] +to build `lld` and create the symlink `/usr/bin/rust-lld` to the build binary. + + - Mac: +[source, shell] +brew install cmake pkg-config openssl git llvm + +To finish installation of Substrate, jump down to <>. + +==== Windows + +If you are trying to set up Substrate on Windows, you should do the following: + +1. First, you will need to download and install "Build Tools for Visual Studio:" + + * You can get it at this link: https://aka.ms/buildtools + * Run the installation file: `vs_buildtools.exe` + * Please ensure the Windows 10 SDK component is included when installing the Visual C++ Build Tools. + * image:https://i.imgur.com/zayVLmu.png[image] + * Restart your computer. + +2. Next, you need to install Rust: + + * Detailed instructions are provided by the https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windows[Rust Book]. + * Download from: https://www.rust-lang.org/tools/install + * Run the installation file: `rustup-init.exe` + > Note that it should not prompt you to install vs_buildtools since you did it in step 1. + * Choose "Default Installation." + * To get started, you need Cargo's bin directory (%USERPROFILE%\.cargo\bin) in your PATH environment variable. Future applications will automatically have the correct environment, but you may need to restart your current shell. + +3. Then, you will need to run some commands in CMD to set up your Wasm Build Environment: + + rustup update nightly + rustup update stable + rustup target add wasm32-unknown-unknown --toolchain nightly + +4. Then, you need to install LLVM: https://releases.llvm.org/download.html + +5. Next, you need to install OpenSSL, which we will do with `vcpkg`: + + mkdir \Tools + cd \Tools + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + .\bootstrap-vcpkg.bat + .\vcpkg.exe install openssl:x64-windows-static + +6. After, you need to add OpenSSL to your System Variables. Note that in order for the following commands to work, you need to use Windows Powershell: + + $env:OPENSSL_DIR = 'C:\Tools\vcpkg\installed\x64-windows-static' + $env:OPENSSL_STATIC = 'Yes' + [System.Environment]::SetEnvironmentVariable('OPENSSL_DIR', $env:OPENSSL_DIR, [System.EnvironmentVariableTarget]::User) + [System.Environment]::SetEnvironmentVariable('OPENSSL_STATIC', $env:OPENSSL_STATIC, [System.EnvironmentVariableTarget]::User) + +7. Finally, you need to install `cmake`: https://cmake.org/download/ + +==== Shared Steps + +Then, grab the Substrate source code: + +[source, shell] +---- +git clone https://github.com/paritytech/substrate.git +cd substrate +---- + +Then build the code: + +[source, shell] +---- +cargo build # Builds all native code +---- + +You can run all the tests if you like: + +[source, shell] +cargo test --all + +Or just run the tests of a specific package (i.e. `cargo test -p paint-assets`) + +You can start a development chain with: + +[source, shell] +cargo run --release -- --dev + +Detailed logs may be shown by running the node with the following environment variables set: `RUST_LOG=debug RUST_BACKTRACE=1 cargo run --release \-- --dev`. + +If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet with two validator nodes for Alice and Bob, who are the initial authorities of the genesis chain specification that have been endowed with a testnet DOTs. We'll give each node a name and expose them so they are listed on link:https://telemetry.polkadot.io/#/Local%20Testnet[Telemetry]. You'll need two terminal windows open. + +We'll start Alice's Substrate node first on default TCP port 30333 with her chain database stored locally at `/tmp/alice`. The Bootnode ID of her node is `QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR`, which is generated from the `--node-key` value that we specify below: + +[source, shell] +cargo run --release \-- \ + --base-path /tmp/alice \ + --chain=local \ + --alice \ + --node-key 0000000000000000000000000000000000000000000000000000000000000001 \ + --telemetry-url ws://telemetry.polkadot.io:1024 \ + --validator + +In the second terminal, we'll run the following to start Bob's Substrate node on a different TCP port of 30334, and with his chain database stored locally at `/tmp/bob`. We'll specify a value for the `--bootnodes` option that will connect his node to Alice's Bootnode ID on TCP port 30333: + +[source, shell] +cargo run --release \-- \ + --base-path /tmp/bob \ + --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR \ + --chain=local \ + --bob \ + --port 30334 \ + --telemetry-url ws://telemetry.polkadot.io:1024 \ + --validator + +Additional Substrate CLI usage options are available and may be shown by running `cargo run \-- --help`. + +=== WASM binaries + +The WASM binaries are built during the normal `cargo build` process. To control the WASM binary building, +we support multiple environment variables: + +* `SKIP_WASM_BUILD` - Skips building any WASM binary. This is useful when only native should be recompiled. +* `BUILD_DUMMY_WASM_BINARY` - Builds dummy WASM binaries. These dummy binaries are empty and useful + for `cargo check` runs. +* `WASM_BUILD_TYPE` - Sets the build type for building WASM binaries. Supported values are `release` or `debug`. + By default the build type is equal to the build type used by the main build. +* `TRIGGER_WASM_BUILD` - Can be set to trigger a WASM build. On subsequent calls the value of the variable + needs to change. As WASM builder instructs `cargo` to watch for file changes + this environment variable should only be required in certain circumstances. +* `WASM_TARGET_DIRECTORY` - Will copy any build WASM binary to the given directory. The path needs + to be absolute. +* `WASM_BUILD_RUSTFLAGS` - Extend `RUSTFLAGS` given to `cargo build` while building the wasm binary. +* `WASM_BUILD_NO_COLOR` - Disable color output of the wasm build. + +Each project can be skipped individually by using the environment variable `SKIP_PROJECT_NAME_WASM_BUILD`. +Where `PROJECT_NAME` needs to be replaced by the name of the cargo project, e.g. `node-runtime` will +be `NODE_RUNTIME`. + +[[flaming-fir]] +=== Joining the Flaming Fir Testnet + +Flaming Fir is the new testnet for Substrate master (2.0) to test the latest development features. Please note that master is not compatible with the BBQ Birch, Charred Cherry, Dried Danta or Emberic Elm testnets. Ensure you have the dependencies listed above before compiling. + +Since Flaming Fir is targeting the master branch we make absolutely no guarantees of stability and/or persistence of the network. We might reset the chain at any time if it is necessary to deploy new changes. Currently, the validators are running with a client built from `d013bd900`, if you build from this commit you should be able to successfully sync, later commits may not work as new breaking changes may be introduced in master. + +Latest known working version: `a2a0eb5398d6223e531455b4c155ef053a4a3a2b` + +[source, shell] +---- +git clone https://github.com/paritytech/substrate.git +cd substrate +git checkout -b flaming-fir a2a0eb5398d6223e531455b4c155ef053a4a3a2b +---- + +You can run the tests if you like: + +[source, shell] +cargo test --all + +Start your node: + +[source, shell] +cargo run --release \-- + +To see a list of command line options, enter: + +[source, shell] +cargo run --release \-- --help + +For example, you can choose a custom node name: + +[source, shell] +cargo run --release \-- --name my_custom_name + +If you are successful, you will see your node syncing at https://telemetry.polkadot.io/#/Flaming%20Fir + +=== Joining the Emberic Elm Testnet + +Emberic Elm is the testnet for Substrate 1.0. Please note that 1.0 is not compatible with the BBQ Birch, Charred Cherry, Dried Danta or Flaming Fir testnets. +In order to join the Emberic Elm testnet you should build from the `v1.0` branch. Ensure you have the dependencies listed above before compiling. + +[source, shell] +---- +git clone https://github.com/paritytech/substrate.git +cd substrate +git checkout -b v1.0 origin/v1.0 +---- + +You can then follow the same steps for building and running as described above in <>. + +== Key management + +Keys in Substrate are stored in the keystore in the file system. To store keys into this keystore, +you need to use one of the two provided RPC calls. If your keys are encrypted or should be encrypted +by the keystore, you need to provide the key using one of the cli arguments `--password`, +`--password-interactive` or `--password-filename`. + +=== Recommended RPC call + +For most users who want to run a validator node, the `author_rotateKeys` RPC call is sufficient. +The RPC call will generate `N` Session keys for you and return their public keys. `N` is the number +of session keys configured in the runtime. The output of the RPC call can be used as input for the +`session::set_keys` transaction. + +``` +curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_rotateKeys", "id":1 }' localhost:9933 +``` + +=== Advanced RPC call + +If the Session keys need to match a fixed seed, they can be set individually key by key. The RPC call +expects the key seed and the key type. The key types supported by default in Substrate are listed +https://github.com/paritytech/substrate/blob/master/core/primitives/src/crypto.rs#L767[here], but the +user can declare any key type. + +``` +curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["KEY_TYPE", "SEED", "PUBLIC"],"id":1 }' localhost:9933 +``` + +`KEY_TYPE` - needs to be replaced with the 4-character key type identifier. +`SEED` - is the seed of the key. +`PUBLIC` - public key for the given key. + +== Documentation + +=== Viewing documentation for Substrate packages + +You can generate documentation for a Substrate Rust package and have it automatically open in your web browser using https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html#using-rustdoc-with-cargo[rustdoc with Cargo], +(of the The Rustdoc Book), by running the following command: + +``` +cargo doc --package --open +``` + +Replacing `` with one of the following (i.e. `cargo doc --package substrate --open`): + +* All Substrate Packages +[source, shell] +substrate +* Substrate Core +[source, shell] +substrate, substrate-cli, substrate-client, substrate-client-db, +substrate-consensus-common, substrate-consensus-rhd, +substrate-executor, substrate-finality-grandpa, substrate-keyring, substrate-keystore, substrate-network, +substrate-network-libp2p, substrate-primitives, substrate-rpc, substrate-rpc-servers, +substrate-serializer, substrate-service, substrate-service-test, substrate-state-db, +substrate-state-machine, substrate-telemetry, substrate-test-client, +substrate-test-runtime, substrate-transaction-graph, substrate-transaction-pool, +substrate-trie +* Substrate Runtime +[source, shell] +sr-api, sr-io, sr-primitives, sr-sandbox, sr-std, sr-version +* Substrate Runtime Module Library (SRML) +[source, shell] +paint-assets, paint-balances, paint-consensus, paint-contracts, paint-council, paint-democracy, paint-example, +paint-executive, paint-metadata, paint-session, paint-staking, paint-support, paint-system, paint-timestamp, +paint-treasury +* Node +[source, shell] +node-cli, node-consensus, node-executor, node-network, node-primitives, node-runtime +* Subkey +[source, shell] +subkey + +=== Contributing to documentation for Substrate packages + +https://doc.rust-lang.org/1.9.0/book/documentation.html[Document source code] for Substrate packages by annotating the source code with documentation comments. + +Example (generic): +```markdown +/// Summary +/// +/// Description +/// +/// # Panics +/// +/// # Errors +/// +/// # Safety +/// +/// # Examples +/// +/// Summary of Example 1 +/// +/// ```rust +/// // insert example 1 code here +/// ``` +/// +``` + +* Important notes: +** Documentation comments must use annotations with a triple slash `///` +** Modules are documented using `//!` +``` +//! Summary (of module) +//! +//! Description (of module) +``` +* Special section header is indicated with a hash `#`. +** `Panics` section requires an explanation if the function triggers a panic +** `Errors` section is for describing conditions under which a function of method returns `Err(E)` if it returns a `Result` +** `Safety` section requires an explanation if the function is `unsafe` +** `Examples` section includes examples of using the function or method +* Code block annotations for examples are included between triple graves, as shown above. +Instead of including the programming language to use for syntax highlighting as the annotation +after the triple graves, alternative annotations include the `ignore`, `text`, `should_panic`, or `no_run`. +* Summary sentence is a short high level single sentence of its functionality +* Description paragraph is for details additional to the summary sentence +* Missing documentation annotations may be used to identify where to generate warnings with `#![warn(missing_docs)]` +or errors `#![deny(missing_docs)]` +* Hide documentation for items with `#[doc(hidden)]` + +=== Contributing to documentation (tests, extended examples, macros) for Substrate packages + +The code block annotations in the `# Example` section may be used as https://doc.rust-lang.org/1.9.0/book/documentation.html#documentation-as-tests[documentation as tests and for extended examples]. + +* Important notes: +** Rustdoc will automatically add a `main()` wrapper around the code block to test it +** https://doc.rust-lang.org/1.9.0/book/documentation.html#documenting-macros[Documenting macros]. +** Documentation as tests examples are included when running `cargo test` + +== Contributing + +=== Contributing Guidelines + +include::CONTRIBUTING.adoc[] + +=== Contributor Code of Conduct + +include::CODE_OF_CONDUCT.adoc[] + +== License + +https://github.com/paritytech/substrate/blob/master/LICENSE[LICENSE] diff --git a/SECURITY.md b/docs/SECURITY.md similarity index 100% rename from SECURITY.md rename to docs/SECURITY.md diff --git a/docs/Structure.adoc b/docs/Structure.adoc new file mode 100644 index 0000000000000..0e9606e0a900a --- /dev/null +++ b/docs/Structure.adoc @@ -0,0 +1,110 @@ += Structure +:Author: Substrate developers +:Revision: 0.3.0 +:toc: +:sectnums: + + +== Overview + +Substrate is split into multiple levels with increasing opinion and decreasing flexibility: + +* primitives +* client +* PAINT (formerly `paint`) + +Putting all these components together we have: + +* Integration Tests +* Node +* Node template +* Subkey + +=== Runtime + +* _found in_: `/primitives` +* _crates prefix_: `sp-` +* _constrains_: +** must be `[no_std]` +** crates may not (dev-)depend on crates in other subfolders of this repo + +In the lowest level, substrate defines primitives, interfaces and traits to implement any on-chain substrate transition system and its interactions with the outside world. This is the lowest level of abstraction and opinion everything else builds upon. + +=== Client + +* _found in_: `/client` +* _crates prefix_: `substrate-` +* _constrains_: +** crates may not (dev-)depend on any `paint-`-crates + +In the client you can find a set of crates to construct the outer substrate-node, implementing outer runtime interfaces, thus it depends on `runtime`. It provides the outer building blocks like transaction queue, networking layer, database backend, full* and light-client support. + +=== PAINT (formerly `paint`) + +* _found in_: `/paint` +* _crates prefix_: `paint-` +* _constrains_: +** all crates that go on chain, must be `[no_std]` +** must not (dev-)depend on anything in `/client` + +PAINT, the Parity Application Interface for Network-wide Transitions, is a set of modules implementing specific transition functions and features one (might) want to have in their runtime. + +=== integration tests + +* _found in_: `/test` +* _crates prefix_: `substrate-test` +* _constrains_: +** only helpers may be published +** purely testing crates must be `publish = false` + +All tests that have to pull (dev)-dependencies out of their substree and would thus break the dependency rules, are considered intergration tests and should be stored in here. Only helper-crates in here shall be published, everything else is expected to be non-publish. + +=== Binaries and template + +* _found in_: `/bin` + +We also provide some binaries pulling from the components creating full applications. + +==== Node + +* _found in_: `/bin/node` + +The default (testing) application pulling together our recommended setup of substrate-client with a wasm-contracts-supporting paint-runtime. The node pulls it all together, constructs the (upgradable) runtime and wires up the client around it. You can find an example client, which includes a full wasm-contracts chain in `node`. This is also what is being build and run if you do `cargo run`. + + +==== Node Template + +* _found in_: `/bin/node-template` + +We also provide a template to get you started building your own node. + +==== Subkey + +* _found in_: `/bin/subkey` + +Subkey is a client library to generate keys and sign transactions to send to a substrate node. + +== Internal Dependency Tree + +[ditaa] +.... ++---------------+ +----------------+ +| | | | +| runtime +<------+ paint | +| | | | ++------+-----+--+ +-------------+--+ + ^ ^ ^ + | +----------------+ | + | | | ++------+--------+ | | +| | | | +| client | +--+-------+--------+ +| +<---------+ | ++---------------+ | | + | test /bin/* | + | | + | | + +-------------------+ + +.... + diff --git a/license_header.txt b/docs/license_header.txt similarity index 100% rename from license_header.txt rename to docs/license_header.txt diff --git a/node-template/Cargo.toml b/node-template/Cargo.toml deleted file mode 100644 index e68cbc189379b..0000000000000 --- a/node-template/Cargo.toml +++ /dev/null @@ -1,41 +0,0 @@ -[package] -name = "node-template" -version = "2.0.0" -authors = ["Anonymous"] -build = "build.rs" -edition = "2018" - -[[bin]] -name = "node-template" -path = "src/main.rs" - -[dependencies] -derive_more = "0.15.0" -futures = "0.1.29" -ctrlc = { version = "3.1.3", features = ["termination"] } -log = "0.4.8" -tokio = "0.1.22" -exit-future = "0.1.4" -parking_lot = "0.9.0" -codec = { package = "parity-scale-codec", version = "1.0.0" } -trie-root = "0.15.2" -sr-io = { path = "../core/sr-io" } -substrate-cli = { path = "../core/cli" } -primitives = { package = "substrate-primitives", path = "../core/primitives" } -substrate-executor = { path = "../core/executor" } -substrate-service = { path = "../core/service" } -inherents = { package = "substrate-inherents", path = "../core/inherents" } -transaction-pool = { package = "substrate-transaction-pool", path = "../core/transaction-pool" } -network = { package = "substrate-network", path = "../core/network" } -aura = { package = "substrate-consensus-aura", path = "../core/consensus/aura" } -aura-primitives = { package = "substrate-consensus-aura-primitives", path = "../core/consensus/aura/primitives" } -grandpa = { package = "substrate-finality-grandpa", path = "../core/finality-grandpa" } -grandpa-primitives = { package = "substrate-finality-grandpa-primitives", path = "../core/finality-grandpa/primitives" } -substrate-client = { path = "../core/client" } -basic-authorship = { package = "substrate-basic-authorship", path = "../core/basic-authorship" } -runtime = { package = "node-template-runtime", path = "runtime" } -sr-primitives = { path = "../core/sr-primitives" } - -[build-dependencies] -vergen = "3.0.4" -build-script-utils = { package = "substrate-build-script-utils", path = "../core/utils/build-script-utils" } diff --git a/node-template/runtime/Cargo.toml b/node-template/runtime/Cargo.toml deleted file mode 100644 index 217202b390c1d..0000000000000 --- a/node-template/runtime/Cargo.toml +++ /dev/null @@ -1,67 +0,0 @@ -[package] -name = "node-template-runtime" -version = "2.0.0" -authors = ["Anonymous"] -edition = "2018" - -[dependencies] -serde = { version = "1.0.101", optional = true, features = ["derive"] } -safe-mix = { version = "1.0.0", default-features = false } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sr-std", path = "../../core/sr-std", default_features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default_features = false } -version = { package = "sr-version", path = "../../core/sr-version", default_features = false } -support = { package = "srml-support", path = "../../srml/support", default_features = false } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default_features = false } -substrate-session = { path = "../../core/session", default-features = false } -balances = { package = "srml-balances", path = "../../srml/balances", default_features = false } -aura = { package = "srml-aura", path = "../../srml/aura", default_features = false } -aura-primitives = { package = "substrate-consensus-aura-primitives", path = "../../core/consensus/aura/primitives", default_features = false } -grandpa = { package = "srml-grandpa", path = "../../srml/grandpa", default_features = false } -executive = { package = "srml-executive", path = "../../srml/executive", default_features = false } -indices = { package = "srml-indices", path = "../../srml/indices", default_features = false } -randomness-collective-flip = { package = "srml-randomness-collective-flip", path = "../../srml/randomness-collective-flip", default_features = false } -system = { package = "srml-system", path = "../../srml/system", default_features = false } -timestamp = { package = "srml-timestamp", path = "../../srml/timestamp", default_features = false } -sudo = { package = "srml-sudo", path = "../../srml/sudo", default_features = false } -transaction-payment = { package = "srml-transaction-payment", path = "../../srml/transaction-payment", default_features = false } -sr-primitives = { path = "../../core/sr-primitives", default_features = false } -sr-api = { path = "../../core/sr-api", default_features = false } -offchain-primitives = { package = "substrate-offchain-primitives", path = "../../core/offchain/primitives", default-features = false } -block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../core/block-builder/runtime-api", default-features = false } -tx-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../../core/transaction-pool/runtime-api", default-features = false } -inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } - -[build-dependencies] -wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.4" } - -[features] -default = ["std"] -std = [ - "codec/std", - "sr-api/std", - "rstd/std", - "runtime-io/std", - "support/std", - "balances/std", - "aura/std", - "aura-primitives/std", - "grandpa/std", - "executive/std", - "indices/std", - "primitives/std", - "sr-primitives/std", - "randomness-collective-flip/std", - "system/std", - "timestamp/std", - "sudo/std", - "transaction-payment/std", - "version/std", - "serde", - "safe-mix/std", - "offchain-primitives/std", - "substrate-session/std", - "block-builder-api/std", - "tx-pool-api/std", - "inherents/std", -] diff --git a/node/executor/Cargo.toml b/node/executor/Cargo.toml deleted file mode 100644 index 8e23187962dac..0000000000000 --- a/node/executor/Cargo.toml +++ /dev/null @@ -1,48 +0,0 @@ -[package] -name = "node-executor" -version = "2.0.0" -authors = ["Parity Technologies "] -description = "Substrate node implementation in Rust." -edition = "2018" - -[dependencies] -trie-root = "0.15.2" -codec = { package = "parity-scale-codec", version = "1.0.0" } -runtime_io = { package = "sr-io", path = "../../core/sr-io" } -state_machine = { package = "substrate-state-machine", path = "../../core/state-machine" } -substrate-executor = { path = "../../core/executor" } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -trie = { package = "substrate-trie", path = "../../core/trie" } -node-primitives = { path = "../primitives" } -node-runtime = { path = "../runtime" } - -[dev-dependencies] -node-testing = { path = "../testing" } -test-client = { package = "substrate-test-client", path = "../../core/test-client" } -sr-primitives = { path = "../../core/sr-primitives" } -runtime_support = { package = "srml-support", path = "../../srml/support" } -balances = { package = "srml-balances", path = "../../srml/balances" } -transaction-payment = { package = "srml-transaction-payment", path = "../../srml/transaction-payment" } -session = { package = "srml-session", path = "../../srml/session" } -system = { package = "srml-system", path = "../../srml/system" } -timestamp = { package = "srml-timestamp", path = "../../srml/timestamp" } -treasury = { package = "srml-treasury", path = "../../srml/treasury" } -contracts = { package = "srml-contracts", path = "../../srml/contracts" } -grandpa = { package = "srml-grandpa", path = "../../srml/grandpa" } -indices = { package = "srml-indices", path = "../../srml/indices" } -wabt = "0.9.2" -criterion = "0.3.0" - -[features] -wasmtime = [ - "substrate-executor/wasmtime", -] -wasmi-errno = [ - "substrate-executor/wasmi-errno", -] -stress-test = [] - -[[bench]] -name = "bench" -harness = false - diff --git a/node/rpc/Cargo.toml b/node/rpc/Cargo.toml deleted file mode 100644 index 5d2b3ac85832d..0000000000000 --- a/node/rpc/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "node-rpc" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -client = { package = "substrate-client", path = "../../core/client" } -jsonrpc-core = "14.0.3" -node-primitives = { path = "../primitives" } -node-runtime = { path = "../runtime" } -sr-primitives = { path = "../../core/sr-primitives" } -srml-contracts-rpc = { path = "../../srml/contracts/rpc/" } -srml-transaction-payment-rpc = { path = "../../srml/transaction-payment/rpc/" } -srml-system-rpc = { path = "../../srml/system/rpc/" } -transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" } diff --git a/node/runtime/Cargo.toml b/node/runtime/Cargo.toml deleted file mode 100644 index c39edaa29d6fc..0000000000000 --- a/node/runtime/Cargo.toml +++ /dev/null @@ -1,124 +0,0 @@ -[package] -name = "node-runtime" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" -build = "build.rs" - -[dependencies] -# third-party dependencies -codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] } -integer-sqrt = { version = "0.1.2" } -safe-mix = { version = "1.0", default-features = false } -rustc-hex = { version = "2.0", optional = true } -serde = { version = "1.0.102", optional = true } - -# primitives -authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", path = "../../core/authority-discovery/primitives", default-features = false } -babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../core/consensus/babe/primitives", default-features = false } -node-primitives = { path = "../primitives", default-features = false } -offchain-primitives = { package = "substrate-offchain-primitives", path = "../../core/offchain/primitives", default-features = false } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -sr-staking-primitives = { path = "../../core/sr-staking-primitives", default-features = false } - -# core dependencies -sr-api = { path = "../../core/sr-api", default-features = false } -inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } -block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../core/block-builder/runtime-api", default-features = false } -tx-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../../core/transaction-pool/runtime-api", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -version = { package = "sr-version", path = "../../core/sr-version", default-features = false } -substrate-session = { path = "../../core/session", default-features = false } -substrate-keyring = { path = "../../core/keyring", optional = true } - -# srml dependencies -authorship = { package = "srml-authorship", path = "../../srml/authorship", default-features = false } -babe = { package = "srml-babe", path = "../../srml/babe", default-features = false } -balances = { package = "srml-balances", path = "../../srml/balances", default-features = false } -collective = { package = "srml-collective", path = "../../srml/collective", default-features = false } -contracts = { package = "srml-contracts", path = "../../srml/contracts", default-features = false } -contracts-rpc-runtime-api = { package = "srml-contracts-rpc-runtime-api", path = "../../srml/contracts/rpc/runtime-api/", default-features = false } -democracy = { package = "srml-democracy", path = "../../srml/democracy", default-features = false } -elections-phragmen = { package = "srml-elections-phragmen", path = "../../srml/elections-phragmen", default-features = false } -executive = { package = "srml-executive", path = "../../srml/executive", default-features = false } -finality-tracker = { package = "srml-finality-tracker", path = "../../srml/finality-tracker", default-features = false } -grandpa = { package = "srml-grandpa", path = "../../srml/grandpa", default-features = false } -im-online = { package = "srml-im-online", path = "../../srml/im-online", default-features = false } -authority-discovery = { package = "srml-authority-discovery", path = "../../srml/authority-discovery", default-features = false } -indices = { package = "srml-indices", path = "../../srml/indices", default-features = false } -membership = { package = "srml-membership", path = "../../srml/membership", default-features = false } -nicks = { package = "srml-nicks", path = "../../srml/nicks", default-features = false } -offences = { package = "srml-offences", path = "../../srml/offences", default-features = false } -randomness-collective-flip = { package = "srml-randomness-collective-flip", path = "../../srml/randomness-collective-flip", default-features = false } -session = { package = "srml-session", path = "../../srml/session", default-features = false, features = ["historical"] } -staking = { package = "srml-staking", path = "../../srml/staking", default-features = false } -srml-staking-reward-curve = { path = "../../srml/staking/reward-curve"} -sudo = { package = "srml-sudo", path = "../../srml/sudo", default-features = false } -support = { package = "srml-support", path = "../../srml/support", default-features = false } -system = { package = "srml-system", path = "../../srml/system", default-features = false } -system-rpc-runtime-api = { package = "srml-system-rpc-runtime-api", path = "../../srml/system/rpc/runtime-api/", default-features = false } -timestamp = { package = "srml-timestamp", path = "../../srml/timestamp", default-features = false } -treasury = { package = "srml-treasury", path = "../../srml/treasury", default-features = false } -utility = { package = "srml-utility", path = "../../srml/utility", default-features = false } -transaction-payment = { package = "srml-transaction-payment", path = "../../srml/transaction-payment", default-features = false } -transaction-payment-rpc-runtime-api = { package = "srml-transaction-payment-rpc-runtime-api", path = "../../srml/transaction-payment/rpc/runtime-api/", default-features = false } - -[build-dependencies] -wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.4", path = "../../core/utils/wasm-builder-runner" } - -[dev-dependencies] -runtime_io = { package = "sr-io", path = "../../core/sr-io" } - -[features] -default = ["std"] -std = [ - "authority-discovery/std", - "authority-discovery-primitives/std", - "authorship/std", - "babe-primitives/std", - "babe/std", - "balances/std", - "sr-api/std", - "codec/std", - "collective/std", - "contracts/std", - "contracts-rpc-runtime-api/std", - "democracy/std", - "elections-phragmen/std", - "executive/std", - "finality-tracker/std", - "grandpa/std", - "im-online/std", - "indices/std", - "membership/std", - "nicks/std", - "node-primitives/std", - "offchain-primitives/std", - "offences/std", - "primitives/std", - "randomness-collective-flip/std", - "rstd/std", - "rustc-hex", - "safe-mix/std", - "serde", - "session/std", - "sr-primitives/std", - "sr-staking-primitives/std", - "staking/std", - "substrate-keyring", - "substrate-session/std", - "sudo/std", - "support/std", - "system/std", - "system-rpc-runtime-api/std", - "timestamp/std", - "treasury/std", - "utility/std", - "transaction-payment/std", - "transaction-payment-rpc-runtime-api/std", - "version/std", - "block-builder-api/std", - "tx-pool-api/std", - "inherents/std", -] diff --git a/node/testing/Cargo.toml b/node/testing/Cargo.toml deleted file mode 100644 index a3382cd53540e..0000000000000 --- a/node/testing/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[package] -name = "node-testing" -version = "2.0.0" -authors = ["Parity Technologies "] -description = "Test utilities for Substrate node." -edition = "2018" - -[dependencies] -balances = { package = "srml-balances", path = "../../srml/balances" } -client = { package = "substrate-client", path = "../../core/client" } -contracts = { package = "srml-contracts", path = "../../srml/contracts" } -grandpa = { package = "srml-grandpa", path = "../../srml/grandpa" } -indices = { package = "srml-indices", path = "../../srml/indices" } -keyring = { package = "substrate-keyring", path = "../../core/keyring" } -node-executor = { path = "../executor" } -node-primitives = { path = "../primitives" } -node-runtime = { path = "../runtime" } -codec = { package = "parity-scale-codec", version = "1.0.0" } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -runtime-io = { package = "sr-io", path = "../../core/sr-io" } -sr-primitives = { path = "../../core/sr-primitives" } -runtime_support = { package = "srml-support", path = "../../srml/support" } -session = { package = "srml-session", path = "../../srml/session" } -staking = { package = "srml-staking", path = "../../srml/staking" } -substrate-executor = { path = "../../core/executor" } -system = { package = "srml-system", path = "../../srml/system" } -test-client = { package = "substrate-test-client", path = "../../core/test-client" } -timestamp = { package = "srml-timestamp", path = "../../srml/timestamp" } -treasury = { package = "srml-treasury", path = "../../srml/treasury" } -transaction-payment = { package = "srml-transaction-payment", path = "../../srml/transaction-payment" } -wabt = "0.9.2" diff --git a/srml/assets/Cargo.toml b/paint/assets/Cargo.toml similarity index 62% rename from srml/assets/Cargo.toml rename to paint/assets/Cargo.toml index 052a3045b2164..d8fa259484dbc 100644 --- a/srml/assets/Cargo.toml +++ b/paint/assets/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "srml-assets" +name = "paint-assets" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" @@ -8,16 +8,16 @@ edition = "2018" serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sr-primitives = { path = "../../core/sr-primitives", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } # Needed for type-safe access to storage DB. -support = { package = "srml-support", path = "../support", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -system = { package = "srml-system", path = "../system", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } [dev-dependencies] -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -rstd = { package = "sr-std", path = "../../core/sr-std" } -runtime-io = { package = "sr-io", path = "../../core/sr-io" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +rstd = { package = "sr-std", path = "../../primitives/sr-std" } +runtime-io = { package = "sr-io", path = "../../primitives/sr-io" } [features] default = ["std"] diff --git a/srml/assets/src/lib.rs b/paint/assets/src/lib.rs similarity index 99% rename from srml/assets/src/lib.rs rename to paint/assets/src/lib.rs index 5c8b1bbd610a3..4f91cd19198a4 100644 --- a/srml/assets/src/lib.rs +++ b/paint/assets/src/lib.rs @@ -124,8 +124,8 @@ //! //! ## Related Modules //! -//! * [`System`](../srml_system/index.html) -//! * [`Support`](../srml_support/index.html) +//! * [`System`](../paint_system/index.html) +//! * [`Support`](../paint_support/index.html) // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/paint/aura/Cargo.toml b/paint/aura/Cargo.toml new file mode 100644 index 0000000000000..23250ac312ee6 --- /dev/null +++ b/paint/aura/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "paint-aura" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +app-crypto = { package = "substrate-application-crypto", path = "../../primitives/application-crypto", default-features = false } +codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } +inherents = { package = "substrate-inherents", path = "../../primitives/inherents", default-features = false } +primitives = { package = "substrate-primitives", path = "../../primitives/core", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +serde = { version = "1.0.101", optional = true } +session = { package = "paint-session", path = "../session", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +runtime-io ={ package = "sr-io", path = "../../primitives/sr-io", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +substrate-consensus-aura-primitives = { path = "../../primitives/consensus/aura", default-features = false} +system = { package = "paint-system", path = "../system", default-features = false } +timestamp = { package = "paint-timestamp", path = "../timestamp", default-features = false } + +[dev-dependencies] +lazy_static = "1.4.0" +parking_lot = "0.9.0" + +[features] +default = ["std"] +std = [ + "app-crypto/std", + "codec/std", + "inherents/std", + "runtime-io/std", + "primitives/std", + "rstd/std", + "serde", + "sr-primitives/std", + "support/std", + "substrate-consensus-aura-primitives/std", + "system/std", + "timestamp/std", +] diff --git a/srml/aura/src/lib.rs b/paint/aura/src/lib.rs similarity index 96% rename from srml/aura/src/lib.rs rename to paint/aura/src/lib.rs index 7e459fde0486b..4b14c5b6485fa 100644 --- a/srml/aura/src/lib.rs +++ b/paint/aura/src/lib.rs @@ -31,15 +31,15 @@ //! //! ## Related Modules //! -//! - [Timestamp](../srml_timestamp/index.html): The Timestamp module is used in Aura to track +//! - [Timestamp](../paint_timestamp/index.html): The Timestamp module is used in Aura to track //! consensus rounds (via `slots`). -//! - [Consensus](../srml_consensus/index.html): The Consensus module does not relate directly to Aura, +//! - [Consensus](../paint_consensus/index.html): The Consensus module does not relate directly to Aura, //! but serves to manage offline reporting by implementing `ProvideInherent` in a similar way. //! //! ## References //! //! If you're interested in hacking on this module, it is useful to understand the interaction with -//! `substrate/core/inherents/src/lib.rs` and, specifically, the required implementation of +//! `substrate/primitives/inherents/src/lib.rs` and, specifically, the required implementation of //! [`ProvideInherent`](../substrate_inherents/trait.ProvideInherent.html) and //! [`ProvideInherentData`](../substrate_inherents/trait.ProvideInherentData.html) to create and check inherents. diff --git a/srml/aura/src/mock.rs b/paint/aura/src/mock.rs similarity index 100% rename from srml/aura/src/mock.rs rename to paint/aura/src/mock.rs diff --git a/srml/aura/src/tests.rs b/paint/aura/src/tests.rs similarity index 100% rename from srml/aura/src/tests.rs rename to paint/aura/src/tests.rs diff --git a/paint/authority-discovery/Cargo.toml b/paint/authority-discovery/Cargo.toml new file mode 100644 index 0000000000000..923017d9a4b41 --- /dev/null +++ b/paint/authority-discovery/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "paint-authority-discovery" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", path = "../../primitives/authority-discovery", default-features = false } +app-crypto = { package = "substrate-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 = "substrate-primitives", path = "../../primitives/core", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +serde = { version = "1.0.101", optional = true } +runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false } +session = { package = "paint-session", path = "../session", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } + +[dev-dependencies] +sr-staking-primitives = { path = "../../primitives/sr-staking-primitives", default-features = false } + +[features] +default = ["std"] +std = [ + "app-crypto/std", + "authority-discovery-primitives/std", + "codec/std", + "primitives/std", + "rstd/std", + "runtime-io/std", + "serde", + "session/std", + "sr-primitives/std", + "support/std", + "system/std", +] diff --git a/srml/authority-discovery/src/lib.rs b/paint/authority-discovery/src/lib.rs similarity index 100% rename from srml/authority-discovery/src/lib.rs rename to paint/authority-discovery/src/lib.rs diff --git a/srml/authorship/Cargo.toml b/paint/authorship/Cargo.toml similarity index 52% rename from srml/authorship/Cargo.toml rename to paint/authorship/Cargo.toml index a59976c699096..b53c059c3a01c 100644 --- a/srml/authorship/Cargo.toml +++ b/paint/authorship/Cargo.toml @@ -1,19 +1,19 @@ [package] -name = "srml-authorship" +name = "paint-authorship" version = "0.1.0" description = "Block and Uncle Author tracking for the SRML" authors = ["Parity Technologies "] edition = "2018" [dependencies] -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } +primitives = { package = "substrate-primitives", path = "../../primitives/core", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } -runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = false } +inherents = { package = "substrate-inherents", path = "../../primitives/inherents", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } +runtime-io ={ package = "sr-io", path = "../../primitives/sr-io", default-features = false } impl-trait-for-tuples = "0.1.3" [features] diff --git a/srml/authorship/src/lib.rs b/paint/authorship/src/lib.rs similarity index 100% rename from srml/authorship/src/lib.rs rename to paint/authorship/src/lib.rs diff --git a/paint/babe/Cargo.toml b/paint/babe/Cargo.toml new file mode 100644 index 0000000000000..cdbee72216dde --- /dev/null +++ b/paint/babe/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "paint-babe" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +hex-literal = "0.2.1" +codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.101", optional = true } +inherents = { package = "substrate-inherents", path = "../../primitives/inherents", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +sr-staking-primitives = { path = "../../primitives/sr-staking-primitives", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } +timestamp = { package = "paint-timestamp", path = "../timestamp", default-features = false } +session = { package = "paint-session", path = "../session", default-features = false } +babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../primitives/consensus/babe", default-features = false } +runtime-io ={ package = "sr-io", path = "../../primitives/sr-io", default-features = false } + +[dev-dependencies] +lazy_static = "1.4.0" +parking_lot = "0.9.0" +sr-version = { path = "../../primitives/sr-version", default-features = false } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +test-runtime = { package = "substrate-test-runtime", path = "../../test/utils/runtime" } + +[features] +default = ["std"] +std = [ + "serde", + "codec/std", + "rstd/std", + "support/std", + "sr-primitives/std", + "sr-staking-primitives/std", + "system/std", + "timestamp/std", + "inherents/std", + "babe-primitives/std", + "session/std", + "runtime-io/std", +] diff --git a/srml/babe/src/lib.rs b/paint/babe/src/lib.rs similarity index 99% rename from srml/babe/src/lib.rs rename to paint/babe/src/lib.rs index 17ce12c716359..5bdae6ce9b1b0 100644 --- a/srml/babe/src/lib.rs +++ b/paint/babe/src/lib.rs @@ -148,7 +148,7 @@ pub trait EpochChangeTrigger { } /// A type signifying to BABE that an external trigger -/// for epoch changes (e.g. srml-session) is used. +/// for epoch changes (e.g. paint-session) is used. pub struct ExternalTrigger; impl EpochChangeTrigger for ExternalTrigger { @@ -390,7 +390,7 @@ impl Module { /// and the caller is the only caller of this function. /// /// Typically, this is not handled directly by the user, but by higher-level validator-set manager logic like - /// `srml-session`. + /// `paint-session`. pub fn enact_epoch_change( authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, next_authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, diff --git a/srml/babe/src/mock.rs b/paint/babe/src/mock.rs similarity index 100% rename from srml/babe/src/mock.rs rename to paint/babe/src/mock.rs diff --git a/srml/babe/src/tests.rs b/paint/babe/src/tests.rs similarity index 100% rename from srml/babe/src/tests.rs rename to paint/babe/src/tests.rs diff --git a/srml/balances/Cargo.toml b/paint/balances/Cargo.toml similarity index 51% rename from srml/balances/Cargo.toml rename to paint/balances/Cargo.toml index f7f6041c6bb16..be00ed30c7660 100644 --- a/srml/balances/Cargo.toml +++ b/paint/balances/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "srml-balances" +name = "paint-balances" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" @@ -8,16 +8,16 @@ edition = "2018" serde = { version = "1.0.101", optional = true } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -substrate-keyring = { path = "../../core/keyring", optional = true } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } +substrate-keyring = { path = "../../primitives/keyring", optional = true } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } [dev-dependencies] -runtime-io = { package = "sr-io", path = "../../core/sr-io" } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -transaction-payment = { package = "srml-transaction-payment", path = "../transaction-payment" } +runtime-io = { package = "sr-io", path = "../../primitives/sr-io" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +transaction-payment = { package = "paint-transaction-payment", path = "../transaction-payment" } [features] default = ["std"] diff --git a/srml/balances/src/lib.rs b/paint/balances/src/lib.rs similarity index 98% rename from srml/balances/src/lib.rs rename to paint/balances/src/lib.rs index cd6c84492276c..37869345c2ca4 100644 --- a/srml/balances/src/lib.rs +++ b/paint/balances/src/lib.rs @@ -63,16 +63,16 @@ //! The Balances module provides implementations for the following traits. If these traits provide the functionality //! that you need, then you can avoid coupling with the Balances module. //! -//! - [`Currency`](../srml_support/traits/trait.Currency.html): Functions for dealing with a +//! - [`Currency`](../paint_support/traits/trait.Currency.html): Functions for dealing with a //! fungible assets system. -//! - [`ReservableCurrency`](../srml_support/traits/trait.ReservableCurrency.html): +//! - [`ReservableCurrency`](../paint_support/traits/trait.ReservableCurrency.html): //! Functions for dealing with assets that can be reserved from an account. -//! - [`LockableCurrency`](../srml_support/traits/trait.LockableCurrency.html): Functions for +//! - [`LockableCurrency`](../paint_support/traits/trait.LockableCurrency.html): Functions for //! dealing with accounts that allow liquidity restrictions. -//! - [`Imbalance`](../srml_support/traits/trait.Imbalance.html): Functions for handling +//! - [`Imbalance`](../paint_support/traits/trait.Imbalance.html): Functions for handling //! imbalances between total issuance in the system and account balances. Must be used when a function //! creates new funds (e.g. a reward) or destroys some funds (e.g. a system fee). -//! - [`IsDeadAccount`](../srml_system/trait.IsDeadAccount.html): Determiner to say whether a +//! - [`IsDeadAccount`](../paint_system/trait.IsDeadAccount.html): Determiner to say whether a //! given account is unused. //! //! ## Interface diff --git a/srml/balances/src/mock.rs b/paint/balances/src/mock.rs similarity index 100% rename from srml/balances/src/mock.rs rename to paint/balances/src/mock.rs diff --git a/srml/balances/src/tests.rs b/paint/balances/src/tests.rs similarity index 100% rename from srml/balances/src/tests.rs rename to paint/balances/src/tests.rs diff --git a/srml/collective/Cargo.toml b/paint/collective/Cargo.toml similarity index 55% rename from srml/collective/Cargo.toml rename to paint/collective/Cargo.toml index 347a289b57b89..3f629f25c1e94 100644 --- a/srml/collective/Cargo.toml +++ b/paint/collective/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "srml-collective" +name = "paint-collective" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" @@ -8,16 +8,16 @@ edition = "2018" serde = { version = "1.0.101", optional = true } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } +primitives = { package = "substrate-primitives", path = "../../primitives/core", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } [dev-dependencies] hex-literal = "0.2.1" -balances = { package = "srml-balances", path = "../balances" } +balances = { package = "paint-balances", path = "../balances" } [features] default = ["std"] diff --git a/srml/collective/src/lib.rs b/paint/collective/src/lib.rs similarity index 100% rename from srml/collective/src/lib.rs rename to paint/collective/src/lib.rs diff --git a/srml/contracts/COMPLEXITY.md b/paint/contracts/COMPLEXITY.md similarity index 100% rename from srml/contracts/COMPLEXITY.md rename to paint/contracts/COMPLEXITY.md diff --git a/srml/contracts/Cargo.toml b/paint/contracts/Cargo.toml similarity index 53% rename from srml/contracts/Cargo.toml rename to paint/contracts/Cargo.toml index 365566cfb547e..728cf72e11d49 100644 --- a/srml/contracts/Cargo.toml +++ b/paint/contracts/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "srml-contracts" +name = "paint-contracts" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" @@ -10,22 +10,22 @@ pwasm-utils = { version = "0.11.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } parity-wasm = { version = "0.40.3", default-features = false } wasmi-validation = { version = "0.2.0", default-features = false } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -sandbox = { package = "sr-sandbox", path = "../../core/sr-sandbox", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } +primitives = { package = "substrate-primitives", path = "../../primitives/core", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +sandbox = { package = "sr-sandbox", path = "../../primitives/sr-sandbox", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } [dev-dependencies] wabt = "0.9.2" assert_matches = "1.3.0" hex-literal = "0.2.1" -balances = { package = "srml-balances", path = "../balances" } +balances = { package = "paint-balances", path = "../balances" } hex = "0.3.2" -timestamp = { package = "srml-timestamp", path = "../timestamp" } -randomness-collective-flip = { package = "srml-randomness-collective-flip", path = "../randomness-collective-flip" } +timestamp = { package = "paint-timestamp", path = "../timestamp" } +randomness-collective-flip = { package = "paint-randomness-collective-flip", path = "../randomness-collective-flip" } [features] default = ["std"] diff --git a/srml/contracts/rpc/Cargo.toml b/paint/contracts/rpc/Cargo.toml similarity index 61% rename from srml/contracts/rpc/Cargo.toml rename to paint/contracts/rpc/Cargo.toml index f9d51452f412f..723b51a38bdaa 100644 --- a/srml/contracts/rpc/Cargo.toml +++ b/paint/contracts/rpc/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "srml-contracts-rpc" +name = "paint-contracts-rpc" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" [dependencies] -client = { package = "substrate-client", path = "../../../core/client" } +client = { package = "substrate-client", path = "../../../client/" } codec = { package = "parity-scale-codec", version = "1.0.0" } jsonrpc-core = "14.0.3" jsonrpc-core-client = "14.0.3" jsonrpc-derive = "14.0.3" -primitives = { package = "substrate-primitives", path = "../../../core/primitives" } -rpc-primitives = { package = "substrate-rpc-primitives", path = "../../../core/rpc/primitives" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +rpc-primitives = { package = "substrate-rpc-primitives", path = "../../../primitives/rpc" } serde = { version = "1.0.101", features = ["derive"] } -sr-primitives = { path = "../../../core/sr-primitives" } -srml-contracts-rpc-runtime-api = { path = "./runtime-api" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +paint-contracts-rpc-runtime-api = { path = "./runtime-api" } diff --git a/srml/contracts/rpc/runtime-api/Cargo.toml b/paint/contracts/rpc/runtime-api/Cargo.toml similarity index 57% rename from srml/contracts/rpc/runtime-api/Cargo.toml rename to paint/contracts/rpc/runtime-api/Cargo.toml index e37d476860395..ac5c2be224713 100644 --- a/srml/contracts/rpc/runtime-api/Cargo.toml +++ b/paint/contracts/rpc/runtime-api/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "srml-contracts-rpc-runtime-api" +name = "paint-contracts-rpc-runtime-api" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" [dependencies] -sr-api = { path = "../../../../core/sr-api", default-features = false } +sr-api = { path = "../../../../primitives/sr-api", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sr-std", path = "../../../../core/sr-std", default-features = false } +rstd = { package = "sr-std", path = "../../../../primitives/sr-std", default-features = false } serde = { version = "1.0.101", optional = true, features = ["derive"] } -sr-primitives = { path = "../../../../core/sr-primitives", default-features = false } +sr-primitives = { path = "../../../../primitives/sr-primitives", default-features = false } [features] default = ["std"] diff --git a/srml/contracts/rpc/runtime-api/src/lib.rs b/paint/contracts/rpc/runtime-api/src/lib.rs similarity index 100% rename from srml/contracts/rpc/runtime-api/src/lib.rs rename to paint/contracts/rpc/runtime-api/src/lib.rs diff --git a/srml/contracts/rpc/src/lib.rs b/paint/contracts/rpc/src/lib.rs similarity index 99% rename from srml/contracts/rpc/src/lib.rs rename to paint/contracts/rpc/src/lib.rs index 91783df99617e..e226949d54a64 100644 --- a/srml/contracts/rpc/src/lib.rs +++ b/paint/contracts/rpc/src/lib.rs @@ -31,7 +31,7 @@ use sr_primitives::{ }; pub use self::gen_client::Client as ContractsClient; -pub use srml_contracts_rpc_runtime_api::{ +pub use paint_contracts_rpc_runtime_api::{ self as runtime_api, ContractExecResult, ContractsApi as ContractsRuntimeApi, GetStorageResult, }; diff --git a/srml/contracts/src/account_db.rs b/paint/contracts/src/account_db.rs similarity index 100% rename from srml/contracts/src/account_db.rs rename to paint/contracts/src/account_db.rs diff --git a/srml/contracts/src/exec.rs b/paint/contracts/src/exec.rs similarity index 100% rename from srml/contracts/src/exec.rs rename to paint/contracts/src/exec.rs diff --git a/srml/contracts/src/gas.rs b/paint/contracts/src/gas.rs similarity index 100% rename from srml/contracts/src/gas.rs rename to paint/contracts/src/gas.rs diff --git a/srml/contracts/src/lib.rs b/paint/contracts/src/lib.rs similarity index 99% rename from srml/contracts/src/lib.rs rename to paint/contracts/src/lib.rs index 05e22aeae2fad..a4b59226dcdf4 100644 --- a/srml/contracts/src/lib.rs +++ b/paint/contracts/src/lib.rs @@ -84,7 +84,7 @@ //! //! ## Related Modules //! -//! * [Balances](../srml_balances/index.html) +//! * [Balances](../paint_balances/index.html) #![cfg_attr(not(feature = "std"), no_std)] diff --git a/srml/contracts/src/rent.rs b/paint/contracts/src/rent.rs similarity index 100% rename from srml/contracts/src/rent.rs rename to paint/contracts/src/rent.rs diff --git a/srml/contracts/src/tests.rs b/paint/contracts/src/tests.rs similarity index 100% rename from srml/contracts/src/tests.rs rename to paint/contracts/src/tests.rs diff --git a/srml/contracts/src/wasm/code_cache.rs b/paint/contracts/src/wasm/code_cache.rs similarity index 100% rename from srml/contracts/src/wasm/code_cache.rs rename to paint/contracts/src/wasm/code_cache.rs diff --git a/srml/contracts/src/wasm/env_def/macros.rs b/paint/contracts/src/wasm/env_def/macros.rs similarity index 100% rename from srml/contracts/src/wasm/env_def/macros.rs rename to paint/contracts/src/wasm/env_def/macros.rs diff --git a/srml/contracts/src/wasm/env_def/mod.rs b/paint/contracts/src/wasm/env_def/mod.rs similarity index 100% rename from srml/contracts/src/wasm/env_def/mod.rs rename to paint/contracts/src/wasm/env_def/mod.rs diff --git a/srml/contracts/src/wasm/mod.rs b/paint/contracts/src/wasm/mod.rs similarity index 100% rename from srml/contracts/src/wasm/mod.rs rename to paint/contracts/src/wasm/mod.rs diff --git a/srml/contracts/src/wasm/prepare.rs b/paint/contracts/src/wasm/prepare.rs similarity index 100% rename from srml/contracts/src/wasm/prepare.rs rename to paint/contracts/src/wasm/prepare.rs diff --git a/srml/contracts/src/wasm/runtime.rs b/paint/contracts/src/wasm/runtime.rs similarity index 100% rename from srml/contracts/src/wasm/runtime.rs rename to paint/contracts/src/wasm/runtime.rs diff --git a/srml/democracy/Cargo.toml b/paint/democracy/Cargo.toml similarity index 56% rename from srml/democracy/Cargo.toml rename to paint/democracy/Cargo.toml index 761e56ceda6cb..1f28c013c5d1c 100644 --- a/srml/democracy/Cargo.toml +++ b/paint/democracy/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "srml-democracy" +name = "paint-democracy" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" @@ -8,15 +8,15 @@ edition = "2018" serde = { version = "1.0.101", optional = true, features = ["derive"] } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } [dev-dependencies] -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -balances = { package = "srml-balances", path = "../balances" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +balances = { package = "paint-balances", path = "../balances" } [features] default = ["std"] diff --git a/srml/democracy/src/lib.rs b/paint/democracy/src/lib.rs similarity index 100% rename from srml/democracy/src/lib.rs rename to paint/democracy/src/lib.rs diff --git a/srml/democracy/src/vote_threshold.rs b/paint/democracy/src/vote_threshold.rs similarity index 100% rename from srml/democracy/src/vote_threshold.rs rename to paint/democracy/src/vote_threshold.rs diff --git a/paint/elections-phragmen/Cargo.toml b/paint/elections-phragmen/Cargo.toml new file mode 100644 index 0000000000000..0fb1f6246567d --- /dev/null +++ b/paint/elections-phragmen/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "paint-elections-phragmen" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +phragmen = { package = "substrate-phragmen", path = "../../primitives/phragmen", default-features = false } +paint-support = { path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } + +[dev-dependencies] +runtime_io = { package = "sr-io", path = "../../primitives/sr-io" } +hex-literal = "0.2.1" +balances = { package = "paint-balances", path = "../balances" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } +serde = { version = "1.0.101" } + +[features] +default = ["std"] +std = [ + "codec/std", + "paint-support/std", + "sr-primitives/std", + "phragmen/std", + "system/std", + "rstd/std", +] diff --git a/srml/elections-phragmen/src/lib.rs b/paint/elections-phragmen/src/lib.rs similarity index 99% rename from srml/elections-phragmen/src/lib.rs rename to paint/elections-phragmen/src/lib.rs index 1ddd890b8e02f..0a615bb8c98a2 100644 --- a/srml/elections-phragmen/src/lib.rs +++ b/paint/elections-phragmen/src/lib.rs @@ -80,7 +80,7 @@ use rstd::prelude::*; use codec::Decode; use sr_primitives::{print, traits::{Zero, StaticLookup, Bounded, Convert}}; use sr_primitives::weights::SimpleDispatchInfo; -use srml_support::{ +use paint_support::{ decl_storage, decl_event, ensure, decl_module, dispatch, storage::unhashed, traits::{ @@ -667,7 +667,7 @@ impl Module { mod tests { use super::*; use std::cell::RefCell; - use srml_support::{assert_ok, assert_noop, parameter_types, assert_eq_uvec}; + use paint_support::{assert_ok, assert_noop, parameter_types, assert_eq_uvec}; use primitives::H256; use sr_primitives::{ Perbill, testing::Header, BuildStorage, @@ -783,7 +783,7 @@ mod tests { pub type Block = sr_primitives::generic::Block; pub type UncheckedExtrinsic = sr_primitives::generic::UncheckedExtrinsic; - srml_support::construct_runtime!( + paint_support::construct_runtime!( pub enum Test where Block = Block, NodeBlock = Block, @@ -863,7 +863,7 @@ mod tests { #[test] fn temp_migration_works() { ExtBuilder::default().build().execute_with(|| { - use srml_support::storage::unhashed; + use paint_support::storage::unhashed; use codec::Encode; let old_members = vec![1u64, 2]; diff --git a/srml/elections/Cargo.toml b/paint/elections/Cargo.toml similarity index 55% rename from srml/elections/Cargo.toml rename to paint/elections/Cargo.toml index 88d147ac087aa..1e8e7702f557d 100644 --- a/srml/elections/Cargo.toml +++ b/paint/elections/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "srml-elections" +name = "paint-elections" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" @@ -8,16 +8,16 @@ edition = "2018" serde = { version = "1.0.101", optional = true } safe-mix = { version = "1.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } +primitives = { package = "substrate-primitives", path = "../../primitives/core", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } [dev-dependencies] hex-literal = "0.2.1" -balances = { package = "srml-balances", path = "../balances" } +balances = { package = "paint-balances", path = "../balances" } [features] default = ["std"] diff --git a/srml/elections/src/lib.rs b/paint/elections/src/lib.rs similarity index 100% rename from srml/elections/src/lib.rs rename to paint/elections/src/lib.rs diff --git a/srml/elections/src/mock.rs b/paint/elections/src/mock.rs similarity index 100% rename from srml/elections/src/mock.rs rename to paint/elections/src/mock.rs diff --git a/srml/elections/src/tests.rs b/paint/elections/src/tests.rs similarity index 100% rename from srml/elections/src/tests.rs rename to paint/elections/src/tests.rs diff --git a/srml/evm/Cargo.toml b/paint/evm/Cargo.toml similarity index 53% rename from srml/evm/Cargo.toml rename to paint/evm/Cargo.toml index f0bad3e793ce8..45cb990861d27 100644 --- a/srml/evm/Cargo.toml +++ b/paint/evm/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "srml-evm" +name = "paint-evm" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" @@ -7,14 +7,14 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } -timestamp = { package = "srml-timestamp", path = "../timestamp", default-features = false } -balances = { package = "srml-balances", path = "../balances", default-features = false } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } +timestamp = { package = "paint-timestamp", path = "../timestamp", default-features = false } +balances = { package = "paint-balances", path = "../balances", default-features = false } +primitives = { package = "substrate-primitives", path = "../../primitives/core", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false } primitive-types = { version = "0.6", default-features = false, features = ["rlp"] } rlp = { version = "0.4", default-features = false } evm = { version = "0.14", default-features = false } diff --git a/srml/evm/src/backend.rs b/paint/evm/src/backend.rs similarity index 100% rename from srml/evm/src/backend.rs rename to paint/evm/src/backend.rs diff --git a/srml/evm/src/lib.rs b/paint/evm/src/lib.rs similarity index 100% rename from srml/evm/src/lib.rs rename to paint/evm/src/lib.rs diff --git a/srml/example/Cargo.toml b/paint/example/Cargo.toml similarity index 50% rename from srml/example/Cargo.toml rename to paint/example/Cargo.toml index 695e0602fb327..c25e91235f67b 100644 --- a/srml/example/Cargo.toml +++ b/paint/example/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "srml-example" +name = "paint-example" version = "2.0.0" authors = ["Parity Technologies "] edition = "2018" @@ -7,15 +7,15 @@ edition = "2018" [dependencies] serde = { version = "1.0.101", optional = true } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } -balances = { package = "srml-balances", path = "../balances", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false } +support = { package = "paint-support", path = "../support", default-features = false } +system = { package = "paint-system", path = "../system", default-features = false } +balances = { package = "paint-balances", path = "../balances", default-features = false } +sr-primitives = { path = "../../primitives/sr-primitives", default-features = false } +rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false } +runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false } [dev-dependencies] -primitives = { package = "substrate-primitives", path = "../../core/primitives" } +primitives = { package = "substrate-primitives", path = "../../primitives/core" } [features] default = ["std"] diff --git a/srml/example/src/lib.rs b/paint/example/src/lib.rs similarity index 99% rename from srml/example/src/lib.rs rename to paint/example/src/lib.rs index 8d8f4dacd24d7..2fdee498e06bb 100644 --- a/srml/example/src/lib.rs +++ b/paint/example/src/lib.rs @@ -20,7 +20,7 @@ //! The Example: A simple example of a runtime module demonstrating //! concepts, APIs and structures common to most runtime modules. //! -//! Run `cargo doc --package srml-example --open` to view this module's documentation. +//! Run `cargo doc --package paint-example --open` to view this module's documentation. //! //! ### Documentation Guidelines: //! @@ -49,8 +49,8 @@ //! //! ### Documentation Template:
//! -//! Copy and paste this template from srml/example/src/lib.rs into file -//! `srml//src/lib.rs` of your own custom module and complete it. +//! Copy and paste this template from paint/example/src/lib.rs into file +//! `paint//src/lib.rs` of your own custom module and complete it. //!

 //! // Add heading with custom module name
 //!
diff --git a/paint/executive/Cargo.toml b/paint/executive/Cargo.toml
new file mode 100644
index 0000000000000..9dbea514d20ec
--- /dev/null
+++ b/paint/executive/Cargo.toml
@@ -0,0 +1,33 @@
+[package]
+name = "paint-executive"
+version = "2.0.0"
+authors = ["Parity Technologies "]
+edition = "2018"
+
+[dependencies]
+serde = { version = "1.0.101", optional = true }
+codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+
+[dev-dependencies]
+hex-literal = "0.2.1"
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
+paint-indices = { path = "../indices" }
+balances = { package = "paint-balances", path = "../balances" }
+transaction-payment = { package = "paint-transaction-payment", path = "../transaction-payment" }
+
+[features]
+default = ["std"]
+std = [
+	"rstd/std",
+	"support/std",
+	"serde",
+	"codec/std",
+	"sr-primitives/std",
+	"runtime-io/std",
+	"system/std",
+]
diff --git a/srml/executive/src/lib.rs b/paint/executive/src/lib.rs
similarity index 99%
rename from srml/executive/src/lib.rs
rename to paint/executive/src/lib.rs
index 11f83d548f89b..2f0a418ab089b 100644
--- a/srml/executive/src/lib.rs
+++ b/paint/executive/src/lib.rs
@@ -23,7 +23,7 @@
 //!
 //! The executive module is not a typical SRML module providing functionality around a specific feature.
 //! It is a cross-cutting framework component for the SRML. It works in conjunction with the
-//! [SRML System module](../srml_system/index.html) to perform these cross-cutting functions.
+//! [SRML System module](../paint_system/index.html) to perform these cross-cutting functions.
 //!
 //! The Executive module provides functions to:
 //!
@@ -51,7 +51,7 @@
 //!
 //! ```
 //! # use sr_primitives::generic;
-//! # use srml_executive as executive;
+//! # use paint_executive as executive;
 //! # pub struct UncheckedExtrinsic {};
 //! # pub struct Header {};
 //! # type Context = system::ChainContext;
diff --git a/paint/finality-tracker/Cargo.toml b/paint/finality-tracker/Cargo.toml
new file mode 100644
index 0000000000000..f11fa2c4d9159
--- /dev/null
+++ b/paint/finality-tracker/Cargo.toml
@@ -0,0 +1,31 @@
+[package]
+name = "paint-finality-tracker"
+version = "2.0.0"
+authors = ["Parity Technologies "]
+edition = "2018"
+
+[dependencies]
+serde = { version = "1.0.101", default-features = false, features = ["derive"] }
+codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
+inherents = { package = "substrate-inherents", path = "../../primitives/inherents", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+paint-system = { path = "../system", default-features = false }
+impl-trait-for-tuples = "0.1.3"
+
+[dev-dependencies]
+primitives = { package = "substrate-primitives",  path = "../../primitives/core", default-features = false }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+
+[features]
+default = ["std"]
+std = [
+	"serde/std",
+	"codec/std",
+	"rstd/std",
+	"support/std",
+	"sr-primitives/std",
+	"paint-system/std",
+	"inherents/std",
+]
diff --git a/srml/finality-tracker/src/lib.rs b/paint/finality-tracker/src/lib.rs
similarity index 98%
rename from srml/finality-tracker/src/lib.rs
rename to paint/finality-tracker/src/lib.rs
index b5c01c3c8733f..e0721e5a1419f 100644
--- a/srml/finality-tracker/src/lib.rs
+++ b/paint/finality-tracker/src/lib.rs
@@ -24,7 +24,7 @@ use rstd::{prelude::*, result, cmp, vec};
 use codec::Decode;
 use support::{decl_module, decl_storage};
 use support::traits::Get;
-use srml_system::{ensure_none, Trait as SystemTrait};
+use paint_system::{ensure_none, Trait as SystemTrait};
 
 #[cfg(feature = "std")]
 use codec::Encode;
@@ -124,7 +124,7 @@ decl_module! {
 			ensure_none(origin)?;
 			assert!(!::Update::exists(), "Final hint must be updated only once in the block");
 			assert!(
-				srml_system::Module::::block_number() >= hint,
+				paint_system::Module::::block_number() >= hint,
 				"Finalized height above block number",
 			);
 			::Update::put(hint);
@@ -199,7 +199,7 @@ impl Module {
 		::Median::put(median);
 
 		if T::BlockNumber::from(our_window_size) == window_size {
-			let now = srml_system::Module::::block_number();
+			let now = paint_system::Module::::block_number();
 			let latency = T::ReportLatency::get();
 
 			// the delay is the latency plus half the window size.
@@ -254,7 +254,7 @@ mod tests {
 		traits::{BlakeTwo256, IdentityLookup, OnFinalize, Header as HeaderT},
 	};
 	use support::{assert_ok, impl_outer_origin, parameter_types};
-	use srml_system as system;
+	use paint_system as system;
 	use std::cell::RefCell;
 
 	#[derive(Clone, PartialEq, Debug)]
diff --git a/srml/generic-asset/Cargo.toml b/paint/generic-asset/Cargo.toml
similarity index 57%
rename from srml/generic-asset/Cargo.toml
rename to paint/generic-asset/Cargo.toml
index 49a9db4c0ecd8..db0bae7a46bff 100644
--- a/srml/generic-asset/Cargo.toml
+++ b/paint/generic-asset/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-generic-asset"
+name = "paint-generic-asset"
 version = "2.0.0"
 authors = ["Centrality Developers "]
 edition = "2018"
@@ -7,14 +7,14 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", optional = true }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
 
 [dev-dependencies]
-runtime-io ={ package = "sr-io", path = "../../core/sr-io" }
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
 
 [features]
 default = ["std"]
diff --git a/srml/generic-asset/src/lib.rs b/paint/generic-asset/src/lib.rs
similarity index 100%
rename from srml/generic-asset/src/lib.rs
rename to paint/generic-asset/src/lib.rs
diff --git a/srml/generic-asset/src/mock.rs b/paint/generic-asset/src/mock.rs
similarity index 100%
rename from srml/generic-asset/src/mock.rs
rename to paint/generic-asset/src/mock.rs
diff --git a/srml/generic-asset/src/tests.rs b/paint/generic-asset/src/tests.rs
similarity index 100%
rename from srml/generic-asset/src/tests.rs
rename to paint/generic-asset/src/tests.rs
diff --git a/paint/grandpa/Cargo.toml b/paint/grandpa/Cargo.toml
new file mode 100644
index 0000000000000..956478b41af45
--- /dev/null
+++ b/paint/grandpa/Cargo.toml
@@ -0,0 +1,38 @@
+[package]
+name = "paint-grandpa"
+version = "2.0.0"
+authors = ["Parity Technologies "]
+edition = "2018"
+
+[dependencies]
+serde = { version = "1.0.101", optional = true, features = ["derive"] }
+codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core", default-features = false }
+substrate-finality-grandpa-primitives = { path = "../../primitives/finality-grandpa", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+sr-staking-primitives = { path = "../../primitives/sr-staking-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+session = { package = "paint-session", path = "../session", default-features = false }
+finality-tracker = { package = "paint-finality-tracker", path = "../finality-tracker", default-features = false }
+
+[dev-dependencies]
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io" }
+
+[features]
+default = ["std"]
+std = [
+	"serde",
+	"codec/std",
+	"primitives/std",
+	"substrate-finality-grandpa-primitives/std",
+	"rstd/std",
+	"support/std",
+	"sr-primitives/std",
+	"sr-staking-primitives/std",
+	"system/std",
+	"session/std",
+	"finality-tracker/std",
+]
+migrate-authorities = []
diff --git a/srml/grandpa/src/lib.rs b/paint/grandpa/src/lib.rs
similarity index 100%
rename from srml/grandpa/src/lib.rs
rename to paint/grandpa/src/lib.rs
diff --git a/srml/grandpa/src/mock.rs b/paint/grandpa/src/mock.rs
similarity index 100%
rename from srml/grandpa/src/mock.rs
rename to paint/grandpa/src/mock.rs
diff --git a/srml/grandpa/src/tests.rs b/paint/grandpa/src/tests.rs
similarity index 100%
rename from srml/grandpa/src/tests.rs
rename to paint/grandpa/src/tests.rs
diff --git a/paint/im-online/Cargo.toml b/paint/im-online/Cargo.toml
new file mode 100644
index 0000000000000..e509620f6e037
--- /dev/null
+++ b/paint/im-online/Cargo.toml
@@ -0,0 +1,39 @@
+[package]
+name = "paint-im-online"
+version = "0.1.0"
+authors = ["Parity Technologies "]
+edition = "2018"
+
+[dependencies]
+app-crypto = { package = "substrate-application-crypto", path = "../../primitives/application-crypto", default-features = false }
+authorship = { package = "paint-authorship", path = "../authorship", default-features = false }
+codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
+primitives = { package="substrate-primitives", path = "../../primitives/core", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+serde = { version = "1.0.101", optional = true }
+session = { package = "paint-session", path = "../session", default-features = false }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+sr-staking-primitives = { path = "../../primitives/sr-staking-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+
+[dev-dependencies]
+offchain = { package = "substrate-offchain", path = "../../client/offchain" }
+
+[features]
+default = ["std", "session/historical"]
+std = [
+	"app-crypto/std",
+	"authorship/std",
+	"codec/std",
+	"primitives/std",
+	"rstd/std",
+	"serde",
+	"session/std",
+	"runtime-io/std",
+	"sr-primitives/std",
+	"sr-staking-primitives/std",
+	"support/std",
+	"system/std",
+]
diff --git a/srml/im-online/src/lib.rs b/paint/im-online/src/lib.rs
similarity index 98%
rename from srml/im-online/src/lib.rs
rename to paint/im-online/src/lib.rs
index 1a32f1098af62..4df8f442e4da4 100644
--- a/srml/im-online/src/lib.rs
+++ b/paint/im-online/src/lib.rs
@@ -26,7 +26,7 @@
 //!
 //! The heartbeat is a signed transaction, which was signed using the session key
 //! and includes the recent best block number of the local validators chain as well
-//! as the [NetworkState](../../core/offchain/struct.NetworkState.html).
+//! as the [NetworkState](../../client/offchain/struct.NetworkState.html).
 //! It is submitted as an Unsigned Transaction via off-chain workers.
 //!
 //! - [`im_online::Trait`](./trait.Trait.html)
@@ -44,7 +44,7 @@
 //! ```
 //! use support::{decl_module, dispatch::Result};
 //! use system::ensure_signed;
-//! use srml_im_online::{self as im_online};
+//! use paint_im_online::{self as im_online};
 //!
 //! pub trait Trait: im_online::Trait {}
 //!
@@ -62,7 +62,7 @@
 //!
 //! ## Dependencies
 //!
-//! This module depends on the [Session module](../srml_session/index.html).
+//! This module depends on the [Session module](../paint_session/index.html).
 
 // Ensure we're `no_std` when compiling for Wasm.
 #![cfg_attr(not(feature = "std"), no_std)]
@@ -131,7 +131,7 @@ pub mod ed25519 {
 
 /// The local storage database key under which the worker progress status
 /// is tracked.
-const DB_KEY: &[u8] = b"srml/im-online-worker-status";
+const DB_KEY: &[u8] = b"paint/im-online-worker-status";
 
 /// It's important to persist the worker state, since e.g. the
 /// server could be restarted while starting the gossip process, but before
diff --git a/srml/im-online/src/mock.rs b/paint/im-online/src/mock.rs
similarity index 100%
rename from srml/im-online/src/mock.rs
rename to paint/im-online/src/mock.rs
diff --git a/srml/im-online/src/tests.rs b/paint/im-online/src/tests.rs
similarity index 100%
rename from srml/im-online/src/tests.rs
rename to paint/im-online/src/tests.rs
diff --git a/srml/indices/Cargo.toml b/paint/indices/Cargo.toml
similarity index 56%
rename from srml/indices/Cargo.toml
rename to paint/indices/Cargo.toml
index b8b560c3f9b4d..443d28ba878d8 100644
--- a/srml/indices/Cargo.toml
+++ b/paint/indices/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-indices"
+name = "paint-indices"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -8,13 +8,13 @@ edition = "2018"
 serde = { version = "1.0.101", optional = true }
 safe-mix = { version = "1.0.0", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-substrate-keyring = { path = "../../core/keyring", optional = true }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-primitives = { package = "substrate-primitives",  path = "../../core/primitives", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
+substrate-keyring = { path = "../../primitives/keyring", optional = true }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
 
 [dev-dependencies]
 ref_thread_local = "0.0.0"
diff --git a/srml/indices/src/address.rs b/paint/indices/src/address.rs
similarity index 100%
rename from srml/indices/src/address.rs
rename to paint/indices/src/address.rs
diff --git a/srml/indices/src/lib.rs b/paint/indices/src/lib.rs
similarity index 100%
rename from srml/indices/src/lib.rs
rename to paint/indices/src/lib.rs
diff --git a/srml/indices/src/mock.rs b/paint/indices/src/mock.rs
similarity index 100%
rename from srml/indices/src/mock.rs
rename to paint/indices/src/mock.rs
diff --git a/srml/indices/src/tests.rs b/paint/indices/src/tests.rs
similarity index 100%
rename from srml/indices/src/tests.rs
rename to paint/indices/src/tests.rs
diff --git a/srml/membership/Cargo.toml b/paint/membership/Cargo.toml
similarity index 54%
rename from srml/membership/Cargo.toml
rename to paint/membership/Cargo.toml
index a8cb73055563e..fc75bc4c69ea5 100644
--- a/srml/membership/Cargo.toml
+++ b/paint/membership/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-membership"
+name = "paint-membership"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,14 +7,14 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", optional = true }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
 
 [dev-dependencies]
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
 
 [features]
 default = ["std"]
diff --git a/srml/membership/src/lib.rs b/paint/membership/src/lib.rs
similarity index 100%
rename from srml/membership/src/lib.rs
rename to paint/membership/src/lib.rs
diff --git a/srml/metadata/Cargo.toml b/paint/metadata/Cargo.toml
similarity index 63%
rename from srml/metadata/Cargo.toml
rename to paint/metadata/Cargo.toml
index e9381f68bbbf9..1d7185cc1060a 100644
--- a/srml/metadata/Cargo.toml
+++ b/paint/metadata/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-metadata"
+name = "paint-metadata"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,8 +7,8 @@ edition = "2018"
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
 serde = { version = "1.0.101", optional = true, features = ["derive"] }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+primitives = { package = "substrate-primitives", path = "../../primitives/core", default-features = false }
 
 [features]
 default = ["std"]
diff --git a/srml/metadata/src/lib.rs b/paint/metadata/src/lib.rs
similarity index 100%
rename from srml/metadata/src/lib.rs
rename to paint/metadata/src/lib.rs
diff --git a/srml/nicks/Cargo.toml b/paint/nicks/Cargo.toml
similarity index 50%
rename from srml/nicks/Cargo.toml
rename to paint/nicks/Cargo.toml
index 4b8fabe9effe5..9e78254332451 100644
--- a/srml/nicks/Cargo.toml
+++ b/paint/nicks/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-nicks"
+name = "paint-nicks"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,15 +7,15 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", optional = true }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
 
 [dev-dependencies]
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
-balances = { package = "srml-balances", path = "../balances", default-features = false }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
+balances = { package = "paint-balances", path = "../balances", default-features = false }
 
 [features]
 default = ["std"]
diff --git a/srml/nicks/src/lib.rs b/paint/nicks/src/lib.rs
similarity index 100%
rename from srml/nicks/src/lib.rs
rename to paint/nicks/src/lib.rs
diff --git a/paint/offences/Cargo.toml b/paint/offences/Cargo.toml
new file mode 100644
index 0000000000000..8eb217c8b3265
--- /dev/null
+++ b/paint/offences/Cargo.toml
@@ -0,0 +1,32 @@
+[package]
+name = "paint-offences"
+version = "1.0.0"
+authors = ["Parity Technologies "]
+edition = "2018"
+
+[dependencies]
+balances = { package = "paint-balances", path = "../balances", default-features = false }
+codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+serde = { version = "1.0.101", optional = true }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+sr-staking-primitives = { path = "../../primitives/sr-staking-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+
+[dev-dependencies]
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io" }
+substrate-primitives = { path = "../../primitives/core" }
+
+[features]
+default = ["std"]
+std = [
+	"balances/std",
+	"codec/std",
+	"rstd/std",
+	"serde",
+	"sr-primitives/std",
+	"sr-staking-primitives/std",
+	"support/std",
+	"system/std",
+]
diff --git a/srml/offences/src/lib.rs b/paint/offences/src/lib.rs
similarity index 100%
rename from srml/offences/src/lib.rs
rename to paint/offences/src/lib.rs
diff --git a/srml/offences/src/mock.rs b/paint/offences/src/mock.rs
similarity index 97%
rename from srml/offences/src/mock.rs
rename to paint/offences/src/mock.rs
index f9c79390819e0..6ae0e35b9bd58 100644
--- a/srml/offences/src/mock.rs
+++ b/paint/offences/src/mock.rs
@@ -148,7 +148,7 @@ impl offence::Offence for Offence {
 	}
 
 	fn session_index(&self) -> SessionIndex {
-		// session index is not used by the srml-offences directly, but rather it exists only for
+		// session index is not used by the paint-offences directly, but rather it exists only for
 		// filtering historical reports.
 		unimplemented!()
 	}
diff --git a/srml/offences/src/tests.rs b/paint/offences/src/tests.rs
similarity index 100%
rename from srml/offences/src/tests.rs
rename to paint/offences/src/tests.rs
diff --git a/srml/randomness-collective-flip/Cargo.toml b/paint/randomness-collective-flip/Cargo.toml
similarity index 55%
rename from srml/randomness-collective-flip/Cargo.toml
rename to paint/randomness-collective-flip/Cargo.toml
index 5be9aad50f0b3..97e56d1a83a41 100644
--- a/srml/randomness-collective-flip/Cargo.toml
+++ b/paint/randomness-collective-flip/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-randomness-collective-flip"
+name = "paint-randomness-collective-flip"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,14 +7,14 @@ edition = "2018"
 [dependencies]
 safe-mix = { version = "1.0", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
 
 [dev-dependencies]
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
-runtime-io = { package = "sr-io", path = "../../core/sr-io" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io" }
 
 [features]
 default = ["std"]
diff --git a/srml/randomness-collective-flip/src/lib.rs b/paint/randomness-collective-flip/src/lib.rs
similarity index 99%
rename from srml/randomness-collective-flip/src/lib.rs
rename to paint/randomness-collective-flip/src/lib.rs
index 3644b8898c2ab..62170e8a8842c 100644
--- a/srml/randomness-collective-flip/src/lib.rs
+++ b/paint/randomness-collective-flip/src/lib.rs
@@ -42,7 +42,7 @@
 //! decl_module! {
 //! 	pub struct Module for enum Call where origin: T::Origin {
 //! 		pub fn random_module_example(origin) -> Result {
-//! 			let _random_seed = >::random_seed();
+//! 			let _random_seed = >::random_seed();
 //! 			Ok(())
 //! 		}
 //! 	}
diff --git a/srml/scored-pool/Cargo.toml b/paint/scored-pool/Cargo.toml
similarity index 51%
rename from srml/scored-pool/Cargo.toml
rename to paint/scored-pool/Cargo.toml
index e65f71a10d13e..35da18437bb51 100644
--- a/srml/scored-pool/Cargo.toml
+++ b/paint/scored-pool/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-scored-pool"
+name = "paint-scored-pool"
 version = "1.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,15 +7,15 @@ edition = "2018"
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
 serde = { version = "1.0.101", optional = true }
-runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
 
 [dev-dependencies]
-balances = { package = "srml-balances", path = "../balances" }
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
+balances = { package = "paint-balances", path = "../balances" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
 
 [features]
 default = ["std"]
diff --git a/srml/scored-pool/src/lib.rs b/paint/scored-pool/src/lib.rs
similarity index 99%
rename from srml/scored-pool/src/lib.rs
rename to paint/scored-pool/src/lib.rs
index 5fde1e9c450cf..3ed4b8f21fa49 100644
--- a/srml/scored-pool/src/lib.rs
+++ b/paint/scored-pool/src/lib.rs
@@ -55,7 +55,7 @@
 //! ```
 //! use support::{decl_module, dispatch::Result};
 //! use system::ensure_signed;
-//! use srml_scored_pool::{self as scored_pool};
+//! use paint_scored_pool::{self as scored_pool};
 //!
 //! pub trait Trait: scored_pool::Trait {}
 //!
@@ -77,7 +77,7 @@
 //!
 //! ## Dependencies
 //!
-//! This module depends on the [System module](../srml_system/index.html).
+//! This module depends on the [System module](../paint_system/index.html).
 
 // Ensure we're `no_std` when compiling for Wasm.
 #![cfg_attr(not(feature = "std"), no_std)]
diff --git a/srml/scored-pool/src/mock.rs b/paint/scored-pool/src/mock.rs
similarity index 100%
rename from srml/scored-pool/src/mock.rs
rename to paint/scored-pool/src/mock.rs
diff --git a/srml/scored-pool/src/tests.rs b/paint/scored-pool/src/tests.rs
similarity index 100%
rename from srml/scored-pool/src/tests.rs
rename to paint/scored-pool/src/tests.rs
diff --git a/srml/session/Cargo.toml b/paint/session/Cargo.toml
similarity index 52%
rename from srml/session/Cargo.toml
rename to paint/session/Cargo.toml
index d9a95100aae58..3a5b1476a455f 100644
--- a/srml/session/Cargo.toml
+++ b/paint/session/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-session"
+name = "paint-session"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition =  "2018"
@@ -8,19 +8,19 @@ edition =  "2018"
 serde = { version = "1.0.101", optional = true }
 safe-mix = { version = "1.0.0", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-sr-staking-primitives = { path = "../../core/sr-staking-primitives", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
-timestamp = { package = "srml-timestamp", path = "../timestamp", default-features = false }
-substrate-trie = { path = "../../core/trie", default-features = false, optional = true }
-runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+sr-staking-primitives = { path = "../../primitives/sr-staking-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+timestamp = { package = "paint-timestamp", path = "../timestamp", default-features = false }
+substrate-trie = { path = "../../primitives/trie", default-features = false, optional = true }
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io", default-features = false }
 impl-trait-for-tuples = "0.1.3"
 
 [dev-dependencies]
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
-app-crypto = { package = "substrate-application-crypto",  path = "../../core/application-crypto" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
+app-crypto = { package = "substrate-application-crypto",  path = "../../primitives/application-crypto" }
 lazy_static = "1.4.0"
 
 [features]
diff --git a/srml/session/src/historical.rs b/paint/session/src/historical.rs
similarity index 100%
rename from srml/session/src/historical.rs
rename to paint/session/src/historical.rs
diff --git a/srml/session/src/lib.rs b/paint/session/src/lib.rs
similarity index 98%
rename from srml/session/src/lib.rs
rename to paint/session/src/lib.rs
index aa86dedd987f4..95209c9ab6bd3 100644
--- a/srml/session/src/lib.rs
+++ b/paint/session/src/lib.rs
@@ -45,7 +45,7 @@
 //! a block author or a validator. The session keys of accounts are removed once their account balance is zero.
 //! - **Validator set session key configuration process:** Each session we iterate through the current
 //! set of validator account IDs to check if a session key was created for it in the previous session
-//! using `set_key`. If it was then we call `set_authority` from the [Consensus module](../srml_consensus/index.html)
+//! using `set_key`. If it was then we call `set_authority` from the [Consensus module](../paint_consensus/index.html)
 //! and pass it a set of session keys (each associated with an account ID) as the session keys for the new
 //! validator set. Lastly, if the session key of the current authority does not match any session keys stored under
 //! its validator index in the `AuthorityStorageVec` mapping, then we update the mapping with its session
@@ -100,10 +100,10 @@
 //!
 //! ### Example from the SRML
 //!
-//! The [Staking module](../srml_staking/index.html) uses the Session module to get the validator set.
+//! The [Staking module](../paint_staking/index.html) uses the Session module to get the validator set.
 //!
 //! ```
-//! use srml_session as session;
+//! use paint_session as session;
 //! # fn not_executed() {
 //!
 //! let validators = >::validators();
@@ -113,9 +113,9 @@
 //!
 //! ## Related Modules
 //!
-//! - [Consensus](../srml_consensus/index.html)
-//! - [Staking](../srml_staking/index.html)
-//! - [Timestamp](../srml_timestamp/index.html)
+//! - [Consensus](../paint_consensus/index.html)
+//! - [Staking](../paint_staking/index.html)
+//! - [Timestamp](../paint_timestamp/index.html)
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
@@ -358,7 +358,7 @@ pub trait Trait: system::Trait {
 	/// The fraction of validators set that is safe to be disabled.
 	///
 	/// After the threshold is reached `disabled` method starts to return true,
-	/// which in combination with `srml_staking` forces a new era.
+	/// which in combination with `paint_staking` forces a new era.
 	type DisabledValidatorsThreshold: Get;
 
 	/// Select initial validators.
diff --git a/srml/session/src/mock.rs b/paint/session/src/mock.rs
similarity index 100%
rename from srml/session/src/mock.rs
rename to paint/session/src/mock.rs
diff --git a/paint/staking/Cargo.toml b/paint/staking/Cargo.toml
new file mode 100644
index 0000000000000..7632ae38c4d78
--- /dev/null
+++ b/paint/staking/Cargo.toml
@@ -0,0 +1,45 @@
+[package]
+name = "paint-staking"
+version = "2.0.0"
+authors = ["Parity Technologies "]
+edition = "2018"
+
+[dependencies]
+serde = { version = "1.0.101", optional = true }
+safe-mix = { version = "1.0.0", default-features = false }
+codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
+substrate-keyring = { path = "../../primitives/keyring", optional = true }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+phragmen = { package = "substrate-phragmen", path = "../../primitives/phragmen", default-features = false }
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+sr-staking-primitives = { path = "../../primitives/sr-staking-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+session = { package = "paint-session", path = "../session", default-features = false, features = ["historical"] }
+authorship = { package = "paint-authorship", path = "../authorship", default-features = false }
+
+[dev-dependencies]
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
+balances = { package = "paint-balances", path = "../balances" }
+timestamp = { package = "paint-timestamp", path = "../timestamp" }
+paint-staking-reward-curve = { path = "../staking/reward-curve"}
+
+[features]
+equalize = []
+default = ["std", "equalize"]
+std = [
+	"serde",
+	"safe-mix/std",
+	"substrate-keyring",
+	"codec/std",
+	"rstd/std",
+	"phragmen/std",
+	"runtime-io/std",
+	"support/std",
+	"sr-primitives/std",
+	"sr-staking-primitives/std",
+	"session/std",
+	"system/std",
+	"authorship/std",
+]
diff --git a/srml/staking/reward-curve/Cargo.toml b/paint/staking/reward-curve/Cargo.toml
similarity index 73%
rename from srml/staking/reward-curve/Cargo.toml
rename to paint/staking/reward-curve/Cargo.toml
index b33323a5e3190..03b6ab8955de1 100644
--- a/srml/staking/reward-curve/Cargo.toml
+++ b/paint/staking/reward-curve/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-staking-reward-curve"
+name = "paint-staking-reward-curve"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -14,4 +14,4 @@ proc-macro2 = "1.0.6"
 proc-macro-crate = "0.1.4"
 
 [dev-dependencies]
-sr-primitives = { path = "../../../core/sr-primitives" }
+sr-primitives = { path = "../../../primitives/sr-primitives" }
diff --git a/srml/staking/reward-curve/src/lib.rs b/paint/staking/reward-curve/src/lib.rs
similarity index 99%
rename from srml/staking/reward-curve/src/lib.rs
rename to paint/staking/reward-curve/src/lib.rs
index 4ccffa2172f6d..947a9a84d0cb3 100644
--- a/srml/staking/reward-curve/src/lib.rs
+++ b/paint/staking/reward-curve/src/lib.rs
@@ -44,7 +44,7 @@ use syn::parse::{Parse, ParseStream};
 /// # fn main() {}
 /// use sr_primitives::curve::PiecewiseLinear;
 ///
-/// srml_staking_reward_curve::build! {
+/// paint_staking_reward_curve::build! {
 /// 	const I_NPOS: PiecewiseLinear<'static> = curve!(
 /// 		min_inflation: 0_025_000,
 /// 		max_inflation: 0_100_000,
@@ -373,7 +373,7 @@ fn generate_test_module(input: &INposInput) -> TokenStream2 {
 
 	quote!(
 		#[cfg(test)]
-		mod __srml_staking_reward_curve_test_module {
+		mod __paint_staking_reward_curve_test_module {
 			fn i_npos(x: f64) -> f64 {
 				if x <= #x_ideal {
 					#i_0 + x * (#i_ideal - #i_0 / #x_ideal)
diff --git a/srml/staking/reward-curve/src/log.rs b/paint/staking/reward-curve/src/log.rs
similarity index 100%
rename from srml/staking/reward-curve/src/log.rs
rename to paint/staking/reward-curve/src/log.rs
diff --git a/srml/staking/reward-curve/tests/test.rs b/paint/staking/reward-curve/tests/test.rs
similarity index 89%
rename from srml/staking/reward-curve/tests/test.rs
rename to paint/staking/reward-curve/tests/test.rs
index 55a3b7d383e9e..be7f0cbd1883c 100644
--- a/srml/staking/reward-curve/tests/test.rs
+++ b/paint/staking/reward-curve/tests/test.rs
@@ -14,11 +14,11 @@
 // You should have received a copy of the GNU General Public License
 // along with Substrate.  If not, see .
 
-//! Test crate for srml-staking-reward-curve. Allows to test for procedural macro.
+//! Test crate for paint-staking-reward-curve. Allows to test for procedural macro.
 //! See tests directory.
 
 mod test_small_falloff {
-	srml_staking_reward_curve::build! {
+	paint_staking_reward_curve::build! {
 		const REWARD_CURVE: sr_primitives::curve::PiecewiseLinear<'static> = curve!(
 			min_inflation: 0_020_000,
 			max_inflation: 0_200_000,
@@ -31,7 +31,7 @@ mod test_small_falloff {
 }
 
 mod test_big_falloff {
-	srml_staking_reward_curve::build! {
+	paint_staking_reward_curve::build! {
 		const REWARD_CURVE: sr_primitives::curve::PiecewiseLinear<'static> = curve!(
 			min_inflation: 0_100_000,
 			max_inflation: 0_400_000,
diff --git a/srml/staking/src/inflation.rs b/paint/staking/src/inflation.rs
similarity index 99%
rename from srml/staking/src/inflation.rs
rename to paint/staking/src/inflation.rs
index 03e5b84eede57..11cf3151f6599 100644
--- a/srml/staking/src/inflation.rs
+++ b/paint/staking/src/inflation.rs
@@ -49,7 +49,7 @@ pub fn compute_total_payout(
 mod test {
 	use sr_primitives::curve::PiecewiseLinear;
 
-	srml_staking_reward_curve::build! {
+	paint_staking_reward_curve::build! {
 		const I_NPOS: PiecewiseLinear<'static> = curve!(
 			min_inflation: 0_025_000,
 			max_inflation: 0_100_000,
diff --git a/srml/staking/src/lib.rs b/paint/staking/src/lib.rs
similarity index 99%
rename from srml/staking/src/lib.rs
rename to paint/staking/src/lib.rs
index e5613a57be69e..3ef7032783465 100644
--- a/srml/staking/src/lib.rs
+++ b/paint/staking/src/lib.rs
@@ -138,7 +138,7 @@
 //! ```
 //! use support::{decl_module, dispatch::Result};
 //! use system::ensure_signed;
-//! use srml_staking::{self as staking};
+//! use paint_staking::{self as staking};
 //!
 //! pub trait Trait: staking::Trait {}
 //!
@@ -179,7 +179,7 @@
 //! [`reward_by_indices`](./enum.Call.html#variant.reward_by_indices).
 //!
 //! [`Module`](./struct.Module.html) implements
-//! [`authorship::EventHandler`](../srml_authorship/trait.EventHandler.html) to add reward points
+//! [`authorship::EventHandler`](../paint_authorship/trait.EventHandler.html) to add reward points
 //! to block producer and block producer of referenced uncles.
 //!
 //! The validator and its nominator split their reward as following:
@@ -237,8 +237,8 @@
 //!
 //! ## Related Modules
 //!
-//! - [Balances](../srml_balances/index.html): Used to manage values at stake.
-//! - [Session](../srml_session/index.html): Used to manage sessions. Also, a list of new validators
+//! - [Balances](../paint_balances/index.html): Used to manage values at stake.
+//! - [Session](../paint_session/index.html): Used to manage sessions. Also, a list of new validators
 //! is stored in the Session module's `Validators` at the end of each era.
 
 #![recursion_limit="128"]
diff --git a/srml/staking/src/mock.rs b/paint/staking/src/mock.rs
similarity index 99%
rename from srml/staking/src/mock.rs
rename to paint/staking/src/mock.rs
index 58d46d765543f..ff9bfe50a5df1 100644
--- a/srml/staking/src/mock.rs
+++ b/paint/staking/src/mock.rs
@@ -178,7 +178,7 @@ impl timestamp::Trait for Test {
 	type OnTimestampSet = ();
 	type MinimumPeriod = MinimumPeriod;
 }
-srml_staking_reward_curve::build! {
+paint_staking_reward_curve::build! {
 	const I_NPOS: PiecewiseLinear<'static> = curve!(
 		min_inflation: 0_025_000,
 		max_inflation: 0_100_000,
diff --git a/srml/staking/src/tests.rs b/paint/staking/src/tests.rs
similarity index 100%
rename from srml/staking/src/tests.rs
rename to paint/staking/src/tests.rs
diff --git a/srml/sudo/Cargo.toml b/paint/sudo/Cargo.toml
similarity index 55%
rename from srml/sudo/Cargo.toml
rename to paint/sudo/Cargo.toml
index 152f32ab89363..2bd1e83585ff7 100644
--- a/srml/sudo/Cargo.toml
+++ b/paint/sudo/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-sudo"
+name = "paint-sudo"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,14 +7,14 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", optional = true }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
 
 [dev-dependencies]
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
 
 [features]
 default = ["std"]
diff --git a/srml/sudo/src/lib.rs b/paint/sudo/src/lib.rs
similarity index 98%
rename from srml/sudo/src/lib.rs
rename to paint/sudo/src/lib.rs
index 7801384abcc2f..326c07cf8f436 100644
--- a/srml/sudo/src/lib.rs
+++ b/paint/sudo/src/lib.rs
@@ -77,8 +77,8 @@
 //!
 //! ## Related Modules
 //!
-//! * [Consensus](../srml_consensus/index.html)
-//! * [Democracy](../srml_democracy/index.html)
+//! * [Consensus](../paint_consensus/index.html)
+//! * [Democracy](../paint_democracy/index.html)
 //!
 //! [`Call`]: ./enum.Call.html
 //! [`Trait`]: ./trait.Trait.html
diff --git a/srml/support/Cargo.toml b/paint/support/Cargo.toml
similarity index 54%
rename from srml/support/Cargo.toml
rename to paint/support/Cargo.toml
index 55ea65d55f853..17f0ddebc9c27 100644
--- a/srml/support/Cargo.toml
+++ b/paint/support/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-support"
+name = "paint-support"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -8,22 +8,22 @@ edition = "2018"
 log = "0.4"
 serde = { version = "1.0.101", optional = true, features = ["derive"] }
 codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] }
-srml-metadata = { path = "../metadata", default-features = false }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-primitives = { package = "substrate-primitives",  path = "../../core/primitives", default-features = false }
-inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false }
-srml-support-procedural = { package = "srml-support-procedural", path = "./procedural" }
+paint-metadata = { path = "../metadata", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core", default-features = false }
+inherents = { package = "substrate-inherents", path = "../../primitives/inherents", default-features = false }
+paint-support-procedural = { package = "paint-support-procedural", path = "./procedural" }
 paste = "0.1.6"
 once_cell = { version = "0.2.4", default-features = false, optional = true }
-state-machine = { package = "substrate-state-machine", path = "../../core/state-machine", optional = true }
+state-machine = { package = "substrate-state-machine", path = "../../primitives/state-machine", optional = true }
 bitmask = { version = "0.5.0", default-features = false }
 impl-trait-for-tuples = "0.1.3"
 
 [dev-dependencies]
 pretty_assertions = "0.6.1"
-srml-system = { path = "../system" }
+paint-system = { path = "../system" }
 
 [features]
 default = ["std"]
@@ -35,7 +35,7 @@ std = [
 	"codec/std",
 	"rstd/std",
 	"sr-primitives/std",
-	"srml-metadata/std",
+	"paint-metadata/std",
 	"inherents/std",
 	"state-machine",
 ]
diff --git a/srml/support/procedural/Cargo.toml b/paint/support/procedural/Cargo.toml
similarity index 63%
rename from srml/support/procedural/Cargo.toml
rename to paint/support/procedural/Cargo.toml
index 59025800ec615..96839c7d1fe55 100644
--- a/srml/support/procedural/Cargo.toml
+++ b/paint/support/procedural/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-support-procedural"
+name = "paint-support-procedural"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -8,7 +8,7 @@ edition = "2018"
 proc-macro = true
 
 [dependencies]
-srml-support-procedural-tools = { package = "srml-support-procedural-tools", path = "./tools" }
+paint-support-procedural-tools = { package = "paint-support-procedural-tools", path = "./tools" }
 
 proc-macro2 = "1.0.6"
 quote = "1.0.2"
diff --git a/srml/support/procedural/src/lib.rs b/paint/support/procedural/src/lib.rs
similarity index 88%
rename from srml/support/procedural/src/lib.rs
rename to paint/support/procedural/src/lib.rs
index 623f8fde4b345..ee704617fe297 100644
--- a/srml/support/procedural/src/lib.rs
+++ b/paint/support/procedural/src/lib.rs
@@ -53,16 +53,16 @@ use proc_macro::TokenStream;
 /// Basic storage consists of a name and a type; supported types are:
 ///
 /// * Value: `Foo: type`: Implements the
-///   [`StorageValue`](../srml_support/storage/trait.StorageValue.html) trait using the
-///   [`StorageValue generator`](../srml_support/storage/generator/trait.StorageValue.html).
+///   [`StorageValue`](../paint_support/storage/trait.StorageValue.html) trait using the
+///   [`StorageValue generator`](../paint_support/storage/generator/trait.StorageValue.html).
 ///   The generator `unhashed_key` is `$module_prefix ++ " " ++ $storage_name`
 ///
 /// * Map: `Foo: map hasher($hash) type => type`: Implements the
-///   [`StorageMap`](../srml_support/storage/trait.StorageMap.html) trait using the
-///   [`StorageMap generator`](../srml_support/storage/generator/trait.StorageMap.html).
+///   [`StorageMap`](../paint_support/storage/trait.StorageMap.html) trait using the
+///   [`StorageMap generator`](../paint_support/storage/generator/trait.StorageMap.html).
 ///
 ///   `$hash` representing a choice of hashing algorithms available in the
-///   [`Hashable`](../srml_support/trait.Hashable.html) trait.
+///   [`Hashable`](../paint_support/trait.Hashable.html) trait.
 ///
 ///   `hasher($hash)` is optional and its default is `blake2_256`. One should use another hasher
 ///   with care, see generator documentation.
@@ -72,11 +72,11 @@ use proc_macro::TokenStream;
 ///   * `Hasher`: $hash
 ///
 /// * Linked map: `Foo: linked_map hasher($hash) type => type`: Implements the
-///   [`StorageLinkedMap`](../srml_support/storage/trait.StorageLinkedMap.html) trait using the
-///   [`StorageLinkedMap generator`](../srml_support/storage/generator/trait.StorageLinkedMap.html).
+///   [`StorageLinkedMap`](../paint_support/storage/trait.StorageLinkedMap.html) trait using the
+///   [`StorageLinkedMap generator`](../paint_support/storage/generator/trait.StorageLinkedMap.html).
 ///
 ///   `$hash` representing a choice of hashing algorithms available in the
-///   [`Hashable`](../srml_support/trait.Hashable.html) trait.
+///   [`Hashable`](../paint_support/trait.Hashable.html) trait.
 ///
 ///   `hasher($hash)` is optional and its default is `blake2_256`. One should use another hasher
 ///   with care, see generator documentation.
@@ -91,11 +91,11 @@ use proc_macro::TokenStream;
 ///   is implemented for the storage linked map type as well.
 ///
 /// * Double map: `Foo: double_map hasher($hash1) u32, $hash2(u32) => u32`: Implements the
-///   [`StorageDoubleMap`](../srml_support/storage/trait.StorageDoubleMap.html) trait using the
-///   [`StorageDoubleMap generator`](../srml_support/storage/generator/trait.StorageDoubleMap.html).
+///   [`StorageDoubleMap`](../paint_support/storage/trait.StorageDoubleMap.html) trait using the
+///   [`StorageDoubleMap generator`](../paint_support/storage/generator/trait.StorageDoubleMap.html).
 ///
 ///   `$hash1` and `$hash2` representing choices of hashing algorithms available in the
-///   [`Hashable`](../srml_support/trait.Hashable.html) trait. They must be choosen with care, see
+///   [`Hashable`](../paint_support/trait.Hashable.html) trait. They must be choosen with care, see
 ///   generator documentation.
 ///
 ///   `hasher($hash)` is optional and its default is `blake2_256`.
diff --git a/srml/support/procedural/src/storage/genesis_config/builder_def.rs b/paint/support/procedural/src/storage/genesis_config/builder_def.rs
similarity index 98%
rename from srml/support/procedural/src/storage/genesis_config/builder_def.rs
rename to paint/support/procedural/src/storage/genesis_config/builder_def.rs
index fc425e4a6d532..12694e1f0610e 100644
--- a/srml/support/procedural/src/storage/genesis_config/builder_def.rs
+++ b/paint/support/procedural/src/storage/genesis_config/builder_def.rs
@@ -16,7 +16,7 @@
 
 //! Builder logic definition used to build genesis storage.
 
-use srml_support_procedural_tools::syn_ext as ext;
+use paint_support_procedural_tools::syn_ext as ext;
 use proc_macro2::TokenStream;
 use syn::spanned::Spanned;
 use quote::{quote, quote_spanned};
diff --git a/srml/support/procedural/src/storage/genesis_config/genesis_config_def.rs b/paint/support/procedural/src/storage/genesis_config/genesis_config_def.rs
similarity index 98%
rename from srml/support/procedural/src/storage/genesis_config/genesis_config_def.rs
rename to paint/support/procedural/src/storage/genesis_config/genesis_config_def.rs
index 4bf665de71fa6..b63c2993b25f6 100644
--- a/srml/support/procedural/src/storage/genesis_config/genesis_config_def.rs
+++ b/paint/support/procedural/src/storage/genesis_config/genesis_config_def.rs
@@ -16,7 +16,7 @@
 
 //! Genesis config defintion.
 
-use srml_support_procedural_tools::syn_ext as ext;
+use paint_support_procedural_tools::syn_ext as ext;
 use proc_macro2::TokenStream;
 use syn::{spanned::Spanned, parse_quote};
 use quote::quote;
diff --git a/srml/support/procedural/src/storage/genesis_config/mod.rs b/paint/support/procedural/src/storage/genesis_config/mod.rs
similarity index 100%
rename from srml/support/procedural/src/storage/genesis_config/mod.rs
rename to paint/support/procedural/src/storage/genesis_config/mod.rs
diff --git a/srml/support/procedural/src/storage/getters.rs b/paint/support/procedural/src/storage/getters.rs
similarity index 100%
rename from srml/support/procedural/src/storage/getters.rs
rename to paint/support/procedural/src/storage/getters.rs
diff --git a/srml/support/procedural/src/storage/instance_trait.rs b/paint/support/procedural/src/storage/instance_trait.rs
similarity index 100%
rename from srml/support/procedural/src/storage/instance_trait.rs
rename to paint/support/procedural/src/storage/instance_trait.rs
diff --git a/srml/support/procedural/src/storage/metadata.rs b/paint/support/procedural/src/storage/metadata.rs
similarity index 99%
rename from srml/support/procedural/src/storage/metadata.rs
rename to paint/support/procedural/src/storage/metadata.rs
index f81da84c74c66..e02e02c3ce875 100644
--- a/srml/support/procedural/src/storage/metadata.rs
+++ b/paint/support/procedural/src/storage/metadata.rs
@@ -16,7 +16,7 @@
 
 //! Implementation of `storage_metadata` on module structure, used by construct_runtime.
 
-use srml_support_procedural_tools::clean_type_string;
+use paint_support_procedural_tools::clean_type_string;
 use proc_macro2::TokenStream;
 use quote::quote;
 use super::{DeclStorageDefExt, StorageLineDefExt, StorageLineTypeDef};
diff --git a/srml/support/procedural/src/storage/mod.rs b/paint/support/procedural/src/storage/mod.rs
similarity index 99%
rename from srml/support/procedural/src/storage/mod.rs
rename to paint/support/procedural/src/storage/mod.rs
index bdbef49d2776a..ca03f6d3d5626 100644
--- a/srml/support/procedural/src/storage/mod.rs
+++ b/paint/support/procedural/src/storage/mod.rs
@@ -25,7 +25,7 @@ mod instance_trait;
 mod genesis_config;
 
 use quote::quote;
-use srml_support_procedural_tools::{
+use paint_support_procedural_tools::{
 	generate_crate_access, generate_hidden_includes, syn_ext as ext
 };
 
@@ -403,8 +403,8 @@ pub fn decl_storage_impl(input: proc_macro::TokenStream) -> proc_macro::TokenStr
 	let hidden_crate_name = def_ext.hidden_crate.as_ref().map(|i| i.to_string())
 		.unwrap_or_else(|| "decl_storage".to_string());
 
-	let scrate = generate_crate_access(&hidden_crate_name, "srml-support");
-	let scrate_decl = generate_hidden_includes(&hidden_crate_name, "srml-support");
+	let scrate = generate_crate_access(&hidden_crate_name, "paint-support");
+	let scrate_decl = generate_hidden_includes(&hidden_crate_name, "paint-support");
 
 	let store_trait = store_trait::decl_and_impl(&def_ext);
 	let getters = getters::impl_getters(&scrate, &def_ext);
diff --git a/srml/support/procedural/src/storage/parse.rs b/paint/support/procedural/src/storage/parse.rs
similarity index 99%
rename from srml/support/procedural/src/storage/parse.rs
rename to paint/support/procedural/src/storage/parse.rs
index e428fbe24f295..a680d5e9ee8b2 100644
--- a/srml/support/procedural/src/storage/parse.rs
+++ b/paint/support/procedural/src/storage/parse.rs
@@ -16,7 +16,7 @@
 
 //! Parsing of decl_storage input.
 
-use srml_support_procedural_tools::{ToTokens, Parse, syn_ext as ext};
+use paint_support_procedural_tools::{ToTokens, Parse, syn_ext as ext};
 use syn::{Ident, Token, spanned::Spanned};
 
 mod keyword {
diff --git a/srml/support/procedural/src/storage/storage_struct.rs b/paint/support/procedural/src/storage/storage_struct.rs
similarity index 100%
rename from srml/support/procedural/src/storage/storage_struct.rs
rename to paint/support/procedural/src/storage/storage_struct.rs
diff --git a/srml/support/procedural/src/storage/store_trait.rs b/paint/support/procedural/src/storage/store_trait.rs
similarity index 100%
rename from srml/support/procedural/src/storage/store_trait.rs
rename to paint/support/procedural/src/storage/store_trait.rs
diff --git a/srml/support/procedural/tools/Cargo.toml b/paint/support/procedural/tools/Cargo.toml
similarity index 59%
rename from srml/support/procedural/tools/Cargo.toml
rename to paint/support/procedural/tools/Cargo.toml
index 4c5726c202521..7fb906b6ffcca 100644
--- a/srml/support/procedural/tools/Cargo.toml
+++ b/paint/support/procedural/tools/Cargo.toml
@@ -1,11 +1,11 @@
 [package]
-name = "srml-support-procedural-tools"
+name = "paint-support-procedural-tools"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
 
 [dependencies]
-srml-support-procedural-tools-derive = { package = "srml-support-procedural-tools-derive", path = "./derive" }
+paint-support-procedural-tools-derive = { package = "paint-support-procedural-tools-derive", path = "./derive" }
 proc-macro2 = "1.0.6"
 quote = "1.0.2"
 syn = { version = "1.0.7", features = ["full"] }
diff --git a/srml/support/procedural/tools/derive/Cargo.toml b/paint/support/procedural/tools/derive/Cargo.toml
similarity index 86%
rename from srml/support/procedural/tools/derive/Cargo.toml
rename to paint/support/procedural/tools/derive/Cargo.toml
index acc0c1b1d3367..6b81ee829d1cb 100644
--- a/srml/support/procedural/tools/derive/Cargo.toml
+++ b/paint/support/procedural/tools/derive/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-support-procedural-tools-derive"
+name = "paint-support-procedural-tools-derive"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
diff --git a/srml/support/procedural/tools/derive/src/lib.rs b/paint/support/procedural/tools/derive/src/lib.rs
similarity index 100%
rename from srml/support/procedural/tools/derive/src/lib.rs
rename to paint/support/procedural/tools/derive/src/lib.rs
diff --git a/srml/support/procedural/tools/src/lib.rs b/paint/support/procedural/tools/src/lib.rs
similarity index 94%
rename from srml/support/procedural/tools/src/lib.rs
rename to paint/support/procedural/tools/src/lib.rs
index 2b08104ca71ba..d76ef24f19d7e 100644
--- a/srml/support/procedural/tools/src/lib.rs
+++ b/paint/support/procedural/tools/src/lib.rs
@@ -19,7 +19,7 @@
 // end::description[]
 
 // reexport proc macros
-pub use srml_support_procedural_tools_derive::*;
+pub use paint_support_procedural_tools_derive::*;
 
 use proc_macro_crate::crate_name;
 use syn::parse::Error;
@@ -35,10 +35,10 @@ fn generate_hidden_includes_mod_name(unique_id: &str) -> Ident {
 	Ident::new(&format!("sr_api_hidden_includes_{}", unique_id), Span::call_site())
 }
 
-/// Generates the access to the `srml-support` crate.
+/// Generates the access to the `paint-support` crate.
 pub fn generate_crate_access(unique_id: &str, def_crate: &str) -> TokenStream {
 	if std::env::var("CARGO_PKG_NAME").unwrap() == def_crate {
-		quote::quote!( srml_support )
+		quote::quote!( paint_support )
 	} else {
 		let mod_name = generate_hidden_includes_mod_name(unique_id);
 		quote::quote!( self::#mod_name::hidden_include )
diff --git a/srml/support/procedural/tools/src/syn_ext.rs b/paint/support/procedural/tools/src/syn_ext.rs
similarity index 99%
rename from srml/support/procedural/tools/src/syn_ext.rs
rename to paint/support/procedural/tools/src/syn_ext.rs
index 39cfb0ee1cf2f..a3f6d52c4c643 100644
--- a/srml/support/procedural/tools/src/syn_ext.rs
+++ b/paint/support/procedural/tools/src/syn_ext.rs
@@ -22,7 +22,7 @@ use syn::{visit::{Visit, self}, parse::{Parse, ParseStream, Result}, Ident};
 use proc_macro2::{TokenStream, TokenTree};
 use quote::ToTokens;
 use std::iter::once;
-use srml_support_procedural_tools_derive::{ToTokens, Parse};
+use paint_support_procedural_tools_derive::{ToTokens, Parse};
 
 /// stop parsing here getting remaining token as content
 /// Warn duplicate stream (part of)
diff --git a/srml/support/rpc/Cargo.toml b/paint/support/rpc/Cargo.toml
similarity index 58%
rename from srml/support/rpc/Cargo.toml
rename to paint/support/rpc/Cargo.toml
index fca9634ef1fba..17533950102b2 100644
--- a/srml/support/rpc/Cargo.toml
+++ b/paint/support/rpc/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-support-rpc"
+name = "paint-support-rpc"
 version = "2.0.0"
 authors = ["Parity Technologies ", "Andrew Dirksen "]
 edition = "2018"
@@ -10,10 +10,10 @@ jsonrpc-client-transports = "14"
 jsonrpc-core = "14"
 parity-scale-codec = "1"
 serde = "1"
-srml-support = { path = "../" }
-substrate-primitives-storage = { path = "../../../core/primitives/storage" }
-substrate-rpc-api = { path = "../../../core/rpc/api" }
+paint-support = { path = "../" }
+substrate-primitives-storage = { path = "../../../primitives/core/storage" }
+substrate-rpc-api = { path = "../../../client/rpc/api" }
 
 [dev-dependencies]
-srml-system = { path = "../../system" }
+paint-system = { path = "../../system" }
 tokio = "0.1"
diff --git a/srml/support/rpc/src/lib.rs b/paint/support/rpc/src/lib.rs
similarity index 90%
rename from srml/support/rpc/src/lib.rs
rename to paint/support/rpc/src/lib.rs
index f2a6182cd239f..a09fbd694c872 100644
--- a/srml/support/rpc/src/lib.rs
+++ b/paint/support/rpc/src/lib.rs
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Substrate.  If not, see .
 
-//! Combines [substrate_rpc_api::state::StateClient] with [srml_support::storage::generator] traits
+//! Combines [substrate_rpc_api::state::StateClient] with [paint_support::storage::generator] traits
 //! to provide strongly typed chain state queries over rpc.
 
 #![warn(missing_docs)]
@@ -24,7 +24,7 @@ use futures::compat::Future01CompatExt;
 use jsonrpc_client_transports::RpcError;
 use parity_scale_codec::{DecodeAll, FullCodec, FullEncode};
 use serde::{de::DeserializeOwned, Serialize};
-use srml_support::storage::generator::{
+use paint_support::storage::generator::{
 	StorageDoubleMap, StorageLinkedMap, StorageMap, StorageValue
 };
 use substrate_primitives_storage::{StorageData, StorageKey};
@@ -39,13 +39,13 @@ use substrate_rpc_api::state::StateClient;
 /// # use jsonrpc_client_transports::RpcError;
 /// # use jsonrpc_client_transports::transports::http;
 /// # use parity_scale_codec::Encode;
-/// # use srml_support::{decl_storage, decl_module};
-/// # use srml_support_rpc::StorageQuery;
-/// # use srml_system::Trait;
+/// # use paint_support::{decl_storage, decl_module};
+/// # use paint_support_rpc::StorageQuery;
+/// # use paint_system::Trait;
 /// # use substrate_rpc_api::state::StateClient;
 /// #
-/// # // Hash would normally be ::Hash, but we don't have
-/// # // srml_system::Trait implemented for TestRuntime. Here we just pretend.
+/// # // Hash would normally be ::Hash, but we don't have
+/// # // paint_system::Trait implemented for TestRuntime. Here we just pretend.
 /// # type Hash = ();
 /// #
 /// # fn main() -> Result<(), RpcError> {
@@ -134,7 +134,7 @@ impl StorageQuery {
 
 	/// Send this query over RPC, await the typed result.
 	///
-	/// Hash should be ::Hash.
+	/// Hash should be ::Hash.
 	///
 	/// # Arguments
 	///
diff --git a/srml/support/src/debug.rs b/paint/support/src/debug.rs
similarity index 98%
rename from srml/support/src/debug.rs
rename to paint/support/src/debug.rs
index ee187edb396d8..8904d3defef63 100644
--- a/srml/support/src/debug.rs
+++ b/paint/support/src/debug.rs
@@ -35,7 +35,7 @@
 //! that WASM debug formatting of structs will be empty.
 //!
 //! ```rust,no_run
-//!	use srml_support::debug;
+//!	use paint_support::debug;
 //!
 //! #[derive(primitives::RuntimeDebug)]
 //!	struct MyStruct {
@@ -66,7 +66,7 @@
 //! logs conditionally and strips out logs in WASM.
 //!
 //! ```rust,no_run
-//!	use srml_support::debug::native;
+//!	use paint_support::debug::native;
 //!
 //! #[derive(primitives::RuntimeDebug)]
 //!	struct MyStruct {
@@ -124,7 +124,7 @@ pub mod native {
 /// # Example
 ///
 /// ```
-/// srml_support::runtime_print!("my value is {}", 3);
+/// paint_support::runtime_print!("my value is {}", 3);
 /// ```
 #[macro_export]
 macro_rules! runtime_print {
diff --git a/srml/support/src/dispatch.rs b/paint/support/src/dispatch.rs
similarity index 98%
rename from srml/support/src/dispatch.rs
rename to paint/support/src/dispatch.rs
index 6929838811b7a..d985ce80cd62d 100644
--- a/srml/support/src/dispatch.rs
+++ b/paint/support/src/dispatch.rs
@@ -19,7 +19,7 @@
 
 pub use crate::rstd::{result, fmt, prelude::{Vec, Clone, Eq, PartialEq}, marker};
 pub use crate::codec::{Codec, EncodeLike, Decode, Encode, Input, Output, HasCompact, EncodeAsRef};
-pub use srml_metadata::{
+pub use paint_metadata::{
 	FunctionMetadata, DecodeDifferent, DecodeDifferentArray, FunctionArgumentMetadata,
 	ModuleConstantMetadata, DefaultByte, DefaultByteGetter, ModuleErrorMetadata, ErrorMetadata
 };
@@ -57,9 +57,9 @@ impl Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
 ///
 /// ```
 /// # #[macro_use]
-/// # extern crate srml_support;
-/// # use srml_support::dispatch::Result;
-/// # use srml_system::{self as system, Trait, ensure_signed};
+/// # extern crate paint_support;
+/// # use paint_support::dispatch::Result;
+/// # use paint_system::{self as system, Trait, ensure_signed};
 /// decl_module! {
 /// 	pub struct Module for enum Call where origin: T::Origin {
 ///
@@ -97,9 +97,9 @@ impl Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
 ///
 /// ```
 /// # #[macro_use]
-/// # extern crate srml_support;
-/// # use srml_support::dispatch::Result;
-/// # use srml_system::{self as system, Trait, ensure_signed};
+/// # extern crate paint_support;
+/// # use paint_support::dispatch::Result;
+/// # use paint_system::{self as system, Trait, ensure_signed};
 /// decl_module! {
 /// 	pub struct Module for enum Call where origin: T::Origin {
 ///
@@ -122,9 +122,9 @@ impl Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
 ///
 /// ```
 /// # #[macro_use]
-/// # extern crate srml_support;
-/// # use srml_support::dispatch::Result;
-/// # use srml_system::{self as system, Trait, ensure_signed, ensure_root};
+/// # extern crate paint_support;
+/// # use paint_support::dispatch::Result;
+/// # use paint_system::{self as system, Trait, ensure_signed, ensure_root};
 /// decl_module! {
 /// 	pub struct Module for enum Call where origin: T::Origin {
 ///			fn my_privileged_function(origin) -> Result {
@@ -140,15 +140,15 @@ impl Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
 /// ## Multiple Module Instances Example
 ///
 /// A Substrate module can be built such that multiple instances of the same module can be used within a single
-/// runtime. For example, the [Balances module](../srml_balances/index.html) can be added multiple times to your
+/// runtime. For example, the [Balances module](../paint_balances/index.html) can be added multiple times to your
 /// runtime in order to support multiple, independent currencies for your blockchain. Here is an example of how
 /// you would declare such a module using the `decl_module!` macro:
 ///
 /// ```
 /// # #[macro_use]
-/// # extern crate srml_support;
-/// # use srml_support::dispatch::Result;
-/// # use srml_system::{self as system, ensure_signed};
+/// # extern crate paint_support;
+/// # use paint_support::dispatch::Result;
+/// # use paint_system::{self as system, ensure_signed};
 /// # pub struct DefaultInstance;
 /// # pub trait Instance {}
 /// # impl Instance for DefaultInstance {}
@@ -174,9 +174,9 @@ impl Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
 ///
 /// ```
 /// # #[macro_use]
-/// # extern crate srml_support;
-/// # use srml_support::dispatch::Result;
-/// # use srml_system::{self as system, ensure_signed};
+/// # extern crate paint_support;
+/// # use paint_support::dispatch::Result;
+/// # use paint_system::{self as system, ensure_signed};
 /// pub trait Trait: system::Trait where Self::AccountId: From {}
 ///
 /// decl_module! {
@@ -192,7 +192,7 @@ impl Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
 /// The following are reserved function signatures:
 ///
 /// * `deposit_event`: Helper function for depositing an [event](https://docs.substrate.dev/docs/event-enum).
-/// The default behavior is to call `deposit_event` from the [System module](../srml_system/index.html).
+/// The default behavior is to call `deposit_event` from the [System module](../paint_system/index.html).
 /// However, you can write your own implementation for events in your runtime. To use the default behavior,
 /// add `fn deposit_event() = default;` to your `Module`.
 ///
diff --git a/srml/support/src/error.rs b/paint/support/src/error.rs
similarity index 97%
rename from srml/support/src/error.rs
rename to paint/support/src/error.rs
index 9aa13713daafb..4b2e0a232d4d3 100644
--- a/srml/support/src/error.rs
+++ b/paint/support/src/error.rs
@@ -18,7 +18,7 @@
 
 #[doc(hidden)]
 pub use sr_primitives::traits::LookupError;
-pub use srml_metadata::{ModuleErrorMetadata, ErrorMetadata, DecodeDifferent};
+pub use paint_metadata::{ModuleErrorMetadata, ErrorMetadata, DecodeDifferent};
 
 /// Declare an error type for a runtime module.
 ///
@@ -31,7 +31,7 @@ pub use srml_metadata::{ModuleErrorMetadata, ErrorMetadata, DecodeDifferent};
 /// # Usage
 ///
 /// ```
-/// # use srml_support::decl_error;
+/// # use paint_support::decl_error;
 /// decl_error! {
 ///     /// Errors that can occur in my module.
 ///     pub enum MyError {
diff --git a/srml/support/src/event.rs b/paint/support/src/event.rs
similarity index 98%
rename from srml/support/src/event.rs
rename to paint/support/src/event.rs
index 3411c93922e2b..139db1f609b9a 100644
--- a/srml/support/src/event.rs
+++ b/paint/support/src/event.rs
@@ -17,14 +17,14 @@
 // You should have received a copy of the GNU General Public License
 // along with Substrate.  If not, see .
 
-pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEncode};
+pub use paint_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEncode};
 
 /// Implement the `Event` for a module.
 ///
 /// # Simple Event Example:
 ///
 /// ```rust
-/// srml_support::decl_event!(
+/// paint_support::decl_event!(
 ///    pub enum Event {
 ///       Success,
 ///       Failure(String),
@@ -44,7 +44,7 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
 ///
 /// mod event1 {
 ///     // Event that specifies the generic parameter explicitly (`Balance`).
-///     srml_support::decl_event!(
+///     paint_support::decl_event!(
 ///        pub enum Event where Balance = ::Balance {
 ///           Message(Balance),
 ///        }
@@ -55,7 +55,7 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
 ///     // Event that uses the generic parameter `Balance`.
 ///     // If no name for the generic parameter is specified explicitly,
 ///     // the name will be taken from the type name of the trait.
-///     srml_support::decl_event!(
+///     paint_support::decl_event!(
 ///        pub enum Event where ::Balance {
 ///           Message(Balance),
 ///        }
@@ -64,7 +64,7 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
 ///
 /// mod event3 {
 ///     // And we even support declaring multiple generic parameters!
-///     srml_support::decl_event!(
+///     paint_support::decl_event!(
 ///        pub enum Event where ::Balance, ::Token {
 ///           Message(Balance, Token),
 ///        }
@@ -88,7 +88,7 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
 /// }
 ///
 /// // For module with instances, DefaultInstance is optional
-/// srml_support::decl_event!(
+/// paint_support::decl_event!(
 ///    pub enum Event where
 ///       ::Balance,
 ///       ::Token
diff --git a/srml/support/src/hash.rs b/paint/support/src/hash.rs
similarity index 97%
rename from srml/support/src/hash.rs
rename to paint/support/src/hash.rs
index c2b63a84db346..122fefab70e96 100644
--- a/srml/support/src/hash.rs
+++ b/paint/support/src/hash.rs
@@ -20,7 +20,7 @@ use codec::Codec;
 use rstd::prelude::Vec;
 use runtime_io::hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256};
 
-// This trait must be kept coherent with srml-support-procedural HasherKind usage
+// This trait must be kept coherent with paint-support-procedural HasherKind usage
 pub trait Hashable: Sized {
 	fn blake2_128(&self) -> [u8; 16];
 	fn blake2_256(&self) -> [u8; 32];
diff --git a/srml/support/src/inherent.rs b/paint/support/src/inherent.rs
similarity index 100%
rename from srml/support/src/inherent.rs
rename to paint/support/src/inherent.rs
diff --git a/srml/support/src/lib.rs b/paint/support/src/lib.rs
similarity index 98%
rename from srml/support/src/lib.rs
rename to paint/support/src/lib.rs
index ed08ce5f41e9e..37dd2b4f9d47a 100644
--- a/srml/support/src/lib.rs
+++ b/paint/support/src/lib.rs
@@ -18,8 +18,8 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-/// Export ourself as `srml_support` to make tests happy.
-extern crate self as srml_support;
+/// Export ourself as `paint_support` to make tests happy.
+extern crate self as paint_support;
 
 #[macro_use]
 extern crate bitmask;
@@ -113,7 +113,7 @@ macro_rules! parameter_types {
 }
 
 #[doc(inline)]
-pub use srml_support_procedural::decl_storage;
+pub use paint_support_procedural::decl_storage;
 
 /// Return Err of the expression: `return Err($expression);`.
 ///
@@ -190,8 +190,8 @@ macro_rules! assert_ok {
 ///
 /// ```rust
 /// #[macro_use]
-/// # extern crate srml_support;
-/// # use srml_support::{assert_eq_uvec};
+/// # extern crate paint_support;
+/// # use paint_support::{assert_eq_uvec};
 /// # fn main() {
 /// assert_eq_uvec!(vec![1,2], vec![2,1]);
 /// # }
@@ -199,8 +199,8 @@ macro_rules! assert_ok {
 ///
 /// ```rust,should_panic
 /// #[macro_use]
-/// # extern crate srml_support;
-/// # use srml_support::{assert_eq_uvec};
+/// # extern crate paint_support;
+/// # use paint_support::{assert_eq_uvec};
 /// # fn main() {
 /// assert_eq_uvec!(vec![1,2,3], vec![2,1]);
 /// # }
@@ -238,7 +238,7 @@ pub use serde::{Serialize, Deserialize};
 mod tests {
 	use super::*;
 	use codec::{Codec, EncodeLike};
-	use srml_metadata::{
+	use paint_metadata::{
 		DecodeDifferent, StorageEntryMetadata, StorageMetadata, StorageEntryType,
 		StorageEntryModifier, DefaultByteGetter, StorageHasher,
 	};
diff --git a/srml/support/src/metadata.rs b/paint/support/src/metadata.rs
similarity index 98%
rename from srml/support/src/metadata.rs
rename to paint/support/src/metadata.rs
index a223a14f9e405..f55cddea9914e 100644
--- a/srml/support/src/metadata.rs
+++ b/paint/support/src/metadata.rs
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Substrate.  If not, see .
 
-pub use srml_metadata::{
+pub use paint_metadata::{
 	DecodeDifferent, FnEncode, RuntimeMetadata, ModuleMetadata, RuntimeMetadataLastVersion,
 	DefaultByteGetter, RuntimeMetadataPrefixed, StorageEntryMetadata, StorageMetadata,
 	StorageEntryType, StorageEntryModifier, DefaultByte, StorageHasher, ModuleErrorMetadata
@@ -29,11 +29,11 @@ pub use srml_metadata::{
 ///#        type Origin;
 ///#        type BlockNumber;
 ///#    }
-///#    srml_support::decl_module! {
+///#    paint_support::decl_module! {
 ///#        pub struct Module for enum Call where origin: T::Origin {}
 ///#    }
 ///#
-///#    srml_support::decl_storage! {
+///#    paint_support::decl_storage! {
 ///#        trait Store for Module as TestStorage {}
 ///#    }
 ///# }
@@ -45,7 +45,7 @@ pub use srml_metadata::{
 ///# }
 ///
 /// struct Runtime;
-/// srml_support::impl_runtime_metadata! {
+/// paint_support::impl_runtime_metadata! {
 ///     for Runtime with modules
 ///         module0::Module as Module0 with,
 ///         module1::Module as Module1 with,
@@ -229,7 +229,7 @@ macro_rules! __runtime_modules_to_metadata_calls_storage {
 #[allow(dead_code)]
 mod tests {
 	use super::*;
-	use srml_metadata::{
+	use paint_metadata::{
 		EventMetadata, StorageEntryModifier, StorageEntryType, FunctionMetadata, StorageEntryMetadata,
 		ModuleMetadata, RuntimeMetadataPrefixed, DefaultByte, ModuleConstantMetadata, DefaultByteGetter,
 		ErrorMetadata,
diff --git a/srml/support/src/origin.rs b/paint/support/src/origin.rs
similarity index 100%
rename from srml/support/src/origin.rs
rename to paint/support/src/origin.rs
diff --git a/srml/support/src/runtime.rs b/paint/support/src/runtime.rs
similarity index 100%
rename from srml/support/src/runtime.rs
rename to paint/support/src/runtime.rs
diff --git a/srml/support/src/storage/child.rs b/paint/support/src/storage/child.rs
similarity index 100%
rename from srml/support/src/storage/child.rs
rename to paint/support/src/storage/child.rs
diff --git a/srml/support/src/storage/generator/double_map.rs b/paint/support/src/storage/generator/double_map.rs
similarity index 100%
rename from srml/support/src/storage/generator/double_map.rs
rename to paint/support/src/storage/generator/double_map.rs
diff --git a/srml/support/src/storage/generator/linked_map.rs b/paint/support/src/storage/generator/linked_map.rs
similarity index 100%
rename from srml/support/src/storage/generator/linked_map.rs
rename to paint/support/src/storage/generator/linked_map.rs
diff --git a/srml/support/src/storage/generator/map.rs b/paint/support/src/storage/generator/map.rs
similarity index 100%
rename from srml/support/src/storage/generator/map.rs
rename to paint/support/src/storage/generator/map.rs
diff --git a/srml/support/src/storage/generator/mod.rs b/paint/support/src/storage/generator/mod.rs
similarity index 100%
rename from srml/support/src/storage/generator/mod.rs
rename to paint/support/src/storage/generator/mod.rs
diff --git a/srml/support/src/storage/generator/value.rs b/paint/support/src/storage/generator/value.rs
similarity index 100%
rename from srml/support/src/storage/generator/value.rs
rename to paint/support/src/storage/generator/value.rs
diff --git a/srml/support/src/storage/hashed.rs b/paint/support/src/storage/hashed.rs
similarity index 100%
rename from srml/support/src/storage/hashed.rs
rename to paint/support/src/storage/hashed.rs
diff --git a/srml/support/src/storage/mod.rs b/paint/support/src/storage/mod.rs
similarity index 100%
rename from srml/support/src/storage/mod.rs
rename to paint/support/src/storage/mod.rs
diff --git a/srml/support/src/storage/unhashed.rs b/paint/support/src/storage/unhashed.rs
similarity index 100%
rename from srml/support/src/storage/unhashed.rs
rename to paint/support/src/storage/unhashed.rs
diff --git a/srml/support/src/traits.rs b/paint/support/src/traits.rs
similarity index 99%
rename from srml/support/src/traits.rs
rename to paint/support/src/traits.rs
index c6572a3f94168..b723860739d3d 100644
--- a/srml/support/src/traits.rs
+++ b/paint/support/src/traits.rs
@@ -631,7 +631,7 @@ impl WithdrawReasons {
 	/// Choose all variants except for `one`.
 	///
 	/// ```rust
-	/// # use srml_support::traits::{WithdrawReason, WithdrawReasons};
+	/// # use paint_support::traits::{WithdrawReason, WithdrawReasons};
 	/// # fn main() {
 	/// assert_eq!(
 	/// 	WithdrawReason::Fee | WithdrawReason::Transfer | WithdrawReason::Reserve | WithdrawReason::Tip,
diff --git a/srml/support/src/unsigned.rs b/paint/support/src/unsigned.rs
similarity index 94%
rename from srml/support/src/unsigned.rs
rename to paint/support/src/unsigned.rs
index 282f3ac8ae9a8..690ea4947129e 100644
--- a/srml/support/src/unsigned.rs
+++ b/paint/support/src/unsigned.rs
@@ -32,10 +32,10 @@ pub use crate::sr_primitives::ApplyError;
 /// # mod timestamp {
 /// # 	pub struct Module;
 /// #
-/// # 	impl srml_support::unsigned::ValidateUnsigned for Module {
+/// # 	impl paint_support::unsigned::ValidateUnsigned for Module {
 /// # 		type Call = Call;
 /// #
-/// # 		fn validate_unsigned(call: &Self::Call) -> srml_support::unsigned::TransactionValidity {
+/// # 		fn validate_unsigned(call: &Self::Call) -> paint_support::unsigned::TransactionValidity {
 /// # 			unimplemented!();
 /// # 		}
 /// # 	}
@@ -53,7 +53,7 @@ pub use crate::sr_primitives::ApplyError;
 /// # #[allow(unused)]
 /// pub struct Runtime;
 ///
-/// srml_support::impl_outer_validate_unsigned! {
+/// paint_support::impl_outer_validate_unsigned! {
 /// 	impl ValidateUnsigned for Runtime {
 /// 		Timestamp
 /// 	}
diff --git a/srml/support/test/Cargo.toml b/paint/support/test/Cargo.toml
similarity index 59%
rename from srml/support/test/Cargo.toml
rename to paint/support/test/Cargo.toml
index cbca8a859c187..19ed73566090e 100644
--- a/srml/support/test/Cargo.toml
+++ b/paint/support/test/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-support-test"
+name = "paint-support-test"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,12 +7,12 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", default-features = false, features = ["derive"] }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-runtime-io ={ package = "sr-io", path = "../../../core/sr-io", default-features = false }
-state-machine ={ package = "substrate-state-machine", path = "../../../core/state-machine", optional = true }
-support = { package = "srml-support", version = "2", path = "../", default-features = false }
-inherents = { package = "substrate-inherents", path = "../../../core/inherents", default-features = false }
-sr-primitives = { package = "sr-primitives", path = "../../../core/sr-primitives", default-features = false }
-primitives = { package = "substrate-primitives", path = "../../../core/primitives", default-features = false }
+runtime-io ={ package = "sr-io", path = "../../../primitives/sr-io", default-features = false }
+state-machine ={ package = "substrate-state-machine", path = "../../../primitives/state-machine", optional = true }
+support = { package = "paint-support", version = "2", path = "../", default-features = false }
+inherents = { package = "substrate-inherents", path = "../../../primitives/inherents", default-features = false }
+sr-primitives = { package = "sr-primitives", path = "../../../primitives/sr-primitives", default-features = false }
+primitives = { package = "substrate-primitives", path = "../../../primitives/core", default-features = false }
 trybuild = "1.0.17"
 pretty_assertions = "0.6.1"
 
diff --git a/srml/support/test/src/lib.rs b/paint/support/test/src/lib.rs
similarity index 90%
rename from srml/support/test/src/lib.rs
rename to paint/support/test/src/lib.rs
index b65bc43cbb5a8..fa5c8cf1ea31d 100644
--- a/srml/support/test/src/lib.rs
+++ b/paint/support/test/src/lib.rs
@@ -14,5 +14,5 @@
 // You should have received a copy of the GNU General Public License
 // along with Substrate.  If not, see .
 
-//! Test crate for srml_support. Allow to make use of `support::decl_storage`.
+//! Test crate for paint_support. Allow to make use of `support::decl_storage`.
 //! See tests directory.
diff --git a/srml/support/test/tests/decl_storage.rs b/paint/support/test/tests/decl_storage.rs
similarity index 100%
rename from srml/support/test/tests/decl_storage.rs
rename to paint/support/test/tests/decl_storage.rs
diff --git a/srml/support/test/tests/decl_storage_ui.rs b/paint/support/test/tests/decl_storage_ui.rs
similarity index 100%
rename from srml/support/test/tests/decl_storage_ui.rs
rename to paint/support/test/tests/decl_storage_ui.rs
diff --git a/srml/support/test/tests/decl_storage_ui/config_duplicate.rs b/paint/support/test/tests/decl_storage_ui/config_duplicate.rs
similarity index 100%
rename from srml/support/test/tests/decl_storage_ui/config_duplicate.rs
rename to paint/support/test/tests/decl_storage_ui/config_duplicate.rs
diff --git a/srml/support/test/tests/decl_storage_ui/config_duplicate.stderr b/paint/support/test/tests/decl_storage_ui/config_duplicate.stderr
similarity index 100%
rename from srml/support/test/tests/decl_storage_ui/config_duplicate.stderr
rename to paint/support/test/tests/decl_storage_ui/config_duplicate.stderr
diff --git a/srml/support/test/tests/decl_storage_ui/config_get_duplicate.rs b/paint/support/test/tests/decl_storage_ui/config_get_duplicate.rs
similarity index 100%
rename from srml/support/test/tests/decl_storage_ui/config_get_duplicate.rs
rename to paint/support/test/tests/decl_storage_ui/config_get_duplicate.rs
diff --git a/srml/support/test/tests/decl_storage_ui/config_get_duplicate.stderr b/paint/support/test/tests/decl_storage_ui/config_get_duplicate.stderr
similarity index 100%
rename from srml/support/test/tests/decl_storage_ui/config_get_duplicate.stderr
rename to paint/support/test/tests/decl_storage_ui/config_get_duplicate.stderr
diff --git a/srml/support/test/tests/decl_storage_ui/get_duplicate.rs b/paint/support/test/tests/decl_storage_ui/get_duplicate.rs
similarity index 100%
rename from srml/support/test/tests/decl_storage_ui/get_duplicate.rs
rename to paint/support/test/tests/decl_storage_ui/get_duplicate.rs
diff --git a/srml/support/test/tests/decl_storage_ui/get_duplicate.stderr b/paint/support/test/tests/decl_storage_ui/get_duplicate.stderr
similarity index 100%
rename from srml/support/test/tests/decl_storage_ui/get_duplicate.stderr
rename to paint/support/test/tests/decl_storage_ui/get_duplicate.stderr
diff --git a/srml/support/test/tests/final_keys.rs b/paint/support/test/tests/final_keys.rs
similarity index 100%
rename from srml/support/test/tests/final_keys.rs
rename to paint/support/test/tests/final_keys.rs
diff --git a/srml/support/test/tests/genesisconfig.rs b/paint/support/test/tests/genesisconfig.rs
similarity index 100%
rename from srml/support/test/tests/genesisconfig.rs
rename to paint/support/test/tests/genesisconfig.rs
diff --git a/srml/support/test/tests/instance.rs b/paint/support/test/tests/instance.rs
similarity index 100%
rename from srml/support/test/tests/instance.rs
rename to paint/support/test/tests/instance.rs
diff --git a/srml/support/test/tests/issue2219.rs b/paint/support/test/tests/issue2219.rs
similarity index 100%
rename from srml/support/test/tests/issue2219.rs
rename to paint/support/test/tests/issue2219.rs
diff --git a/srml/support/test/tests/reserved_keyword.rs b/paint/support/test/tests/reserved_keyword.rs
similarity index 100%
rename from srml/support/test/tests/reserved_keyword.rs
rename to paint/support/test/tests/reserved_keyword.rs
diff --git a/srml/support/test/tests/reserved_keyword/on_initialize.rs b/paint/support/test/tests/reserved_keyword/on_initialize.rs
similarity index 100%
rename from srml/support/test/tests/reserved_keyword/on_initialize.rs
rename to paint/support/test/tests/reserved_keyword/on_initialize.rs
diff --git a/srml/support/test/tests/reserved_keyword/on_initialize.stderr b/paint/support/test/tests/reserved_keyword/on_initialize.stderr
similarity index 100%
rename from srml/support/test/tests/reserved_keyword/on_initialize.stderr
rename to paint/support/test/tests/reserved_keyword/on_initialize.stderr
diff --git a/srml/support/test/tests/system.rs b/paint/support/test/tests/system.rs
similarity index 100%
rename from srml/support/test/tests/system.rs
rename to paint/support/test/tests/system.rs
diff --git a/srml/system/Cargo.toml b/paint/system/Cargo.toml
similarity index 63%
rename from srml/system/Cargo.toml
rename to paint/system/Cargo.toml
index 52570617a1b97..9fa98937b9d36 100644
--- a/srml/system/Cargo.toml
+++ b/paint/system/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-system"
+name = "paint-system"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -8,12 +8,12 @@ edition = "2018"
 serde = { version = "1.0.101", optional = true, features = ["derive"] }
 safe-mix = { version = "1.0.0", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-primitives = { package = "substrate-primitives",  path = "../../core/primitives", default-features = false }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-sr-version = { path = "../../core/sr-version", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+sr-version = { path = "../../primitives/sr-version", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
 impl-trait-for-tuples = "0.1.3"
 
 [dev-dependencies]
diff --git a/srml/system/benches/bench.rs b/paint/system/benches/bench.rs
similarity index 99%
rename from srml/system/benches/bench.rs
rename to paint/system/benches/bench.rs
index 6da02cf9c8cea..2ff794521d4e5 100644
--- a/srml/system/benches/bench.rs
+++ b/paint/system/benches/bench.rs
@@ -15,7 +15,7 @@
 // along with Substrate.  If not, see .
 
 use criterion::{Criterion, criterion_group, criterion_main, black_box};
-use srml_system as system;
+use paint_system as system;
 use support::{decl_module, decl_event, impl_outer_origin, impl_outer_event};
 use primitives::H256;
 use sr_primitives::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header};
diff --git a/srml/system/rpc/Cargo.toml b/paint/system/rpc/Cargo.toml
similarity index 61%
rename from srml/system/rpc/Cargo.toml
rename to paint/system/rpc/Cargo.toml
index e71e1f588a7ef..6f71b9af51b14 100644
--- a/srml/system/rpc/Cargo.toml
+++ b/paint/system/rpc/Cargo.toml
@@ -1,23 +1,23 @@
 [package]
-name = "srml-system-rpc"
+name = "paint-system-rpc"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
 
 [dependencies]
-client = { package = "substrate-client", path = "../../../core/client" }
+client = { package = "substrate-client", path = "../../../client/" }
 codec = { package = "parity-scale-codec", version = "1.0.0" }
 jsonrpc-core = "14.0.3"
 jsonrpc-core-client = "14.0.3"
 jsonrpc-derive = "14.0.3"
 log = "0.4.8"
 serde = { version = "1.0.101", features = ["derive"] }
-sr-primitives = { path = "../../../core/sr-primitives" }
-srml-system-rpc-runtime-api = { path = "./runtime-api" }
-substrate-primitives = { path = "../../../core/primitives" }
-transaction_pool = { package = "substrate-transaction-pool", path = "../../../core/transaction-pool" }
+sr-primitives = { path = "../../../primitives/sr-primitives" }
+paint-system-rpc-runtime-api = { path = "./runtime-api" }
+substrate-primitives = { path = "../../../primitives/core" }
+transaction_pool = { package = "substrate-transaction-pool", path = "../../../client/transaction-pool" }
 
 [dev-dependencies]
-test-client = { package = "substrate-test-runtime-client", path = "../../../core/test-runtime/client" }
+test-client = { package = "substrate-test-runtime-client", path = "../../../test/utils/runtime/client" }
 env_logger = "0.7.0"
 futures03 = { package = "futures-preview", version = "=0.3.0-alpha.19" }
diff --git a/srml/system/rpc/runtime-api/Cargo.toml b/paint/system/rpc/runtime-api/Cargo.toml
similarity index 70%
rename from srml/system/rpc/runtime-api/Cargo.toml
rename to paint/system/rpc/runtime-api/Cargo.toml
index 19a3ac10ce2fe..e0e90e79658ba 100644
--- a/srml/system/rpc/runtime-api/Cargo.toml
+++ b/paint/system/rpc/runtime-api/Cargo.toml
@@ -1,11 +1,11 @@
 [package]
-name = "srml-system-rpc-runtime-api"
+name = "paint-system-rpc-runtime-api"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
 
 [dependencies]
-sr-api = { path = "../../../../core/sr-api", default-features = false }
+sr-api = { path = "../../../../primitives/sr-api", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false  }
 
 [features]
diff --git a/srml/system/rpc/runtime-api/src/lib.rs b/paint/system/rpc/runtime-api/src/lib.rs
similarity index 100%
rename from srml/system/rpc/runtime-api/src/lib.rs
rename to paint/system/rpc/runtime-api/src/lib.rs
diff --git a/srml/system/rpc/src/lib.rs b/paint/system/rpc/src/lib.rs
similarity index 98%
rename from srml/system/rpc/src/lib.rs
rename to paint/system/rpc/src/lib.rs
index c6c0a658fba53..e89e9b7592cb8 100644
--- a/srml/system/rpc/src/lib.rs
+++ b/paint/system/rpc/src/lib.rs
@@ -29,7 +29,7 @@ use sr_primitives::{
 use substrate_primitives::hexdisplay::HexDisplay;
 use transaction_pool::txpool::{self, Pool};
 
-pub use srml_system_rpc_runtime_api::AccountNonceApi;
+pub use paint_system_rpc_runtime_api::AccountNonceApi;
 pub use self::gen_client::Client as SystemClient;
 
 /// System RPC methods.
diff --git a/srml/system/src/lib.rs b/paint/system/src/lib.rs
similarity index 99%
rename from srml/system/src/lib.rs
rename to paint/system/src/lib.rs
index 347e458490564..9a4bf2297a46f 100644
--- a/srml/system/src/lib.rs
+++ b/paint/system/src/lib.rs
@@ -69,7 +69,7 @@
 //!
 //! ```
 //! use support::{decl_module, dispatch::Result};
-//! use srml_system::{self as system, ensure_signed};
+//! use paint_system::{self as system, ensure_signed};
 //!
 //! pub trait Trait: system::Trait {}
 //!
diff --git a/srml/system/src/offchain.rs b/paint/system/src/offchain.rs
similarity index 100%
rename from srml/system/src/offchain.rs
rename to paint/system/src/offchain.rs
diff --git a/srml/timestamp/Cargo.toml b/paint/timestamp/Cargo.toml
similarity index 52%
rename from srml/timestamp/Cargo.toml
rename to paint/timestamp/Cargo.toml
index d8eab64f9f3d9..73485f96e12bb 100644
--- a/srml/timestamp/Cargo.toml
+++ b/paint/timestamp/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-timestamp"
+name = "paint-timestamp"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,16 +7,16 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", optional = true }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+inherents = { package = "substrate-inherents", path = "../../primitives/inherents", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
 impl-trait-for-tuples = "0.1.3"
 
 [dev-dependencies]
-runtime-io ={ package = "sr-io", path = "../../core/sr-io" }
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
 
 [features]
 default = ["std"]
diff --git a/srml/timestamp/src/lib.rs b/paint/timestamp/src/lib.rs
similarity index 99%
rename from srml/timestamp/src/lib.rs
rename to paint/timestamp/src/lib.rs
index 8271c6e0e5795..d6123e54a9b38 100644
--- a/srml/timestamp/src/lib.rs
+++ b/paint/timestamp/src/lib.rs
@@ -62,7 +62,7 @@
 //!
 //! ```
 //! use support::{decl_module, dispatch::Result};
-//! # use srml_timestamp as timestamp;
+//! # use paint_timestamp as timestamp;
 //! use system::ensure_signed;
 //!
 //! pub trait Trait: timestamp::Trait {}
@@ -81,12 +81,12 @@
 //!
 //! ### Example from the SRML
 //!
-//! The [Session module](https://github.com/paritytech/substrate/blob/master/srml/session/src/lib.rs) uses
+//! The [Session module](https://github.com/paritytech/substrate/blob/master/paint/session/src/lib.rs) uses
 //! the Timestamp module for session management.
 //!
 //! ## Related Modules
 //!
-//! * [Session](../srml_session/index.html)
+//! * [Session](../paint_session/index.html)
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
diff --git a/paint/transaction-payment/Cargo.toml b/paint/transaction-payment/Cargo.toml
new file mode 100644
index 0000000000000..535df1ed95660
--- /dev/null
+++ b/paint/transaction-payment/Cargo.toml
@@ -0,0 +1,29 @@
+[package]
+name = "paint-transaction-payment"
+version = "2.0.0"
+authors = ["Parity Technologies "]
+edition = "2018"
+
+[dependencies]
+codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+transaction-payment-rpc-runtime-api = { package = "paint-transaction-payment-rpc-runtime-api", path = "./rpc/runtime-api", default-features = false }
+
+[dev-dependencies]
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
+balances = { package = "paint-balances", path = "../balances" }
+
+[features]
+default = ["std"]
+std = [
+	"codec/std",
+	"rstd/std",
+	"sr-primitives/std",
+	"support/std",
+	"system/std",
+	"transaction-payment-rpc-runtime-api/std"
+]
diff --git a/srml/transaction-payment/rpc/Cargo.toml b/paint/transaction-payment/rpc/Cargo.toml
similarity index 59%
rename from srml/transaction-payment/rpc/Cargo.toml
rename to paint/transaction-payment/rpc/Cargo.toml
index 1fcfc21f805c3..22d68f8a6c7ea 100644
--- a/srml/transaction-payment/rpc/Cargo.toml
+++ b/paint/transaction-payment/rpc/Cargo.toml
@@ -1,17 +1,17 @@
 [package]
-name = "srml-transaction-payment-rpc"
+name = "paint-transaction-payment-rpc"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
 
 [dependencies]
-client = { package = "substrate-client", path = "../../../core/client" }
+client = { package = "substrate-client", path = "../../../client/" }
 codec = { package = "parity-scale-codec", version = "1.0.0" }
 jsonrpc-core = "14.0.3"
 jsonrpc-core-client = "14.0.3"
 jsonrpc-derive = "14.0.3"
-primitives = { package = "substrate-primitives",  path = "../../../core/primitives" }
-rpc-primitives = { package = "substrate-rpc-primitives", path = "../../../core/rpc/primitives" }
+primitives = { package = "substrate-primitives",  path = "../../../primitives/core" }
+rpc-primitives = { package = "substrate-rpc-primitives", path = "../../../primitives/rpc" }
 serde = { version = "1.0.101", features = ["derive"] }
-sr-primitives = { path = "../../../core/sr-primitives" }
-srml-transaction-payment-rpc-runtime-api = { path = "./runtime-api" }
+sr-primitives = { path = "../../../primitives/sr-primitives" }
+paint-transaction-payment-rpc-runtime-api = { path = "./runtime-api" }
diff --git a/srml/transaction-payment/rpc/runtime-api/Cargo.toml b/paint/transaction-payment/rpc/runtime-api/Cargo.toml
similarity index 56%
rename from srml/transaction-payment/rpc/runtime-api/Cargo.toml
rename to paint/transaction-payment/rpc/runtime-api/Cargo.toml
index 2ef5e3acf6252..05ba940d675f6 100644
--- a/srml/transaction-payment/rpc/runtime-api/Cargo.toml
+++ b/paint/transaction-payment/rpc/runtime-api/Cargo.toml
@@ -1,15 +1,15 @@
 [package]
-name = "srml-transaction-payment-rpc-runtime-api"
+name = "paint-transaction-payment-rpc-runtime-api"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
 
 [dependencies]
 serde = { version = "1.0.101", optional = true, features = ["derive"] }
-sr-api = { path = "../../../../core/sr-api", default-features = false }
+sr-api = { path = "../../../../primitives/sr-api", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] }
-rstd = { package = "sr-std", path = "../../../../core/sr-std", default-features = false }
-sr-primitives = { path = "../../../../core/sr-primitives", default-features = false }
+rstd = { package = "sr-std", path = "../../../../primitives/sr-std", default-features = false }
+sr-primitives = { path = "../../../../primitives/sr-primitives", default-features = false }
 
 [features]
 default = ["std"]
diff --git a/srml/transaction-payment/rpc/runtime-api/src/lib.rs b/paint/transaction-payment/rpc/runtime-api/src/lib.rs
similarity index 100%
rename from srml/transaction-payment/rpc/runtime-api/src/lib.rs
rename to paint/transaction-payment/rpc/runtime-api/src/lib.rs
diff --git a/srml/transaction-payment/rpc/src/lib.rs b/paint/transaction-payment/rpc/src/lib.rs
similarity index 94%
rename from srml/transaction-payment/rpc/src/lib.rs
rename to paint/transaction-payment/rpc/src/lib.rs
index 6ee3c7eddbc55..8b59263b57959 100644
--- a/srml/transaction-payment/rpc/src/lib.rs
+++ b/paint/transaction-payment/rpc/src/lib.rs
@@ -26,8 +26,8 @@ use sr_primitives::{
 	traits::{Block as BlockT, ProvideRuntimeApi},
 };
 use primitives::Bytes;
-use srml_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
-pub use srml_transaction_payment_rpc_runtime_api::TransactionPaymentApi as TransactionPaymentRuntimeApi;
+use paint_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
+pub use paint_transaction_payment_rpc_runtime_api::TransactionPaymentApi as TransactionPaymentRuntimeApi;
 pub use self::gen_client::Client as TransactionPaymentClient;
 
 #[rpc]
diff --git a/srml/transaction-payment/src/lib.rs b/paint/transaction-payment/src/lib.rs
similarity index 100%
rename from srml/transaction-payment/src/lib.rs
rename to paint/transaction-payment/src/lib.rs
diff --git a/srml/treasury/Cargo.toml b/paint/treasury/Cargo.toml
similarity index 52%
rename from srml/treasury/Cargo.toml
rename to paint/treasury/Cargo.toml
index f19fa2c2188eb..7f917fb22e50b 100644
--- a/srml/treasury/Cargo.toml
+++ b/paint/treasury/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-treasury"
+name = "paint-treasury"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,15 +7,15 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", optional = true, features = ["derive"] }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
-balances = { package = "srml-balances", path = "../balances", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+balances = { package = "paint-balances", path = "../balances", default-features = false }
 
 [dev-dependencies]
-runtime-io ={ package = "sr-io", path = "../../core/sr-io" }
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
 
 [features]
 default = ["std"]
diff --git a/srml/treasury/src/lib.rs b/paint/treasury/src/lib.rs
similarity index 100%
rename from srml/treasury/src/lib.rs
rename to paint/treasury/src/lib.rs
diff --git a/srml/utility/Cargo.toml b/paint/utility/Cargo.toml
similarity index 50%
rename from srml/utility/Cargo.toml
rename to paint/utility/Cargo.toml
index 5e92bcf88ad48..1415c3e92245a 100644
--- a/srml/utility/Cargo.toml
+++ b/paint/utility/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "srml-utility"
+name = "paint-utility"
 version = "2.0.0"
 authors = ["Parity Technologies "]
 edition = "2018"
@@ -7,15 +7,15 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", optional = true }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
-support = { package = "srml-support", path = "../support", default-features = false }
-system = { package = "srml-system", path = "../system", default-features = false }
-sr-primitives = { path = "../../core/sr-primitives", default-features = false }
-rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
-runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
+support = { package = "paint-support", path = "../support", default-features = false }
+system = { package = "paint-system", path = "../system", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
+rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false }
 
 [dev-dependencies]
-primitives = { package = "substrate-primitives",  path = "../../core/primitives" }
-balances = { package = "srml-balances", path = "../balances" }
+primitives = { package = "substrate-primitives",  path = "../../primitives/core" }
+balances = { package = "paint-balances", path = "../balances" }
 
 [features]
 default = ["std"]
diff --git a/srml/utility/src/lib.rs b/paint/utility/src/lib.rs
similarity index 100%
rename from srml/utility/src/lib.rs
rename to paint/utility/src/lib.rs
diff --git a/core/application-crypto/Cargo.toml b/primitives/application-crypto/Cargo.toml
similarity index 76%
rename from core/application-crypto/Cargo.toml
rename to primitives/application-crypto/Cargo.toml
index 663ca79d77045..598f74ac15bd4 100644
--- a/core/application-crypto/Cargo.toml
+++ b/primitives/application-crypto/Cargo.toml
@@ -6,15 +6,15 @@ edition = "2018"
 description = "Provides facilities for generating application specific crypto wrapper types."
 
 [dependencies]
-primitives = { package = "substrate-primitives", path = "../primitives", default-features = false }
+primitives = { package = "substrate-primitives", path = "../core", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
 serde = { version = "1.0.101", optional = true, features = ["derive"] }
 rstd = { package = "sr-std", path = "../sr-std", default-features = false }
-runtime-io = { package = "sr-io", path = "../sr-io", default-features = false }
+runtime-io = { package = "sr-io", path = "../../primitives/sr-io", default-features = false }
 
 [dev-dependencies]
-test-client = { package = "substrate-test-runtime-client", path = "../test-runtime/client" }
-sr-primitives = { path = "../sr-primitives" }
+test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" }
+sr-primitives = { path = "../../primitives/sr-primitives" }
 
 [features]
 default = [ "std" ]
diff --git a/core/application-crypto/src/ed25519.rs b/primitives/application-crypto/src/ed25519.rs
similarity index 100%
rename from core/application-crypto/src/ed25519.rs
rename to primitives/application-crypto/src/ed25519.rs
diff --git a/core/application-crypto/src/lib.rs b/primitives/application-crypto/src/lib.rs
similarity index 100%
rename from core/application-crypto/src/lib.rs
rename to primitives/application-crypto/src/lib.rs
diff --git a/core/application-crypto/src/sr25519.rs b/primitives/application-crypto/src/sr25519.rs
similarity index 100%
rename from core/application-crypto/src/sr25519.rs
rename to primitives/application-crypto/src/sr25519.rs
diff --git a/core/application-crypto/src/traits.rs b/primitives/application-crypto/src/traits.rs
similarity index 100%
rename from core/application-crypto/src/traits.rs
rename to primitives/application-crypto/src/traits.rs
diff --git a/core/authority-discovery/primitives/Cargo.toml b/primitives/authority-discovery/Cargo.toml
similarity index 64%
rename from core/authority-discovery/primitives/Cargo.toml
rename to primitives/authority-discovery/Cargo.toml
index 96df8d3085a0b..1e975b5680105 100644
--- a/core/authority-discovery/primitives/Cargo.toml
+++ b/primitives/authority-discovery/Cargo.toml
@@ -6,18 +6,18 @@ description = "Authority discovery primitives"
 edition = "2018"
 
 [dependencies]
-app-crypto = { package = "substrate-application-crypto", path = "../../application-crypto", default-features = false }
+app-crypto = { package = "substrate-application-crypto", path = "../application-crypto", default-features = false }
 codec = { package = "parity-scale-codec", default-features = false, version = "1.0.3" }
-rstd = { package = "sr-std", path = "../../sr-std", default-features = false }
-sr-api = { path = "../../sr-api", default-features = false }
-sr-primitives = { path = "../../sr-primitives", default-features = false }
+rstd = { package = "sr-std", path = "../sr-std", default-features = false }
+sr-api = { path = "../sr-api", default-features = false }
+sr-primitives = { path = "../sr-primitives", default-features = false }
 
 [features]
 default = ["std"]
 std = [
 	"app-crypto/std",
+	"codec/std",
 	"rstd/std",
 	"sr-api/std",
-	"codec/std",
 	"sr-primitives/std"
 ]
diff --git a/core/authority-discovery/primitives/src/lib.rs b/primitives/authority-discovery/src/lib.rs
similarity index 96%
rename from core/authority-discovery/primitives/src/lib.rs
rename to primitives/authority-discovery/src/lib.rs
index 1a5833f904118..0116ca02aad1f 100644
--- a/core/authority-discovery/primitives/src/lib.rs
+++ b/primitives/authority-discovery/src/lib.rs
@@ -38,7 +38,8 @@ pub type AuthoritySignature = app::Signature;
 sr_api::decl_runtime_apis! {
 	/// The authority discovery api.
 	///
-	/// This api is used by the `core/authority-discovery` module to retrieve identifiers of the current authority set.
+	/// This api is used by the `core/authority-discovery` module to retrieve identifiers
+	/// of the current authority set.
 	pub trait AuthorityDiscoveryApi {
 		/// Retrieve authority identifiers of the current authority set.
 		fn authorities() -> Vec;
diff --git a/core/block-builder/runtime-api/Cargo.toml b/primitives/block-builder/runtime-api/Cargo.toml
similarity index 100%
rename from core/block-builder/runtime-api/Cargo.toml
rename to primitives/block-builder/runtime-api/Cargo.toml
diff --git a/core/block-builder/runtime-api/src/lib.rs b/primitives/block-builder/runtime-api/src/lib.rs
similarity index 100%
rename from core/block-builder/runtime-api/src/lib.rs
rename to primitives/block-builder/runtime-api/src/lib.rs
diff --git a/core/finality-grandpa/primitives/Cargo.toml b/primitives/consensus/aura/Cargo.toml
similarity index 78%
rename from core/finality-grandpa/primitives/Cargo.toml
rename to primitives/consensus/aura/Cargo.toml
index 412a36ce7e8ac..20a98f9f7a617 100644
--- a/core/finality-grandpa/primitives/Cargo.toml
+++ b/primitives/consensus/aura/Cargo.toml
@@ -1,24 +1,23 @@
 [package]
-name = "substrate-finality-grandpa-primitives"
+name = "substrate-consensus-aura-primitives"
 version = "2.0.0"
 authors = ["Parity Technologies "]
+description = "Primitives for Aura consensus"
 edition = "2018"
 
 [dependencies]
-sr-api = { path = "../../sr-api", default-features = false }
 app-crypto = { package = "substrate-application-crypto", path = "../../application-crypto", default-features = false }
-codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-sr-primitives = { path = "../../sr-primitives", default-features = false }
+codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
 rstd = { package = "sr-std", path = "../../sr-std", default-features = false }
-serde = { version = "1.0.101", optional = true, features = ["derive"] }
+sr-api = { path = "../../sr-api", default-features = false }
+sr-primitives = { path = "../../sr-primitives", default-features = false }
 
 [features]
 default = ["std"]
 std = [
-	"sr-api/std",
+	"app-crypto/std",
 	"codec/std",
-	"sr-primitives/std",
 	"rstd/std",
-	"serde",
-	"app-crypto/std",
+	"sr-api/std",
+	"sr-primitives/std",
 ]
diff --git a/core/consensus/aura/primitives/src/lib.rs b/primitives/consensus/aura/src/lib.rs
similarity index 100%
rename from core/consensus/aura/primitives/src/lib.rs
rename to primitives/consensus/aura/src/lib.rs
diff --git a/core/consensus/babe/primitives/Cargo.toml b/primitives/consensus/babe/Cargo.toml
similarity index 62%
rename from core/consensus/babe/primitives/Cargo.toml
rename to primitives/consensus/babe/Cargo.toml
index c74f2bd259c2c..2ee36bd6c39f7 100644
--- a/core/consensus/babe/primitives/Cargo.toml
+++ b/primitives/consensus/babe/Cargo.toml
@@ -6,22 +6,22 @@ description = "Primitives for BABE consensus"
 edition = "2018"
 
 [dependencies]
-sr-api = { path = "../../../sr-api", default-features = false }
-rstd = { package = "sr-std", path = "../../../sr-std", default-features = false }
-sr-primitives = {  path = "../../../sr-primitives", default-features = false }
-app-crypto = { package = "substrate-application-crypto", path = "../../../application-crypto", default-features = false }
-slots = { package = "substrate-consensus-slots", path = "../../slots", optional = true }
-schnorrkel = { version = "0.8.5", features = ["preaudit_deprecated"], optional = true }
+app-crypto = { package = "substrate-application-crypto", path = "../../application-crypto", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
+rstd = { package = "sr-std", path = "../../sr-std", default-features = false }
+schnorrkel = { version = "0.8.5", features = ["preaudit_deprecated"], optional = true }
+slots = { package = "substrate-consensus-slots", path = "../../../client/consensus/slots", optional = true }
+sr-api = { path = "../../sr-api", default-features = false }
+sr-primitives = {  path = "../../sr-primitives", default-features = false }
 
 [features]
 default = ["std"]
 std = [
-	"rstd/std",
-	"sr-primitives/std",
-	"sr-api/std",
+	"app-crypto/std",
 	"codec/std",
+	"rstd/std",
 	"schnorrkel",
 	"slots",
-	"app-crypto/std",
+	"sr-api/std",
+	"sr-primitives/std",
 ]
diff --git a/core/consensus/babe/primitives/src/digest.rs b/primitives/consensus/babe/src/digest.rs
similarity index 100%
rename from core/consensus/babe/primitives/src/digest.rs
rename to primitives/consensus/babe/src/digest.rs
diff --git a/core/consensus/babe/primitives/src/lib.rs b/primitives/consensus/babe/src/lib.rs
similarity index 100%
rename from core/consensus/babe/primitives/src/lib.rs
rename to primitives/consensus/babe/src/lib.rs
diff --git a/core/consensus/common/Cargo.toml b/primitives/consensus/common/Cargo.toml
similarity index 88%
rename from core/consensus/common/Cargo.toml
rename to primitives/consensus/common/Cargo.toml
index 9c4e96f65dcee..6901bf09b70dc 100644
--- a/core/consensus/common/Cargo.toml
+++ b/primitives/consensus/common/Cargo.toml
@@ -9,7 +9,7 @@ edition = "2018"
 derive_more = "0.15.0"
 libp2p = { version = "0.13.0", default-features = false }
 log = "0.4.8"
-primitives = { package = "substrate-primitives", path= "../../primitives" }
+primitives = { package = "substrate-primitives", path= "../../core" }
 inherents = { package = "substrate-inherents", path = "../../inherents" }
 futures-preview = "0.3.0-alpha.19"
 futures-timer = "0.4.0"
@@ -20,7 +20,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive
 parking_lot = "0.9.0"
 
 [dev-dependencies]
-test-client = { package = "substrate-test-runtime-client", path = "../../test-runtime/client" }
+test-client = { package = "substrate-test-runtime-client", path = "../../../test/utils/runtime/client" }
 
 [features]
 default = []
diff --git a/core/consensus/common/src/block_import.rs b/primitives/consensus/common/src/block_import.rs
similarity index 100%
rename from core/consensus/common/src/block_import.rs
rename to primitives/consensus/common/src/block_import.rs
diff --git a/core/consensus/common/src/block_validation.rs b/primitives/consensus/common/src/block_validation.rs
similarity index 100%
rename from core/consensus/common/src/block_validation.rs
rename to primitives/consensus/common/src/block_validation.rs
diff --git a/core/consensus/common/src/error.rs b/primitives/consensus/common/src/error.rs
similarity index 100%
rename from core/consensus/common/src/error.rs
rename to primitives/consensus/common/src/error.rs
diff --git a/core/consensus/common/src/evaluation.rs b/primitives/consensus/common/src/evaluation.rs
similarity index 100%
rename from core/consensus/common/src/evaluation.rs
rename to primitives/consensus/common/src/evaluation.rs
diff --git a/core/consensus/common/src/import_queue.rs b/primitives/consensus/common/src/import_queue.rs
similarity index 100%
rename from core/consensus/common/src/import_queue.rs
rename to primitives/consensus/common/src/import_queue.rs
diff --git a/core/consensus/common/src/import_queue/basic_queue.rs b/primitives/consensus/common/src/import_queue/basic_queue.rs
similarity index 100%
rename from core/consensus/common/src/import_queue/basic_queue.rs
rename to primitives/consensus/common/src/import_queue/basic_queue.rs
diff --git a/core/consensus/common/src/import_queue/buffered_link.rs b/primitives/consensus/common/src/import_queue/buffered_link.rs
similarity index 100%
rename from core/consensus/common/src/import_queue/buffered_link.rs
rename to primitives/consensus/common/src/import_queue/buffered_link.rs
diff --git a/core/consensus/common/src/lib.rs b/primitives/consensus/common/src/lib.rs
similarity index 100%
rename from core/consensus/common/src/lib.rs
rename to primitives/consensus/common/src/lib.rs
diff --git a/core/consensus/common/src/offline_tracker.rs b/primitives/consensus/common/src/offline_tracker.rs
similarity index 100%
rename from core/consensus/common/src/offline_tracker.rs
rename to primitives/consensus/common/src/offline_tracker.rs
diff --git a/core/consensus/common/src/select_chain.rs b/primitives/consensus/common/src/select_chain.rs
similarity index 100%
rename from core/consensus/common/src/select_chain.rs
rename to primitives/consensus/common/src/select_chain.rs
diff --git a/core/consensus/pow/primitives/Cargo.toml b/primitives/consensus/pow/Cargo.toml
similarity index 56%
rename from core/consensus/pow/primitives/Cargo.toml
rename to primitives/consensus/pow/Cargo.toml
index 82a7da90755b6..99aa00da8ee8e 100644
--- a/core/consensus/pow/primitives/Cargo.toml
+++ b/primitives/consensus/pow/Cargo.toml
@@ -6,10 +6,10 @@ description = "Primitives for Aura consensus"
 edition = "2018"
 
 [dependencies]
-sr-api = { path = "../../../sr-api", default-features = false }
-rstd = { package = "sr-std", path = "../../../sr-std", default-features = false }
-sr-primitives = { path = "../../../sr-primitives", default-features = false }
-primitives = { package = "substrate-primitives", path = "../../../primitives", default-features = false }
+sr-api = { path = "../../sr-api", default-features = false }
+rstd = { package = "sr-std", path = "../../sr-std", default-features = false }
+sr-primitives = { path = "../../sr-primitives", default-features = false }
+primitives = { package = "substrate-primitives", path = "../../core", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
 
 [features]
diff --git a/core/consensus/pow/primitives/src/lib.rs b/primitives/consensus/pow/src/lib.rs
similarity index 100%
rename from core/consensus/pow/primitives/src/lib.rs
rename to primitives/consensus/pow/src/lib.rs
diff --git a/core/primitives/Cargo.toml b/primitives/core/Cargo.toml
similarity index 100%
rename from core/primitives/Cargo.toml
rename to primitives/core/Cargo.toml
diff --git a/core/primitives/benches/bench.rs b/primitives/core/benches/bench.rs
similarity index 100%
rename from core/primitives/benches/bench.rs
rename to primitives/core/benches/bench.rs
diff --git a/core/primitives/debug-derive/Cargo.toml b/primitives/core/debug-derive/Cargo.toml
similarity index 100%
rename from core/primitives/debug-derive/Cargo.toml
rename to primitives/core/debug-derive/Cargo.toml
diff --git a/core/primitives/debug-derive/src/impls.rs b/primitives/core/debug-derive/src/impls.rs
similarity index 100%
rename from core/primitives/debug-derive/src/impls.rs
rename to primitives/core/debug-derive/src/impls.rs
diff --git a/core/primitives/debug-derive/src/lib.rs b/primitives/core/debug-derive/src/lib.rs
similarity index 100%
rename from core/primitives/debug-derive/src/lib.rs
rename to primitives/core/debug-derive/src/lib.rs
diff --git a/core/primitives/debug-derive/tests/tests.rs b/primitives/core/debug-derive/tests/tests.rs
similarity index 100%
rename from core/primitives/debug-derive/tests/tests.rs
rename to primitives/core/debug-derive/tests/tests.rs
diff --git a/core/primitives/src/changes_trie.rs b/primitives/core/src/changes_trie.rs
similarity index 100%
rename from core/primitives/src/changes_trie.rs
rename to primitives/core/src/changes_trie.rs
diff --git a/core/primitives/src/crypto.rs b/primitives/core/src/crypto.rs
similarity index 100%
rename from core/primitives/src/crypto.rs
rename to primitives/core/src/crypto.rs
diff --git a/core/primitives/src/ecdsa.rs b/primitives/core/src/ecdsa.rs
similarity index 100%
rename from core/primitives/src/ecdsa.rs
rename to primitives/core/src/ecdsa.rs
diff --git a/core/primitives/src/ed25519.rs b/primitives/core/src/ed25519.rs
similarity index 100%
rename from core/primitives/src/ed25519.rs
rename to primitives/core/src/ed25519.rs
diff --git a/core/primitives/src/hash.rs b/primitives/core/src/hash.rs
similarity index 100%
rename from core/primitives/src/hash.rs
rename to primitives/core/src/hash.rs
diff --git a/core/primitives/src/hasher.rs b/primitives/core/src/hasher.rs
similarity index 100%
rename from core/primitives/src/hasher.rs
rename to primitives/core/src/hasher.rs
diff --git a/core/primitives/src/hashing.rs b/primitives/core/src/hashing.rs
similarity index 100%
rename from core/primitives/src/hashing.rs
rename to primitives/core/src/hashing.rs
diff --git a/core/primitives/src/hexdisplay.rs b/primitives/core/src/hexdisplay.rs
similarity index 100%
rename from core/primitives/src/hexdisplay.rs
rename to primitives/core/src/hexdisplay.rs
diff --git a/core/primitives/src/lib.rs b/primitives/core/src/lib.rs
similarity index 100%
rename from core/primitives/src/lib.rs
rename to primitives/core/src/lib.rs
diff --git a/core/primitives/src/offchain.rs b/primitives/core/src/offchain.rs
similarity index 100%
rename from core/primitives/src/offchain.rs
rename to primitives/core/src/offchain.rs
diff --git a/core/primitives/src/sandbox.rs b/primitives/core/src/sandbox.rs
similarity index 100%
rename from core/primitives/src/sandbox.rs
rename to primitives/core/src/sandbox.rs
diff --git a/core/primitives/src/sr25519.rs b/primitives/core/src/sr25519.rs
similarity index 100%
rename from core/primitives/src/sr25519.rs
rename to primitives/core/src/sr25519.rs
diff --git a/core/primitives/src/testing.rs b/primitives/core/src/testing.rs
similarity index 100%
rename from core/primitives/src/testing.rs
rename to primitives/core/src/testing.rs
diff --git a/core/primitives/src/tests.rs b/primitives/core/src/tests.rs
similarity index 100%
rename from core/primitives/src/tests.rs
rename to primitives/core/src/tests.rs
diff --git a/core/primitives/src/traits.rs b/primitives/core/src/traits.rs
similarity index 100%
rename from core/primitives/src/traits.rs
rename to primitives/core/src/traits.rs
diff --git a/core/primitives/src/u32_trait.rs b/primitives/core/src/u32_trait.rs
similarity index 100%
rename from core/primitives/src/u32_trait.rs
rename to primitives/core/src/u32_trait.rs
diff --git a/core/primitives/src/uint.rs b/primitives/core/src/uint.rs
similarity index 97%
rename from core/primitives/src/uint.rs
rename to primitives/core/src/uint.rs
index b41596a910326..c835cf5773518 100644
--- a/core/primitives/src/uint.rs
+++ b/primitives/core/src/uint.rs
@@ -91,7 +91,9 @@ mod tests {
 			"\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\""
 		);
 		assert!(
-			ser::from_str::("\"0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"").unwrap_err().is_data()
+			ser::from_str::("\"0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"")
+			.unwrap_err()
+			.is_data()
 		);
 	}
 }
diff --git a/core/primitives/storage/Cargo.toml b/primitives/core/storage/Cargo.toml
similarity index 100%
rename from core/primitives/storage/Cargo.toml
rename to primitives/core/storage/Cargo.toml
diff --git a/core/primitives/storage/src/lib.rs b/primitives/core/storage/src/lib.rs
similarity index 100%
rename from core/primitives/storage/src/lib.rs
rename to primitives/core/storage/src/lib.rs
diff --git a/core/externalities/Cargo.toml b/primitives/externalities/Cargo.toml
similarity index 91%
rename from core/externalities/Cargo.toml
rename to primitives/externalities/Cargo.toml
index babb3e7f9f4a2..0b806ecee0494 100644
--- a/core/externalities/Cargo.toml
+++ b/primitives/externalities/Cargo.toml
@@ -7,6 +7,6 @@ edition = "2018"
 
 [dependencies]
 primitive-types = { version = "0.6", features = ["codec"] }
-primitives-storage = { package = "substrate-primitives-storage", path = "../primitives/storage" }
+primitives-storage = { package = "substrate-primitives-storage", path = "../core/storage" }
 rstd = { package = "sr-std", path = "../sr-std" }
 environmental = { version = "1.0.2" }
diff --git a/core/externalities/src/extensions.rs b/primitives/externalities/src/extensions.rs
similarity index 100%
rename from core/externalities/src/extensions.rs
rename to primitives/externalities/src/extensions.rs
diff --git a/core/externalities/src/lib.rs b/primitives/externalities/src/lib.rs
similarity index 100%
rename from core/externalities/src/lib.rs
rename to primitives/externalities/src/lib.rs
diff --git a/core/externalities/src/scope_limited.rs b/primitives/externalities/src/scope_limited.rs
similarity index 100%
rename from core/externalities/src/scope_limited.rs
rename to primitives/externalities/src/scope_limited.rs
diff --git a/primitives/finality-grandpa/Cargo.toml b/primitives/finality-grandpa/Cargo.toml
new file mode 100644
index 0000000000000..e9a166d2875bb
--- /dev/null
+++ b/primitives/finality-grandpa/Cargo.toml
@@ -0,0 +1,24 @@
+[package]
+name = "substrate-finality-grandpa-primitives"
+version = "2.0.0"
+authors = ["Parity Technologies "]
+edition = "2018"
+
+[dependencies]
+app-crypto = { package = "substrate-application-crypto", path = "../application-crypto", default-features = false }
+codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
+rstd = { package = "sr-std", path = "../sr-std", default-features = false }
+serde = { version = "1.0.101", optional = true, features = ["derive"] }
+sr-api = { path = "../sr-api", default-features = false }
+sr-primitives = { path = "../sr-primitives", default-features = false }
+
+[features]
+default = ["std"]
+std = [
+	"app-crypto/std",
+	"codec/std",
+	"rstd/std",
+	"serde",
+	"sr-api/std",
+	"sr-primitives/std",
+]
diff --git a/core/finality-grandpa/primitives/src/lib.rs b/primitives/finality-grandpa/src/lib.rs
similarity index 100%
rename from core/finality-grandpa/primitives/src/lib.rs
rename to primitives/finality-grandpa/src/lib.rs
diff --git a/core/inherents/Cargo.toml b/primitives/inherents/Cargo.toml
similarity index 84%
rename from core/inherents/Cargo.toml
rename to primitives/inherents/Cargo.toml
index fbed81150283d..108cb15e9cce5 100644
--- a/core/inherents/Cargo.toml
+++ b/primitives/inherents/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2018"
 [dependencies]
 parking_lot = { version = "0.9.0", optional = true }
 rstd = { package = "sr-std", path = "../sr-std", default-features = false }
-primitives = { package = "substrate-primitives", path = "../primitives", default-features = false }
+primitives = { package = "substrate-primitives", path = "../core", default-features = false }
 codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] }
 derive_more = { version = "0.15.0", optional = true }
 
diff --git a/core/inherents/src/lib.rs b/primitives/inherents/src/lib.rs
similarity index 100%
rename from core/inherents/src/lib.rs
rename to primitives/inherents/src/lib.rs
diff --git a/core/keyring/Cargo.toml b/primitives/keyring/Cargo.toml
similarity index 76%
rename from core/keyring/Cargo.toml
rename to primitives/keyring/Cargo.toml
index 0147689985fa9..cc0e2836bacea 100644
--- a/core/keyring/Cargo.toml
+++ b/primitives/keyring/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Parity Technologies "]
 edition = "2018"
 
 [dependencies]
-primitives = { package = "substrate-primitives",  path = "../primitives" }
+primitives = { package = "substrate-primitives",  path = "../core" }
 sr-primitives = { path = "../sr-primitives" }
 lazy_static = "1.4.0"
 strum = "0.15.0"
diff --git a/core/keyring/src/ed25519.rs b/primitives/keyring/src/ed25519.rs
similarity index 100%
rename from core/keyring/src/ed25519.rs
rename to primitives/keyring/src/ed25519.rs
diff --git a/core/keyring/src/lib.rs b/primitives/keyring/src/lib.rs
similarity index 100%
rename from core/keyring/src/lib.rs
rename to primitives/keyring/src/lib.rs
diff --git a/core/keyring/src/sr25519.rs b/primitives/keyring/src/sr25519.rs
similarity index 100%
rename from core/keyring/src/sr25519.rs
rename to primitives/keyring/src/sr25519.rs
diff --git a/core/offchain/primitives/Cargo.toml b/primitives/offchain/Cargo.toml
similarity index 68%
rename from core/offchain/primitives/Cargo.toml
rename to primitives/offchain/Cargo.toml
index 80f1313cd41d8..5b451ee6d1053 100644
--- a/core/offchain/primitives/Cargo.toml
+++ b/primitives/offchain/Cargo.toml
@@ -7,8 +7,8 @@ authors = ["Parity Technologies "]
 edition = "2018"
 
 [dependencies]
-sr-api = { path = "../../sr-api", default-features = false }
-sr-primitives = {  path = "../../sr-primitives", default-features = false }
+sr-api = { path = "../sr-api", default-features = false }
+sr-primitives = {  path = "../sr-primitives", default-features = false }
 
 [features]
 default = ["std"]
diff --git a/core/offchain/primitives/src/lib.rs b/primitives/offchain/src/lib.rs
similarity index 100%
rename from core/offchain/primitives/src/lib.rs
rename to primitives/offchain/src/lib.rs
diff --git a/core/panic-handler/Cargo.toml b/primitives/panic-handler/Cargo.toml
similarity index 100%
rename from core/panic-handler/Cargo.toml
rename to primitives/panic-handler/Cargo.toml
diff --git a/core/panic-handler/src/lib.rs b/primitives/panic-handler/src/lib.rs
similarity index 100%
rename from core/panic-handler/src/lib.rs
rename to primitives/panic-handler/src/lib.rs
diff --git a/core/peerset/Cargo.toml b/primitives/peerset/Cargo.toml
similarity index 100%
rename from core/peerset/Cargo.toml
rename to primitives/peerset/Cargo.toml
diff --git a/core/peerset/src/lib.rs b/primitives/peerset/src/lib.rs
similarity index 100%
rename from core/peerset/src/lib.rs
rename to primitives/peerset/src/lib.rs
diff --git a/core/peerset/src/peersstate.rs b/primitives/peerset/src/peersstate.rs
similarity index 100%
rename from core/peerset/src/peersstate.rs
rename to primitives/peerset/src/peersstate.rs
diff --git a/core/peerset/tests/fuzz.rs b/primitives/peerset/tests/fuzz.rs
similarity index 100%
rename from core/peerset/tests/fuzz.rs
rename to primitives/peerset/tests/fuzz.rs
diff --git a/core/phragmen/Cargo.toml b/primitives/phragmen/Cargo.toml
similarity index 64%
rename from core/phragmen/Cargo.toml
rename to primitives/phragmen/Cargo.toml
index 5ee6d3b3c24bc..250a09dd34a06 100644
--- a/core/phragmen/Cargo.toml
+++ b/primitives/phragmen/Cargo.toml
@@ -7,11 +7,11 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", optional = true, features = ["derive"] }
 rstd = { package = "sr-std", path = "../sr-std", default-features = false }
-sr-primitives = { path = "../sr-primitives", default-features = false }
+sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
 
 [dev-dependencies]
-runtime-io ={ package = "sr-io", path = "../sr-io" }
-support = { package = "srml-support", path = "../../srml/support" }
+runtime-io ={ package = "sr-io", path = "../../primitives/sr-io" }
+support = { package = "paint-support", path = "../../paint/support" }
 rand = "0.7.2"
 
 [features]
diff --git a/core/phragmen/benches/phragmen.rs b/primitives/phragmen/benches/phragmen.rs
similarity index 100%
rename from core/phragmen/benches/phragmen.rs
rename to primitives/phragmen/benches/phragmen.rs
diff --git a/core/phragmen/src/lib.rs b/primitives/phragmen/src/lib.rs
similarity index 100%
rename from core/phragmen/src/lib.rs
rename to primitives/phragmen/src/lib.rs
diff --git a/core/phragmen/src/mock.rs b/primitives/phragmen/src/mock.rs
similarity index 100%
rename from core/phragmen/src/mock.rs
rename to primitives/phragmen/src/mock.rs
diff --git a/core/phragmen/src/tests.rs b/primitives/phragmen/src/tests.rs
similarity index 100%
rename from core/phragmen/src/tests.rs
rename to primitives/phragmen/src/tests.rs
diff --git a/core/rpc/primitives/Cargo.toml b/primitives/rpc/Cargo.toml
similarity index 72%
rename from core/rpc/primitives/Cargo.toml
rename to primitives/rpc/Cargo.toml
index 4044428112780..5216882b1a22e 100644
--- a/core/rpc/primitives/Cargo.toml
+++ b/primitives/rpc/Cargo.toml
@@ -6,4 +6,4 @@ edition = "2018"
 
 [dependencies]
 serde = { version = "1.0.101", features = ["derive"] }
-primitives = { package = "substrate-primitives", path = "../../primitives" }
+primitives = { package = "substrate-primitives", path = "../core" }
diff --git a/core/rpc/primitives/src/lib.rs b/primitives/rpc/src/lib.rs
similarity index 100%
rename from core/rpc/primitives/src/lib.rs
rename to primitives/rpc/src/lib.rs
diff --git a/core/rpc/primitives/src/number.rs b/primitives/rpc/src/number.rs
similarity index 100%
rename from core/rpc/primitives/src/number.rs
rename to primitives/rpc/src/number.rs
diff --git a/core/runtime-interface/Cargo.toml b/primitives/runtime-interface/Cargo.toml
similarity index 88%
rename from core/runtime-interface/Cargo.toml
rename to primitives/runtime-interface/Cargo.toml
index b809e0ccbe1ac..7af9b8b0887e5 100644
--- a/core/runtime-interface/Cargo.toml
+++ b/primitives/runtime-interface/Cargo.toml
@@ -15,10 +15,10 @@ static_assertions = "1.0.0"
 primitive-types = { version = "0.6.1", default-features = false }
 
 [dev-dependencies]
-executor = { package = "substrate-executor", path = "../executor" }
+executor = { package = "substrate-executor", path = "../../client/executor" }
 test-wasm = { package = "substrate-runtime-interface-test-wasm", path = "test-wasm" }
-state_machine = { package = "substrate-state-machine", path = "../state-machine"  }
-primitives = { package = "substrate-primitives", path = "../primitives"  }
+state_machine = { package = "substrate-state-machine", path = "../../primitives/state-machine"  }
+primitives = { package = "substrate-primitives", path = "../core" }
 runtime-io = { package = "sr-io", path = "../sr-io" }
 
 [features]
diff --git a/core/runtime-interface/proc-macro/Cargo.toml b/primitives/runtime-interface/proc-macro/Cargo.toml
similarity index 100%
rename from core/runtime-interface/proc-macro/Cargo.toml
rename to primitives/runtime-interface/proc-macro/Cargo.toml
diff --git a/core/runtime-interface/proc-macro/src/lib.rs b/primitives/runtime-interface/proc-macro/src/lib.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/lib.rs
rename to primitives/runtime-interface/proc-macro/src/lib.rs
diff --git a/core/runtime-interface/proc-macro/src/pass_by/codec.rs b/primitives/runtime-interface/proc-macro/src/pass_by/codec.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/pass_by/codec.rs
rename to primitives/runtime-interface/proc-macro/src/pass_by/codec.rs
diff --git a/core/runtime-interface/proc-macro/src/pass_by/enum_.rs b/primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/pass_by/enum_.rs
rename to primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs
diff --git a/core/runtime-interface/proc-macro/src/pass_by/inner.rs b/primitives/runtime-interface/proc-macro/src/pass_by/inner.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/pass_by/inner.rs
rename to primitives/runtime-interface/proc-macro/src/pass_by/inner.rs
diff --git a/core/runtime-interface/proc-macro/src/pass_by/mod.rs b/primitives/runtime-interface/proc-macro/src/pass_by/mod.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/pass_by/mod.rs
rename to primitives/runtime-interface/proc-macro/src/pass_by/mod.rs
diff --git a/core/runtime-interface/proc-macro/src/runtime_interface/bare_function_interface.rs b/primitives/runtime-interface/proc-macro/src/runtime_interface/bare_function_interface.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/runtime_interface/bare_function_interface.rs
rename to primitives/runtime-interface/proc-macro/src/runtime_interface/bare_function_interface.rs
diff --git a/core/runtime-interface/proc-macro/src/runtime_interface/host_function_interface.rs b/primitives/runtime-interface/proc-macro/src/runtime_interface/host_function_interface.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/runtime_interface/host_function_interface.rs
rename to primitives/runtime-interface/proc-macro/src/runtime_interface/host_function_interface.rs
diff --git a/core/runtime-interface/proc-macro/src/runtime_interface/mod.rs b/primitives/runtime-interface/proc-macro/src/runtime_interface/mod.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/runtime_interface/mod.rs
rename to primitives/runtime-interface/proc-macro/src/runtime_interface/mod.rs
diff --git a/core/runtime-interface/proc-macro/src/runtime_interface/trait_decl_impl.rs b/primitives/runtime-interface/proc-macro/src/runtime_interface/trait_decl_impl.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/runtime_interface/trait_decl_impl.rs
rename to primitives/runtime-interface/proc-macro/src/runtime_interface/trait_decl_impl.rs
diff --git a/core/runtime-interface/proc-macro/src/utils.rs b/primitives/runtime-interface/proc-macro/src/utils.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/src/utils.rs
rename to primitives/runtime-interface/proc-macro/src/utils.rs
diff --git a/core/runtime-interface/proc-macro/tests/ui.rs b/primitives/runtime-interface/proc-macro/tests/ui.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui.rs
rename to primitives/runtime-interface/proc-macro/tests/ui.rs
diff --git a/core/runtime-interface/proc-macro/tests/ui/no_generic_parameters.rs b/primitives/runtime-interface/proc-macro/tests/ui/no_generic_parameters.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/no_generic_parameters.rs
rename to primitives/runtime-interface/proc-macro/tests/ui/no_generic_parameters.rs
diff --git a/core/runtime-interface/proc-macro/tests/ui/no_generic_parameters.stderr b/primitives/runtime-interface/proc-macro/tests/ui/no_generic_parameters.stderr
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/no_generic_parameters.stderr
rename to primitives/runtime-interface/proc-macro/tests/ui/no_generic_parameters.stderr
diff --git a/core/runtime-interface/proc-macro/tests/ui/no_method_implementation.rs b/primitives/runtime-interface/proc-macro/tests/ui/no_method_implementation.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/no_method_implementation.rs
rename to primitives/runtime-interface/proc-macro/tests/ui/no_method_implementation.rs
diff --git a/core/runtime-interface/proc-macro/tests/ui/no_method_implementation.stderr b/primitives/runtime-interface/proc-macro/tests/ui/no_method_implementation.stderr
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/no_method_implementation.stderr
rename to primitives/runtime-interface/proc-macro/tests/ui/no_method_implementation.stderr
diff --git a/core/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.rs b/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.rs
rename to primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.rs
diff --git a/core/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.stderr b/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.stderr
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.stderr
rename to primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.stderr
diff --git a/core/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.rs b/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.rs
rename to primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.rs
diff --git a/core/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.stderr b/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.stderr
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.stderr
rename to primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.stderr
diff --git a/core/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.rs b/primitives/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.rs
rename to primitives/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.rs
diff --git a/core/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.stderr b/primitives/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.stderr
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.stderr
rename to primitives/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.stderr
diff --git a/core/runtime-interface/proc-macro/tests/ui/take_self_by_value.rs b/primitives/runtime-interface/proc-macro/tests/ui/take_self_by_value.rs
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/take_self_by_value.rs
rename to primitives/runtime-interface/proc-macro/tests/ui/take_self_by_value.rs
diff --git a/core/runtime-interface/proc-macro/tests/ui/take_self_by_value.stderr b/primitives/runtime-interface/proc-macro/tests/ui/take_self_by_value.stderr
similarity index 100%
rename from core/runtime-interface/proc-macro/tests/ui/take_self_by_value.stderr
rename to primitives/runtime-interface/proc-macro/tests/ui/take_self_by_value.stderr
diff --git a/core/runtime-interface/src/host.rs b/primitives/runtime-interface/src/host.rs
similarity index 100%
rename from core/runtime-interface/src/host.rs
rename to primitives/runtime-interface/src/host.rs
diff --git a/core/runtime-interface/src/impls.rs b/primitives/runtime-interface/src/impls.rs
similarity index 100%
rename from core/runtime-interface/src/impls.rs
rename to primitives/runtime-interface/src/impls.rs
diff --git a/core/runtime-interface/src/lib.rs b/primitives/runtime-interface/src/lib.rs
similarity index 100%
rename from core/runtime-interface/src/lib.rs
rename to primitives/runtime-interface/src/lib.rs
diff --git a/core/runtime-interface/src/pass_by.rs b/primitives/runtime-interface/src/pass_by.rs
similarity index 100%
rename from core/runtime-interface/src/pass_by.rs
rename to primitives/runtime-interface/src/pass_by.rs
diff --git a/core/runtime-interface/src/wasm.rs b/primitives/runtime-interface/src/wasm.rs
similarity index 100%
rename from core/runtime-interface/src/wasm.rs
rename to primitives/runtime-interface/src/wasm.rs
diff --git a/core/runtime-interface/test-wasm/Cargo.toml b/primitives/runtime-interface/test-wasm/Cargo.toml
similarity index 78%
rename from core/runtime-interface/test-wasm/Cargo.toml
rename to primitives/runtime-interface/test-wasm/Cargo.toml
index dd870164e98c2..13d6e2591421b 100644
--- a/core/runtime-interface/test-wasm/Cargo.toml
+++ b/primitives/runtime-interface/test-wasm/Cargo.toml
@@ -9,10 +9,10 @@ build = "build.rs"
 runtime-interface = { package = "substrate-runtime-interface", path = "../", default-features = false }
 rstd = { package = "sr-std", path = "../../sr-std", default-features = false }
 runtime-io = { package = "sr-io", path = "../../sr-io", default-features = false }
-primitives = { package = "substrate-primitives", path = "../../primitives", default-features = false }
+primitives = { package = "substrate-primitives", path = "../../core", default-features = false }
 
 [build-dependencies]
-wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.3", path = "../../utils/wasm-builder-runner" }
+wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.3", path = "../../../client/utils/wasm-builder-runner" }
 
 [features]
 default = [ "std" ]
diff --git a/core/runtime-interface/test-wasm/build.rs b/primitives/runtime-interface/test-wasm/build.rs
similarity index 96%
rename from core/runtime-interface/test-wasm/build.rs
rename to primitives/runtime-interface/test-wasm/build.rs
index fd4749b34c45e..ef2650dd5afe8 100644
--- a/core/runtime-interface/test-wasm/build.rs
+++ b/primitives/runtime-interface/test-wasm/build.rs
@@ -20,7 +20,7 @@ fn main() {
 	build_current_project_with_rustflags(
 		"wasm_binary.rs",
 		WasmBuilderSource::CratesOrPath {
-			path: "../../utils/wasm-builder",
+			path: "../../../utils/wasm-builder",
 			version: "1.0.6",
 		},
 		// This instructs LLD to export __heap_base as a global variable, which is used by the
diff --git a/core/runtime-interface/test-wasm/src/lib.rs b/primitives/runtime-interface/test-wasm/src/lib.rs
similarity index 100%
rename from core/runtime-interface/test-wasm/src/lib.rs
rename to primitives/runtime-interface/test-wasm/src/lib.rs
diff --git a/core/serializer/Cargo.toml b/primitives/serializer/Cargo.toml
similarity index 100%
rename from core/serializer/Cargo.toml
rename to primitives/serializer/Cargo.toml
diff --git a/core/serializer/src/lib.rs b/primitives/serializer/src/lib.rs
similarity index 100%
rename from core/serializer/src/lib.rs
rename to primitives/serializer/src/lib.rs
diff --git a/core/session/Cargo.toml b/primitives/session/Cargo.toml
similarity index 100%
rename from core/session/Cargo.toml
rename to primitives/session/Cargo.toml
diff --git a/core/session/src/lib.rs b/primitives/session/src/lib.rs
similarity index 100%
rename from core/session/src/lib.rs
rename to primitives/session/src/lib.rs
diff --git a/core/sr-api/Cargo.toml b/primitives/sr-api/Cargo.toml
similarity index 82%
rename from core/sr-api/Cargo.toml
rename to primitives/sr-api/Cargo.toml
index a2d23e9bbc771..a23a36284d8cb 100644
--- a/core/sr-api/Cargo.toml
+++ b/primitives/sr-api/Cargo.toml
@@ -7,15 +7,15 @@ edition = "2018"
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
 sr-api-proc-macro = { path = "proc-macro" }
-primitives = { package = "substrate-primitives", path = "../primitives", default-features = false }
+primitives = { package = "substrate-primitives", path = "../core", default-features = false }
 rstd = { package = "sr-std", path = "../sr-std", default-features = false }
 sr-primitives = { path = "../sr-primitives", default-features = false }
 sr-version = { path = "../sr-version", default-features = false }
-state-machine = { package = "substrate-state-machine", path = "../state-machine", optional = true }
+state-machine = { package = "substrate-state-machine", path = "../../primitives/state-machine", optional = true }
 
 [dev-dependencies]
 criterion = "0.3.0"
-test-client = { package = "substrate-test-runtime-client", path = "../test-runtime/client" }
+test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" }
 
 [[bench]]
 name = "bench"
diff --git a/core/sr-api/benches/bench.rs b/primitives/sr-api/benches/bench.rs
similarity index 100%
rename from core/sr-api/benches/bench.rs
rename to primitives/sr-api/benches/bench.rs
diff --git a/core/sr-api/proc-macro/Cargo.toml b/primitives/sr-api/proc-macro/Cargo.toml
similarity index 93%
rename from core/sr-api/proc-macro/Cargo.toml
rename to primitives/sr-api/proc-macro/Cargo.toml
index fe6a4cc6d6d0d..bd6418c458f0a 100644
--- a/core/sr-api/proc-macro/Cargo.toml
+++ b/primitives/sr-api/proc-macro/Cargo.toml
@@ -18,7 +18,7 @@ proc-macro-crate = "0.1.4"
 sr-api = { path = ".." }
 sr-primitives = { path = "../../sr-primitives" }
 sr-version = { path = "../../sr-version" }
-test-client = { package = "substrate-test-runtime-client", path = "../../test-runtime/client" }
+test-client = { package = "substrate-test-runtime-client", path = "../../../test/utils/runtime/client" }
 
 # Required for the doc tests
 [features]
diff --git a/core/sr-api/proc-macro/src/decl_runtime_apis.rs b/primitives/sr-api/proc-macro/src/decl_runtime_apis.rs
similarity index 100%
rename from core/sr-api/proc-macro/src/decl_runtime_apis.rs
rename to primitives/sr-api/proc-macro/src/decl_runtime_apis.rs
diff --git a/core/sr-api/proc-macro/src/impl_runtime_apis.rs b/primitives/sr-api/proc-macro/src/impl_runtime_apis.rs
similarity index 100%
rename from core/sr-api/proc-macro/src/impl_runtime_apis.rs
rename to primitives/sr-api/proc-macro/src/impl_runtime_apis.rs
diff --git a/core/sr-api/proc-macro/src/lib.rs b/primitives/sr-api/proc-macro/src/lib.rs
similarity index 100%
rename from core/sr-api/proc-macro/src/lib.rs
rename to primitives/sr-api/proc-macro/src/lib.rs
diff --git a/core/sr-api/proc-macro/src/utils.rs b/primitives/sr-api/proc-macro/src/utils.rs
similarity index 100%
rename from core/sr-api/proc-macro/src/utils.rs
rename to primitives/sr-api/proc-macro/src/utils.rs
diff --git a/core/sr-api/src/lib.rs b/primitives/sr-api/src/lib.rs
similarity index 100%
rename from core/sr-api/src/lib.rs
rename to primitives/sr-api/src/lib.rs
diff --git a/core/sr-api/test/Cargo.toml b/primitives/sr-api/test/Cargo.toml
similarity index 83%
rename from core/sr-api/test/Cargo.toml
rename to primitives/sr-api/test/Cargo.toml
index 753ffb2d05b45..7915266cca107 100644
--- a/core/sr-api/test/Cargo.toml
+++ b/primitives/sr-api/test/Cargo.toml
@@ -6,12 +6,12 @@ edition = "2018"
 
 [dependencies]
 sr-api = { path = "../" }
-test-client = { package = "substrate-test-runtime-client", path = "../../test-runtime/client" }
+test-client = { package = "substrate-test-runtime-client", path = "../../../test/utils/runtime/client" }
 sr-version = { path = "../../sr-version" }
 sr-primitives = { path = "../../sr-primitives" }
-consensus_common = { package = "substrate-consensus-common", path = "../../consensus/common" }
+consensus_common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" }
 codec = { package = "parity-scale-codec", version = "1.0.0" }
-state-machine = { package = "substrate-state-machine", path = "../../state-machine" }
+state-machine = { package = "substrate-state-machine", path = "../../../primitives/state-machine" }
 trybuild = "1.0.17"
 rustversion = "1.0.0"
 
diff --git a/core/sr-api/test/tests/decl_and_impl.rs b/primitives/sr-api/test/tests/decl_and_impl.rs
similarity index 100%
rename from core/sr-api/test/tests/decl_and_impl.rs
rename to primitives/sr-api/test/tests/decl_and_impl.rs
diff --git a/core/sr-api/test/tests/runtime_calls.rs b/primitives/sr-api/test/tests/runtime_calls.rs
similarity index 100%
rename from core/sr-api/test/tests/runtime_calls.rs
rename to primitives/sr-api/test/tests/runtime_calls.rs
diff --git a/core/sr-api/test/tests/trybuild.rs b/primitives/sr-api/test/tests/trybuild.rs
similarity index 100%
rename from core/sr-api/test/tests/trybuild.rs
rename to primitives/sr-api/test/tests/trybuild.rs
diff --git a/core/sr-api/test/tests/ui/adding_self_parameter.rs b/primitives/sr-api/test/tests/ui/adding_self_parameter.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/adding_self_parameter.rs
rename to primitives/sr-api/test/tests/ui/adding_self_parameter.rs
diff --git a/core/sr-api/test/tests/ui/adding_self_parameter.stderr b/primitives/sr-api/test/tests/ui/adding_self_parameter.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/adding_self_parameter.stderr
rename to primitives/sr-api/test/tests/ui/adding_self_parameter.stderr
diff --git a/core/sr-api/test/tests/ui/changed_in_unknown_version.rs b/primitives/sr-api/test/tests/ui/changed_in_unknown_version.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/changed_in_unknown_version.rs
rename to primitives/sr-api/test/tests/ui/changed_in_unknown_version.rs
diff --git a/core/sr-api/test/tests/ui/changed_in_unknown_version.stderr b/primitives/sr-api/test/tests/ui/changed_in_unknown_version.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/changed_in_unknown_version.stderr
rename to primitives/sr-api/test/tests/ui/changed_in_unknown_version.stderr
diff --git a/core/sr-api/test/tests/ui/declaring_old_block.rs b/primitives/sr-api/test/tests/ui/declaring_old_block.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/declaring_old_block.rs
rename to primitives/sr-api/test/tests/ui/declaring_old_block.rs
diff --git a/core/sr-api/test/tests/ui/declaring_old_block.stderr b/primitives/sr-api/test/tests/ui/declaring_old_block.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/declaring_old_block.stderr
rename to primitives/sr-api/test/tests/ui/declaring_old_block.stderr
diff --git a/core/sr-api/test/tests/ui/declaring_own_block_with_different_name.rs b/primitives/sr-api/test/tests/ui/declaring_own_block_with_different_name.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/declaring_own_block_with_different_name.rs
rename to primitives/sr-api/test/tests/ui/declaring_own_block_with_different_name.rs
diff --git a/core/sr-api/test/tests/ui/declaring_own_block_with_different_name.stderr b/primitives/sr-api/test/tests/ui/declaring_own_block_with_different_name.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/declaring_own_block_with_different_name.stderr
rename to primitives/sr-api/test/tests/ui/declaring_own_block_with_different_name.stderr
diff --git a/core/sr-api/test/tests/ui/empty_impl_runtime_apis_call.rs b/primitives/sr-api/test/tests/ui/empty_impl_runtime_apis_call.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/empty_impl_runtime_apis_call.rs
rename to primitives/sr-api/test/tests/ui/empty_impl_runtime_apis_call.rs
diff --git a/core/sr-api/test/tests/ui/empty_impl_runtime_apis_call.stderr b/primitives/sr-api/test/tests/ui/empty_impl_runtime_apis_call.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/empty_impl_runtime_apis_call.stderr
rename to primitives/sr-api/test/tests/ui/empty_impl_runtime_apis_call.stderr
diff --git a/core/sr-api/test/tests/ui/impl_incorrect_method_signature.rs b/primitives/sr-api/test/tests/ui/impl_incorrect_method_signature.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/impl_incorrect_method_signature.rs
rename to primitives/sr-api/test/tests/ui/impl_incorrect_method_signature.rs
diff --git a/core/sr-api/test/tests/ui/impl_incorrect_method_signature.stderr b/primitives/sr-api/test/tests/ui/impl_incorrect_method_signature.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/impl_incorrect_method_signature.stderr
rename to primitives/sr-api/test/tests/ui/impl_incorrect_method_signature.stderr
diff --git a/core/sr-api/test/tests/ui/impl_two_traits_with_same_name.rs b/primitives/sr-api/test/tests/ui/impl_two_traits_with_same_name.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/impl_two_traits_with_same_name.rs
rename to primitives/sr-api/test/tests/ui/impl_two_traits_with_same_name.rs
diff --git a/core/sr-api/test/tests/ui/impl_two_traits_with_same_name.stderr b/primitives/sr-api/test/tests/ui/impl_two_traits_with_same_name.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/impl_two_traits_with_same_name.stderr
rename to primitives/sr-api/test/tests/ui/impl_two_traits_with_same_name.stderr
diff --git a/core/sr-api/test/tests/ui/invalid_api_version.rs b/primitives/sr-api/test/tests/ui/invalid_api_version.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/invalid_api_version.rs
rename to primitives/sr-api/test/tests/ui/invalid_api_version.rs
diff --git a/core/sr-api/test/tests/ui/invalid_api_version.stderr b/primitives/sr-api/test/tests/ui/invalid_api_version.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/invalid_api_version.stderr
rename to primitives/sr-api/test/tests/ui/invalid_api_version.stderr
diff --git a/core/sr-api/test/tests/ui/invalid_api_version_2.rs b/primitives/sr-api/test/tests/ui/invalid_api_version_2.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/invalid_api_version_2.rs
rename to primitives/sr-api/test/tests/ui/invalid_api_version_2.rs
diff --git a/core/sr-api/test/tests/ui/invalid_api_version_2.stderr b/primitives/sr-api/test/tests/ui/invalid_api_version_2.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/invalid_api_version_2.stderr
rename to primitives/sr-api/test/tests/ui/invalid_api_version_2.stderr
diff --git a/core/sr-api/test/tests/ui/invalid_api_version_3.rs b/primitives/sr-api/test/tests/ui/invalid_api_version_3.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/invalid_api_version_3.rs
rename to primitives/sr-api/test/tests/ui/invalid_api_version_3.rs
diff --git a/core/sr-api/test/tests/ui/invalid_api_version_3.stderr b/primitives/sr-api/test/tests/ui/invalid_api_version_3.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/invalid_api_version_3.stderr
rename to primitives/sr-api/test/tests/ui/invalid_api_version_3.stderr
diff --git a/core/sr-api/test/tests/ui/missing_block_generic_parameter.rs b/primitives/sr-api/test/tests/ui/missing_block_generic_parameter.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/missing_block_generic_parameter.rs
rename to primitives/sr-api/test/tests/ui/missing_block_generic_parameter.rs
diff --git a/core/sr-api/test/tests/ui/missing_block_generic_parameter.stderr b/primitives/sr-api/test/tests/ui/missing_block_generic_parameter.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/missing_block_generic_parameter.stderr
rename to primitives/sr-api/test/tests/ui/missing_block_generic_parameter.stderr
diff --git a/core/sr-api/test/tests/ui/missing_path_for_trait.rs b/primitives/sr-api/test/tests/ui/missing_path_for_trait.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/missing_path_for_trait.rs
rename to primitives/sr-api/test/tests/ui/missing_path_for_trait.rs
diff --git a/core/sr-api/test/tests/ui/missing_path_for_trait.stderr b/primitives/sr-api/test/tests/ui/missing_path_for_trait.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/missing_path_for_trait.stderr
rename to primitives/sr-api/test/tests/ui/missing_path_for_trait.stderr
diff --git a/core/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.rs b/primitives/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.rs
similarity index 100%
rename from core/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.rs
rename to primitives/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.rs
diff --git a/core/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.stderr b/primitives/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.stderr
similarity index 100%
rename from core/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.stderr
rename to primitives/sr-api/test/tests/ui/type_reference_in_impl_runtime_apis_call.stderr
diff --git a/core/sr-arithmetic/Cargo.toml b/primitives/sr-arithmetic/Cargo.toml
similarity index 88%
rename from core/sr-arithmetic/Cargo.toml
rename to primitives/sr-arithmetic/Cargo.toml
index fd484671dd848..47b3315e86193 100644
--- a/core/sr-arithmetic/Cargo.toml
+++ b/primitives/sr-arithmetic/Cargo.toml
@@ -10,7 +10,7 @@ integer-sqrt = "0.1.2"
 num-traits = { version = "0.2.8", default-features = false }
 rstd = { package = "sr-std", path = "../sr-std", default-features = false }
 serde = { version = "1.0.101", optional = true, features = ["derive"] }
-substrate-debug-derive = { path = "../primitives/debug-derive", default-features = false }
+substrate-debug-derive = { path = "../../primitives/core/debug-derive", default-features = false }
 
 [dev-dependencies]
 primitive-types = "0.6.0"
diff --git a/core/sr-arithmetic/benches/bench.rs b/primitives/sr-arithmetic/benches/bench.rs
similarity index 100%
rename from core/sr-arithmetic/benches/bench.rs
rename to primitives/sr-arithmetic/benches/bench.rs
diff --git a/core/sr-arithmetic/fuzzer/.gitignore b/primitives/sr-arithmetic/fuzzer/.gitignore
similarity index 100%
rename from core/sr-arithmetic/fuzzer/.gitignore
rename to primitives/sr-arithmetic/fuzzer/.gitignore
diff --git a/core/sr-arithmetic/fuzzer/Cargo.lock b/primitives/sr-arithmetic/fuzzer/Cargo.lock
similarity index 100%
rename from core/sr-arithmetic/fuzzer/Cargo.lock
rename to primitives/sr-arithmetic/fuzzer/Cargo.lock
diff --git a/core/sr-arithmetic/fuzzer/Cargo.toml b/primitives/sr-arithmetic/fuzzer/Cargo.toml
similarity index 100%
rename from core/sr-arithmetic/fuzzer/Cargo.toml
rename to primitives/sr-arithmetic/fuzzer/Cargo.toml
diff --git a/core/sr-arithmetic/fuzzer/src/biguint.rs b/primitives/sr-arithmetic/fuzzer/src/biguint.rs
similarity index 100%
rename from core/sr-arithmetic/fuzzer/src/biguint.rs
rename to primitives/sr-arithmetic/fuzzer/src/biguint.rs
diff --git a/core/sr-arithmetic/fuzzer/src/rational128.rs b/primitives/sr-arithmetic/fuzzer/src/rational128.rs
similarity index 100%
rename from core/sr-arithmetic/fuzzer/src/rational128.rs
rename to primitives/sr-arithmetic/fuzzer/src/rational128.rs
diff --git a/core/sr-arithmetic/src/biguint.rs b/primitives/sr-arithmetic/src/biguint.rs
similarity index 100%
rename from core/sr-arithmetic/src/biguint.rs
rename to primitives/sr-arithmetic/src/biguint.rs
diff --git a/core/sr-arithmetic/src/fixed64.rs b/primitives/sr-arithmetic/src/fixed64.rs
similarity index 100%
rename from core/sr-arithmetic/src/fixed64.rs
rename to primitives/sr-arithmetic/src/fixed64.rs
diff --git a/core/sr-arithmetic/src/helpers_128bit.rs b/primitives/sr-arithmetic/src/helpers_128bit.rs
similarity index 100%
rename from core/sr-arithmetic/src/helpers_128bit.rs
rename to primitives/sr-arithmetic/src/helpers_128bit.rs
diff --git a/core/sr-arithmetic/src/lib.rs b/primitives/sr-arithmetic/src/lib.rs
similarity index 100%
rename from core/sr-arithmetic/src/lib.rs
rename to primitives/sr-arithmetic/src/lib.rs
diff --git a/core/sr-arithmetic/src/per_things.rs b/primitives/sr-arithmetic/src/per_things.rs
similarity index 100%
rename from core/sr-arithmetic/src/per_things.rs
rename to primitives/sr-arithmetic/src/per_things.rs
diff --git a/core/sr-arithmetic/src/rational128.rs b/primitives/sr-arithmetic/src/rational128.rs
similarity index 100%
rename from core/sr-arithmetic/src/rational128.rs
rename to primitives/sr-arithmetic/src/rational128.rs
diff --git a/core/sr-arithmetic/src/traits.rs b/primitives/sr-arithmetic/src/traits.rs
similarity index 100%
rename from core/sr-arithmetic/src/traits.rs
rename to primitives/sr-arithmetic/src/traits.rs
diff --git a/core/sr-io/Cargo.toml b/primitives/sr-io/Cargo.toml
similarity index 81%
rename from core/sr-io/Cargo.toml
rename to primitives/sr-io/Cargo.toml
index 7d62dd8d2787f..52e175d2b80cd 100644
--- a/core/sr-io/Cargo.toml
+++ b/primitives/sr-io/Cargo.toml
@@ -7,12 +7,12 @@ edition = "2018"
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false }
 hash-db = { version = "0.15.2", default-features = false }
-primitives = { package = "substrate-primitives", path = "../primitives", default-features = false }
+primitives = { package = "substrate-primitives", path = "../core", default-features = false }
 rstd = { package = "sr-std", path = "../sr-std", default-features = false }
 libsecp256k1 = { version = "0.3.0", optional = true }
-substrate-state-machine = { path = "../state-machine", optional = true }
+substrate-state-machine = { path = "../../primitives/state-machine", optional = true }
 runtime-interface = { package = "substrate-runtime-interface", path = "../runtime-interface", default-features = false }
-trie = { package = "substrate-trie", path = "../trie", optional = true }
+trie = { package = "substrate-trie", path = "../../primitives/trie", optional = true }
 externalities = { package = "substrate-externalities", path = "../externalities", optional = true }
 log = { version = "0.4.8", optional = true }
 
diff --git a/core/sr-io/src/lib.rs b/primitives/sr-io/src/lib.rs
similarity index 99%
rename from core/sr-io/src/lib.rs
rename to primitives/sr-io/src/lib.rs
index 0399b1ac66a8c..080d0b245b738 100644
--- a/core/sr-io/src/lib.rs
+++ b/primitives/sr-io/src/lib.rs
@@ -23,8 +23,10 @@
 #![cfg_attr(not(feature = "std"), feature(alloc_error_handler))]
 #![cfg_attr(not(feature = "std"), feature(core_intrinsics))]
 
-#![cfg_attr(feature = "std", doc = "Substrate runtime standard library as compiled when linked with Rust's standard library.")]
-#![cfg_attr(not(feature = "std"), doc = "Substrate's runtime standard library as compiled without Rust's standard library.")]
+#![cfg_attr(feature = "std",
+   doc = "Substrate runtime standard library as compiled when linked with Rust's standard library.")]
+#![cfg_attr(not(feature = "std"),
+   doc = "Substrate's runtime standard library as compiled without Rust's standard library.")]
 
 use rstd::vec::Vec;
 
diff --git a/primitives/sr-io/with_std.rs b/primitives/sr-io/with_std.rs
new file mode 100644
index 0000000000000..7e0504c37aafc
--- /dev/null
+++ b/primitives/sr-io/with_std.rs
@@ -0,0 +1,553 @@
+// 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 .
+
+use primitives::{
+	blake2_128, blake2_256, twox_128, twox_256, twox_64, ed25519, Blake2Hasher, sr25519, Pair, H256,
+	traits::KeystoreExt, storage::ChildStorageKey, hexdisplay::HexDisplay, Hasher,
+	offchain::{self, OffchainExt},
+};
+// Switch to this after PoC-3
+// pub use primitives::BlakeHasher;
+pub use substrate_state_machine::{BasicExternalities, TestExternalities};
+
+use trie::{TrieConfiguration, trie_types::Layout};
+
+use std::{collections::HashMap, convert::TryFrom};
+
+use externalities::{with_externalities, set_and_run_with_externalities, ExternalitiesExt};
+
+/// Additional bounds for `Hasher` trait for with_std.
+pub trait HasherBounds {}
+impl HasherBounds for T {}
+
+/// Returns a `ChildStorageKey` if the given `storage_key` slice is a valid storage
+/// key or panics otherwise.
+///
+/// Panicking here is aligned with what the `without_std` environment would do
+/// in the case of an invalid child storage key.
+fn child_storage_key_or_panic(storage_key: &[u8]) -> ChildStorageKey {
+	match ChildStorageKey::from_slice(storage_key) {
+		Some(storage_key) => storage_key,
+		None => panic!("child storage key is invalid"),
+	}
+}
+
+impl StorageApi for () {
+	fn storage(key: &[u8]) -> Option> {
+		with_externalities(|ext| ext.storage(key).map(|s| s.to_vec()))
+			.expect("storage cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn read_storage(key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option {
+		with_externalities(|ext| ext.storage(key).map(|value| {
+			let data = &value[value_offset.min(value.len())..];
+			let written = std::cmp::min(data.len(), value_out.len());
+			value_out[..written].copy_from_slice(&data[..written]);
+			value.len()
+		})).expect("read_storage cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn child_storage(storage_key: &[u8], key: &[u8]) -> Option> {
+		with_externalities(|ext| {
+			let storage_key = child_storage_key_or_panic(storage_key);
+			ext.child_storage(storage_key, key).map(|s| s.to_vec())
+		})
+		.expect("storage cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn set_storage(key: &[u8], value: &[u8]) {
+		with_externalities(|ext|
+			ext.set_storage(key.to_vec(), value.to_vec())
+		);
+	}
+
+	fn read_child_storage(
+		storage_key: &[u8],
+		key: &[u8],
+		value_out: &mut [u8],
+		value_offset: usize,
+	) -> Option {
+		with_externalities(|ext| {
+			let storage_key = child_storage_key_or_panic(storage_key);
+			ext.child_storage(storage_key, key)
+				.map(|value| {
+					let data = &value[value_offset.min(value.len())..];
+					let written = std::cmp::min(data.len(), value_out.len());
+					value_out[..written].copy_from_slice(&data[..written]);
+					value.len()
+				})
+		})
+		.expect("read_child_storage cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn set_child_storage(storage_key: &[u8], key: &[u8], value: &[u8]) {
+		with_externalities(|ext| {
+			let storage_key = child_storage_key_or_panic(storage_key);
+			ext.set_child_storage(storage_key, key.to_vec(), value.to_vec())
+		});
+	}
+
+	fn clear_storage(key: &[u8]) {
+		with_externalities(|ext|
+			ext.clear_storage(key)
+		);
+	}
+
+	fn clear_child_storage(storage_key: &[u8], key: &[u8]) {
+		with_externalities(|ext| {
+			let storage_key = child_storage_key_or_panic(storage_key);
+			ext.clear_child_storage(storage_key, key)
+		});
+	}
+
+	fn kill_child_storage(storage_key: &[u8]) {
+		with_externalities(|ext| {
+			let storage_key = child_storage_key_or_panic(storage_key);
+			ext.kill_child_storage(storage_key)
+		});
+	}
+
+	fn exists_storage(key: &[u8]) -> bool {
+		with_externalities(|ext|
+			ext.exists_storage(key)
+		).unwrap_or(false)
+	}
+
+	fn exists_child_storage(storage_key: &[u8], key: &[u8]) -> bool {
+		with_externalities(|ext| {
+			let storage_key = child_storage_key_or_panic(storage_key);
+			ext.exists_child_storage(storage_key, key)
+		}).unwrap_or(false)
+	}
+
+	fn clear_prefix(prefix: &[u8]) {
+		with_externalities(|ext| ext.clear_prefix(prefix));
+	}
+
+	fn clear_child_prefix(storage_key: &[u8], prefix: &[u8]) {
+		with_externalities(|ext| {
+			let storage_key = child_storage_key_or_panic(storage_key);
+			ext.clear_child_prefix(storage_key, prefix)
+		});
+	}
+
+	fn storage_root() -> [u8; 32] {
+		with_externalities(|ext|
+			ext.storage_root()
+		).unwrap_or(H256::zero()).into()
+	}
+
+	fn child_storage_root(storage_key: &[u8]) -> Vec {
+		with_externalities(|ext| {
+			let storage_key = child_storage_key_or_panic(storage_key);
+			ext.child_storage_root(storage_key)
+		}).expect("child_storage_root cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn storage_changes_root(parent_hash: [u8; 32]) -> Option<[u8; 32]> {
+		with_externalities(|ext|
+			ext.storage_changes_root(parent_hash.into()).map(|h| h.map(|h| h.into()))
+		).unwrap_or(Ok(None)).expect("Invalid parent hash passed to storage_changes_root")
+	}
+
+	fn blake2_256_trie_root(input: Vec<(Vec, Vec)>) -> H256 {
+		Layout::::trie_root(input)
+	}
+
+	fn blake2_256_ordered_trie_root(input: Vec>) -> H256 {
+		Layout::::ordered_trie_root(input)
+	}
+}
+
+impl OtherApi for () {
+	fn chain_id() -> u64 {
+		with_externalities(|ext|
+			ext.chain_id()
+		).unwrap_or(0)
+	}
+
+	fn print_num(val: u64) {
+		log::debug!(target: "runtime", "{}", val);
+	}
+
+	fn print_utf8(utf8: &[u8]) {
+		if let Ok(data) = std::str::from_utf8(utf8) {
+			log::debug!(target: "runtime", "{}", data)
+		}
+	}
+
+	fn print_hex(data: &[u8]) {
+		log::debug!(target: "runtime", "{}", HexDisplay::from(&data));
+	}
+
+	fn log(
+		level: LogLevel,
+		target: &[u8],
+		message: &[u8],
+	) {
+		let target = std::str::from_utf8(target).unwrap_or("invalid utf8");
+		let msg = std::str::from_utf8(message).unwrap_or("invalid utf8");
+
+		log::log!(
+			target: target,
+			log::Level::from(level),
+			"{}",
+			msg,
+		)
+	}
+}
+
+impl CryptoApi for () {
+	fn ed25519_public_keys(id: KeyTypeId) -> Vec {
+		with_externalities(|ext| {
+			ext.extension::()
+				.expect("No `keystore` associated for the current context!")
+				.read()
+				.ed25519_public_keys(id)
+		}).expect("`ed25519_public_keys` cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn ed25519_generate(id: KeyTypeId, seed: Option<&str>) -> ed25519::Public {
+		with_externalities(|ext| {
+			ext.extension::()
+				.expect("No `keystore` associated for the current context!")
+				.write()
+				.ed25519_generate_new(id, seed)
+				.expect("`ed25519_generate` failed")
+		}).expect("`ed25519_generate` cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn ed25519_sign(
+		id: KeyTypeId,
+		pubkey: &ed25519::Public,
+		msg: &[u8],
+	) -> Option {
+		let pub_key = ed25519::Public::try_from(pubkey.as_ref()).ok()?;
+
+		with_externalities(|ext| {
+			ext.extension::()
+				.expect("No `keystore` associated for the current context!")
+				.read()
+				.ed25519_key_pair(id, &pub_key)
+				.map(|k| k.sign(msg))
+		}).expect("`ed25519_sign` cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn ed25519_verify(sig: &ed25519::Signature, msg: &[u8], pubkey: &ed25519::Public) -> bool {
+		ed25519::Pair::verify(sig, msg, pubkey)
+	}
+
+	fn sr25519_public_keys(id: KeyTypeId) -> Vec {
+		with_externalities(|ext| {
+			ext.extension::()
+				.expect("No `keystore` associated for the current context!")
+				.read()
+				.sr25519_public_keys(id)
+		}).expect("`sr25519_public_keys` cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn sr25519_generate(id: KeyTypeId, seed: Option<&str>) -> sr25519::Public {
+		with_externalities(|ext| {
+			ext.extension::()
+				.expect("No `keystore` associated for the current context!")
+				.write()
+				.sr25519_generate_new(id, seed)
+				.expect("`sr25519_generate` failed")
+		}).expect("`sr25519_generate` cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn sr25519_sign(
+		id: KeyTypeId,
+		pubkey: &sr25519::Public,
+		msg: &[u8],
+	) -> Option {
+		let pub_key = sr25519::Public::try_from(pubkey.as_ref()).ok()?;
+
+		with_externalities(|ext| {
+			ext.extension::()
+				.expect("No `keystore` associated for the current context!")
+				.read()
+				.sr25519_key_pair(id, &pub_key)
+				.map(|k| k.sign(msg))
+		}).expect("`sr25519_sign` cannot be called outside of an Externalities-provided environment.")
+	}
+
+	fn sr25519_verify(sig: &sr25519::Signature, msg: &[u8], pubkey: &sr25519::Public) -> bool {
+		sr25519::Pair::verify(sig, msg, pubkey)
+	}
+
+	fn secp256k1_ecdsa_recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 64], EcdsaVerifyError> {
+		let rs = secp256k1::Signature::parse_slice(&sig[0..64])
+			.map_err(|_| EcdsaVerifyError::BadRS)?;
+		let v = secp256k1::RecoveryId::parse(if sig[64] > 26 { sig[64] - 27 } else { sig[64] } as u8)
+			.map_err(|_| EcdsaVerifyError::BadV)?;
+		let pubkey = secp256k1::recover(&secp256k1::Message::parse(msg), &rs, &v)
+			.map_err(|_| EcdsaVerifyError::BadSignature)?;
+		let mut res = [0u8; 64];
+		res.copy_from_slice(&pubkey.serialize()[1..65]);
+		Ok(res)
+	}
+
+	fn secp256k1_ecdsa_recover_compressed(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 33], EcdsaVerifyError> {
+		let rs = secp256k1::Signature::parse_slice(&sig[0..64])
+			.map_err(|_| EcdsaVerifyError::BadRS)?;
+		let v = secp256k1::RecoveryId::parse(if sig[64] > 26 { sig[64] - 27 } else { sig[64] } as u8)
+			.map_err(|_| EcdsaVerifyError::BadV)?;
+		let pubkey = secp256k1::recover(&secp256k1::Message::parse(msg), &rs, &v)
+			.map_err(|_| EcdsaVerifyError::BadSignature)?;
+		Ok(pubkey.serialize_compressed())
+	}
+}
+
+impl HashingApi for () {
+	fn keccak_256(data: &[u8]) -> [u8; 32] {
+		tiny_keccak::keccak256(data)
+	}
+
+	fn blake2_128(data: &[u8]) -> [u8; 16] {
+		blake2_128(data)
+	}
+
+	fn blake2_256(data: &[u8]) -> [u8; 32] {
+		blake2_256(data)
+	}
+
+	fn twox_256(data: &[u8]) -> [u8; 32] {
+		twox_256(data)
+	}
+
+	fn twox_128(data: &[u8]) -> [u8; 16] {
+		twox_128(data)
+	}
+
+	fn twox_64(data: &[u8]) -> [u8; 8] {
+		twox_64(data)
+	}
+}
+
+fn with_offchain(f: impl FnOnce(&mut dyn offchain::Externalities) -> R, msg: &'static str) -> R {
+	with_externalities(|ext| ext
+		.extension::()
+		.map(|ext| f(&mut **ext))
+		.expect(msg)
+	).expect("offchain-worker functions cannot be called outside of an Externalities-provided environment.")
+}
+
+impl OffchainApi for () {
+	fn is_validator() -> bool {
+		with_offchain(|ext| {
+			ext.is_validator()
+		}, "is_validator can be called only in the offchain worker context")
+	}
+
+	fn submit_transaction(data: Vec) -> Result<(), ()> {
+		with_offchain(|ext| {
+			ext.submit_transaction(data)
+		}, "submit_transaction can be called only in the offchain worker context")
+	}
+
+	fn network_state() -> Result {
+		with_offchain(|ext| {
+			ext.network_state()
+		}, "network_state can be called only in the offchain worker context")
+	}
+
+	fn timestamp() -> offchain::Timestamp {
+		with_offchain(|ext| {
+			ext.timestamp()
+		}, "timestamp can be called only in the offchain worker context")
+	}
+
+	fn sleep_until(deadline: offchain::Timestamp) {
+		with_offchain(|ext| {
+			ext.sleep_until(deadline)
+		}, "sleep_until can be called only in the offchain worker context")
+	}
+
+	fn random_seed() -> [u8; 32] {
+		with_offchain(|ext| {
+			ext.random_seed()
+		}, "random_seed can be called only in the offchain worker context")
+	}
+
+	fn local_storage_set(kind: offchain::StorageKind, key: &[u8], value: &[u8]) {
+		with_offchain(|ext| {
+			ext.local_storage_set(kind, key, value)
+		}, "local_storage_set can be called only in the offchain worker context")
+	}
+
+	fn local_storage_compare_and_set(
+		kind: offchain::StorageKind,
+		key: &[u8],
+		old_value: Option<&[u8]>,
+		new_value: &[u8],
+	) -> bool {
+		with_offchain(|ext| {
+			ext.local_storage_compare_and_set(kind, key, old_value, new_value)
+		}, "local_storage_compare_and_set can be called only in the offchain worker context")
+	}
+
+	fn local_storage_get(kind: offchain::StorageKind, key: &[u8]) -> Option> {
+		with_offchain(|ext| {
+			ext.local_storage_get(kind, key)
+		}, "local_storage_get can be called only in the offchain worker context")
+	}
+
+	fn http_request_start(
+		method: &str,
+		uri: &str,
+		meta: &[u8],
+	) -> Result {
+		with_offchain(|ext| {
+			ext.http_request_start(method, uri, meta)
+		}, "http_request_start can be called only in the offchain worker context")
+	}
+
+	fn http_request_add_header(
+		request_id: offchain::HttpRequestId,
+		name: &str,
+		value: &str,
+	) -> Result<(), ()> {
+		with_offchain(|ext| {
+			ext.http_request_add_header(request_id, name, value)
+		}, "http_request_add_header can be called only in the offchain worker context")
+	}
+
+	fn http_request_write_body(
+		request_id: offchain::HttpRequestId,
+		chunk: &[u8],
+		deadline: Option,
+	) -> Result<(), offchain::HttpError> {
+		with_offchain(|ext| {
+			ext.http_request_write_body(request_id, chunk, deadline)
+		}, "http_request_write_body can be called only in the offchain worker context")
+	}
+
+	fn http_response_wait(
+		ids: &[offchain::HttpRequestId],
+		deadline: Option,
+	) -> Vec {
+		with_offchain(|ext| {
+			ext.http_response_wait(ids, deadline)
+		}, "http_response_wait can be called only in the offchain worker context")
+	}
+
+	fn http_response_headers(
+		request_id: offchain::HttpRequestId,
+	) -> Vec<(Vec, Vec)> {
+		with_offchain(|ext| {
+			ext.http_response_headers(request_id)
+		}, "http_response_headers can be called only in the offchain worker context")
+	}
+
+	fn http_response_read_body(
+		request_id: offchain::HttpRequestId,
+		buffer: &mut [u8],
+		deadline: Option,
+	) -> Result {
+		with_offchain(|ext| {
+			ext.http_response_read_body(request_id, buffer, deadline)
+		}, "http_response_read_body can be called only in the offchain worker context")
+	}
+}
+
+impl Api for () {}
+
+/// A set of key value pairs for storage.
+pub type StorageOverlay = HashMap, Vec>;
+
+/// A set of key value pairs for children storage;
+pub type ChildrenStorageOverlay = HashMap, StorageOverlay>;
+
+/// Execute the given closure with global functions available whose functionality routes into
+/// externalities that draw from and populate `storage` and `children_storage`.
+/// Forwards the value that the closure returns.
+pub fn with_storage R>(
+	storage: &mut (StorageOverlay, ChildrenStorageOverlay),
+	f: F
+) -> R {
+	let mut alt_storage = Default::default();
+	rstd::mem::swap(&mut alt_storage, storage);
+
+	let mut ext = BasicExternalities::new(alt_storage.0, alt_storage.1);
+	let r = set_and_run_with_externalities(&mut ext, f);
+
+	*storage = ext.into_storages();
+
+	r
+}
+
+#[cfg(test)]
+mod std_tests {
+	use super::*;
+	use primitives::map;
+
+	#[test]
+	fn storage_works() {
+		let mut t = BasicExternalities::default();
+		assert!(set_and_run_with_externalities(&mut t, || {
+			assert_eq!(storage(b"hello"), None);
+			set_storage(b"hello", b"world");
+			assert_eq!(storage(b"hello"), Some(b"world".to_vec()));
+			assert_eq!(storage(b"foo"), None);
+			set_storage(b"foo", &[1, 2, 3][..]);
+			true
+		}));
+
+		t = BasicExternalities::new(map![b"foo".to_vec() => b"bar".to_vec()], map![]);
+
+		assert!(!set_and_run_with_externalities(&mut t, || {
+			assert_eq!(storage(b"hello"), None);
+			assert_eq!(storage(b"foo"), Some(b"bar".to_vec()));
+			false
+		}));
+	}
+
+	#[test]
+	fn read_storage_works() {
+		let mut t = BasicExternalities::new(map![
+			b":test".to_vec() => b"\x0b\0\0\0Hello world".to_vec()
+		], map![]);
+
+		set_and_run_with_externalities(&mut t, || {
+			let mut v = [0u8; 4];
+			assert!(read_storage(b":test", &mut v[..], 0).unwrap() >= 4);
+			assert_eq!(v, [11u8, 0, 0, 0]);
+			let mut w = [0u8; 11];
+			assert!(read_storage(b":test", &mut w[..], 4).unwrap() >= 11);
+			assert_eq!(&w, b"Hello world");
+		});
+	}
+
+	#[test]
+	fn clear_prefix_works() {
+		let mut t = BasicExternalities::new(map![
+			b":a".to_vec() => b"\x0b\0\0\0Hello world".to_vec(),
+			b":abcd".to_vec() => b"\x0b\0\0\0Hello world".to_vec(),
+			b":abc".to_vec() => b"\x0b\0\0\0Hello world".to_vec(),
+			b":abdd".to_vec() => b"\x0b\0\0\0Hello world".to_vec()
+		], map![]);
+
+		set_and_run_with_externalities(&mut t, || {
+			clear_prefix(b":abc");
+
+			assert!(storage(b":a").is_some());
+			assert!(storage(b":abdd").is_some());
+			assert!(storage(b":abcd").is_none());
+			assert!(storage(b":abc").is_none());
+		});
+	}
+}
diff --git a/primitives/sr-io/without_std.rs b/primitives/sr-io/without_std.rs
new file mode 100644
index 0000000000000..c3f7d62031b93
--- /dev/null
+++ b/primitives/sr-io/without_std.rs
@@ -0,0 +1,1241 @@
+// 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 .
+
+#[doc(hidden)]
+pub use rstd;
+pub use rstd::{mem, slice};
+
+use core::{intrinsics, panic::PanicInfo};
+use rstd::{vec::Vec, cell::Cell, convert::TryInto};
+use primitives::offchain;
+use codec::Decode;
+
+#[cfg(not(feature = "no_panic_handler"))]
+#[panic_handler]
+#[no_mangle]
+pub fn panic(info: &PanicInfo) -> ! {
+	unsafe {
+		let message = rstd::alloc::format!("{}", info);
+		extern_functions_host_impl::ext_print_utf8(message.as_ptr() as *const u8, message.len() as u32);
+		intrinsics::abort()
+	}
+}
+
+#[cfg(not(feature = "no_oom"))]
+#[alloc_error_handler]
+pub extern fn oom(_: core::alloc::Layout) -> ! {
+	static OOM_MSG: &str = "Runtime memory exhausted. Aborting";
+
+	unsafe {
+		extern_functions_host_impl::ext_print_utf8(OOM_MSG.as_ptr(), OOM_MSG.len() as u32);
+		intrinsics::abort();
+	}
+}
+
+/// External (Host) APIs
+pub mod ext {
+	use super::*;
+
+	/// The state of an exchangeable function.
+	#[derive(Clone, Copy)]
+	enum ExchangeableFunctionState {
+		/// Original function is present
+		Original,
+		/// The function has been replaced.
+		Replaced,
+	}
+
+	/// A function which implementation can be exchanged.
+	///
+	/// Internally this works by swapping function pointers.
+	pub struct ExchangeableFunction(Cell<(T, ExchangeableFunctionState)>);
+
+	impl ExchangeableFunction {
+		/// Create a new instance of `ExchangeableFunction`.
+		pub const fn new(impl_: T) -> Self {
+			Self(Cell::new((impl_, ExchangeableFunctionState::Original)))
+		}
+	}
+
+	impl ExchangeableFunction {
+		/// Replace the implementation with `new_impl`.
+		///
+		/// # Panics
+		///
+		/// Panics when trying to replace an already replaced implementation.
+		///
+		/// # Returns
+		///
+		/// Returns the original implementation wrapped in [`RestoreImplementation`].
+		pub fn replace_implementation(&'static self, new_impl: T)  -> RestoreImplementation {
+			if let ExchangeableFunctionState::Replaced = self.0.get().1 {
+				panic!("Trying to replace an already replaced implementation!")
+			}
+
+			let old = self.0.replace((new_impl, ExchangeableFunctionState::Replaced));
+
+			RestoreImplementation(self, Some(old.0))
+		}
+
+		/// Restore the original implementation.
+		fn restore_orig_implementation(&self, orig: T) {
+			self.0.set((orig, ExchangeableFunctionState::Original));
+		}
+
+		/// Returns the internal function pointer.
+		pub fn get(&self) -> T {
+			self.0.get().0
+		}
+	}
+
+	// WASM does not support threads, so this is safe; qed.
+	unsafe impl Sync for ExchangeableFunction {}
+
+	/// Restores a function implementation on drop.
+	///
+	/// Stores a static reference to the function object and the original implementation.
+	pub struct RestoreImplementation(&'static ExchangeableFunction, Option);
+
+	impl Drop for RestoreImplementation {
+		fn drop(&mut self) {
+			self.0.restore_orig_implementation(self.1.take().expect("Value is only taken on drop; qed"));
+		}
+	}
+
+	/// Declare extern functions
+	macro_rules! extern_functions {
+		(
+			$(
+				$( #[$attr:meta] )*
+				fn $name:ident ( $( $arg:ident : $arg_ty:ty ),* $(,)? ) $( -> $ret:ty )?;
+			)*
+		) => {
+			$(
+				$( #[$attr] )*
+				#[allow(non_upper_case_globals)]
+				pub static $name: ExchangeableFunction $ret )?> =
+					ExchangeableFunction::new(extern_functions_host_impl::$name);
+			)*
+
+			/// The exchangeable extern functions host implementations.
+			pub(crate) mod extern_functions_host_impl {
+				$(
+					pub unsafe fn $name ( $( $arg : $arg_ty ),* ) $( -> $ret )? {
+						implementation::$name ( $( $arg ),* )
+					}
+				)*
+
+				mod implementation {
+					extern "C" {
+						$(
+							pub fn $name ( $( $arg : $arg_ty ),* ) $( -> $ret )?;
+						)*
+					}
+				}
+			}
+		};
+	}
+
+	/// Host functions, provided by the executor.
+	/// A WebAssembly runtime module would "import" these to access the execution environment
+	/// (most importantly, storage) or perform heavy hash calculations.
+	/// See also "ext_" functions in sr-sandbox and sr-std
+	extern_functions! {
+		/// Host functions for printing, useful for debugging.
+		fn ext_print_utf8(utf8_data: *const u8, utf8_len: u32);
+		/// Print data as hex.
+		fn ext_print_hex(data: *const u8, len: u32);
+		/// Print a number
+		fn ext_print_num(value: u64);
+		/// Print a log line if logging for given level and target is enabled.
+		fn ext_log(
+			level: u32,
+			target_data: *const u8,
+			target_len: u32,
+			message_data: *const u8,
+			message_len: u32,
+		);
+
+		/// Set value for key in storage.
+		fn ext_set_storage(key_data: *const u8, key_len: u32, value_data: *const u8, value_len: u32);
+		/// Remove key and value from storage.
+		fn ext_clear_storage(key_data: *const u8, key_len: u32);
+		/// Checks if the given key exists in the storage.
+		///
+		/// # Returns
+		///
+		/// - `1` if the value exists.
+		/// - `0` if the value does not exists.
+		fn ext_exists_storage(key_data: *const u8, key_len: u32) -> u32;
+		/// Remove storage entries which key starts with given prefix.
+		fn ext_clear_prefix(prefix_data: *const u8, prefix_len: u32);
+		/// Remove child storage entries which key starts with given prefix.
+		fn ext_clear_child_prefix(
+			storage_key_data: *const u8,
+			storage_key_len: u32,
+			prefix_data: *const u8,
+			prefix_len: u32,
+		);
+		/// Gets the value of the given key from storage.
+		///
+		/// The host allocates the memory for storing the value.
+		///
+		/// # Returns
+		///
+		/// - `0` if no value exists to the given key. `written_out` is set to `u32::max_value()`.
+		/// - Otherwise, pointer to the value in memory. `written_out` contains the length of the value.
+		fn ext_get_allocated_storage(key_data: *const u8, key_len: u32, written_out: *mut u32) -> *mut u8;
+		/// Gets the value of the given key from storage.
+		///
+		/// The value is written into `value` starting at `value_offset`.
+		///
+		/// If the value length is greater than `value_len - value_offset`, the value is written partially.
+		///
+		/// # Returns
+		///
+		/// - `u32::max_value()` if the value does not exists.
+		///
+		/// - Otherwise, the number of bytes written for value.
+		fn ext_get_storage_into(
+			key_data: *const u8,
+			key_len: u32,
+			value_data: *mut u8,
+			value_len: u32,
+			value_offset: u32,
+		) -> u32;
+		/// Gets the trie root of the storage.
+		fn ext_storage_root(result: *mut u8);
+		/// Get the change trie root of the current storage overlay at a block with given parent.
+		///
+		/// # Returns
+		///
+		/// - `1` if the change trie root was found.
+		/// - `0` if the change trie root was not found.
+		fn ext_storage_changes_root(
+			parent_hash_data: *const u8,
+			parent_hash_len: u32,
+			result: *mut u8,
+		) -> u32;
+
+		/// A child storage function.
+		///
+		/// See [`ext_set_storage`] for details.
+		///
+		/// A child storage is used e.g. by a contract.
+		fn ext_set_child_storage(
+			storage_key_data: *const u8,
+			storage_key_len: u32,
+			key_data: *const u8,
+			key_len: u32,
+			value_data: *const u8,
+			value_len: u32,
+		);
+		/// A child storage function.
+		///
+		/// See [`ext_clear_storage`] for details.
+		///
+		/// A child storage is used e.g. by a contract.
+		fn ext_clear_child_storage(
+			storage_key_data: *const u8,
+			storage_key_len: u32,
+			key_data: *const u8,
+			key_len: u32,
+		);
+		/// A child storage function.
+		///
+		/// See [`ext_exists_storage`] for details.
+		///
+		/// A child storage is used e.g. by a contract.
+		fn ext_exists_child_storage(
+			storage_key_data: *const u8,
+			storage_key_len: u32,
+			key_data: *const u8,
+			key_len: u32,
+		) -> u32;
+		/// A child storage function.
+		///
+		/// See [`ext_kill_storage`] for details.
+		///
+		/// A child storage is used e.g. by a contract.
+		fn ext_kill_child_storage(storage_key_data: *const u8, storage_key_len: u32);
+		/// A child storage function.
+		///
+		/// See [`ext_get_allocated_storage`] for details.
+		///
+		/// A child storage is used e.g. by a contract.
+		fn ext_get_allocated_child_storage(
+			storage_key_data: *const u8,
+			storage_key_len: u32,
+			key_data: *const u8,
+			key_len: u32,
+			written_out: *mut u32,
+		) -> *mut u8;
+		/// A child storage function.
+		///
+		/// See [`ext_get_storage_into`] for details.
+		///
+		/// A child storage is used e.g. by a contract.
+		fn ext_get_child_storage_into(
+			storage_key_data: *const u8,
+			storage_key_len: u32,
+			key_data: *const u8,
+			key_len: u32,
+			value_data: *mut u8,
+			value_len: u32,
+			value_offset: u32,
+		) -> u32;
+		/// Commits all changes and calculates the child-storage root.
+		///
+		/// A child storage is used e.g. by a contract.
+		///
+		/// # Returns
+		///
+		/// - The pointer to the result vector and `written_out` contains its length.
+		fn ext_child_storage_root(
+			storage_key_data: *const u8,
+			storage_key_len: u32,
+			written_out: *mut u32
+		) -> *mut u8;
+
+		/// The current relay chain identifier.
+		fn ext_chain_id() -> u64;
+
+		/// Calculate a blake2_256 merkle trie root.
+		fn ext_blake2_256_enumerated_trie_root(
+			values_data: *const u8,
+			lens_data: *const u32,
+			lens_len: u32,
+			result: *mut u8
+		);
+		/// BLAKE2_128 hash
+		fn ext_blake2_128(data: *const u8, len: u32, out: *mut u8);
+		/// BLAKE2_256 hash
+		fn ext_blake2_256(data: *const u8, len: u32, out: *mut u8);
+		/// XX64 hash
+		fn ext_twox_64(data: *const u8, len: u32, out: *mut u8);
+		/// XX128 hash
+		fn ext_twox_128(data: *const u8, len: u32, out: *mut u8);
+		/// XX256 hash
+		fn ext_twox_256(data: *const u8, len: u32, out: *mut u8);
+		/// Keccak256 hash
+		fn ext_keccak_256(data: *const u8, len: u32, out: *mut u8);
+
+		/// Returns all `ed25519` public keys for the given key type from the keystore.
+		fn ext_ed25519_public_keys(id: *const u8, result_len: *mut u32) -> *mut u8;
+
+		/// Note: `ext_ed25519_verify` returns `0` if the signature is correct, nonzero otherwise.
+		fn ext_ed25519_verify(
+			msg_data: *const u8,
+			msg_len: u32,
+			sig_data: *const u8,
+			pubkey_data: *const u8,
+		) -> u32;
+
+		/// Generate an `ed25519` key pair for the given key type id and store the public key
+		/// in `out`.
+		fn ext_ed25519_generate(id: *const u8, seed: *const u8, seed_len: u32, out: *mut u8);
+
+		/// Sign the given `msg` with the `ed25519` key pair that corresponds to then given key
+		/// type id and public key. The raw signature is stored in `out`.
+		///
+		/// # Returns
+		///
+		/// - `0` on success
+		/// - nonezero if something failed, e.g. retrieving of the key.
+		fn ext_ed25519_sign(
+			id: *const u8,
+			pubkey: *const u8,
+			msg: *const u8,
+			msg_len: u32,
+			out: *mut u8,
+		) -> u32;
+
+		/// Returns all `sr25519` public keys for the given key type from the keystore.
+		fn ext_sr25519_public_keys(id: *const u8, result_len: *mut u32) -> *mut u8;
+
+		/// Note: `ext_sr25519_verify` returns 0 if the signature is correct, nonzero otherwise.
+		fn ext_sr25519_verify(
+			msg_data: *const u8,
+			msg_len: u32,
+			sig_data: *const u8,
+			pubkey_data: *const u8,
+		) -> u32;
+
+		/// Generate an `sr25519` key pair for the given key type id and store the public
+		/// key in `out`.
+		fn ext_sr25519_generate(id: *const u8, seed: *const u8, seed_len: u32, out: *mut u8);
+
+		/// Sign the given `msg` with the `sr25519` key pair that corresponds to then given key
+		/// type id and public key. The raw signature is stored in `out`.
+		///
+		/// # Returns
+		///
+		/// - `0` on success
+		/// - nonezero if something failed, e.g. retrieving of the key.
+		fn ext_sr25519_sign(
+			id: *const u8,
+			pubkey: *const u8,
+			msg: *const u8,
+			msg_len: u32,
+			out: *mut u8,
+		) -> u32;
+
+		/// Note: ext_secp256k1_ecdsa_recover returns 0 if the signature is correct, nonzero otherwise.
+		///
+		/// pubkey_data must point to 64 bytes.
+		fn ext_secp256k1_ecdsa_recover(
+			msg_data: *const u8,
+			sig_data: *const u8,
+			pubkey_data: *mut u8,
+		) -> u32;
+
+		/// Note: ext_secp256k1_ecdsa_recover_compressed returns 0 if the signature is correct, nonzero otherwise.
+		///
+		/// pubkey_data must point to 33 bytes.
+		fn ext_secp256k1_ecdsa_recover_compressed(
+			msg_data: *const u8,
+			sig_data: *const u8,
+			pubkey_data: *mut u8,
+		) -> u32;
+
+		//================================
+		// Offchain-worker Context
+		//================================
+
+		/// Returns if the local node is a potential validator.
+		///
+		/// - `1` == `true`
+		/// - `0` == `false`
+		fn ext_is_validator() -> u32;
+
+		/// Submit transaction.
+		///
+		/// # Returns
+		///
+		/// - 0 if it was successfuly added to the pool
+		/// - nonzero otherwise.
+		fn ext_submit_transaction(data: *const u8, len: u32) -> u32;
+
+		/// Returns information about the local node's network state.
+		///
+		/// # Returns
+		///
+		/// The encoded `Result`.
+		/// `written_out` contains the length of the message.
+		///
+		/// The ownership of the returned buffer is transferred to the runtime
+		/// code and the runtime is responsible for freeing it. This is always
+		/// a properly allocated pointer (which cannot be NULL), hence the
+		/// runtime code can always rely on it.
+		fn ext_network_state(written_out: *mut u32) -> *mut u8;
+
+		/// Returns current UNIX timestamp (milliseconds)
+		fn ext_timestamp() -> u64;
+
+		/// Pause execution until given timestamp (milliseconds; `deadline`) is reached.
+		///
+		/// The deadline is obtained by querying the current timestamp via `ext_timestamp`
+		/// and then adding some time to it.
+		fn ext_sleep_until(deadline: u64);
+
+		/// Generate a random seed
+		///
+		/// `data` has to be a pointer to a slice of 32 bytes.
+		fn ext_random_seed(data: *mut u8);
+
+		/// Write a value to local storage.
+		fn ext_local_storage_set(kind: u32, key: *const u8, key_len: u32, value: *const u8, value_len: u32);
+
+		/// Write a value to local storage in atomic fashion.
+		///
+		/// # Returns
+		/// - `0` in case the value has been set
+		/// - `1` if the `old_value` didn't match
+		fn ext_local_storage_compare_and_set(
+			kind: u32,
+			key: *const u8,
+			key_len: u32,
+			old_value: *const u8,
+			old_value_len: u32,
+			new_value: *const u8,
+			new_value_len: u32,
+		) -> u32;
+
+		/// Read a value from local storage.
+		///
+		///
+		/// # Returns
+		///
+		/// - 0 if the value has not been found, the `value_len` is set to `u32::max_value`.
+		/// - Otherwise, pointer to the value in memory. `value_len` contains the length of the value.
+		fn ext_local_storage_get(kind: u32, key: *const u8, key_len: u32, value_len: *mut u32) -> *mut u8;
+
+		/// Initiates a http request.
+		///
+		/// `meta` is parity-scale-codec encoded additional parameters to the request (like redirection policy,
+		/// timeouts, certificates policy, etc). The format is not yet specified and the field is currently
+		/// only reserved for future use.
+		///
+		/// # Returns
+		///
+		///	`RequestId(u16)` of initiated request, any value beyond `u16::max_value`
+		/// signifies an error.
+		fn ext_http_request_start(
+			method: *const u8,
+			method_len: u32,
+			url: *const u8,
+			url_len: u32,
+			meta: *const u8,
+			meta_len: u32,
+		) -> u32;
+
+		/// Add a header to the request.
+		///
+		/// # Returns
+		///
+		/// - `0` if successful (and the request id exists)
+		/// - nonzero otherwise
+		fn ext_http_request_add_header(
+			request_id: u32,
+			name: *const u8,
+			name_len: u32,
+			value: *const u8,
+			value_len: u32,
+		) -> u32;
+
+		/// Write a chunk of request body.
+		///
+		/// Writing an empty chunks finalises the request.
+		/// Passing `0` as deadline blocks forever.
+		///
+		/// # Returns
+		///
+		/// - `0` if successful,
+		/// - nonzero otherwise (see HttpError for the codes)
+		fn ext_http_request_write_body(
+			request_id: u32,
+			chunk: *const u8,
+			chunk_len: u32,
+			deadline: u64,
+		) -> u32;
+
+		/// Block and wait for the responses for given requests.
+		///
+		/// Note that if deadline is 0 the method will block indefinitely,
+		/// otherwise unready responses will produce `DeadlineReached` status.
+		/// (see #primitives::offchain::HttpRequestStatus)
+		///
+		/// Make sure that `statuses` have the same length as ids.
+		fn ext_http_response_wait(
+			ids: *const u32,
+			ids_len: u32,
+			statuses: *mut u32,
+			deadline: u64,
+		);
+
+		/// Read all response headers.
+		///
+		/// Note the headers are only available before response body is fully consumed.
+		///
+		/// # Returns
+		///
+		/// - A pointer to parity-scale-codec encoded vector of pairs `(HeaderKey, HeaderValue)`.
+		/// - In case invalid `id` is passed it returns a pointer to parity-encoded empty vector.
+		fn ext_http_response_headers(
+			id: u32,
+			written_out: *mut u32,
+		) -> *mut u8;
+
+		/// Read a chunk of body response to given buffer.
+		///
+		/// Passing `0` as deadline blocks forever.
+		///
+		/// # Returns
+		///
+		/// The number of bytes written if successful,
+		/// - if it's `0` it means response has been fully consumed,
+		/// - if it's greater than `u32::max_value() - 255` it means reading body failed.
+		///
+		/// In case of failure, the error code should be mapped to `HttpError`
+		/// in a following manner:
+		/// - `u32::max_value()` HttpError code 1 (DeadlineReached)
+		/// - `u32::max_value() - 1` HttpError code 2 (IoError)
+		/// The rest is reserved for potential future errors.
+		fn ext_http_response_read_body(
+			id: u32,
+			buffer: *mut u8,
+			buffer_len: u32,
+			deadline: u64,
+		) -> u32;
+	}
+}
+
+pub use self::ext::*;
+
+impl StorageApi for () {
+	fn storage(key: &[u8]) -> Option> {
+		let mut length: u32 = 0;
+		unsafe {
+			let ptr = ext_get_allocated_storage.get()(key.as_ptr(), key.len() as u32, &mut length);
+			from_raw_parts(ptr, length)
+		}
+	}
+
+	fn child_storage(storage_key: &[u8], key: &[u8]) -> Option> {
+		let mut length: u32 = 0;
+		unsafe {
+			let ptr = ext_get_allocated_child_storage.get()(
+				storage_key.as_ptr(),
+				storage_key.len() as u32,
+				key.as_ptr(),
+				key.len() as u32,
+				&mut length
+			);
+			from_raw_parts(ptr, length)
+		}
+	}
+
+	fn read_storage(key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option {
+		unsafe {
+			match ext_get_storage_into.get()(
+				key.as_ptr(),
+				key.len() as u32,
+				value_out.as_mut_ptr(),
+				value_out.len() as u32,
+				value_offset as u32,
+			) {
+				none if none == u32::max_value() => None,
+				length => Some(length as usize),
+			}
+		}
+	}
+
+	fn read_child_storage(storage_key: &[u8], key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option {
+		unsafe {
+			match ext_get_child_storage_into.get()(
+				storage_key.as_ptr(), storage_key.len() as u32,
+				key.as_ptr(), key.len() as u32,
+				value_out.as_mut_ptr(), value_out.len() as u32,
+				value_offset as u32
+			) {
+				none if none == u32::max_value() => None,
+				length => Some(length as usize),
+			}
+		}
+	}
+
+	fn set_storage(key: &[u8], value: &[u8]) {
+		unsafe {
+			ext_set_storage.get()(
+				key.as_ptr(), key.len() as u32,
+				value.as_ptr(), value.len() as u32
+			);
+		}
+	}
+
+	fn set_child_storage(storage_key: &[u8], key: &[u8], value: &[u8]) {
+		unsafe {
+			ext_set_child_storage.get()(
+				storage_key.as_ptr(), storage_key.len() as u32,
+				key.as_ptr(), key.len() as u32,
+				value.as_ptr(), value.len() as u32
+			);
+		}
+	}
+
+	fn clear_storage(key: &[u8]) {
+		unsafe {
+			ext_clear_storage.get()(
+				key.as_ptr(), key.len() as u32
+			);
+		}
+	}
+
+	fn clear_child_storage(storage_key: &[u8], key: &[u8]) {
+		unsafe {
+			ext_clear_child_storage.get()(
+				storage_key.as_ptr(), storage_key.len() as u32,
+				key.as_ptr(), key.len() as u32
+			);
+		}
+	}
+
+	fn exists_storage(key: &[u8]) -> bool {
+		unsafe {
+			ext_exists_storage.get()(
+				key.as_ptr(), key.len() as u32
+			) != 0
+		}
+	}
+
+	fn exists_child_storage(storage_key: &[u8], key: &[u8]) -> bool {
+		unsafe {
+			ext_exists_child_storage.get()(
+				storage_key.as_ptr(), storage_key.len() as u32,
+				key.as_ptr(), key.len() as u32
+			) != 0
+		}
+	}
+
+	fn clear_prefix(prefix: &[u8]) {
+		unsafe {
+			ext_clear_prefix.get()(
+				prefix.as_ptr(),
+				prefix.len() as u32
+			);
+		}
+	}
+
+	fn clear_child_prefix(storage_key: &[u8], prefix: &[u8]) {
+		unsafe {
+			ext_clear_child_prefix.get()(
+				storage_key.as_ptr(), storage_key.len() as u32,
+				prefix.as_ptr(), prefix.len() as u32
+			);
+		}
+	}
+
+	fn kill_child_storage(storage_key: &[u8]) {
+		unsafe {
+			ext_kill_child_storage.get()(
+				storage_key.as_ptr(),
+				storage_key.len() as u32
+			);
+		}
+	}
+
+	fn storage_root() -> [u8; 32] {
+		let mut result: [u8; 32] = Default::default();
+		unsafe {
+			ext_storage_root.get()(result.as_mut_ptr());
+		}
+		result
+	}
+
+	fn child_storage_root(storage_key: &[u8]) -> Vec {
+		let mut length: u32 = 0;
+		unsafe {
+			let ptr = ext_child_storage_root.get()(
+				storage_key.as_ptr(),
+				storage_key.len() as u32,
+				&mut length
+			);
+			from_raw_parts(ptr, length).expect("ext_child_storage_root never returns u32::max_value; qed")
+		}
+	}
+
+	fn storage_changes_root(parent_hash: [u8; 32]) -> Option<[u8; 32]> {
+		let mut result: [u8; 32] = Default::default();
+		let is_set = unsafe {
+			ext_storage_changes_root.get()(parent_hash.as_ptr(), parent_hash.len() as u32, result.as_mut_ptr())
+		};
+
+		if is_set != 0 {
+			Some(result)
+		} else {
+			None
+		}
+	}
+
+
+	fn blake2_256_trie_root(_input: Vec<(Vec, Vec)>) -> H256 {
+		unimplemented!()
+	}
+
+	fn blake2_256_ordered_trie_root(input: Vec>) -> H256 {
+		let mut values = Vec::with_capacity(input.len());
+		let mut lengths = Vec::with_capacity(input.len());
+		for v in input {
+			values.extend_from_slice(&v);
+			lengths.push((v.len() as u32).to_le());
+		}
+		let mut result: [u8; 32] = Default::default();
+		unsafe {
+			ext_blake2_256_enumerated_trie_root.get()(
+				values.as_ptr(),
+				lengths.as_ptr(),
+				lengths.len() as u32,
+				result.as_mut_ptr(),
+			);
+		}
+		result.into()
+	}
+}
+
+impl OtherApi for () {
+	fn chain_id() -> u64 {
+		unsafe {
+			ext_chain_id.get()()
+		}
+	}
+
+	fn print_num(val: u64) {
+		unsafe {
+			ext_print_num.get()(val);
+		}
+	}
+
+	fn print_utf8(utf8: &[u8]) {
+		unsafe {
+			ext_print_utf8.get()(utf8.as_ptr(), utf8.len() as u32);
+		}
+	}
+
+	fn print_hex(data: &[u8]) {
+		unsafe {
+			ext_print_hex.get()(data.as_ptr(), data.len() as u32);
+		}
+	}
+
+	fn log(
+		level: LogLevel,
+		target: &[u8],
+		message: &[u8]
+	) {
+		unsafe {
+			ext_log.get()(
+				level as u32,
+				target.as_ptr(),
+				target.len() as u32,
+				message.as_ptr(),
+				message.len() as u32,
+			)
+		}
+	}
+}
+
+impl HashingApi for () {
+	fn keccak_256(data: &[u8]) -> [u8; 32] {
+		let mut result: [u8; 32] = Default::default();
+		unsafe {
+			ext_keccak_256.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr());
+		}
+		result
+	}
+
+	fn blake2_128(data: &[u8]) -> [u8; 16] {
+		let mut result: [u8; 16] = Default::default();
+		unsafe {
+			ext_blake2_128.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr());
+		}
+		result
+	}
+
+	fn blake2_256(data: &[u8]) -> [u8; 32] {
+		let mut result: [u8; 32] = Default::default();
+		unsafe {
+			ext_blake2_256.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr());
+		}
+		result
+	}
+
+	fn twox_256(data: &[u8]) -> [u8; 32] {
+		let mut result: [u8; 32] = Default::default();
+		unsafe {
+			ext_twox_256.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr());
+		}
+		result
+	}
+
+	fn twox_128(data: &[u8]) -> [u8; 16] {
+		let mut result: [u8; 16] = Default::default();
+		unsafe {
+			ext_twox_128.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr());
+		}
+		result
+	}
+
+	fn twox_64(data: &[u8]) -> [u8; 8] {
+		let mut result: [u8; 8] = Default::default();
+		unsafe {
+			ext_twox_64.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr());
+		}
+		result
+	}
+}
+
+impl CryptoApi for () {
+	fn ed25519_public_keys(id: KeyTypeId) -> Vec {
+		let mut res_len = 0u32;
+		unsafe {
+			let res_ptr = ext_ed25519_public_keys.get()(id.0.as_ptr(), &mut res_len);
+			Vec::decode(&mut rstd::slice::from_raw_parts(res_ptr, res_len as usize)).unwrap_or_default()
+		}
+	}
+
+	fn ed25519_generate(id: KeyTypeId, seed: Option<&str>) -> ed25519::Public {
+		let mut res = [0u8; 32];
+		let seed = seed.as_ref().map(|s| s.as_bytes()).unwrap_or(&[]);
+		unsafe {
+			ext_ed25519_generate.get()(id.0.as_ptr(), seed.as_ptr(), seed.len() as u32, res.as_mut_ptr())
+		};
+		ed25519::Public(res)
+	}
+
+	fn ed25519_sign(
+		id: KeyTypeId,
+		pubkey: &ed25519::Public,
+		msg: &[u8],
+	) -> Option {
+		let mut res = [0u8; 64];
+		let success = unsafe {
+			ext_ed25519_sign.get()(
+				id.0.as_ptr(),
+				pubkey.0.as_ptr(),
+				msg.as_ptr(),
+				msg.len() as u32,
+				res.as_mut_ptr(),
+			) == 0
+		};
+
+		if success {
+			Some(ed25519::Signature(res))
+		} else {
+			None
+		}
+	}
+
+	fn ed25519_verify(sig: &ed25519::Signature, msg: &[u8], pubkey: &ed25519::Public) -> bool {
+		unsafe {
+			ext_ed25519_verify.get()(
+				msg.as_ptr(),
+				msg.len() as u32,
+				sig.0.as_ptr(),
+				pubkey.0.as_ptr(),
+			) == 0
+		}
+	}
+
+	fn sr25519_public_keys(id: KeyTypeId) -> Vec {
+		let mut res_len = 0u32;
+		unsafe {
+			let res_ptr = ext_sr25519_public_keys.get()(id.0.as_ptr(), &mut res_len);
+			Vec::decode(&mut rstd::slice::from_raw_parts(res_ptr, res_len as usize)).unwrap_or_default()
+		}
+	}
+
+	fn sr25519_generate(id: KeyTypeId, seed: Option<&str>) -> sr25519::Public {
+		let mut res = [0u8;32];
+		let seed = seed.as_ref().map(|s| s.as_bytes()).unwrap_or(&[]);
+		unsafe {
+			ext_sr25519_generate.get()(id.0.as_ptr(), seed.as_ptr(), seed.len() as u32, res.as_mut_ptr())
+		};
+		sr25519::Public(res)
+	}
+
+	fn sr25519_sign(
+		id: KeyTypeId,
+		pubkey: &sr25519::Public,
+		msg: &[u8],
+	) -> Option {
+		let mut res = [0u8; 64];
+		let success = unsafe {
+			ext_sr25519_sign.get()(
+				id.0.as_ptr(),
+				pubkey.0.as_ptr(),
+				msg.as_ptr(),
+				msg.len() as u32,
+				res.as_mut_ptr(),
+			) == 0
+		};
+
+		if success {
+			Some(sr25519::Signature(res))
+		} else {
+			None
+		}
+	}
+
+	fn sr25519_verify(sig: &sr25519::Signature, msg: &[u8], pubkey: &sr25519::Public) -> bool {
+		unsafe {
+			ext_sr25519_verify.get()(
+				msg.as_ptr(),
+				msg.len() as u32,
+				sig.0.as_ptr(),
+				pubkey.0.as_ptr(),
+			) == 0
+		}
+	}
+
+	fn secp256k1_ecdsa_recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 64], EcdsaVerifyError> {
+		let mut pubkey = [0u8; 64];
+		match unsafe {
+			ext_secp256k1_ecdsa_recover.get()(msg.as_ptr(), sig.as_ptr(), pubkey.as_mut_ptr())
+		} {
+			0 => Ok(pubkey),
+			1 => Err(EcdsaVerifyError::BadRS),
+			2 => Err(EcdsaVerifyError::BadV),
+			3 => Err(EcdsaVerifyError::BadSignature),
+			_ => unreachable!("`ext_secp256k1_ecdsa_recover` only returns 0, 1, 2 or 3; qed"),
+		}
+	}
+
+	fn secp256k1_ecdsa_recover_compressed(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 33], EcdsaVerifyError> {
+		let mut pubkey = [0u8; 33];
+		match unsafe {
+			ext_secp256k1_ecdsa_recover_compressed.get()(msg.as_ptr(), sig.as_ptr(), pubkey.as_mut_ptr())
+		} {
+			0 => Ok(pubkey),
+			1 => Err(EcdsaVerifyError::BadRS),
+			2 => Err(EcdsaVerifyError::BadV),
+			3 => Err(EcdsaVerifyError::BadSignature),
+			_ => unreachable!("`ext_secp256k1_ecdsa_recover_compressed` only returns 0, 1, 2 or 3; qed"),
+		}
+	}
+}
+
+impl OffchainApi for () {
+	fn is_validator() -> bool {
+		unsafe { ext_is_validator.get()() == 1 }
+	}
+
+	fn submit_transaction(data: Vec) -> Result<(), ()> {
+		let ret = unsafe {
+			ext_submit_transaction.get()(data.as_ptr(), data.len() as u32)
+		};
+
+		if ret == 0 {
+			Ok(())
+		} else {
+			Err(())
+		}
+	}
+
+	fn network_state() -> Result {
+		let mut len = 0_u32;
+		let raw_result = unsafe {
+			let ptr = ext_network_state.get()(&mut len);
+
+			from_raw_parts(ptr, len)
+		};
+
+		match raw_result {
+			Some(raw_result) => codec::Decode::decode(&mut &*raw_result).unwrap_or(Err(())),
+			None => Err(())
+		}
+	}
+
+	fn timestamp() -> offchain::Timestamp {
+		offchain::Timestamp::from_unix_millis(unsafe {
+			ext_timestamp.get()()
+		})
+	}
+
+	fn sleep_until(deadline: offchain::Timestamp) {
+		unsafe {
+			ext_sleep_until.get()(deadline.unix_millis())
+		}
+	}
+
+	fn random_seed() -> [u8; 32] {
+		let mut result = [0_u8; 32];
+		unsafe {
+			ext_random_seed.get()(result.as_mut_ptr())
+		}
+		result
+	}
+
+	fn local_storage_set(kind: offchain::StorageKind, key: &[u8], value: &[u8]) {
+		unsafe {
+			ext_local_storage_set.get()(
+				kind.into(),
+				key.as_ptr(),
+				key.len() as u32,
+				value.as_ptr(),
+				value.len() as u32,
+			)
+		}
+	}
+
+	fn local_storage_compare_and_set(
+		kind: offchain::StorageKind,
+		key: &[u8],
+		old_value: Option<&[u8]>,
+		new_value: &[u8],
+	) -> bool {
+		let (ptr, len) = match old_value {
+			Some(old_value) => (
+				old_value.as_ptr(),
+				old_value.len() as u32,
+			),
+			None => (0 as *const u8, u32::max_value()),
+		};
+
+		unsafe {
+			ext_local_storage_compare_and_set.get()(
+				kind.into(),
+				key.as_ptr(),
+				key.len() as u32,
+				ptr,
+				len,
+				new_value.as_ptr(),
+				new_value.len() as u32,
+			) == 0
+		}
+	}
+
+	fn local_storage_get(kind: offchain::StorageKind, key: &[u8]) -> Option> {
+		let mut len = 0u32;
+		unsafe {
+			let ptr = ext_local_storage_get.get()(
+				kind.into(),
+				key.as_ptr(),
+				key.len() as u32,
+				&mut len,
+			);
+
+			from_raw_parts(ptr, len)
+		}
+	}
+
+	fn http_request_start(method: &str, url: &str, meta: &[u8]) -> Result {
+		let method = method.as_bytes();
+		let url = url.as_bytes();
+
+		let result = unsafe {
+			ext_http_request_start.get()(
+				method.as_ptr(),
+				method.len() as u32,
+				url.as_ptr(),
+				url.len() as u32,
+				meta.as_ptr(),
+				meta.len() as u32,
+			)
+		};
+
+		if result > u16::max_value() as u32 {
+			Err(())
+		} else {
+			Ok(offchain::HttpRequestId(result as u16))
+		}
+	}
+
+	fn http_request_add_header(request_id: offchain::HttpRequestId, name: &str, value: &str) -> Result<(), ()> {
+		let name = name.as_bytes();
+		let value = value.as_bytes();
+
+		let result = unsafe {
+			ext_http_request_add_header.get()(
+				request_id.into(),
+				name.as_ptr(),
+				name.len() as u32,
+				value.as_ptr(),
+				value.len() as u32,
+			)
+		};
+
+		if result == 0 {
+			Ok(())
+		} else {
+			Err(())
+		}
+	}
+
+	fn http_request_write_body(
+		request_id: offchain::HttpRequestId,
+		chunk: &[u8],
+		deadline: Option
+	) -> Result<(), offchain::HttpError> {
+		let res = unsafe {
+			ext_http_request_write_body.get()(
+				request_id.into(),
+				chunk.as_ptr(),
+				chunk.len() as u32,
+				deadline.map_or(0, |x| x.unix_millis()),
+			)
+		};
+
+		if res == 0 {
+			Ok(())
+		} else {
+			Err(res.try_into().unwrap_or(offchain::HttpError::IoError))
+		}
+	}
+
+	fn http_response_wait(
+		ids: &[offchain::HttpRequestId],
+		deadline: Option
+	) -> Vec {
+		let ids = ids.iter().map(|x| x.0 as u32).collect::>();
+		let mut statuses = Vec::new();
+		statuses.resize(ids.len(), 0u32);
+
+		unsafe {
+			ext_http_response_wait.get()(
+				ids.as_ptr(),
+				ids.len() as u32,
+				statuses.as_mut_ptr(),
+				deadline.map_or(0, |x| x.unix_millis()),
+			)
+		}
+
+		statuses
+			.into_iter()
+			.map(|status| status.try_into().unwrap_or(offchain::HttpRequestStatus::Invalid))
+			.collect()
+	}
+
+	fn http_response_headers(
+		request_id: offchain::HttpRequestId,
+	) -> Vec<(Vec, Vec)> {
+		let mut len = 0u32;
+		let raw_result = unsafe {
+			let ptr = ext_http_response_headers.get()(
+				request_id.into(),
+				&mut len,
+			);
+
+			from_raw_parts(ptr, len).expect("ext_http_response_headers never return u32::max_value; qed")
+		};
+
+		codec::Decode::decode(&mut &*raw_result).unwrap_or_default()
+	}
+
+	fn http_response_read_body(
+		request_id: offchain::HttpRequestId,
+		buffer: &mut [u8],
+		deadline: Option,
+	) -> Result {
+		let res = unsafe {
+			ext_http_response_read_body.get()(
+				request_id.into(),
+				buffer.as_mut_ptr(),
+				buffer.len() as u32,
+				deadline.map_or(0, |x| x.unix_millis()),
+			)
+		};
+
+		if res >= u32::max_value() - 255 {
+			let code = (u32::max_value() - res) + 1;
+			code.try_into().map_err(|_| offchain::HttpError::IoError)
+		} else {
+			Ok(res as usize)
+		}
+	}
+}
+
+unsafe fn from_raw_parts(ptr: *mut u8, len: u32) -> Option> {
+	if len == u32::max_value() {
+		None
+	} else {
+		// Invariants required by Vec::from_raw_parts are not formally fulfilled.
+		// We don't allocate via String/Vec, but use a custom allocator instead.
+		// See #300 for more details.
+		Some(>::from_raw_parts(ptr, len as usize, len as usize))
+	}
+}
+
+impl Api for () {}
diff --git a/core/sr-primitives/Cargo.toml b/primitives/sr-primitives/Cargo.toml
similarity index 80%
rename from core/sr-primitives/Cargo.toml
rename to primitives/sr-primitives/Cargo.toml
index b94de7c026e5c..e1412cf53407e 100644
--- a/core/sr-primitives/Cargo.toml
+++ b/primitives/sr-primitives/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.101", optional = true, features = ["derive"] }
 codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
-primitives = { package = "substrate-primitives",  path = "../primitives", default-features = false }
+primitives = { package = "substrate-primitives",  path = "../core", default-features = false }
 app-crypto = { package = "substrate-application-crypto",  path = "../application-crypto", default-features = false }
 arithmetic = { package = "sr-arithmetic",  path = "../sr-arithmetic", default-features = false }
 rstd = { package = "sr-std", path = "../sr-std", default-features = false }
@@ -21,9 +21,7 @@ inherents = { package = "substrate-inherents", path = "../inherents", default-fe
 [dev-dependencies]
 serde_json = "1.0.41"
 rand = "0.7.2"
-substrate-offchain = { path = "../offchain" }
-support = { package = "srml-support", path = "../../srml/support" }
-system = { package = "srml-system", path = "../../srml/system" }
+substrate-offchain = { path = "../../client/offchain" }
 
 [features]
 bench = []
diff --git a/core/sr-primitives/src/curve.rs b/primitives/sr-primitives/src/curve.rs
similarity index 100%
rename from core/sr-primitives/src/curve.rs
rename to primitives/sr-primitives/src/curve.rs
diff --git a/core/sr-primitives/src/generic/block.rs b/primitives/sr-primitives/src/generic/block.rs
similarity index 100%
rename from core/sr-primitives/src/generic/block.rs
rename to primitives/sr-primitives/src/generic/block.rs
diff --git a/core/sr-primitives/src/generic/checked_extrinsic.rs b/primitives/sr-primitives/src/generic/checked_extrinsic.rs
similarity index 100%
rename from core/sr-primitives/src/generic/checked_extrinsic.rs
rename to primitives/sr-primitives/src/generic/checked_extrinsic.rs
diff --git a/core/sr-primitives/src/generic/digest.rs b/primitives/sr-primitives/src/generic/digest.rs
similarity index 100%
rename from core/sr-primitives/src/generic/digest.rs
rename to primitives/sr-primitives/src/generic/digest.rs
diff --git a/core/sr-primitives/src/generic/era.rs b/primitives/sr-primitives/src/generic/era.rs
similarity index 100%
rename from core/sr-primitives/src/generic/era.rs
rename to primitives/sr-primitives/src/generic/era.rs
diff --git a/core/sr-primitives/src/generic/header.rs b/primitives/sr-primitives/src/generic/header.rs
similarity index 100%
rename from core/sr-primitives/src/generic/header.rs
rename to primitives/sr-primitives/src/generic/header.rs
diff --git a/core/sr-primitives/src/generic/mod.rs b/primitives/sr-primitives/src/generic/mod.rs
similarity index 100%
rename from core/sr-primitives/src/generic/mod.rs
rename to primitives/sr-primitives/src/generic/mod.rs
diff --git a/core/sr-primitives/src/generic/tests.rs b/primitives/sr-primitives/src/generic/tests.rs
similarity index 100%
rename from core/sr-primitives/src/generic/tests.rs
rename to primitives/sr-primitives/src/generic/tests.rs
diff --git a/core/sr-primitives/src/generic/unchecked_extrinsic.rs b/primitives/sr-primitives/src/generic/unchecked_extrinsic.rs
similarity index 100%
rename from core/sr-primitives/src/generic/unchecked_extrinsic.rs
rename to primitives/sr-primitives/src/generic/unchecked_extrinsic.rs
diff --git a/core/sr-primitives/src/lib.rs b/primitives/sr-primitives/src/lib.rs
similarity index 99%
rename from core/sr-primitives/src/lib.rs
rename to primitives/sr-primitives/src/lib.rs
index f072661d611aa..01ace2c004d0b 100644
--- a/core/sr-primitives/src/lib.rs
+++ b/primitives/sr-primitives/src/lib.rs
@@ -453,7 +453,11 @@ impl From<&'static str> for DispatchError {
 
 /// Verify a signature on an encoded value in a lazy manner. This can be
 /// an optimization if the signature scheme has an "unsigned" escape hash.
-pub fn verify_encoded_lazy(sig: &V, item: &T, signer: &::AccountId) -> bool {
+pub fn verify_encoded_lazy(
+	sig: &V,
+	item: &T,
+	signer: &::AccountId
+) -> bool {
 	// The `Lazy` trait expresses something like `X: FnMut &'a T>`.
 	// unfortunately this is a lifetime relationship that can't
 	// be expressed without generic associated types, better unification of HRTBs in type position,
diff --git a/core/sr-primitives/src/offchain/http.rs b/primitives/sr-primitives/src/offchain/http.rs
similarity index 100%
rename from core/sr-primitives/src/offchain/http.rs
rename to primitives/sr-primitives/src/offchain/http.rs
diff --git a/core/sr-primitives/src/offchain/mod.rs b/primitives/sr-primitives/src/offchain/mod.rs
similarity index 100%
rename from core/sr-primitives/src/offchain/mod.rs
rename to primitives/sr-primitives/src/offchain/mod.rs
diff --git a/core/sr-primitives/src/testing.rs b/primitives/sr-primitives/src/testing.rs
similarity index 99%
rename from core/sr-primitives/src/testing.rs
rename to primitives/sr-primitives/src/testing.rs
index ae359f6b6ba15..bd3f673cd5c43 100644
--- a/core/sr-primitives/src/testing.rs
+++ b/primitives/sr-primitives/src/testing.rs
@@ -258,7 +258,9 @@ pub struct Block {
 	pub extrinsics: Vec,
 }
 
-impl traits::Block for Block {
+impl traits::Block
+	for Block
+{
 	type Extrinsic = Xt;
 	type Header = Header;
 	type Hash = 
::Hash; diff --git a/core/sr-primitives/src/traits.rs b/primitives/sr-primitives/src/traits.rs similarity index 100% rename from core/sr-primitives/src/traits.rs rename to primitives/sr-primitives/src/traits.rs diff --git a/core/sr-primitives/src/transaction_validity.rs b/primitives/sr-primitives/src/transaction_validity.rs similarity index 100% rename from core/sr-primitives/src/transaction_validity.rs rename to primitives/sr-primitives/src/transaction_validity.rs diff --git a/core/sr-primitives/src/weights.rs b/primitives/sr-primitives/src/weights.rs similarity index 100% rename from core/sr-primitives/src/weights.rs rename to primitives/sr-primitives/src/weights.rs diff --git a/core/sr-sandbox/Cargo.toml b/primitives/sr-sandbox/Cargo.toml similarity index 85% rename from core/sr-sandbox/Cargo.toml rename to primitives/sr-sandbox/Cargo.toml index 32e79781b2459..97d391d794d65 100755 --- a/core/sr-sandbox/Cargo.toml +++ b/primitives/sr-sandbox/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] wasmi = { version = "0.6.2", optional = true } -primitives = { package = "substrate-primitives", path = "../primitives", default-features = false } +primitives = { package = "substrate-primitives", path = "../core", default-features = false } rstd = { package = "sr-std", path = "../sr-std", default-features = false } runtime-io = { package = "sr-io", path = "../sr-io", default-features = false } codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } diff --git a/core/sr-sandbox/src/lib.rs b/primitives/sr-sandbox/src/lib.rs similarity index 99% rename from core/sr-sandbox/src/lib.rs rename to primitives/sr-sandbox/src/lib.rs index 4639cf983af44..17b2cb7c1ebda 100755 --- a/core/sr-sandbox/src/lib.rs +++ b/primitives/sr-sandbox/src/lib.rs @@ -178,7 +178,9 @@ impl Instance { /// be returned. /// /// [`EnvironmentDefinitionBuilder`]: struct.EnvironmentDefinitionBuilder.html - pub fn new(code: &[u8], env_def_builder: &EnvironmentDefinitionBuilder, state: &mut T) -> Result, Error> { + pub fn new(code: &[u8], env_def_builder: &EnvironmentDefinitionBuilder, state: &mut T) + -> Result, Error> + { Ok(Instance { inner: imp::Instance::new(code, &env_def_builder.inner, state)?, }) diff --git a/core/sr-sandbox/with_std.rs b/primitives/sr-sandbox/with_std.rs similarity index 100% rename from core/sr-sandbox/with_std.rs rename to primitives/sr-sandbox/with_std.rs diff --git a/core/sr-sandbox/without_std.rs b/primitives/sr-sandbox/without_std.rs similarity index 100% rename from core/sr-sandbox/without_std.rs rename to primitives/sr-sandbox/without_std.rs diff --git a/core/sr-staking-primitives/Cargo.toml b/primitives/sr-staking-primitives/Cargo.toml similarity index 100% rename from core/sr-staking-primitives/Cargo.toml rename to primitives/sr-staking-primitives/Cargo.toml diff --git a/core/sr-staking-primitives/src/lib.rs b/primitives/sr-staking-primitives/src/lib.rs similarity index 100% rename from core/sr-staking-primitives/src/lib.rs rename to primitives/sr-staking-primitives/src/lib.rs diff --git a/core/sr-staking-primitives/src/offence.rs b/primitives/sr-staking-primitives/src/offence.rs similarity index 100% rename from core/sr-staking-primitives/src/offence.rs rename to primitives/sr-staking-primitives/src/offence.rs diff --git a/core/sr-std/Cargo.toml b/primitives/sr-std/Cargo.toml similarity index 100% rename from core/sr-std/Cargo.toml rename to primitives/sr-std/Cargo.toml diff --git a/core/sr-std/src/lib.rs b/primitives/sr-std/src/lib.rs similarity index 86% rename from core/sr-std/src/lib.rs rename to primitives/sr-std/src/lib.rs index f369d3908ba83..5aa8e82235247 100644 --- a/core/sr-std/src/lib.rs +++ b/primitives/sr-std/src/lib.rs @@ -15,13 +15,15 @@ // along with Substrate. If not, see . //! Lowest-abstraction level for the Substrate runtime: just exports useful primitives from std -//! or core/alloc to be used with any code that depends on the runtime. +//! or client/alloc to be used with any code that depends on the runtime. #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), feature(core_intrinsics))] -#![cfg_attr(feature = "std", doc = "Substrate runtime standard library as compiled when linked with Rust's standard library.")] -#![cfg_attr(not(feature = "std"), doc = "Substrate's runtime standard library as compiled without Rust's standard library.")] +#![cfg_attr(feature = "std", + doc = "Substrate runtime standard library as compiled when linked with Rust's standard library.")] +#![cfg_attr(not(feature = "std"), + doc = "Substrate's runtime standard library as compiled without Rust's standard library.")] #[macro_export] macro_rules! map { diff --git a/core/sr-std/with_std.rs b/primitives/sr-std/with_std.rs similarity index 100% rename from core/sr-std/with_std.rs rename to primitives/sr-std/with_std.rs diff --git a/core/sr-std/without_std.rs b/primitives/sr-std/without_std.rs similarity index 100% rename from core/sr-std/without_std.rs rename to primitives/sr-std/without_std.rs diff --git a/core/sr-version/Cargo.toml b/primitives/sr-version/Cargo.toml similarity index 100% rename from core/sr-version/Cargo.toml rename to primitives/sr-version/Cargo.toml diff --git a/core/sr-version/src/lib.rs b/primitives/sr-version/src/lib.rs similarity index 100% rename from core/sr-version/src/lib.rs rename to primitives/sr-version/src/lib.rs diff --git a/core/state-machine/Cargo.toml b/primitives/state-machine/Cargo.toml similarity index 90% rename from core/state-machine/Cargo.toml rename to primitives/state-machine/Cargo.toml index 7cd8601a3b636..3f02056647a00 100644 --- a/core/state-machine/Cargo.toml +++ b/primitives/state-machine/Cargo.toml @@ -12,7 +12,7 @@ hash-db = "0.15.2" trie-db = "0.15.2" trie-root = "0.15.2" trie = { package = "substrate-trie", path = "../trie" } -primitives = { package = "substrate-primitives", path = "../primitives" } +primitives = { package = "substrate-primitives", path = "../core" } panic-handler = { package = "substrate-panic-handler", path = "../panic-handler" } codec = { package = "parity-scale-codec", version = "1.0.0" } num-traits = "0.2.8" diff --git a/core/state-machine/src/backend.rs b/primitives/state-machine/src/backend.rs similarity index 100% rename from core/state-machine/src/backend.rs rename to primitives/state-machine/src/backend.rs diff --git a/core/state-machine/src/basic.rs b/primitives/state-machine/src/basic.rs similarity index 100% rename from core/state-machine/src/basic.rs rename to primitives/state-machine/src/basic.rs diff --git a/core/state-machine/src/changes_trie/build.rs b/primitives/state-machine/src/changes_trie/build.rs similarity index 100% rename from core/state-machine/src/changes_trie/build.rs rename to primitives/state-machine/src/changes_trie/build.rs diff --git a/core/state-machine/src/changes_trie/build_cache.rs b/primitives/state-machine/src/changes_trie/build_cache.rs similarity index 100% rename from core/state-machine/src/changes_trie/build_cache.rs rename to primitives/state-machine/src/changes_trie/build_cache.rs diff --git a/core/state-machine/src/changes_trie/build_iterator.rs b/primitives/state-machine/src/changes_trie/build_iterator.rs similarity index 100% rename from core/state-machine/src/changes_trie/build_iterator.rs rename to primitives/state-machine/src/changes_trie/build_iterator.rs diff --git a/core/state-machine/src/changes_trie/changes_iterator.rs b/primitives/state-machine/src/changes_trie/changes_iterator.rs similarity index 100% rename from core/state-machine/src/changes_trie/changes_iterator.rs rename to primitives/state-machine/src/changes_trie/changes_iterator.rs diff --git a/core/state-machine/src/changes_trie/input.rs b/primitives/state-machine/src/changes_trie/input.rs similarity index 100% rename from core/state-machine/src/changes_trie/input.rs rename to primitives/state-machine/src/changes_trie/input.rs diff --git a/core/state-machine/src/changes_trie/mod.rs b/primitives/state-machine/src/changes_trie/mod.rs similarity index 100% rename from core/state-machine/src/changes_trie/mod.rs rename to primitives/state-machine/src/changes_trie/mod.rs diff --git a/core/state-machine/src/changes_trie/prune.rs b/primitives/state-machine/src/changes_trie/prune.rs similarity index 95% rename from core/state-machine/src/changes_trie/prune.rs rename to primitives/state-machine/src/changes_trie/prune.rs index 531318e234c8d..fccd177e60a2f 100644 --- a/core/state-machine/src/changes_trie/prune.rs +++ b/primitives/state-machine/src/changes_trie/prune.rs @@ -168,7 +168,9 @@ fn pruning_range( // last block for which changes trie is pruned let last_block_to_prune = blocks_to_keep.and_then(|b| block.checked_sub(&b)); - let first_block_to_prune = last_block_to_prune.clone().and_then(|b| b.checked_sub(&prune_interval.into())); + let first_block_to_prune = last_block_to_prune + .clone() + .and_then(|b| b.checked_sub(&prune_interval.into())); last_block_to_prune .and_then(|last| first_block_to_prune.map(|first| (first + One::one(), last))) @@ -221,7 +223,10 @@ mod tests { current_block: u64, ) -> HashSet { let mut pruned_trie_nodes = HashSet::new(); - prune(config, storage, min_blocks_to_keep, &AnchorBlockId { hash: Default::default(), number: current_block }, + prune(config, + storage, + min_blocks_to_keep, + &AnchorBlockId { hash: Default::default(), number: current_block }, |node| { pruned_trie_nodes.insert(node); }); pruned_trie_nodes } @@ -232,18 +237,22 @@ mod tests { let child_key = ChildIndex { block: 67u64, storage_key: b"1".to_vec() }.encode(); let mut mdb1 = MemoryDB::::default(); - let root1 = insert_into_memory_db::(&mut mdb1, vec![(vec![10], vec![20])]).unwrap(); + let root1 = insert_into_memory_db::( + &mut mdb1, vec![(vec![10], vec![20])]).unwrap(); let mut mdb2 = MemoryDB::::default(); - let root2 = insert_into_memory_db::(&mut mdb2, vec![(vec![11], vec![21]), (vec![12], vec![22])]).unwrap(); + let root2 = insert_into_memory_db::( + &mut mdb2, vec![(vec![11], vec![21]), (vec![12], vec![22])]).unwrap(); let mut mdb3 = MemoryDB::::default(); - let ch_root3 = insert_into_memory_db::(&mut mdb3, vec![(vec![110], vec![120])]).unwrap(); + let ch_root3 = insert_into_memory_db::( + &mut mdb3, vec![(vec![110], vec![120])]).unwrap(); let root3 = insert_into_memory_db::(&mut mdb3, vec![ (vec![13], vec![23]), (vec![14], vec![24]), (child_key, ch_root3.as_ref().encode()), ]).unwrap(); let mut mdb4 = MemoryDB::::default(); - let root4 = insert_into_memory_db::(&mut mdb4, vec![(vec![15], vec![25])]).unwrap(); + let root4 = insert_into_memory_db::( + &mut mdb4, vec![(vec![15], vec![25])]).unwrap(); let storage = InMemoryStorage::new(); storage.insert(65, root1, mdb1); storage.insert(66, root2, mdb2); diff --git a/core/state-machine/src/changes_trie/storage.rs b/primitives/state-machine/src/changes_trie/storage.rs similarity index 100% rename from core/state-machine/src/changes_trie/storage.rs rename to primitives/state-machine/src/changes_trie/storage.rs diff --git a/core/state-machine/src/changes_trie/surface_iterator.rs b/primitives/state-machine/src/changes_trie/surface_iterator.rs similarity index 100% rename from core/state-machine/src/changes_trie/surface_iterator.rs rename to primitives/state-machine/src/changes_trie/surface_iterator.rs diff --git a/core/state-machine/src/error.rs b/primitives/state-machine/src/error.rs similarity index 100% rename from core/state-machine/src/error.rs rename to primitives/state-machine/src/error.rs diff --git a/core/state-machine/src/ext.rs b/primitives/state-machine/src/ext.rs similarity index 100% rename from core/state-machine/src/ext.rs rename to primitives/state-machine/src/ext.rs diff --git a/core/state-machine/src/lib.rs b/primitives/state-machine/src/lib.rs similarity index 100% rename from core/state-machine/src/lib.rs rename to primitives/state-machine/src/lib.rs diff --git a/core/state-machine/src/overlayed_changes.rs b/primitives/state-machine/src/overlayed_changes.rs similarity index 92% rename from core/state-machine/src/overlayed_changes.rs rename to primitives/state-machine/src/overlayed_changes.rs index 53a66dc49ee05..73cb8b604a1c2 100644 --- a/core/state-machine/src/overlayed_changes.rs +++ b/primitives/state-machine/src/overlayed_changes.rs @@ -359,7 +359,9 @@ mod tests { use crate::ext::Ext; use super::*; - fn strip_extrinsic_index(map: &HashMap, OverlayedValue>) -> HashMap, OverlayedValue> { + fn strip_extrinsic_index(map: &HashMap, OverlayedValue>) + -> HashMap, OverlayedValue> + { let mut clone = map.clone(); clone.remove(&EXTRINSIC_INDEX.to_vec()); clone @@ -455,7 +457,8 @@ mod tests { assert_eq!( strip_extrinsic_index(&overlay.prospective.top), vec![ - (vec![1], OverlayedValue { value: Some(vec![2]), extrinsics: Some(vec![0].into_iter().collect()) }), + (vec![1], OverlayedValue { value: Some(vec![2]), + extrinsics: Some(vec![0].into_iter().collect()) }), ].into_iter().collect(), ); } @@ -491,9 +494,12 @@ mod tests { assert_eq!(strip_extrinsic_index(&overlay.prospective.top), vec![ - (vec![1], OverlayedValue { value: Some(vec![6]), extrinsics: Some(vec![0, 2].into_iter().collect()) }), - (vec![3], OverlayedValue { value: Some(vec![4]), extrinsics: Some(vec![1].into_iter().collect()) }), - (vec![100], OverlayedValue { value: Some(vec![101]), extrinsics: Some(vec![NO_EXTRINSIC_INDEX].into_iter().collect()) }), + (vec![1], OverlayedValue { value: Some(vec![6]), + extrinsics: Some(vec![0, 2].into_iter().collect()) }), + (vec![3], OverlayedValue { value: Some(vec![4]), + extrinsics: Some(vec![1].into_iter().collect()) }), + (vec![100], OverlayedValue { value: Some(vec![101]), + extrinsics: Some(vec![NO_EXTRINSIC_INDEX].into_iter().collect()) }), ].into_iter().collect()); overlay.commit_prospective(); @@ -506,24 +512,32 @@ mod tests { assert_eq!(strip_extrinsic_index(&overlay.committed.top), vec![ - (vec![1], OverlayedValue { value: Some(vec![6]), extrinsics: Some(vec![0, 2].into_iter().collect()) }), - (vec![3], OverlayedValue { value: Some(vec![4]), extrinsics: Some(vec![1].into_iter().collect()) }), - (vec![100], OverlayedValue { value: Some(vec![101]), extrinsics: Some(vec![NO_EXTRINSIC_INDEX].into_iter().collect()) }), + (vec![1], OverlayedValue { value: Some(vec![6]), + extrinsics: Some(vec![0, 2].into_iter().collect()) }), + (vec![3], OverlayedValue { value: Some(vec![4]), + extrinsics: Some(vec![1].into_iter().collect()) }), + (vec![100], OverlayedValue { value: Some(vec![101]), + extrinsics: Some(vec![NO_EXTRINSIC_INDEX].into_iter().collect()) }), ].into_iter().collect()); assert_eq!(strip_extrinsic_index(&overlay.prospective.top), vec![ - (vec![1], OverlayedValue { value: Some(vec![8]), extrinsics: Some(vec![4].into_iter().collect()) }), - (vec![3], OverlayedValue { value: Some(vec![7]), extrinsics: Some(vec![3].into_iter().collect()) }), + (vec![1], OverlayedValue { value: Some(vec![8]), + extrinsics: Some(vec![4].into_iter().collect()) }), + (vec![3], OverlayedValue { value: Some(vec![7]), + extrinsics: Some(vec![3].into_iter().collect()) }), ].into_iter().collect()); overlay.commit_prospective(); assert_eq!(strip_extrinsic_index(&overlay.committed.top), vec![ - (vec![1], OverlayedValue { value: Some(vec![8]), extrinsics: Some(vec![0, 2, 4].into_iter().collect()) }), - (vec![3], OverlayedValue { value: Some(vec![7]), extrinsics: Some(vec![1, 3].into_iter().collect()) }), - (vec![100], OverlayedValue { value: Some(vec![101]), extrinsics: Some(vec![NO_EXTRINSIC_INDEX].into_iter().collect()) }), + (vec![1], OverlayedValue { value: Some(vec![8]), + extrinsics: Some(vec![0, 2, 4].into_iter().collect()) }), + (vec![3], OverlayedValue { value: Some(vec![7]), + extrinsics: Some(vec![1, 3].into_iter().collect()) }), + (vec![100], OverlayedValue { value: Some(vec![101]), + extrinsics: Some(vec![NO_EXTRINSIC_INDEX].into_iter().collect()) }), ].into_iter().collect()); assert_eq!(overlay.prospective, diff --git a/core/state-machine/src/proving_backend.rs b/primitives/state-machine/src/proving_backend.rs similarity index 100% rename from core/state-machine/src/proving_backend.rs rename to primitives/state-machine/src/proving_backend.rs diff --git a/core/state-machine/src/testing.rs b/primitives/state-machine/src/testing.rs similarity index 100% rename from core/state-machine/src/testing.rs rename to primitives/state-machine/src/testing.rs diff --git a/core/state-machine/src/trie_backend.rs b/primitives/state-machine/src/trie_backend.rs similarity index 100% rename from core/state-machine/src/trie_backend.rs rename to primitives/state-machine/src/trie_backend.rs diff --git a/core/state-machine/src/trie_backend_essence.rs b/primitives/state-machine/src/trie_backend_essence.rs similarity index 100% rename from core/state-machine/src/trie_backend_essence.rs rename to primitives/state-machine/src/trie_backend_essence.rs diff --git a/core/transaction-pool/runtime-api/Cargo.toml b/primitives/transaction-pool/runtime-api/Cargo.toml similarity index 91% rename from core/transaction-pool/runtime-api/Cargo.toml rename to primitives/transaction-pool/runtime-api/Cargo.toml index 087d4644fd6a8..e002208502592 100644 --- a/core/transaction-pool/runtime-api/Cargo.toml +++ b/primitives/transaction-pool/runtime-api/Cargo.toml @@ -5,9 +5,9 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -sr-primitives = { path = "../../sr-primitives", default-features = false } -primitives = { package = "substrate-primitives", path = "../../primitives", default-features = false } +primitives = { package = "substrate-primitives", path = "../../core", default-features = false } sr-api = { path = "../../sr-api", default-features = false } +sr-primitives = { path = "../../sr-primitives", default-features = false } [features] default = [ "std" ] diff --git a/core/transaction-pool/runtime-api/src/lib.rs b/primitives/transaction-pool/runtime-api/src/lib.rs similarity index 100% rename from core/transaction-pool/runtime-api/src/lib.rs rename to primitives/transaction-pool/runtime-api/src/lib.rs diff --git a/core/trie/Cargo.toml b/primitives/trie/Cargo.toml similarity index 90% rename from core/trie/Cargo.toml rename to primitives/trie/Cargo.toml index 4a48761e9f9e0..202c9066d0917 100644 --- a/core/trie/Cargo.toml +++ b/primitives/trie/Cargo.toml @@ -18,7 +18,7 @@ hash-db = { version = "0.15.2", default-features = false } trie-db = { version = "0.15.2", default-features = false } trie-root = { version = "0.15.2", default-features = false } memory-db = { version = "0.15.2", default-features = false } -primitives = { package = "substrate-primitives", path = "../primitives", default-features = false } +primitives = { package = "substrate-primitives", path = "../core", default-features = false } [dev-dependencies] trie-bench = "0.16.2" diff --git a/core/trie/benches/bench.rs b/primitives/trie/benches/bench.rs similarity index 100% rename from core/trie/benches/bench.rs rename to primitives/trie/benches/bench.rs diff --git a/core/trie/src/error.rs b/primitives/trie/src/error.rs similarity index 100% rename from core/trie/src/error.rs rename to primitives/trie/src/error.rs diff --git a/core/trie/src/lib.rs b/primitives/trie/src/lib.rs similarity index 100% rename from core/trie/src/lib.rs rename to primitives/trie/src/lib.rs diff --git a/core/trie/src/node_codec.rs b/primitives/trie/src/node_codec.rs similarity index 100% rename from core/trie/src/node_codec.rs rename to primitives/trie/src/node_codec.rs diff --git a/core/trie/src/node_header.rs b/primitives/trie/src/node_header.rs similarity index 100% rename from core/trie/src/node_header.rs rename to primitives/trie/src/node_header.rs diff --git a/core/trie/src/trie_stream.rs b/primitives/trie/src/trie_stream.rs similarity index 100% rename from core/trie/src/trie_stream.rs rename to primitives/trie/src/trie_stream.rs diff --git a/core/wasm-interface/Cargo.toml b/primitives/wasm-interface/Cargo.toml similarity index 100% rename from core/wasm-interface/Cargo.toml rename to primitives/wasm-interface/Cargo.toml diff --git a/core/wasm-interface/src/lib.rs b/primitives/wasm-interface/src/lib.rs similarity index 100% rename from core/wasm-interface/src/lib.rs rename to primitives/wasm-interface/src/lib.rs diff --git a/core/wasm-interface/src/wasmi_impl.rs b/primitives/wasm-interface/src/wasmi_impl.rs similarity index 100% rename from core/wasm-interface/src/wasmi_impl.rs rename to primitives/wasm-interface/src/wasmi_impl.rs diff --git a/srml/README.adoc b/srml/README.adoc deleted file mode 100644 index 05da2de0a0357..0000000000000 --- a/srml/README.adoc +++ /dev/null @@ -1,26 +0,0 @@ - -= SRML - -The Substrate Runtime Module Library (SRML) is a collection of runtime modules. - -== What are runtime modules? - -A Substrate runtime can be composed of several smaller components for separation of concerns. These components are called runtime _modules_. Each runtime module packages together a set of functions (dispatchable extrinsic calls, public or private, mutable or immutable), storage items, and events. - -There are four primary components that support runtime modules: - -=== system module - -https://github.com/paritytech/substrate/tree/master/srml/system[`system`] provides low-level APIs and utilities for other modules. https://github.com/paritytech/substrate/tree/master/srml/system[`system`] also defines all core types and extrinsic events for the Substrate runtime. *All modules depend on the system module.* - -=== executive module - -https://github.com/paritytech/substrate/tree/master/srml/executive[`executive`] dispatches incoming extrinsic calls to the respective modules in the runtime. - -=== support macros - -https://github.com/paritytech/substrate/tree/master/srml/support[`support` macros] are a collection of Rust macros to facilitate the implementation of common module components. https://github.com/paritytech/substrate/tree/master/srml/support[`support` macros] expand at runtime to generate types (e.g. `Module`, `Call`, `Store`, `Event`) which are thereafter used by the runtime to communicate with the modules. Common support macros include https://crates.parity.io/srml_support/macro.decl_module.html[`decl_module`], https://crates.parity.io/srml_support_procedural/macro.decl_storage.html[`decl_storage`], https://crates.parity.io/srml_support/macro.decl_event.html[`decl_event`], and https://crates.parity.io/srml_support/macro.ensure.html[`ensure`]. - -=== runtime - -The runtime expands the support macros to get type and trait implementations for each module before calling https://github.com/paritytech/substrate/tree/master/srml/executive[`executive`] to dispatch calls to the individual modules. To see an example of how this might look, see https://github.com/paritytech/substrate/blob/master/node/runtime/src/lib.rs[`../node/runtime`]. \ No newline at end of file diff --git a/srml/aura/Cargo.toml b/srml/aura/Cargo.toml deleted file mode 100644 index f1c37b7c08d45..0000000000000 --- a/srml/aura/Cargo.toml +++ /dev/null @@ -1,41 +0,0 @@ -[package] -name = "srml-aura" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -app-crypto = { package = "substrate-application-crypto", path = "../../core/application-crypto", default-features = false } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -serde = { version = "1.0.101", optional = true } -session = { package = "srml-session", path = "../session", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -substrate-consensus-aura-primitives = { path = "../../core/consensus/aura/primitives", default-features = false} -system = { package = "srml-system", path = "../system", default-features = false } -timestamp = { package = "srml-timestamp", path = "../timestamp", default-features = false } - -[dev-dependencies] -lazy_static = "1.4.0" -parking_lot = "0.9.0" - -[features] -default = ["std"] -std = [ - "app-crypto/std", - "codec/std", - "inherents/std", - "runtime-io/std", - "primitives/std", - "rstd/std", - "serde", - "sr-primitives/std", - "support/std", - "substrate-consensus-aura-primitives/std", - "system/std", - "timestamp/std", -] diff --git a/srml/authority-discovery/Cargo.toml b/srml/authority-discovery/Cargo.toml deleted file mode 100644 index 6b896e4729ab4..0000000000000 --- a/srml/authority-discovery/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "srml-authority-discovery" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -app-crypto = { package = "substrate-application-crypto", path = "../../core/application-crypto", default-features = false } -authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", path = "../../core/authority-discovery/primitives", default-features = false } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false } -serde = { version = "1.0.101", optional = true } -session = { package = "srml-session", path = "../session", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } - -[dev-dependencies] -sr-staking-primitives = { path = "../../core/sr-staking-primitives", default-features = false } - -[features] -default = ["std"] -std = [ - "app-crypto/std", - "authority-discovery-primitives/std", - "codec/std", - "primitives/std", - "rstd/std", - "runtime-io/std", - "serde", - "session/std", - "sr-primitives/std", - "support/std", - "system/std", -] diff --git a/srml/babe/Cargo.toml b/srml/babe/Cargo.toml deleted file mode 100644 index dc82906650bef..0000000000000 --- a/srml/babe/Cargo.toml +++ /dev/null @@ -1,44 +0,0 @@ -[package] -name = "srml-babe" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -hex-literal = "0.2.1" -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.101", optional = true } -inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -sr-staking-primitives = { path = "../../core/sr-staking-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } -timestamp = { package = "srml-timestamp", path = "../timestamp", default-features = false } -session = { package = "srml-session", path = "../session", default-features = false } -babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../core/consensus/babe/primitives", default-features = false } -runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = false } - -[dev-dependencies] -lazy_static = "1.4.0" -parking_lot = "0.9.0" -sr-version = { path = "../../core/sr-version", default-features = false } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -test-runtime = { package = "substrate-test-runtime", path = "../../core/test-runtime" } - -[features] -default = ["std"] -std = [ - "serde", - "codec/std", - "rstd/std", - "support/std", - "sr-primitives/std", - "sr-staking-primitives/std", - "system/std", - "timestamp/std", - "inherents/std", - "babe-primitives/std", - "session/std", - "runtime-io/std", -] diff --git a/srml/elections-phragmen/Cargo.toml b/srml/elections-phragmen/Cargo.toml deleted file mode 100644 index 85532849ecc00..0000000000000 --- a/srml/elections-phragmen/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[package] -name = "srml-elections-phragmen" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -phragmen = { package = "substrate-phragmen", path = "../../core/phragmen", default-features = false } -srml-support = { path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } - -[dev-dependencies] -runtime_io = { package = "sr-io", path = "../../core/sr-io" } -hex-literal = "0.2.1" -balances = { package = "srml-balances", path = "../balances" } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -serde = { version = "1.0.101" } - -[features] -default = ["std"] -std = [ - "codec/std", - "srml-support/std", - "sr-primitives/std", - "phragmen/std", - "system/std", - "rstd/std", -] diff --git a/srml/executive/Cargo.toml b/srml/executive/Cargo.toml deleted file mode 100644 index f184ae981b856..0000000000000 --- a/srml/executive/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "srml-executive" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -serde = { version = "1.0.101", optional = true } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } - -[dev-dependencies] -hex-literal = "0.2.1" -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -balances = { package = "srml-balances", path = "../balances" } -indices = { package = "srml-indices", path = "../indices" } -transaction-payment = { package = "srml-transaction-payment", path = "../transaction-payment" } - -[features] -default = ["std"] -std = [ - "rstd/std", - "support/std", - "serde", - "codec/std", - "sr-primitives/std", - "runtime-io/std", - "system/std", -] diff --git a/srml/finality-tracker/Cargo.toml b/srml/finality-tracker/Cargo.toml deleted file mode 100644 index a881b2906f045..0000000000000 --- a/srml/finality-tracker/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[package] -name = "srml-finality-tracker" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -serde = { version = "1.0.101", default-features = false, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false } -inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -srml-system = { path = "../system", default-features = false } -impl-trait-for-tuples = "0.1.3" - -[dev-dependencies] -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false } - -[features] -default = ["std"] -std = [ - "serde/std", - "codec/std", - "rstd/std", - "support/std", - "sr-primitives/std", - "srml-system/std", - "inherents/std", -] diff --git a/srml/grandpa/Cargo.toml b/srml/grandpa/Cargo.toml deleted file mode 100644 index 21b48d3cdc51d..0000000000000 --- a/srml/grandpa/Cargo.toml +++ /dev/null @@ -1,38 +0,0 @@ -[package] -name = "srml-grandpa" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -serde = { version = "1.0.101", optional = true, features = ["derive"] } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -substrate-finality-grandpa-primitives = { path = "../../core/finality-grandpa/primitives", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -sr-staking-primitives = { path = "../../core/sr-staking-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } -session = { package = "srml-session", path = "../session", default-features = false } -finality-tracker = { package = "srml-finality-tracker", path = "../finality-tracker", default-features = false } - -[dev-dependencies] -runtime-io ={ package = "sr-io", path = "../../core/sr-io" } - -[features] -default = ["std"] -std = [ - "serde", - "codec/std", - "primitives/std", - "substrate-finality-grandpa-primitives/std", - "rstd/std", - "support/std", - "sr-primitives/std", - "sr-staking-primitives/std", - "system/std", - "session/std", - "finality-tracker/std", -] -migrate-authorities = [] diff --git a/srml/im-online/Cargo.toml b/srml/im-online/Cargo.toml deleted file mode 100644 index 4c7ccf1487d9b..0000000000000 --- a/srml/im-online/Cargo.toml +++ /dev/null @@ -1,39 +0,0 @@ -[package] -name = "srml-im-online" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -app-crypto = { package = "substrate-application-crypto", path = "../../core/application-crypto", default-features = false } -authorship = { package = "srml-authorship", path = "../authorship", default-features = false } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -primitives = { package="substrate-primitives", path = "../../core/primitives", default-features = false } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -serde = { version = "1.0.101", optional = true } -session = { package = "srml-session", path = "../session", default-features = false } -runtime-io = { package = "sr-io", path = "../../core/sr-io", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -sr-staking-primitives = { path = "../../core/sr-staking-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } - -[dev-dependencies] -offchain = { package = "substrate-offchain", path = "../../core/offchain" } - -[features] -default = ["std", "session/historical"] -std = [ - "app-crypto/std", - "authorship/std", - "codec/std", - "primitives/std", - "rstd/std", - "serde", - "session/std", - "runtime-io/std", - "sr-primitives/std", - "sr-staking-primitives/std", - "support/std", - "system/std", -] diff --git a/srml/offences/Cargo.toml b/srml/offences/Cargo.toml deleted file mode 100644 index 90a3396d11228..0000000000000 --- a/srml/offences/Cargo.toml +++ /dev/null @@ -1,32 +0,0 @@ -[package] -name = "srml-offences" -version = "1.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -balances = { package = "srml-balances", path = "../balances", default-features = false } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -serde = { version = "1.0.101", optional = true } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -sr-staking-primitives = { path = "../../core/sr-staking-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } - -[dev-dependencies] -runtime-io = { package = "sr-io", path = "../../core/sr-io" } -substrate-primitives = { path = "../../core/primitives" } - -[features] -default = ["std"] -std = [ - "balances/std", - "codec/std", - "rstd/std", - "serde", - "sr-primitives/std", - "sr-staking-primitives/std", - "support/std", - "system/std", -] diff --git a/srml/staking/Cargo.toml b/srml/staking/Cargo.toml deleted file mode 100644 index 67f3ab41d6583..0000000000000 --- a/srml/staking/Cargo.toml +++ /dev/null @@ -1,45 +0,0 @@ -[package] -name = "srml-staking" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -serde = { version = "1.0.101", optional = true } -safe-mix = { version = "1.0.0", default-features = false } -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -substrate-keyring = { path = "../../core/keyring", optional = true } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -phragmen = { package = "substrate-phragmen", path = "../../core/phragmen", default-features = false } -runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -sr-staking-primitives = { path = "../../core/sr-staking-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } -session = { package = "srml-session", path = "../session", default-features = false, features = ["historical"] } -authorship = { package = "srml-authorship", path = "../authorship", default-features = false } - -[dev-dependencies] -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -balances = { package = "srml-balances", path = "../balances" } -timestamp = { package = "srml-timestamp", path = "../timestamp" } -srml-staking-reward-curve = { path = "../staking/reward-curve"} - -[features] -equalize = [] -default = ["std", "equalize"] -std = [ - "serde", - "safe-mix/std", - "substrate-keyring", - "codec/std", - "rstd/std", - "phragmen/std", - "runtime-io/std", - "support/std", - "sr-primitives/std", - "sr-staking-primitives/std", - "session/std", - "system/std", - "authorship/std", -] diff --git a/srml/transaction-payment/Cargo.toml b/srml/transaction-payment/Cargo.toml deleted file mode 100644 index cbce1e945e69b..0000000000000 --- a/srml/transaction-payment/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "srml-transaction-payment" -version = "2.0.0" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -support = { package = "srml-support", path = "../support", default-features = false } -system = { package = "srml-system", path = "../system", default-features = false } -transaction-payment-rpc-runtime-api = { package = "srml-transaction-payment-rpc-runtime-api", path = "./rpc/runtime-api", default-features = false } - -[dev-dependencies] -runtime-io = { package = "sr-io", path = "../../core/sr-io" } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } -balances = { package = "srml-balances", path = "../balances" } - -[features] -default = ["std"] -std = [ - "codec/std", - "rstd/std", - "sr-primitives/std", - "support/std", - "system/std", - "transaction-payment-rpc-runtime-api/std" -] diff --git a/test-utils/transaction-factory/Cargo.toml b/test-utils/transaction-factory/Cargo.toml deleted file mode 100644 index ce32708ebf4ef..0000000000000 --- a/test-utils/transaction-factory/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "transaction-factory" -version = "0.0.1" -authors = ["Parity Technologies "] -edition = "2018" - -[dependencies] -cli = { package = "substrate-cli", path = "../../core/cli" } -client = { package = "substrate-client", path = "../../core/client" } -sr-api = { path = "../../core/sr-api" } -block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../core/block-builder/runtime-api" } -consensus_common = { package = "substrate-consensus-common", path = "../../core/consensus/common" } -log = "0.4.8" -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false } -sr-primitives = { path = "../../core/sr-primitives", default-features = false } -substrate-service = { path = "../../core/service" } - -[features] -default = ["std"] -std = [ - "codec/std", - "sr-primitives/std", -] diff --git a/test-utils/chain-spec-builder/Cargo.toml b/test/utils/chain-spec-builder/Cargo.toml similarity index 65% rename from test-utils/chain-spec-builder/Cargo.toml rename to test/utils/chain-spec-builder/Cargo.toml index e8ca8d354025a..7498880e0f566 100644 --- a/test-utils/chain-spec-builder/Cargo.toml +++ b/test/utils/chain-spec-builder/Cargo.toml @@ -7,8 +7,8 @@ build = "build.rs" [dependencies] ansi_term = "0.12.1" -keystore = { package = "substrate-keystore", path = "../../core/keystore" } -node-cli = { path = "../../node/cli" } -primitives = { package = "substrate-primitives", path = "../../core/primitives" } +keystore = { package = "substrate-keystore", path = "../../../client/keystore" } +node-cli = { path = "../../../bin/node/cli" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } rand = "0.7.2" structopt = "0.3.3" diff --git a/test-utils/chain-spec-builder/build.rs b/test/utils/chain-spec-builder/build.rs similarity index 100% rename from test-utils/chain-spec-builder/build.rs rename to test/utils/chain-spec-builder/build.rs diff --git a/test-utils/chain-spec-builder/src/main.rs b/test/utils/chain-spec-builder/src/main.rs similarity index 100% rename from test-utils/chain-spec-builder/src/main.rs rename to test/utils/chain-spec-builder/src/main.rs diff --git a/test/utils/client/Cargo.toml b/test/utils/client/Cargo.toml new file mode 100644 index 0000000000000..a000d8186f8e6 --- /dev/null +++ b/test/utils/client/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "substrate-test-client" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +client-api = { package = "substrate-client-api", path = "../../../client/api" } +client = { package = "substrate-client", path = "../../../client/" } +client-db = { package = "substrate-client-db", path = "../../../client//db", features = ["test-helpers"] } +consensus = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" } +executor = { package = "substrate-executor", path = "../../../client/executor" } +futures-preview = "0.3.0-alpha.19" +hash-db = "0.15.2" +keyring = { package = "substrate-keyring", path = "../../../primitives/keyring" } +codec = { package = "parity-scale-codec", version = "1.0.0" } +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +state_machine = { package = "substrate-state-machine", path = "../../../primitives/state-machine" } diff --git a/core/test-client/src/client_ext.rs b/test/utils/client/src/client_ext.rs similarity index 97% rename from core/test-client/src/client_ext.rs rename to test/utils/client/src/client_ext.rs index 8b6286b57699a..d7ae5097a3196 100644 --- a/core/test-client/src/client_ext.rs +++ b/test/utils/client/src/client_ext.rs @@ -16,7 +16,8 @@ //! Client extension for tests. -use client::{self, Client, backend::Finalizer}; +use client::{self, Client}; +use client_api::backend::Finalizer; use consensus::{ BlockImportParams, BlockImport, BlockOrigin, Error as ConsensusError, ForkChoiceStrategy, @@ -63,7 +64,7 @@ pub trait ClientExt: Sized { impl ClientExt for Client where - B: client::backend::Backend, + B: client_api::backend::Backend, E: client::CallExecutor, for<'r> &'r Self: BlockImport, Block: BlockT::Out>, diff --git a/core/test-client/src/lib.rs b/test/utils/client/src/lib.rs similarity index 97% rename from core/test-client/src/lib.rs rename to test/utils/client/src/lib.rs index a075caec3143d..7143b67599199 100644 --- a/core/test-client/src/lib.rs +++ b/test/utils/client/src/lib.rs @@ -20,7 +20,7 @@ pub mod client_ext; -pub use client::{ExecutionStrategies, blockchain, backend, self}; +pub use client::{ExecutionStrategies, blockchain, self}; pub use client_db::{Backend, self}; pub use client_ext::ClientExt; pub use consensus; @@ -171,7 +171,7 @@ impl TestClientBuilder client::LongestChain, ) where Executor: client::CallExecutor, - Backend: client::backend::Backend, + Backend: client_api::backend::Backend, Block: BlockT::Out>, { @@ -223,7 +223,7 @@ impl TestClientBuilder< ) where I: Into>>, E: executor::NativeExecutionDispatch, - Backend: client::backend::Backend, + Backend: client_api::backend::Backend, Block: BlockT::Out>, { let executor = executor.into().unwrap_or_else(|| diff --git a/test/utils/primitives/Cargo.toml b/test/utils/primitives/Cargo.toml new file mode 100644 index 0000000000000..b3d200f95defb --- /dev/null +++ b/test/utils/primitives/Cargo.toml @@ -0,0 +1,71 @@ +[package] +name = "substrate-test-primitives" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +app-crypto = { package = "substrate-application-crypto", path = "../../../primitives/application-crypto", default-features = false } +codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } +# aura-primitives = { package = "substrate-consensus-aura-primitives", path = "../../../primitives/consensus/aura", default-features = false } +# babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../../primitives/consensus/babe", default-features = false } +# block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../../primitives/block-builder/runtime-api", default-features = false } +# inherents = { package = "substrate-inherents", path = "../../../primitives/inherents", default-features = false } +# log = { version = "0.4.8", optional = true } +# memory-db = { version = "0.15.2", default-features = false } +# offchain-primitives = { package = "substrate-offchain-primitives", path = "../../../primitives/offchain", default-features = false} +primitives = { package = "substrate-primitives", path = "../../../primitives/core", default-features = false } +# rstd = { package = "sr-std", path = "../../../primitives/sr-std", default-features = false } +# runtime-interface = { package = "substrate-runtime-interface", path = "../../../primitives/runtime-interface", default-features = false} +# runtime_io = { package = "sr-io", path = "../../../primitives/sr-io", default-features = false } +# runtime_support = { package = "paint-support", path = "../../../paint/support", default-features = false } +# runtime_version = { package = "sr-version", path = "../../../primitives/sr-version", default-features = false } +serde = { version = "1.0.101", optional = true, features = ["derive"] } +# session = { package = "substrate-session", path = "../../../primitives/session", default-features = false } +# sr-api = { path = "../../../primitives/sr-api", default-features = false } +sr-primitives = { path = "../../../primitives/sr-primitives", default-features = false } +# paint-babe = { path = "../../../paint/babe", default-features = false } +# paint-system = { path = "../../../paint/system", default-features = false } +# paint-system-rpc-runtime-api = { path = "../../../paint/system/rpc/runtime-api", default-features = false } +# paint-timestamp = { path = "../../../paint/timestamp", default-features = false } +# substrate-client = { path = "../../../client", optional = true } +# substrate-trie = { path = "../../../primitives/trie", default-features = false } +# transaction-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../../../primitives/transaction-pool/runtime-api", default-features = false } +# trie-db = { version = "0.15.2", default-features = false } + +[features] +default = [ + "std", +] +std = [ + "app-crypto/std", + # "aura-primitives/std", + # "babe-primitives/std", + # "block-builder-api/std", + # "codec/std", + # "executive/std", + # "inherents/std", + # "keyring", + # "log", + # "memory-db/std", + # "offchain-primitives/std", + # "primitives/std", + # "primitives/std", + # "rstd/std", + # "runtime-interface/std", + # "runtime_io/std", + # "runtime_support/std", + # "runtime_version/std", + "serde", + # "session/std", + # "sr-api/std", + # "sr-primitives/std", + # "paint-babe/std", + # "paint-system-rpc-runtime-api/std", + # "paint-system/std", + # "paint-timestamp/std", + # "substrate-client", + # "substrate-trie/std", + # "transaction-pool-api/std", + # "trie-db/std", +] diff --git a/test/utils/primitives/src/lib.rs b/test/utils/primitives/src/lib.rs new file mode 100644 index 0000000000000..d30b9eabf6fa8 --- /dev/null +++ b/test/utils/primitives/src/lib.rs @@ -0,0 +1,78 @@ +// 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 . + +//! 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 sr_primitives::traits::{BlakeTwo256, Verify, Extrinsic as ExtrinsicT,}; + +/// Extrinsic for test-runtime. +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug)] +pub enum Extrinsic { + IncludeData(Vec), + StorageChange(Vec, Option>), +} + +#[cfg(feature = "std")] +impl serde::Serialize for Extrinsic { + fn serialize(&self, seq: S) -> Result 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 { + if let Extrinsic::IncludeData(_) = *self { + Some(false) + } else { + Some(true) + } + } + + fn new(call: Self::Call, _signature_payload: Option) -> Option { + 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 = ::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 = sr_primitives::generic::DigestItem; +/// The digest of a block. +pub type Digest = sr_primitives::generic::Digest; +/// A test block. +pub type Block = sr_primitives::generic::Block; +/// A test block's header. +pub type Header = sr_primitives::generic::Header; diff --git a/test/utils/runtime/Cargo.toml b/test/utils/runtime/Cargo.toml new file mode 100644 index 0000000000000..c405451fa8602 --- /dev/null +++ b/test/utils/runtime/Cargo.toml @@ -0,0 +1,83 @@ +[package] +name = "substrate-test-runtime" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" +build = "build.rs" + +[dependencies] +app-crypto = { package = "substrate-application-crypto", path = "../../../primitives/application-crypto", default-features = false } +aura-primitives = { package = "substrate-consensus-aura-primitives", path = "../../../primitives/consensus/aura", default-features = false } +babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../../../primitives/consensus/babe", default-features = false } +block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../../primitives/block-builder/runtime-api", default-features = false } +cfg-if = "0.1.10" +codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } +executive = { package = "paint-executive", path = "../../../paint/executive", default-features = false } +inherents = { package = "substrate-inherents", path = "../../../primitives/inherents", default-features = false } +keyring = { package = "substrate-keyring", path = "../../../primitives/keyring", optional = true } +log = { version = "0.4.8", optional = true } +memory-db = { version = "0.15.2", default-features = false } +offchain-primitives = { package = "substrate-offchain-primitives", path = "../../../primitives/offchain", default-features = false} +primitives = { package = "substrate-primitives", path = "../../../primitives/core", default-features = false } +rstd = { package = "sr-std", path = "../../../primitives/sr-std", default-features = false } +runtime-interface = { package = "substrate-runtime-interface", path = "../../../primitives/runtime-interface", default-features = false} +runtime_io = { package = "sr-io", path = "../../../primitives/sr-io", default-features = false } +runtime_support = { package = "paint-support", path = "../../../paint/support", default-features = false } +runtime_version = { package = "sr-version", path = "../../../primitives/sr-version", default-features = false } +serde = { version = "1.0.101", optional = true, features = ["derive"] } +session = { package = "substrate-session", path = "../../../primitives/session", default-features = false } +sr-api = { path = "../../../primitives/sr-api", default-features = false } +sr-primitives = { path = "../../../primitives/sr-primitives", default-features = false } +paint-babe = { path = "../../../paint/babe", default-features = false } +paint-system = { path = "../../../paint/system", default-features = false } +paint-system-rpc-runtime-api = { path = "../../../paint/system/rpc/runtime-api", default-features = false } +paint-timestamp = { path = "../../../paint/timestamp", default-features = false } +substrate-client = { path = "../../../client", optional = true } +substrate-trie = { path = "../../../primitives/trie", default-features = false } +transaction-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../../../primitives/transaction-pool/runtime-api", default-features = false } +trie-db = { version = "0.15.2", default-features = false } + +[dev-dependencies] +substrate-executor = { path = "../../../client/executor" } +substrate-test-runtime-client = { path = "./client" } +state_machine = { package = "substrate-state-machine", path = "../../../primitives/state-machine" } + +[build-dependencies] +wasm-builder-runner = { package = "substrate-wasm-builder-runner", path = "../../../client/utils/wasm-builder-runner", version = "1.0.4" } + +[features] +default = [ + "std", +] +std = [ + "app-crypto/std", + "aura-primitives/std", + "babe-primitives/std", + "block-builder-api/std", + "codec/std", + "executive/std", + "inherents/std", + "keyring", + "log", + "memory-db/std", + "offchain-primitives/std", + "primitives/std", + "primitives/std", + "rstd/std", + "runtime-interface/std", + "runtime_io/std", + "runtime_support/std", + "runtime_version/std", + "serde", + "session/std", + "sr-api/std", + "sr-primitives/std", + "paint-babe/std", + "paint-system-rpc-runtime-api/std", + "paint-system/std", + "paint-timestamp/std", + "substrate-client", + "substrate-trie/std", + "transaction-pool-api/std", + "trie-db/std", +] diff --git a/core/test-runtime/build.rs b/test/utils/runtime/build.rs similarity index 97% rename from core/test-runtime/build.rs rename to test/utils/runtime/build.rs index 200cd6d42c2d7..cd2c502e78c45 100644 --- a/core/test-runtime/build.rs +++ b/test/utils/runtime/build.rs @@ -20,7 +20,7 @@ fn main() { build_current_project_with_rustflags( "wasm_binary.rs", WasmBuilderSource::CratesOrPath { - path: "../utils/wasm-builder", + path: "../../../utils/wasm-builder", version: "1.0.8", }, // Note that we set the stack-size to 1MB explicitly even though it is set diff --git a/test/utils/runtime/client/Cargo.toml b/test/utils/runtime/client/Cargo.toml new file mode 100644 index 0000000000000..68f5820062100 --- /dev/null +++ b/test/utils/runtime/client/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "substrate-test-runtime-client" +version = "2.0.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +block-builder = { package = "substrate-block-builder", path = "../../../../client/block-builder" } +generic-test-client = { package = "substrate-test-client", path = "../../client" } +primitives = { package = "substrate-primitives", path = "../../../../primitives/core" } +runtime = { package = "substrate-test-runtime", path = "../../runtime" } +sr-primitives = { path = "../../../../primitives/sr-primitives" } +codec = { package = "parity-scale-codec", version = "1.0.0" } +client-api = { package = "substrate-client-api", path = "../../../../client/api" } +client = { package = "substrate-client", path = "../../../../client/" } diff --git a/core/test-runtime/client/src/block_builder_ext.rs b/test/utils/runtime/client/src/block_builder_ext.rs similarity index 100% rename from core/test-runtime/client/src/block_builder_ext.rs rename to test/utils/runtime/client/src/block_builder_ext.rs diff --git a/core/test-runtime/client/src/lib.rs b/test/utils/runtime/client/src/lib.rs similarity index 99% rename from core/test-runtime/client/src/lib.rs rename to test/utils/runtime/client/src/lib.rs index affbae62c22e7..b5f3833e52f07 100644 --- a/core/test-runtime/client/src/lib.rs +++ b/test/utils/runtime/client/src/lib.rs @@ -205,7 +205,7 @@ impl TestClientBuilderExt for TestClientBuilder< client::LocalCallExecutor>, B > where - B: client::backend::Backend, + B: client_api::backend::Backend, { fn set_heap_pages(mut self, heap_pages: u64) -> Self { self.genesis_init_mut().heap_pages_override = Some(heap_pages); diff --git a/core/test-runtime/client/src/trait_tests.rs b/test/utils/runtime/client/src/trait_tests.rs similarity index 97% rename from core/test-runtime/client/src/trait_tests.rs rename to test/utils/runtime/client/src/trait_tests.rs index 37fad9c7a1bf1..bfdab4d942ed2 100644 --- a/core/test-runtime/client/src/trait_tests.rs +++ b/test/utils/runtime/client/src/trait_tests.rs @@ -21,9 +21,9 @@ use std::sync::Arc; -use crate::backend; +use client_api::backend::LocalBackend; use crate::block_builder_ext::BlockBuilderExt; -use crate::blockchain::{Backend as BlockChainBackendT, HeaderBackend}; +use client_api::blockchain::{Backend as BlockChainBackendT, HeaderBackend}; use crate::{AccountKeyring, ClientExt, TestClientBuilder, TestClientBuilderExt}; use generic_test_client::consensus::BlockOrigin; use primitives::Blake2Hasher; @@ -33,7 +33,7 @@ use sr_primitives::traits::Block as BlockT; /// helper to test the `leaves` implementation for various backends pub fn test_leaves_for_backend(backend: Arc) where - B: backend::LocalBackend, + B: LocalBackend, { // block tree: // G -> A1 -> A2 -> A3 -> A4 -> A5 @@ -149,7 +149,7 @@ pub fn test_leaves_for_backend(backend: Arc) where /// helper to test the `children` implementation for various backends pub fn test_children_for_backend(backend: Arc) where - B: backend::LocalBackend, + B: LocalBackend, { // block tree: // G -> A1 -> A2 -> A3 -> A4 -> A5 @@ -240,7 +240,7 @@ pub fn test_children_for_backend(backend: Arc) where } pub fn test_blockchain_query_by_number_gets_canonical(backend: Arc) where - B: backend::LocalBackend, + B: LocalBackend, { // block tree: // G -> A1 -> A2 -> A3 -> A4 -> A5 diff --git a/core/test-runtime/src/genesismap.rs b/test/utils/runtime/src/genesismap.rs similarity index 100% rename from core/test-runtime/src/genesismap.rs rename to test/utils/runtime/src/genesismap.rs diff --git a/core/test-runtime/src/lib.rs b/test/utils/runtime/src/lib.rs similarity index 97% rename from core/test-runtime/src/lib.rs rename to test/utils/runtime/src/lib.rs index 2bd6cc6bcbd1c..2ec109938889d 100644 --- a/core/test-runtime/src/lib.rs +++ b/test/utils/runtime/src/lib.rs @@ -338,14 +338,14 @@ impl GetRuntimeBlockType for Runtime { } impl_outer_origin!{ - pub enum Origin for Runtime where system = srml_system {} + pub enum Origin for Runtime where system = paint_system {} } #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug)] pub struct Event; -impl From for Event { - fn from(_evt: srml_system::Event) -> Self { +impl From for Event { + fn from(_evt: paint_system::Event) -> Self { unimplemented!("Not required in tests!") } } @@ -358,7 +358,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } -impl srml_system::Trait for Runtime { +impl paint_system::Trait for Runtime { type Origin = Origin; type Call = Extrinsic; type Index = u64; @@ -376,7 +376,7 @@ impl srml_system::Trait for Runtime { type Version = (); } -impl srml_timestamp::Trait for Runtime { +impl paint_timestamp::Trait for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = (); @@ -388,13 +388,13 @@ parameter_types! { pub const ExpectedBlockTime: u64 = 10_000; } -impl srml_babe::Trait for Runtime { +impl paint_babe::Trait for Runtime { type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; // there is no actual runtime in this test-runtime, so testing crates // are manually adding the digests. normally in this situation you'd use - // srml_babe::SameAuthoritiesForever. - type EpochChangeTrigger = srml_babe::ExternalTrigger; + // paint_babe::SameAuthoritiesForever. + type EpochChangeTrigger = paint_babe::ExternalTrigger; } /// Adds one to the given input and returns the final result. @@ -615,7 +615,7 @@ cfg_if! { c: (3, 10), genesis_authorities: system::authorities() .into_iter().map(|x|(x, 1)).collect(), - randomness: >::randomness(), + randomness: >::randomness(), secondary_slots: true, } } @@ -634,7 +634,7 @@ cfg_if! { } } - impl srml_system_rpc_runtime_api::AccountNonceApi for Runtime { + impl paint_system_rpc_runtime_api::AccountNonceApi for Runtime { fn account_nonce(_account: AccountId) -> Index { 0 } @@ -831,7 +831,7 @@ cfg_if! { c: (3, 10), genesis_authorities: system::authorities() .into_iter().map(|x|(x, 1)).collect(), - randomness: >::randomness(), + randomness: >::randomness(), secondary_slots: true, } } @@ -850,7 +850,7 @@ cfg_if! { } } - impl srml_system_rpc_runtime_api::AccountNonceApi for Runtime { + impl paint_system_rpc_runtime_api::AccountNonceApi for Runtime { fn account_nonce(_account: AccountId) -> Index { 0 } diff --git a/core/test-runtime/src/system.rs b/test/utils/runtime/src/system.rs similarity index 99% rename from core/test-runtime/src/system.rs rename to test/utils/runtime/src/system.rs index dcb9aa4f32583..44743be200840 100644 --- a/core/test-runtime/src/system.rs +++ b/test/utils/runtime/src/system.rs @@ -29,7 +29,7 @@ use sr_primitives::{ transaction_validity::{TransactionValidity, ValidTransaction, InvalidTransaction}, }; use codec::{KeyedVec, Encode}; -use srml_system::Trait; +use paint_system::Trait; use crate::{ AccountId, BlockNumber, Extrinsic, Transfer, H256 as Hash, Block, Header, Digest, AuthorityId }; diff --git a/test/utils/transaction-factory/Cargo.toml b/test/utils/transaction-factory/Cargo.toml new file mode 100644 index 0000000000000..fdd948a6f2d29 --- /dev/null +++ b/test/utils/transaction-factory/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "transaction-factory" +version = "0.0.1" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../../primitives/block-builder/runtime-api" } +cli = { package = "substrate-cli", path = "../../../client/cli" } +client-api = { package = "substrate-client-api", path = "../../../client/api" } +client = { package = "substrate-client", path = "../../../client" } +codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] } +consensus_common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" } +log = "0.4.8" +primitives = { package = "substrate-primitives", path = "../../../primitives/core" } +sr-api = { path = "../../../primitives/sr-api" } +sr-primitives = { path = "../../../primitives/sr-primitives" } +substrate-service = { path = "../../../client/service" } + diff --git a/test-utils/transaction-factory/src/complex_mode.rs b/test/utils/transaction-factory/src/complex_mode.rs similarity index 98% rename from test-utils/transaction-factory/src/complex_mode.rs rename to test/utils/transaction-factory/src/complex_mode.rs index 5e68a05c7ddbf..086698ffc3ac9 100644 --- a/test-utils/transaction-factory/src/complex_mode.rs +++ b/test/utils/transaction-factory/src/complex_mode.rs @@ -61,7 +61,7 @@ pub fn next( where Block: BlockT::Out>, Exec: client::CallExecutor + Send + Sync + Clone, - Backend: client::backend::Backend + Send, + Backend: client_api::backend::Backend + Send, Client: ProvideRuntimeApi, as ProvideRuntimeApi>::Api: BlockBuilder, diff --git a/test-utils/transaction-factory/src/lib.rs b/test/utils/transaction-factory/src/lib.rs similarity index 97% rename from test-utils/transaction-factory/src/lib.rs rename to test/utils/transaction-factory/src/lib.rs index 93ee0d608b734..357e8067f37b9 100644 --- a/test-utils/transaction-factory/src/lib.rs +++ b/test/utils/transaction-factory/src/lib.rs @@ -102,7 +102,7 @@ pub fn factory( where Block: BlockT::Out>, Exec: client::CallExecutor + Send + Sync + Clone, - Backend: client::backend::Backend + Send, + Backend: client_api::backend::Backend + Send, Client: ProvideRuntimeApi, as ProvideRuntimeApi>::Api: BlockBuilder, @@ -161,7 +161,7 @@ pub fn create_block( where Block: BlockT::Out>, Exec: client::CallExecutor + Send + Sync + Clone, - Backend: client::backend::Backend + Send, + Backend: client_api::backend::Backend + Send, Client: ProvideRuntimeApi, RtApi: ConstructRuntimeApi> + Send + Sync, as ProvideRuntimeApi>::Api: @@ -187,7 +187,7 @@ fn import_block( ) -> () where Block: BlockT::Out>, Exec: client::CallExecutor + Send + Sync + Clone, - Backend: client::backend::Backend + Send, + Backend: client_api::backend::Backend + Send, { let import = BlockImportParams { origin: BlockOrigin::File, diff --git a/test-utils/transaction-factory/src/modes.rs b/test/utils/transaction-factory/src/modes.rs similarity index 100% rename from test-utils/transaction-factory/src/modes.rs rename to test/utils/transaction-factory/src/modes.rs diff --git a/test-utils/transaction-factory/src/simple_modes.rs b/test/utils/transaction-factory/src/simple_modes.rs similarity index 98% rename from test-utils/transaction-factory/src/simple_modes.rs rename to test/utils/transaction-factory/src/simple_modes.rs index 827561c204e8e..f869201b46cd6 100644 --- a/test-utils/transaction-factory/src/simple_modes.rs +++ b/test/utils/transaction-factory/src/simple_modes.rs @@ -56,7 +56,7 @@ pub fn next( where Block: BlockT::Out>, Exec: client::CallExecutor + Send + Sync + Clone, - Backend: client::backend::Backend + Send, + Backend: client_api::backend::Backend + Send, Client: ProvideRuntimeApi, as ProvideRuntimeApi>::Api: BlockBuilder, diff --git a/core/utils/build-script-utils/Cargo.toml b/utils/build-script-utils/Cargo.toml similarity index 100% rename from core/utils/build-script-utils/Cargo.toml rename to utils/build-script-utils/Cargo.toml diff --git a/core/utils/build-script-utils/src/lib.rs b/utils/build-script-utils/src/lib.rs similarity index 100% rename from core/utils/build-script-utils/src/lib.rs rename to utils/build-script-utils/src/lib.rs diff --git a/core/utils/fork-tree/Cargo.toml b/utils/fork-tree/Cargo.toml similarity index 100% rename from core/utils/fork-tree/Cargo.toml rename to utils/fork-tree/Cargo.toml diff --git a/core/utils/fork-tree/src/lib.rs b/utils/fork-tree/src/lib.rs similarity index 100% rename from core/utils/fork-tree/src/lib.rs rename to utils/fork-tree/src/lib.rs diff --git a/core/utils/wasm-builder/Cargo.toml b/utils/wasm-builder/Cargo.toml similarity index 100% rename from core/utils/wasm-builder/Cargo.toml rename to utils/wasm-builder/Cargo.toml diff --git a/core/utils/wasm-builder/README.md b/utils/wasm-builder/README.md similarity index 96% rename from core/utils/wasm-builder/README.md rename to utils/wasm-builder/README.md index 5b94f040ff9e6..b21c588ac383c 100644 --- a/core/utils/wasm-builder/README.md +++ b/utils/wasm-builder/README.md @@ -8,7 +8,7 @@ The WASM builder is a tool that integrates the process of building the WASM bina A project that should be compiled as a WASM binary needs to: 1. Add a `build.rs` file. -2. Add `substrate-wasm-builder-runner` as dependency into `build-dependencies`. +2. Add `substrate-wasm-builder` as dependency into `build-dependencies`. The `build.rs` file needs to contain the following code: diff --git a/core/utils/wasm-builder/src/lib.rs b/utils/wasm-builder/src/lib.rs similarity index 99% rename from core/utils/wasm-builder/src/lib.rs rename to utils/wasm-builder/src/lib.rs index ea3eb6a15bed3..a689f15b55418 100644 --- a/core/utils/wasm-builder/src/lib.rs +++ b/utils/wasm-builder/src/lib.rs @@ -24,7 +24,7 @@ //! A project that should be compiled as a WASM binary needs to: //! //! 1. Add a `build.rs` file. -//! 2. Add `substrate-wasm-builder-runner` as dependency into `build-dependencies`. +//! 2. Add `substrate-wasm-builder` as dependency into `build-dependencies`. //! //! The `build.rs` file needs to contain the following code: //! diff --git a/core/utils/wasm-builder/src/prerequisites.rs b/utils/wasm-builder/src/prerequisites.rs similarity index 100% rename from core/utils/wasm-builder/src/prerequisites.rs rename to utils/wasm-builder/src/prerequisites.rs diff --git a/core/utils/wasm-builder/src/wasm_project.rs b/utils/wasm-builder/src/wasm_project.rs similarity index 100% rename from core/utils/wasm-builder/src/wasm_project.rs rename to utils/wasm-builder/src/wasm_project.rs