--- a/Cargo.lock +++ b/Cargo.lock @@ -16,7 +16,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" dependencies = [ - "gimli", + "gimli 0.22.0", ] [[package]] @@ -361,7 +361,7 @@ "cfg-if 1.0.0", "libc", "miniz_oxide", - "object", + "object 0.21.1", "rustc-demangle", ] @@ -384,6 +384,16 @@ checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] +name = "bincode" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" +dependencies = [ + "byteorder 1.3.4", + "serde", +] + +[[package]] name = "bindgen" version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -791,6 +801,98 @@ checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" [[package]] +name = "cranelift-bforest" +version = "0.66.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dcc286b052ee24a1e5a222e7c1125e6010ad35b0f248709b9b3737a8fedcfdf" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.66.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d9badfe36176cb653506091693bc2bb1970c9bddfcd6ec7fac404f7eaec6f38" +dependencies = [ + "byteorder 1.3.4", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-entity", + "gimli 0.21.0", + "log", + "regalloc", + "serde", + "smallvec 1.4.2", + "target-lexicon", + "thiserror", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.66.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3f460031861e4f4ad510be62b2ae50bba6cc886b598a36f9c0a970feab9598" +dependencies = [ + "cranelift-codegen-shared", + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.66.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ad12409e922e7697cd0bdc7dc26992f64a77c31880dfe5e3c7722f4710206d" + +[[package]] +name = "cranelift-entity" +version = "0.66.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97cdc58972ea065d107872cfb9079f4c92ade78a8af85aaff519a65b5d13f71" +dependencies = [ + "serde", +] + +[[package]] +name = "cranelift-frontend" +version = "0.66.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef419efb4f94ecc02e5d9fbcc910d2bb7f0040e2de570e63a454f883bc891d6" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec 1.4.2", + "target-lexicon", +] + +[[package]] +name = "cranelift-native" +version = "0.66.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e69d44d59826eef6794066ac2c0f4ad3975f02d97030c60dbc04e3886adf36e" +dependencies = [ + "cranelift-codegen", + "raw-cpuid", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.66.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "979df666b1304624abe99738e9e0e7c7479ee5523ba4b8b237df9ff49996acbb" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "log", + "serde", + "thiserror", + "wasmparser 0.59.0", +] + +[[package]] name = "crc32fast" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1079,6 +1181,27 @@ ] [[package]] +name = "errno" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eab5ee3df98a279d9b316b1af6ac95422127b1290317e6d18c1743c99418b01" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" +dependencies = [ + "gcc", + "libc", +] + +[[package]] name = "event-listener" version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1122,6 +1245,12 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] name = "fastrand" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1140,6 +1269,16 @@ ] [[package]] +name = "file-per-thread-logger" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fdbe0d94371f9ce939b555dd342d0686cc4c0cadbcd4b61d70af5ff97eb4126" +dependencies = [ + "env_logger", + "log", +] + +[[package]] name = "finality-grandpa" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1218,6 +1357,24 @@ ] [[package]] +name = "frame-benchmarking-cli" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +dependencies = [ + "frame-benchmarking", + "parity-scale-codec", + "sc-cli", + "sc-client-db", + "sc-executor", + "sc-service", + "sp-core", + "sp-externalities", + "sp-runtime", + "sp-state-machine", + "structopt", +] + +[[package]] name = "frame-executive" version = "2.0.0" source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" @@ -1319,6 +1476,20 @@ ] [[package]] +name = "frame-system-benchmarking" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0" source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" @@ -1636,6 +1807,17 @@ [[package]] name = "gimli" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "gimli" version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" @@ -2013,6 +2195,7 @@ dependencies = [ "autocfg 1.0.1", "hashbrown 0.9.1", + "serde", ] [[package]] @@ -2074,6 +2257,15 @@ ] [[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + +[[package]] name = "itoa" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2296,6 +2488,12 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] +name = "leb128" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" + +[[package]] name = "libc" version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2852,6 +3050,15 @@ checksum = "adb241df5c4caeb888755363fc95f8a896618dc0d435e9e775f7930cb099beab" [[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] name = "matchers" version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3042,6 +3249,12 @@ ] [[package]] +name = "more-asserts" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" + +[[package]] name = "multihash" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3127,6 +3340,8 @@ name = "nft" version = "2.0.0" dependencies = [ + "frame-benchmarking", + "frame-benchmarking-cli", "futures 0.3.6", "jsonrpc-core", "log", @@ -3165,10 +3380,13 @@ name = "nft-runtime" version = "2.0.0" dependencies = [ + "frame-benchmarking", "frame-executive", "frame-support", "frame-system", + "frame-system-benchmarking", "frame-system-rpc-runtime-api", + "hex-literal", "pallet-aura", "pallet-balances", "pallet-contracts", @@ -3297,6 +3515,23 @@ [[package]] name = "object" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2" + +[[package]] +name = "object" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" +dependencies = [ + "crc32fast", + "indexmap", + "wasmparser 0.57.0", +] + +[[package]] +name = "object" version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693" @@ -3569,6 +3804,7 @@ "parity-scale-codec", "serde", "sp-inherents", + "sp-io", "sp-runtime", "sp-std", "sp-timestamp", @@ -4098,7 +4334,7 @@ dependencies = [ "bytes 0.5.6", "heck", - "itertools", + "itertools 0.8.2", "log", "multimap", "petgraph", @@ -4115,7 +4351,7 @@ checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" dependencies = [ "anyhow", - "itertools", + "itertools 0.8.2", "proc-macro2", "quote", "syn", @@ -4368,6 +4604,17 @@ ] [[package]] +name = "raw-cpuid" +version = "7.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf" +dependencies = [ + "bitflags", + "cc", + "rustc_version", +] + +[[package]] name = "rawpointer" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4445,6 +4692,17 @@ ] [[package]] +name = "regalloc" +version = "0.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ba8aaf5fe7cf307c6dbdaeed85478961d29e25e3bee5169e11b92fa9f027a8" +dependencies = [ + "log", + "rustc-hash", + "smallvec 1.4.2", +] + +[[package]] name = "regex" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4473,6 +4731,18 @@ checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" [[package]] +name = "region" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" +dependencies = [ + "bitflags", + "libc", + "mach", + "winapi 0.3.9", +] + +[[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4895,6 +5165,7 @@ "parking_lot 0.10.2", "sc-executor-common", "sc-executor-wasmi", + "sc-executor-wasmtime", "sp-api", "sp-core", "sp-externalities", @@ -4941,6 +5212,24 @@ ] [[package]] +name = "sc-executor-wasmtime" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +dependencies = [ + "log", + "parity-scale-codec", + "parity-wasm", + "pwasm-utils", + "sc-executor-common", + "scoped-tls", + "sp-allocator", + "sp-core", + "sp-runtime-interface", + "sp-wasm-interface", + "wasmtime", +] + +[[package]] name = "sc-finality-grandpa" version = "0.8.0" source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" @@ -5414,6 +5703,12 @@ ] [[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + +[[package]] name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5426,6 +5721,26 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] +name = "scroll" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda28d4b4830b807a8b43f7b0e6b5df875311b3e7621d84577188c175b6ec1ec" +dependencies = [ + "scroll_derive", +] + +[[package]] +name = "scroll_derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dfde5d1531034db129e95c76ac857e2baecea3443579d493d02224950b0fb6d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "sct" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6458,7 +6773,8 @@ [[package]] name = "substrate-wasm-builder-runner" version = "1.0.6" -source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a965994514ab35d3893e9260245f2947fd1981cdd4fffd2c6e6d1a9ce02e6a" [[package]] name = "subtle" @@ -6502,6 +6818,12 @@ checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" [[package]] +name = "target-lexicon" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" + +[[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -7325,6 +7647,191 @@ ] [[package]] +name = "wasmparser" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6" + +[[package]] +name = "wasmparser" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a950e6a618f62147fd514ff445b2a0b53120d382751960797f85f058c7eda9b9" + +[[package]] +name = "wasmtime" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd3c4f449382779ef6e0a7c3ec6752ae614e20a42e4100000c3efdc973100e2" +dependencies = [ + "anyhow", + "backtrace", + "cfg-if 0.1.10", + "lazy_static", + "libc", + "log", + "region", + "rustc-demangle", + "smallvec 1.4.2", + "target-lexicon", + "wasmparser 0.59.0", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-profiling", + "wasmtime-runtime", + "wat", + "winapi 0.3.9", +] + +[[package]] +name = "wasmtime-debug" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634af9067a3af6cf2c7d33dc3b84767ddaf5d010ba68e80eecbcea73d4a349" +dependencies = [ + "anyhow", + "gimli 0.21.0", + "more-asserts", + "object 0.20.0", + "target-lexicon", + "thiserror", + "wasmparser 0.59.0", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-environ" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f85619a94ee4034bd5bb87fc3dcf71fd2237b81c840809da1201061eec9ab3" +dependencies = [ + "anyhow", + "base64 0.12.3", + "bincode", + "cfg-if 0.1.10", + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "cranelift-wasm", + "directories", + "errno", + "file-per-thread-logger", + "indexmap", + "libc", + "log", + "more-asserts", + "rayon", + "serde", + "sha2 0.8.2", + "thiserror", + "toml", + "wasmparser 0.59.0", + "winapi 0.3.9", + "zstd", +] + +[[package]] +name = "wasmtime-jit" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e914c013c7a9f15f4e429d5431f2830fb8adb56e40567661b69c5ec1d645be23" +dependencies = [ + "anyhow", + "cfg-if 0.1.10", + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli 0.21.0", + "log", + "more-asserts", + "object 0.20.0", + "region", + "target-lexicon", + "thiserror", + "wasmparser 0.59.0", + "wasmtime-debug", + "wasmtime-environ", + "wasmtime-obj", + "wasmtime-profiling", + "wasmtime-runtime", + "winapi 0.3.9", +] + +[[package]] +name = "wasmtime-obj" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e81d8e02e9bc9fe2da9b6d48bbc217f96e089f7df613f11a28a3958abc44641e" +dependencies = [ + "anyhow", + "more-asserts", + "object 0.20.0", + "target-lexicon", + "wasmtime-debug", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-profiling" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e8d4d1af8dd5f7096cfcc89dd668d358e52980c38cce199643372ffd6590e27" +dependencies = [ + "anyhow", + "cfg-if 0.1.10", + "gimli 0.21.0", + "lazy_static", + "libc", + "object 0.19.0", + "scroll", + "serde", + "target-lexicon", + "wasmtime-environ", + "wasmtime-runtime", +] + +[[package]] +name = "wasmtime-runtime" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a25f140bbbaadb07c531cba99ce1a966dba216138dc1b2a0ddecec851a01a93" +dependencies = [ + "backtrace", + "cc", + "cfg-if 0.1.10", + "indexmap", + "lazy_static", + "libc", + "log", + "memoffset", + "more-asserts", + "region", + "thiserror", + "wasmtime-environ", + "winapi 0.3.9", +] + +[[package]] +name = "wast" +version = "26.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54b3678343bfdf1768c16308a4b53823b70f7bb148d3d38225123d4306ec731" +dependencies = [ + "leb128", +] + +[[package]] +name = "wat" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b2dccbce4d0e14875091846e110a2369267b18ddd0d6423479b88dad914d71" +dependencies = [ + "wast", +] + +[[package]] name = "web-sys" version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -7489,3 +7996,34 @@ "syn", "synstructure", ] + +[[package]] +name = "zstd" +version = "0.5.3+zstd.1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01b32eaf771efa709e8308605bbf9319bf485dc1503179ec0469b611937c0cd8" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "2.0.5+zstd.1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfb642e0d27f64729a639c52db457e0ae906e7bc6f5fe8f5c453230400f1055" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "1.4.17+zstd.1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b89249644df056b522696b1bb9e7c18c87e8ffa3e2f0dc3b0155875d6498f01b" +dependencies = [ + "cc", + "glob", + "itertools 0.9.0", + "libc", +] --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -27,131 +27,36 @@ structopt = '0.3.8' jsonrpc-core = '15.0.0' -[dependencies.nft-runtime] -path = '../runtime' -version = '2.0.0' - -[dependencies.sc-basic-authorship] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sc-cli] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sc-client-api] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sc-consensus] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.pallet-contracts-rpc] -git = 'https://github.com/usetech-llc/substrate.git' -version = '0.8.0' -branch = 'v2.0.0_release' - -[dependencies.sc-rpc] -git = 'https://github.com/usetech-llc/substrate.git' -version = '2.0.0' -branch = 'v2.0.0_release' - -[dependencies.sp-api] -git = 'https://github.com/usetech-llc/substrate.git' -version = '2.0.0' -branch = 'v2.0.0_release' - -[dependencies.sp-blockchain] -git = 'https://github.com/usetech-llc/substrate.git' -version = '2.0.0' -branch = 'v2.0.0_release' - -[dependencies.sp-block-builder] -git = 'https://github.com/usetech-llc/substrate.git' -version = '2.0.0' -branch = 'v2.0.0_release' - -[dependencies.sc-rpc-api] -git = 'https://github.com/usetech-llc/substrate.git' -version = '0.8.0' -branch = 'v2.0.0_release' - -[dependencies.substrate-frame-rpc-system] -git = 'https://github.com/usetech-llc/substrate.git' -version = '2.0.0' -branch = 'v2.0.0_release' - -[dependencies.pallet-transaction-payment-rpc] -git = 'https://github.com/usetech-llc/substrate.git' -version = '2.0.0' -branch = 'v2.0.0_release' - -[dependencies.sc-consensus-aura] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sc-executor] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sc-finality-grandpa] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sc-network] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sc-service] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sc-transaction-pool] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-consensus] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sp-consensus-aura] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sp-core] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-finality-grandpa] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-inherents] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-runtime] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' +# Substrate dependencies +nft-runtime = { path = '../runtime', version = '2.0.0' } +frame-benchmarking = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +frame-benchmarking-cli = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +pallet-transaction-payment-rpc = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sc-basic-authorship = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sc-cli = { features = ['wasmtime'], version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sc-client-api = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sc-consensus = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sc-consensus-aura = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sc-executor = { features = ['wasmtime'], version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sc-finality-grandpa = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sc-rpc = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sc-rpc-api = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sc-service = { features = ['wasmtime'], version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sc-transaction-pool = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-api = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-block-builder = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-blockchain = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-consensus = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-consensus-aura = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-core = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-finality-grandpa = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-inherents = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-runtime = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sp-transaction-pool = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +sc-network = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +substrate-frame-rpc-system = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} +pallet-contracts-rpc = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} -[dependencies.sp-transaction-pool] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' +[features] +default = [] +runtime-benchmarks = ['nft-runtime/runtime-benchmarks'] --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -39,69 +39,94 @@ } pub fn development_config() -> Result { - Ok(ChainSpec::from_genesis( - "Development", - "dev", - ChainType::Development, - || { - testnet_genesis( - vec![authority_keys_from_seed("Alice")], - get_account_id_from_seed::("Alice"), - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - ], - true, - ) - }, - vec![], - None, - None, - None, - None, - )) + let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?; + + Ok(ChainSpec::from_genesis( + // Name + "Development", + // ID + "dev", + ChainType::Development, + move || testnet_genesis( + wasm_binary, + // Initial PoA authorities + vec![ + authority_keys_from_seed("Alice"), + ], + // Sudo account + get_account_id_from_seed::("Alice"), + // Pre-funded accounts + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + ], + true, + ), + // Bootnodes + vec![], + // Telemetry + None, + // Protocol ID + None, + // Properties + None, + // Extensions + None, + )) } pub fn local_testnet_config() -> Result { - Ok(ChainSpec::from_genesis( - "Local Testnet", - "local_testnet", - ChainType::Local, - || { - testnet_genesis( - vec![ - authority_keys_from_seed("Alice"), - authority_keys_from_seed("Bob"), - ], - get_account_id_from_seed::("Alice"), - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), - ], - true, - ) - }, - vec![], - None, - None, - None, - None, - )) + let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?; + + Ok(ChainSpec::from_genesis( + // Name + "Local Testnet", + // ID + "local_testnet", + ChainType::Local, + move || testnet_genesis( + wasm_binary, + // Initial PoA authorities + vec![ + authority_keys_from_seed("Alice"), + authority_keys_from_seed("Bob"), + ], + // Sudo account + get_account_id_from_seed::("Alice"), + // Pre-funded accounts + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ], + true, + ), + // Bootnodes + vec![], + // Telemetry + None, + // Protocol ID + None, + // Properties + None, + // Extensions + None, + )) } fn testnet_genesis( + wasm_binary: &[u8], initial_authorities: Vec<(AuraId, GrandpaId)>, root_key: AccountId, endowed_accounts: Vec, @@ -109,27 +134,27 @@ ) -> GenesisConfig { GenesisConfig { system: Some(SystemConfig { - code: WASM_BINARY.to_vec(), + code: wasm_binary.to_vec(), changes_trie_config: Default::default(), }), - balances: Some(BalancesConfig { + pallet_balances: Some(BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, 1 << 100)) .collect(), }), - aura: Some(AuraConfig { + pallet_aura: Some(AuraConfig { authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(), }), - grandpa: Some(GrandpaConfig { + pallet_grandpa: Some(GrandpaConfig { authorities: initial_authorities .iter() .map(|x| (x.1.clone(), 1)) .collect(), }), - sudo: Some(SudoConfig { key: root_key }), - nft: Some(NftConfig { + pallet_sudo: Some(SudoConfig { key: root_key }), + pallet_nft: Some(NftConfig { collection: vec![( 1, CollectionType { @@ -160,7 +185,7 @@ refungible_sponsor_transfer_timeout: 15, }, }), - contracts: Some(ContractsConfig { + pallet_contracts: Some(ContractsConfig { current_schedule: ContractsSchedule { enable_println, ..Default::default() --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -34,6 +34,6 @@ Revert(sc_cli::RevertCmd), // The custom benchmark subcommmand benchmarking runtime pallets. - // #[structopt(name = "benchmark", about = "Benchmark runtime pallets.")] - // Benchmark(frame_benchmarking_cli::BenchmarkCmd), + #[structopt(name = "benchmark", about = "Benchmark runtime pallets.")] + Benchmark(frame_benchmarking_cli::BenchmarkCmd), } --- a/node/src/command.rs +++ b/node/src/command.rs @@ -19,7 +19,7 @@ use crate::cli::{Cli, Subcommand}; use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec}; use sc_service::PartialComponents; -// use nft_runtime::Block; +use nft_runtime::Block; impl SubstrateCli for Cli { fn impl_name() -> String { @@ -114,16 +114,16 @@ Ok((cmd.run(client, backend), task_manager)) }) }, - // Some(Subcommand::Benchmark(cmd)) => { - // if cfg!(feature = "runtime-benchmarks") { - // let runner = cli.create_runner(cmd)?; + Some(Subcommand::Benchmark(cmd)) => { + if cfg!(feature = "runtime-benchmarks") { + let runner = cli.create_runner(cmd)?; - // runner.sync_run(|config| cmd.run::(config)) - // } else { - // Err("Benchmarking wasn't enabled when building the node. \ - // You can enable it with `--features runtime-benchmarks`.".into()) - // } - // }, + runner.sync_run(|config| cmd.run::(config)) + } else { + Err("Benchmarking wasn't enabled when building the node. \ + You can enable it with `--features runtime-benchmarks`.".into()) + } + }, None => { let runner = cli.create_runner(&cli.run)?; runner.run_node_until_exit(|config| match config.role { --- a/node/src/service.rs +++ b/node/src/service.rs @@ -16,7 +16,7 @@ pub Executor, nft_runtime::api::dispatch, nft_runtime::native_version, - // frame_benchmarking::benchmarking::HostFunctions, + frame_benchmarking::benchmarking::HostFunctions, ); type FullClient = sc_service::TFullClient; --- a/pallets/nft/Cargo.toml +++ b/pallets/nft/Cargo.toml @@ -1,8 +1,22 @@ +[package] +authors = ['Substrate DevHub '] +description = 'FRAME pallet nft' +edition = '2018' +homepage = 'https://substrate.io' +license = 'Unlicense' +name = 'pallet-nft' +repository = 'https://github.com/substrate-developer-hub/nft/' +version = '2.0.0' + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] + +# alias "parity-scale-code" to "codec" [dependencies.codec] default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.3.0' +version = '1.3.4' [dependencies.frame-support] default-features = false @@ -15,6 +29,7 @@ git = 'https://github.com/usetech-llc/substrate.git' branch = 'v2.0.0_release' version = '2.0.0' + [dev-dependencies.sp-core] default-features = false git = 'https://github.com/usetech-llc/substrate.git' @@ -27,7 +42,7 @@ branch = 'v2.0.0_release' version = '2.0.0' -[dependencies.sp-runtime] +[dev-dependencies.sp-runtime] default-features = false git = 'https://github.com/usetech-llc/substrate.git' branch = 'v2.0.0_release' @@ -49,19 +64,7 @@ git = 'https://github.com/usetech-llc/substrate.git' package = 'pallet-transaction-payment' branch = 'v2.0.0_release' -version = '2.0.0' - -[package] -authors = ['Substrate DevHub '] -description = 'FRAME pallet nft' -edition = '2018' -homepage = 'https://substrate.io' -license = 'Unlicense' -name = 'pallet-nft' -repository = 'https://github.com/substrate-developer-hub/nft/' version = '2.0.0' -[package.metadata.docs.rs] -targets = ['x86_64-unknown-linux-gnu'] [features] default = ['std'] @@ -70,6 +73,5 @@ "serde/std", 'frame-support/std', 'frame-system/std', - 'sp-runtime/std', 'sp-std/std', ] --- a/pallets/nft/src/mock.rs +++ b/pallets/nft/src/mock.rs @@ -35,30 +35,31 @@ } impl system::Trait for Test { - type Origin = Origin; - type Call = (); - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type Event = (); - type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; - type MaximumBlockLength = MaximumBlockLength; - type AvailableBlockRatio = AvailableBlockRatio; - type BaseCallFilter = (); - type DbWeight = RocksDbWeight; - type BlockExecutionWeight = BlockExecutionWeight; - type ExtrinsicBaseWeight = ExtrinsicBaseWeight; - type MaximumExtrinsicWeight = MaximumExtrinsicWeight; - type Version = (); - type ModuleToIndex = (); - type AccountData = (); - type OnNewAccount = (); - type OnKilledAccount = (); + type BaseCallFilter = (); + type Origin = Origin; + type Call = (); + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type Event = (); + type BlockHashCount = BlockHashCount; + type MaximumBlockWeight = MaximumBlockWeight; + type DbWeight = (); + type BlockExecutionWeight = (); + type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = MaximumBlockWeight; + type MaximumBlockLength = MaximumBlockLength; + type AvailableBlockRatio = AvailableBlockRatio; + type Version = (); + type PalletInfo = (); + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); } impl Trait for Test { type Event = (); --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -1,194 +1,3 @@ -[dependencies.aura] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-aura' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.balances] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-balances' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.codec] -default-features = false -features = ['derive'] -package = 'parity-scale-codec' -version = '1.3.0' - -[dependencies.contracts] -git = 'https://github.com/usetech-llc/substrate.git' -default-features = false -package = 'pallet-contracts' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.contracts-primitives] -git = 'https://github.com/usetech-llc/substrate.git' -default-features = false -package = 'pallet-contracts-primitives' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.contracts-rpc-runtime-api] -git = 'https://github.com/usetech-llc/substrate.git' -default-features = false -package = 'pallet-contracts-rpc-runtime-api' -version = '0.8.0' -branch = 'v2.0.0_release' - -[dependencies.frame-executive] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.frame-support] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.grandpa] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-grandpa' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.randomness-collective-flip] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-randomness-collective-flip' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.serde] -features = ['derive'] -optional = true -version = '1.0.101' - -[dependencies.sp-api] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-block-builder] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-consensus-aura] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '0.8.0' - -[dependencies.sp-core] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-inherents] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-offchain] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-runtime] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-session] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-std] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-transaction-pool] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sp-version] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.sudo] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-sudo' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.system] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'frame-system' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.nft] -default-features = false -package = 'pallet-nft' -path = '../pallets/nft' -version = '2.0.0' - -[dependencies.timestamp] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-timestamp' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.transaction-payment] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-transaction-payment' -branch = 'v2.0.0_release' -version = '2.0.0' - -[dependencies.frame-system-rpc-runtime-api] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -version = '2.0.0' -branch = 'v2.0.0_release' - -[dependencies.transaction-payment-rpc-runtime-api] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-transaction-payment-rpc-runtime-api' -version = '2.0.0' -branch = 'v2.0.0_release' - -[build-dependencies.wasm-builder-runner] -git = 'https://github.com/usetech-llc/substrate.git' -package = 'substrate-wasm-builder-runner' -version = '1.0.5' -branch = 'v2.0.0_release' - [package] authors = ['Substrate DevHub '] edition = '2018' @@ -201,21 +10,84 @@ [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] +[build-dependencies] +wasm-builder-runner = { package = 'substrate-wasm-builder-runner', version = '1.0.5' } + +# alias "parity-scale-code" to "codec" +[dependencies.codec] +default-features = false +features = ['derive'] +package = 'parity-scale-codec' +version = '1.3.4' + +[dependencies] +hex-literal = { optional = true, version = '0.3.1' } +serde = { features = ['derive'], optional = true, version = '1.0.101' } + +# local dependencies +pallet-nft = { path = '../pallets/nft', default-features = false, version = '2.0.0' } + +# Substrate dependencies +frame-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +frame-executive = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +frame-support = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +frame-system = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +frame-system-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +frame-system-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-aura = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-balances = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-contracts = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-contracts-primitives = { default-features = false, version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-contracts-rpc-runtime-api = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-grandpa = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-randomness-collective-flip = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-sudo = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-timestamp = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-transaction-payment = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-block-builder = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-consensus-aura = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-core = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-inherents = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-offchain = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-runtime = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-session = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-std = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-transaction-pool = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } +sp-version = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' } + [features] default = ['std'] +runtime-benchmarks = [ + 'hex-literal', + 'frame-benchmarking', + 'frame-support/runtime-benchmarks', + 'frame-system-benchmarking', + 'frame-system/runtime-benchmarks', + 'pallet-balances/runtime-benchmarks', + 'pallet-timestamp/runtime-benchmarks', + 'sp-runtime/runtime-benchmarks', +] std = [ - 'aura/std', - 'balances/std', 'codec/std', - 'contracts/std', - 'contracts-primitives/std', - 'contracts-rpc-runtime-api/std', + 'serde', 'frame-executive/std', 'frame-support/std', + 'frame-system/std', 'frame-system-rpc-runtime-api/std', - 'grandpa/std', - 'randomness-collective-flip/std', - 'serde', + 'pallet-aura/std', + 'pallet-balances/std', + 'pallet-contracts/std', + 'pallet-contracts-primitives/std', + 'pallet-contracts-rpc-runtime-api/std', + 'pallet-grandpa/std', + 'pallet-randomness-collective-flip/std', + 'pallet-sudo/std', + 'pallet-timestamp/std', + 'pallet-transaction-payment/std', + 'pallet-transaction-payment-rpc-runtime-api/std', + 'pallet-nft/std', 'sp-api/std', 'sp-block-builder/std', 'sp-consensus-aura/std', @@ -227,10 +99,4 @@ 'sp-std/std', 'sp-transaction-pool/std', 'sp-version/std', - 'sudo/std', - 'system/std', - 'timestamp/std', - 'transaction-payment/std', - 'transaction-payment-rpc-runtime-api/std', - 'nft/std', ] --- a/runtime/build.rs +++ b/runtime/build.rs @@ -3,7 +3,7 @@ fn main() { WasmBuilder::new() .with_current_project() - .with_wasm_builder_from_crates("1.0.11") + .with_wasm_builder_from_crates("2.0.0") .export_heap_base() .import_memory() .build() --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -8,9 +8,9 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -use contracts_rpc_runtime_api::ContractExecResult; -use grandpa::fg_primitives; -use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; +use pallet_contracts_rpc_runtime_api::ContractExecResult; +use pallet_grandpa::fg_primitives; +use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; @@ -29,8 +29,8 @@ use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. -pub use balances::Call as BalancesCall; -pub use contracts::Schedule as ContractsSchedule; +pub use pallet_balances::Call as BalancesCall; +pub use pallet_contracts::Schedule as ContractsSchedule; pub use frame_support::{ construct_runtime, dispatch::DispatchResult, @@ -49,14 +49,14 @@ #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; use sp_runtime::Perbill; -use system::{self as system}; +use frame_system::{self as system}; -pub use timestamp::Call as TimestampCall; +pub use pallet_timestamp::Call as TimestampCall; /// Re-export a nft pallet /// TODO: Check this re-export. Is this safe and good style? -extern crate nft; -pub use nft::*; +extern crate pallet_nft; +pub use pallet_nft::*; /// An index to a block. pub type BlockNumber = u32; @@ -201,16 +201,16 @@ /// What to do if an account is fully reaped from the system. type OnKilledAccount = (); /// The data to be stored in an account. - type AccountData = balances::AccountData; + type AccountData = pallet_balances::AccountData; /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = (); } -impl aura::Trait for Runtime { +impl pallet_aura::Trait for Runtime { type AuthorityId = AuraId; } -impl grandpa::Trait for Runtime { +impl pallet_grandpa::Trait for Runtime { type Event = Event; type Call = Call; @@ -233,7 +233,7 @@ pub const MinimumPeriod: u64 = SLOT_DURATION / 2; } -impl timestamp::Trait for Runtime { +impl pallet_timestamp::Trait for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; @@ -247,7 +247,7 @@ pub const MaxLocks: u32 = 50; } -impl balances::Trait for Runtime { +impl pallet_balances::Trait for Runtime { type MaxLocks = MaxLocks; /// The type for recording an account's balance. type Balance = Balance; @@ -270,44 +270,44 @@ pub const SurchargeReward: Balance = 150 * MILLICENTS; } -impl contracts::Trait for Runtime { +impl pallet_contracts::Trait for Runtime { type Time = Timestamp; type Randomness = RandomnessCollectiveFlip; type Currency = Balances; type Event = Event; - type DetermineContractAddress = contracts::SimpleAddressDeterminer; - type TrieIdGenerator = contracts::TrieIdFromParentCounter; + type DetermineContractAddress = pallet_contracts::SimpleAddressDeterminer; + type TrieIdGenerator = pallet_contracts::TrieIdFromParentCounter; type RentPayment = (); - type SignedClaimHandicap = contracts::DefaultSignedClaimHandicap; + type SignedClaimHandicap = pallet_contracts::DefaultSignedClaimHandicap; type TombstoneDeposit = TombstoneDeposit; - type StorageSizeOffset = contracts::DefaultStorageSizeOffset; + type StorageSizeOffset = pallet_contracts::DefaultStorageSizeOffset; type RentByteFee = RentByteFee; type RentDepositOffset = RentDepositOffset; type SurchargeReward = SurchargeReward; - type MaxDepth = contracts::DefaultMaxDepth; - type MaxValueSize = contracts::DefaultMaxValueSize; - type WeightPrice = transaction_payment::Module; + type MaxDepth = pallet_contracts::DefaultMaxDepth; + type MaxValueSize = pallet_contracts::DefaultMaxValueSize; + type WeightPrice = pallet_transaction_payment::Module; } parameter_types! { pub const TransactionByteFee: Balance = 1; } -impl transaction_payment::Trait for Runtime { - type Currency = balances::Module; +impl pallet_transaction_payment::Trait for Runtime { + type Currency = pallet_balances::Module; type OnTransactionPayment = (); type TransactionByteFee = TransactionByteFee; type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); } -impl sudo::Trait for Runtime { +impl pallet_sudo::Trait for Runtime { type Event = Event; type Call = Call; } /// Used for the module nft in `./nft.rs` -impl nft::Trait for Runtime { +impl pallet_nft::Trait for Runtime { type Event = Event; } @@ -318,15 +318,15 @@ UncheckedExtrinsic = UncheckedExtrinsic { System: system::{Module, Call, Config, Storage, Event}, - RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage}, - Contracts: contracts::{Module, Call, Config, Storage, Event}, - Timestamp: timestamp::{Module, Call, Storage, Inherent}, - Aura: aura::{Module, Config, Inherent}, - Grandpa: grandpa::{Module, Call, Storage, Config, Event}, - Balances: balances::{Module, Call, Storage, Config, Event}, - TransactionPayment: transaction_payment::{Module, Storage}, - Sudo: sudo::{Module, Call, Config, Storage, Event}, - Nft: nft::{Module, Call, Config, Storage, Event}, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage}, + Contracts: pallet_contracts::{Module, Call, Config, Storage, Event}, + Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent}, + Aura: pallet_aura::{Module, Config, Inherent}, + Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event}, + Balances: pallet_balances::{Module, Call, Storage, Config, Event}, + TransactionPayment: pallet_transaction_payment::{Module, Storage}, + Sudo: pallet_sudo::{Module, Call, Config, Storage, Event}, + Nft: pallet_nft::{Module, Call, Config, Storage, Event}, } ); @@ -348,7 +348,7 @@ system::CheckEra, system::CheckNonce, system::CheckWeight, - nft::ChargeTransactionPayment, + pallet_nft::ChargeTransactionPayment, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -360,7 +360,7 @@ impl_runtime_apis! { - impl contracts_rpc_runtime_api::ContractsApi + impl pallet_contracts_rpc_runtime_api::ContractsApi for Runtime { fn call( @@ -385,13 +385,13 @@ fn get_storage( address: AccountId, key: [u8; 32], - ) -> contracts_primitives::GetStorageResult { + ) -> pallet_contracts_primitives::GetStorageResult { Contracts::get_storage(address, key) } fn rent_projection( address: AccountId, - ) -> contracts_primitives::RentProjectionResult { + ) -> pallet_contracts_primitives::RentProjectionResult { Contracts::rent_projection(address) } } @@ -510,13 +510,47 @@ } } - impl transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { fn query_info( uxt: ::Extrinsic, len: u32, - ) -> transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { TransactionPayment::query_info(uxt, len) } } + #[cfg(feature = "runtime-benchmarks")] + impl frame_benchmarking::Benchmark for Runtime { + fn dispatch_benchmark( + config: frame_benchmarking::BenchmarkConfig + ) -> Result, sp_runtime::RuntimeString> { + use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; + + use frame_system_benchmarking::Module as SystemBench; + impl frame_system_benchmarking::Trait for Runtime {} + + let mut whitelist: Vec = vec![ + // Block Number + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(), + // Total Issuance + hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(), + // Execution Phase + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(), + // Event Count + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(), + // System Events + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(), + ]; + + let mut batches = Vec::::new(); + let params = (&config, &whitelist); + + add_benchmark!(params, batches, frame_system, SystemBench::); + add_benchmark!(params, batches, pallet_balances, Balances); + add_benchmark!(params, batches, pallet_timestamp, Timestamp); + + if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } + Ok(batches) + } + } }