Files
pezkuwi-subxt/substrate/test-utils/runtime/Cargo.toml
T
Michal Kucharczyk 53cbda1de6 test-runtime: GenesisBuilder runtime API impl + tests (#14310)
* test-runtime: GenesisBuilder runtime API impl + tests

This PR provides implementation of `GenesisBuilder` API for `substrate-test-runtime`, can be considered as reference imiplementation for other runtimes.
The `GenesisBuilder` implementation is gated by `gensis-config` feature.

Tested scenarios:
- default `GenesisConfig` to JSON blob,
- deserialization of `GenesisConfig` from custom JSON, and storing its keys into the Storage (genesis storage creation).
- creation of genesis storage using partial JSON definition,
- checking if invalid/renamed JSON files causes the runtime to panic,

* missing file added

* client: GenesisBuilder helper added

* feature renamed: genesis-config -> genesis-builder

* Update Cargo.toml

* Update Cargo.toml

* Update Cargo.toml

* Update Cargo.toml

* redundant function removed

* genesis builder helper: introduced RuntimeGenesisBuild

* test-runtime: get rid of unused T

* redundant bound removed

* helper: use GenesisBuild again

* tests adjusted for on_genesis

* test-runtime: support for BuildGenesisConfig

* helper: BuildGenesisConfig support

* Update client/genesis-builder/src/lib.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Update test-utils/runtime/src/test_json/readme.md

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Update test-utils/runtime/src/test_json/readme.md

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Update test-utils/runtime/src/genesismap.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

* jsons are now human-friendly

* fix

* improvements

* jsons fixed

* helper: no_defaults added

* test-runtime: no_defaults added

* test-runtime: patching fn removed

* helper: patching fn removed

* helper: moved to frame_support

* test-runtime: fixes

* Cargo.lock updated

* fmt + naming

* test-runtime: WasmExecutor used

* helper / test-runtime: struct removed

* test-runtime: merge fixes

* Cargo.lock + test-utils/runtime/Cargo.toml updated

* doc fixed

* client/rpc: test fixed (new rt api)

* client/rpc-spec-v2: test fix

* doc fix

* test-runtime: disable-genesis-builder feature

* fix

* fix

* ".git/.scripts/commands/fmt/fmt.sh"

* test-runtime: rerun added to build script

---------

Co-authored-by: Davide Galassi <davxy@datawok.net>
Co-authored-by: parity-processbot <>
2023-07-24 16:12:52 +00:00

113 lines
5.5 KiB
TOML

[package]
name = "substrate-test-runtime"
version = "2.0.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
build = "build.rs"
license = "Apache-2.0"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
publish = false
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
sp-application-crypto = { version = "23.0.0", default-features = false, path = "../../primitives/application-crypto", features = ["serde"] }
sp-consensus-aura = { version = "0.10.0-dev", default-features = false, path = "../../primitives/consensus/aura", features = ["serde"] }
sp-consensus-babe = { version = "0.10.0-dev", default-features = false, path = "../../primitives/consensus/babe", features = ["serde"] }
sp-genesis-builder = { version = "0.1.0-dev", default-features = false, path = "../../primitives/genesis-builder" }
sp-block-builder = { version = "4.0.0-dev", default-features = false, path = "../../primitives/block-builder" }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
sp-inherents = { version = "4.0.0-dev", default-features = false, path = "../../primitives/inherents" }
sp-keyring = { version = "24.0.0", optional = true, path = "../../primitives/keyring" }
sp-offchain = { version = "4.0.0-dev", default-features = false, path = "../../primitives/offchain" }
sp-core = { version = "21.0.0", default-features = false, path = "../../primitives/core" }
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
sp-io = { version = "23.0.0", default-features = false, path = "../../primitives/io" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../frame/support" }
sp-version = { version = "22.0.0", default-features = false, path = "../../primitives/version" }
sp-session = { version = "4.0.0-dev", default-features = false, path = "../../primitives/session" }
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../primitives/api" }
sp-runtime = { version = "24.0.0", default-features = false, path = "../../primitives/runtime", features = ["serde"] }
pallet-babe = { version = "4.0.0-dev", default-features = false, path = "../../frame/babe" }
pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../frame/balances" }
frame-executive = { version = "4.0.0-dev", default-features = false, path = "../../frame/executive" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../frame/system" }
frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, path = "../../frame/system/rpc/runtime-api" }
pallet-timestamp = { version = "4.0.0-dev", default-features = false, path = "../../frame/timestamp" }
sp-consensus-grandpa = { version = "4.0.0-dev", default-features = false, path = "../../primitives/consensus/grandpa", features = ["serde"] }
sp-trie = { version = "22.0.0", default-features = false, path = "../../primitives/trie" }
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, path = "../../primitives/transaction-pool" }
trie-db = { version = "0.27.0", default-features = false }
sc-service = { version = "0.10.0-dev", default-features = false, optional = true, features = ["test-helpers"], path = "../../client/service" }
sp-state-machine = { version = "0.28.0", default-features = false, path = "../../primitives/state-machine" }
sp-externalities = { version = "0.19.0", default-features = false, path = "../../primitives/externalities" }
# 3rd party
array-bytes = { version = "6.1", optional = true }
log = { version = "0.4.17", default-features = false }
serde = { version = "1.0.163", features = ["alloc", "derive"], default-features = false }
serde_json = { version = "1.0.85", default-features = false, features = ["alloc"] }
[dev-dependencies]
futures = "0.3.21"
sc-block-builder = { version = "0.10.0-dev", path = "../../client/block-builder" }
sc-executor = { version = "0.10.0-dev", path = "../../client/executor" }
sc-executor-common = { version = "0.10.0-dev", path = "../../client/executor/common" }
sp-consensus = { version = "0.10.0-dev", path = "../../primitives/consensus/common" }
substrate-test-runtime-client = { version = "2.0.0", path = "./client" }
sp-tracing = { version = "10.0.0", path = "../../primitives/tracing" }
json-patch = { version = "1.0.0", default-features = false }
[build-dependencies]
substrate-wasm-builder = { version = "5.0.0-dev", path = "../../utils/wasm-builder", optional = true }
[features]
default = [
"std",
]
std = [
"array-bytes",
"sp-genesis-builder/std",
"sp-application-crypto/std",
"sp-consensus-aura/std",
"sp-consensus-babe/std",
"sp-block-builder/std",
"codec/std",
"scale-info/std",
"sp-inherents/std",
"sp-keyring",
"log/std",
"sp-offchain/std",
"sp-core/std",
"sp-core/std",
"sp-std/std",
"sp-io/std",
"frame-support/std",
"sp-version/std",
"sp-session/std",
"sp-api/std",
"sp-runtime/std",
"sp-externalities/std",
"sp-state-machine/std",
"pallet-babe/std",
"pallet-timestamp/std",
"pallet-balances/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"sc-service",
"sp-consensus-grandpa/std",
"sp-trie/std",
"sp-transaction-pool/std",
"trie-db/std",
"substrate-wasm-builder",
]
# Special feature to disable logging
disable-logging = [ "sp-api/disable-logging" ]
#Enabling this flag will disable GenesisBuilder API implementation in runtime.
disable-genesis-builder = []