From 5ecbc869df9228c135e7714390a22b2a118db419 Mon Sep 17 00:00:00 2001 From: sotmorskiy Date: Thu, 26 Nov 2020 03:17:26 +0000 Subject: [PATCH] Merge branch 'develop' into feature/NFTPAR-96 # Conflicts: # pallets/nft/src/lib.rs # pallets/nft/src/tests.rs --- --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,4 @@ doc/ target/ chain-data*/ -smart_contract/ \ No newline at end of file +smart_contract/ --- 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]] @@ -24,12 +24,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" - -[[package]] -name = "adler32" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" [[package]] name = "aead" @@ -37,14 +31,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" dependencies = [ - "generic-array 0.14.3", + "generic-array 0.14.4", ] [[package]] name = "aes" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5" +checksum = "dd2bc6d3f370b5666245ff421e231cba4353df936e26986d2918e61a8fd6aef6" dependencies = [ "aes-soft", "aesni", @@ -53,52 +47,58 @@ [[package]] name = "aes-gcm" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1" +checksum = "0301c9e9c443494d970a07885e8cf3e587bae8356a1d5abd0999068413f7205f" dependencies = [ "aead", "aes", "block-cipher", "ghash", - "subtle 2.2.3", + "subtle 2.3.0", ] [[package]] name = "aes-soft" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7" +checksum = "63dd91889c49327ad7ef3b500fd1109dbd3c509a03db0d4a9ce413b79f575cb6" dependencies = [ "block-cipher", - "byteorder", - "opaque-debug 0.2.3", + "byteorder 1.3.4", + "opaque-debug 0.3.0", ] [[package]] name = "aesni" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264" +checksum = "0a6fe808308bb07d393e2ea47780043ec47683fcf19cf5efc8ca51c50cc8c68a" dependencies = [ "block-cipher", - "opaque-debug 0.2.3", + "opaque-debug 0.3.0", ] [[package]] name = "ahash" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f33b5018f120946c1dcf279194f238a9f146725593ead1c08fa47ff22b0b5d3" +checksum = "29661b60bec623f0586702976ff4d0c9942dcb6723161c2df0eea78455cfedfb" dependencies = [ "const-random", ] [[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" + +[[package]] name = "aho-corasick" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" +checksum = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d" dependencies = [ "memchr", ] @@ -111,7 +111,7 @@ dependencies = [ "approx", "num-complex", - "num-traits 0.2.12", + "num-traits", ] [[package]] @@ -134,9 +134,9 @@ [[package]] name = "anyhow" -version = "1.0.31" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f" +checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c" [[package]] name = "approx" @@ -144,7 +144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" dependencies = [ - "num-traits 0.2.12", + "num-traits", ] [[package]] @@ -189,65 +189,146 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" dependencies = [ - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] -name = "assert_matches" +name = "async-channel" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59740d83946db6a5af71ae25ddf9562c2b176b2ca42cf99a455f09f4a220d6b9" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" +checksum = "d373d78ded7d0b3fa8039375718cde0aace493f2e34fb60f51cbf567562ca801" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "once_cell 1.4.1", + "vec-arena", +] + +[[package]] +name = "async-global-executor" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0659b83a146398616883aa5199cdd1b055ec088a83c9a338eab3534f33f0622e" +dependencies = [ + "async-executor", + "async-io", + "futures-lite", + "num_cpus", + "once_cell 1.4.1", +] [[package]] +name = "async-io" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54bc4c1c7292475efb2253227dbcfad8fe1ca4c02bc62c510cc2f3da5c4704e" +dependencies = [ + "concurrent-queue", + "fastrand", + "futures-lite", + "libc", + "log", + "nb-connect", + "once_cell 1.4.1", + "parking", + "polling", + "vec-arena", + "waker-fn", + "winapi 0.3.9", +] + +[[package]] +name = "async-mutex" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +dependencies = [ + "event-listener", +] + +[[package]] name = "async-std" -version = "1.5.0" +version = "1.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "538ecb01eb64eecd772087e5b6f7540cbc917f047727339a472dafed2185b267" +checksum = "a9fa76751505e8df1c7a77762f60486f60c71bbd9b8557f4da6ad47d083732ed" dependencies = [ - "async-task", - "broadcaster", - "crossbeam-channel", - "crossbeam-deque", + "async-global-executor", + "async-io", + "async-mutex", + "blocking", "crossbeam-utils", + "futures-channel", "futures-core", "futures-io", - "futures-timer 2.0.2", + "futures-lite", + "gloo-timers", "kv-log-macro", "log", "memchr", - "mio", - "mio-uds", "num_cpus", - "once_cell", + "once_cell 1.4.1", "pin-project-lite", "pin-utils", "slab", + "wasm-bindgen-futures", ] [[package]] name = "async-task" -version = "1.3.1" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ac2c016b079e771204030951c366db398864f5026f84a44dafb0ff20f02085d" -dependencies = [ - "libc", - "winapi 0.3.9", -] +checksum = "8ab27c1aa62945039e44edaeee1dc23c74cc0c303dd5fe0fb462a184f1c3a518" [[package]] name = "async-tls" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fd83426b89b034bf4e9ceb9c533c2f2386b813fd3dcae0a425ec6f1837d78a" +checksum = "df097e3f506bec0e1a24f06bb3c962c228f36671de841ff579cb99f371772634" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "rustls", "webpki", "webpki-roots 0.19.0", ] [[package]] +name = "async-trait" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b246867b8b3b6ae56035f1eb1ed557c1d8eae97f0d53696138a50fa0e3a3b8c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f46ca51dca4837f1520754d1c8c36636356b81553d928dc9c177025369a06e" + +[[package]] +name = "atomic-waker" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + +[[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -266,21 +347,21 @@ [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.50" +version = "0.3.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" +checksum = "707b586e0e2f247cbde68cdd2c3ce69ea7b7be43e1c5b426e37c9319c4b9838e" dependencies = [ "addr2line", - "cfg-if", + "cfg-if 1.0.0", "libc", "miniz_oxide", - "object", + "object 0.21.1", "rustc-demangle", ] @@ -297,14 +378,30 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +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.53.3" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" +checksum = "66c0bb6167449588ff70803f4127f0684f9063097eca5016f37eb52b92c2cf36" dependencies = [ "bitflags", "cexpr", - "cfg-if", + "cfg-if 0.1.10", "clang-sys", "clap", "env_logger", @@ -313,7 +410,7 @@ "log", "peeking_take_while", "proc-macro2", - "quote 1.0.7", + "quote", "regex", "rustc-hash", "shlex", @@ -321,6 +418,21 @@ ] [[package]] +name = "bip39" +version = "0.6.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7059804e226b3ac116519a252d7f5fb985a5ccc0e93255e036a5f7e7283323f4" +dependencies = [ + "failure", + "hashbrown 0.1.8", + "hmac", + "once_cell 0.1.8", + "pbkdf2", + "rand 0.6.5", + "sha2 0.8.2", +] + +[[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -340,18 +452,6 @@ dependencies = [ "either", "radium", -] - -[[package]] -name = "blake2" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" -dependencies = [ - "byte-tools", - "crypto-mac 0.7.0", - "digest 0.8.1", - "opaque-debug 0.2.3", ] [[package]] @@ -361,7 +461,7 @@ checksum = "84ce5b6108f8e154604bd4eb76a2f726066c3464d5a552a4229262a18c9bb471" dependencies = [ "byte-tools", - "byteorder", + "byteorder 1.3.4", "crypto-mac 0.8.0", "digest 0.9.0", "opaque-debug 0.2.3", @@ -405,9 +505,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding", + "block-padding 0.1.5", "byte-tools", - "byteorder", + "byteorder 1.3.4", "generic-array 0.12.3", ] @@ -417,16 +517,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.3", + "block-padding 0.2.1", + "generic-array 0.14.4", ] [[package]] name = "block-cipher" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10" +checksum = "f337a3e6da609650eb74e02bc9fac7b735049f7623ab12f2e4c719316fcc7e80" dependencies = [ - "generic-array 0.14.3", + "generic-array 0.14.4", ] [[package]] @@ -439,17 +540,23 @@ ] [[package]] -name = "broadcaster" -version = "1.0.0" +name = "block-padding" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c972e21e0d055a36cf73e4daae870941fe7a8abcd5ac3396aab9e4c126bd87" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "blocking" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9" dependencies = [ - "futures-channel", - "futures-core", - "futures-sink", - "futures-util", - "parking_lot 0.10.2", - "slab", + "async-channel", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "once_cell 1.4.1", ] [[package]] @@ -487,6 +594,12 @@ [[package]] name = "byteorder" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" + +[[package]] +name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" @@ -497,7 +610,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" dependencies = [ - "byteorder", + "byteorder 1.3.4", "either", "iovec", ] @@ -515,10 +628,16 @@ checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" [[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + +[[package]] name = "cc" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" +checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" dependencies = [ "jobserver", ] @@ -539,37 +658,45 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] name = "chacha20" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "086c0f07ac275808b7bf9a39f2fd013aae1498be83632814c8c4e0bd53f2dc58" +checksum = "244fbce0d47e97e8ef2f63b81d5e05882cb518c68531eb33194990d7b7e85845" dependencies = [ - "stream-cipher", + "stream-cipher 0.7.1", "zeroize", ] [[package]] name = "chacha20poly1305" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18b0c90556d8e3fec7cf18d84a2f53d27b21288f2fe481b830fadcf809e48205" +checksum = "9bf18d374d66df0c05cdddd528a7db98f78c28e2519b120855c4f84c5027b1f5" dependencies = [ "aead", "chacha20", "poly1305", - "stream-cipher", + "stream-cipher 0.7.1", "zeroize", ] [[package]] name = "chrono" -version = "0.4.13" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ + "libc", "num-integer", - "num-traits 0.2.12", + "num-traits", "time", + "winapi 0.3.9", ] [[package]] @@ -585,9 +712,9 @@ [[package]] name = "clap" -version = "2.33.1" +version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ "ansi_term 0.11.0", "atty", @@ -599,28 +726,37 @@ ] [[package]] -name = "clear_on_drop" -version = "0.2.4" +name = "cloudabi" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9cc5db465b294c3fa986d5bbb0f3017cd850bff6dd6c52f9ccff8b4d21b7b08" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "cc", + "bitflags", ] [[package]] name = "cloudabi" -version = "0.0.3" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" dependencies = [ "bitflags", ] [[package]] +name = "concurrent-queue" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +dependencies = [ + "cache-padded", +] + +[[package]] name = "const-random" -version = "0.1.8" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f1af9ac737b2dd2d577701e59fd09ba34822f6f2ebdb30a7647405d9e55e16a" +checksum = "02dc82c12dc2ee6e1ded861cf7d582b46f66f796d1b6c93fa28b911ead95da02" dependencies = [ "const-random-macro", "proc-macro-hack", @@ -628,11 +764,11 @@ [[package]] name = "const-random-macro" -version = "0.1.8" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25e4c606eb459dd29f7c57b2e0879f2b6f14ee130918c2b78ccb58a9624e6c7a" +checksum = "fc757bbb9544aa296c2ae00c679e81f886b37e28e59097defe0cf524306f6685" dependencies = [ - "getrandom", + "getrandom 0.2.0", "proc-macro-hack", ] @@ -665,19 +801,111 @@ 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" checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] name = "crossbeam-channel" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061" +checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" dependencies = [ "crossbeam-utils", "maybe-uninit", @@ -700,13 +928,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" dependencies = [ - "autocfg 1.0.0", - "cfg-if", + "autocfg 1.0.1", + "cfg-if 0.1.10", "crossbeam-utils", "lazy_static", "maybe-uninit", "memoffset", - "scopeguard", + "scopeguard 1.1.0", ] [[package]] @@ -715,7 +943,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "crossbeam-utils", "maybe-uninit", ] @@ -726,8 +954,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" dependencies = [ - "autocfg 1.0.0", - "cfg-if", + "autocfg 1.0.1", + "cfg-if 0.1.10", "lazy_static", ] @@ -753,47 +981,70 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.14.3", - "subtle 2.2.3", + "generic-array 0.14.4", + "subtle 2.3.0", ] [[package]] name = "ct-logs" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3686f5fa27dbc1d76c751300376e167c5a43387f44bb451fd1c24776e49113" +checksum = "8c8e13110a84b6315df212c045be706af261fd364791cad863285439ebba672e" dependencies = [ "sct", ] [[package]] +name = "cuckoofilter" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd43f7cfaffe0a386636a10baea2ee05cc50df3b77bea4a456c9572a939bf1f" +dependencies = [ + "byteorder 0.5.3", + "rand 0.3.23", +] + +[[package]] name = "curve25519-dalek" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" dependencies = [ - "byteorder", + "byteorder 1.3.4", "digest 0.8.1", "rand_core 0.5.1", - "subtle 2.2.3", + "subtle 2.3.0", "zeroize", ] [[package]] +name = "curve25519-dalek" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307" +dependencies = [ + "byteorder 1.3.4", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle 2.3.0", + "zeroize", +] + +[[package]] name = "data-encoding" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72aa14c04dfae8dd7d8a2b1cb7ca2152618cd01336dbfe704b8dcbf8d41dbd69" +checksum = "d4d0e2d24e5ee3b23a01de38eefdcd978907890701f08ffffd4cb457ca4ee8d6" [[package]] name = "derive_more" -version = "0.99.9" +version = "0.99.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298998b1cf6b5b2c8a7b023dfd45821825ce3ba8a8af55c921a0e734e4653f76" +checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] @@ -811,7 +1062,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.3", + "generic-array 0.14.4", ] [[package]] @@ -820,7 +1071,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "dirs-sys", ] @@ -841,46 +1092,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" dependencies = [ - "byteorder", + "byteorder 1.3.4", "quick-error", ] [[package]] -name = "doc-comment" -version = "0.3.3" +name = "dyn-clonable" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +dependencies = [ + "dyn-clonable-impl", + "dyn-clone", +] [[package]] -name = "ed25519-dalek" -version = "1.0.0-pre.3" +name = "dyn-clonable-impl" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978710b352437433c97b2bff193f2fb1dfd58a093f863dd95e225a19baa599a2" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" dependencies = [ - "clear_on_drop", - "curve25519-dalek", - "rand 0.7.3", - "sha2 0.8.2", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "either" -version = "1.5.3" +name = "dyn-clone" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +checksum = "4c53dc3a653e0f64081026e4bf048d48fec9fce90c66e8326ca7292df0ff2d82" + +[[package]] +name = "ed25519" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef" +dependencies = [ + "signature", +] [[package]] -name = "enum-primitive-derive" -version = "0.1.2" +name = "ed25519-dalek" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b90e520ec62c1864c8c78d637acbfe8baf5f63240f2fb8165b8325c07812dd" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ - "num-traits 0.1.43", - "quote 0.3.15", - "syn 0.11.11", + "curve25519-dalek 3.0.0", + "ed25519", + "rand 0.7.3", + "serde", + "sha2 0.9.1", + "zeroize", ] [[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -895,9 +1167,9 @@ [[package]] name = "environmental" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516aa8d7a71cb00a1c4146f0798549b93d083d4f189b3ced8f3de6b8f11ee6c4" +checksum = "6576a1755ddffd988788025e75bce9e74b018f7cc226198fe931d077911c6d7e" [[package]] name = "erased-serde" @@ -909,12 +1181,39 @@ ] [[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" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + +[[package]] name = "exit-future" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", ] [[package]] @@ -934,8 +1233,8 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", "synstructure", ] @@ -946,12 +1245,37 @@ 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" +checksum = "ca5faf057445ce5c9d4329e382b2ce7ca38550ef3b73a5348362d5f24e0c7fe3" +dependencies = [ + "instant", +] + +[[package]] name = "fdlimit" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4c9e43643f5a3be4ca5b67d26b98031ff9db6806c3440ae32e02e3ceac3f1b" +dependencies = [ + "libc", +] + +[[package]] +name = "file-per-thread-logger" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da54a593b34c71b889ee45f5b5bb900c74148c5f7f8c6a9479ee7899f69603c" +checksum = "4fdbe0d94371f9ce939b555dd342d0686cc4c0cadbcd4b61d70af5ff97eb4126" dependencies = [ - "libc", + "env_logger", + "log", ] [[package]] @@ -961,10 +1285,10 @@ checksum = "8feb87a63249689640ac9c011742c33139204e3c134293d3054022276869133b" dependencies = [ "either", - "futures 0.3.5", + "futures 0.3.6", "futures-timer 2.0.2", "log", - "num-traits 0.2.12", + "num-traits", "parity-scale-codec", "parking_lot 0.9.0", ] @@ -975,7 +1299,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" dependencies = [ - "byteorder", + "byteorder 1.3.4", "rand 0.7.3", "rustc-hex", "static_assertions", @@ -989,11 +1313,11 @@ [[package]] name = "flate2" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e" +checksum = "da80be589a72651dcda34d8b35bcdc9b7254ad06325611074d9cc0fbb19f60ee" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "crc32fast", "libc", "libz-sys", @@ -1008,16 +1332,16 @@ [[package]] name = "fork-tree" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", ] [[package]] name = "frame-benchmarking" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "frame-system", @@ -1029,17 +1353,37 @@ "sp-runtime", "sp-runtime-interface", "sp-std", + "sp-storage", ] [[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-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "frame-system", "parity-scale-codec", "serde", + "sp-core", "sp-io", "sp-runtime", "sp-std", @@ -1048,8 +1392,8 @@ [[package]] name = "frame-metadata" -version = "11.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "12.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "serde", @@ -1059,19 +1403,19 @@ [[package]] name = "frame-support" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "bitmask", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", "log", - "once_cell", + "once_cell 1.4.1", "parity-scale-codec", "paste", "serde", - "smallvec 1.4.1", + "smallvec 1.4.2", "sp-arithmetic", "sp-core", "sp-inherents", @@ -1084,41 +1428,41 @@ [[package]] name = "frame-support-procedural" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support-procedural-tools", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "frame-support-procedural-tools" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "frame-system" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1132,6 +1476,29 @@ ] [[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" +dependencies = [ + "parity-scale-codec", + "sp-api", +] + +[[package]] name = "fs-swap" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1167,15 +1534,15 @@ [[package]] name = "futures" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" +checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" [[package]] name = "futures" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +checksum = "5d8e3078b7b2a8a671cb7a3d17b4760e4181ea243227776ba83fd043b4ca034e" dependencies = [ "futures-channel", "futures-core", @@ -1188,9 +1555,9 @@ [[package]] name = "futures-channel" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +checksum = "a7a4d35f7401e948629c9c3d6638fb9bf94e0b2121e96c3b428cc4e631f3eb74" dependencies = [ "futures-core", "futures-sink", @@ -1207,9 +1574,9 @@ [[package]] name = "futures-core" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" +checksum = "d674eaa0056896d5ada519900dbf97ead2e46a7b6621e8160d79e2f2e1e2784b" [[package]] name = "futures-core-preview" @@ -1223,7 +1590,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" dependencies = [ - "futures 0.1.29", + "futures 0.1.30", "num_cpus", ] @@ -1233,8 +1600,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9" dependencies = [ - "futures 0.1.29", - "futures 0.3.5", + "futures 0.1.30", + "futures 0.3.6", "lazy_static", "log", "parking_lot 0.9.0", @@ -1245,9 +1612,9 @@ [[package]] name = "futures-executor" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +checksum = "cc709ca1da6f66143b8c9bec8e6260181869893714e9b5a490b169b0414144ab" dependencies = [ "futures-core", "futures-task", @@ -1257,35 +1624,50 @@ [[package]] name = "futures-io" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" +checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c" + +[[package]] +name = "futures-lite" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "381a7ad57b1bad34693f63f6f377e1abded7a9c85c9d3eb6771e11c60aaadab9" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] [[package]] name = "futures-macro" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" +checksum = "f57ed14da4603b2554682e9f2ff3c65d7567b53188db96cb71538217fc64581b" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "futures-sink" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" +checksum = "0d8764258ed64ebc5d9ed185cf86a95db5cac810269c5d20ececb32e0088abbd" [[package]] name = "futures-task" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +checksum = "4dd26820a9f3637f1302da8bceba3ff33adbe53464b54ca24d4e2d4f1db30f94" dependencies = [ - "once_cell", + "once_cell 1.4.1", ] [[package]] @@ -1302,11 +1684,11 @@ [[package]] name = "futures-util" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +checksum = "8a894a0acddba51a2d49a6f4263b1e64b8c579ece8af50fa86503d52cd1eea34" dependencies = [ - "futures 0.1.29", + "futures 0.1.30", "futures-channel", "futures-core", "futures-io", @@ -1335,24 +1717,12 @@ [[package]] name = "futures_codec" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0a73299e4718f5452e45980fc1d6957a070abe308d3700b63b8673f47e1c2b3" -dependencies = [ - "bytes 0.5.6", - "futures 0.3.5", - "memchr", - "pin-project", -] - -[[package]] -name = "futures_codec" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" dependencies = [ "bytes 0.5.6", - "futures 0.3.5", + "futures 0.3.6", "memchr", "pin-project", ] @@ -1374,9 +1744,9 @@ [[package]] name = "generic-array" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60fb4bb6bba52f78a471264d9a3b7d026cc0af47b22cd2cffbc0b787ca003e63" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", "version_check", @@ -1406,13 +1776,24 @@ [[package]] name = "getrandom" -version = "0.1.14" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", - "wasi", + "wasi 0.9.0+wasi-snapshot-preview1", ] [[package]] @@ -1426,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" @@ -1450,15 +1842,28 @@ ] [[package]] +name = "gloo-timers" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] name = "h2" version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" dependencies = [ - "byteorder", + "byteorder 1.3.4", "bytes 0.4.12", "fnv", - "futures 0.1.29", + "futures 0.1.30", "http 0.1.21", "indexmap", "log", @@ -1481,7 +1886,7 @@ "http 0.2.1", "indexmap", "slab", - "tokio 0.2.21", + "tokio 0.2.22", "tokio-util", "tracing", ] @@ -1503,24 +1908,41 @@ [[package]] name = "hashbrown" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" +dependencies = [ + "byteorder 1.3.4", + "scopeguard 0.3.3", +] + +[[package]] +name = "hashbrown" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead" dependencies = [ - "ahash", + "ahash 0.2.19", "autocfg 0.1.7", ] [[package]] name = "hashbrown" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb" +checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" dependencies = [ - "autocfg 1.0.0", + "ahash 0.3.8", + "autocfg 1.0.1", ] [[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" + +[[package]] name = "heck" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1531,9 +1953,9 @@ [[package]] name = "hermit-abi" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" +checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" dependencies = [ "libc", ] @@ -1546,22 +1968,15 @@ [[package]] name = "hex-literal" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "961de220ec9a91af2e1e5bd80d02109155695e516771762381ef8581317066e0" -dependencies = [ - "hex-literal-impl", - "proc-macro-hack", -] +checksum = "5af1f635ef1bc545d78392b136bfe1c9809e029023c84a3638a864a10b8819c8" [[package]] -name = "hex-literal-impl" -version = "0.2.2" +name = "hex_fmt" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853f769599eb31de176303197b7ba4973299c38c7a7604a6bc88c3eef05b9b46" -dependencies = [ - "proc-macro-hack", -] +checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" [[package]] name = "hmac" @@ -1613,7 +2028,7 @@ checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "http 0.1.21", "tokio-buf", ] @@ -1635,6 +2050,12 @@ checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] +name = "httpdate" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + +[[package]] name = "humantime" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1650,7 +2071,7 @@ checksum = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "futures-cpupool", "h2 0.1.26", "http 0.1.21", @@ -1675,9 +2096,9 @@ [[package]] name = "hyper" -version = "0.13.7" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e68a8dd9716185d9e64ea473ea6ef63529252e3e27623295a0378a19665d5eb" +checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" dependencies = [ "bytes 0.5.6", "futures-channel", @@ -1687,11 +2108,11 @@ "http 0.2.1", "http-body 0.3.1", "httparse", + "httpdate", "itoa", "pin-project", "socket2", - "time", - "tokio 0.2.21", + "tokio 0.2.22", "tower-service", "tracing", "want 0.3.0", @@ -1699,18 +2120,18 @@ [[package]] name = "hyper-rustls" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac965ea399ec3a25ac7d13b8affd4b8f39325cca00858ddf5eb29b79e6b14b08" +checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6" dependencies = [ "bytes 0.5.6", "ct-logs", "futures-util", - "hyper 0.13.7", + "hyper 0.13.8", "log", "rustls", "rustls-native-certs", - "tokio 0.2.21", + "tokio 0.2.22", "tokio-rustls", "webpki", ] @@ -1744,15 +2165,6 @@ checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" dependencies = [ "parity-scale-codec", -] - -[[package]] -name = "impl-serde" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e3cae7e99c7ff5a995da2cf78dd0a5383740eda71d98cf7b1910c301ac69b8" -dependencies = [ - "serde", ] [[package]] @@ -1771,25 +2183,38 @@ checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "indexmap" -version = "1.5.0" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" +dependencies = [ + "autocfg 1.0.1", + "hashbrown 0.9.1", + "serde", +] + +[[package]] +name = "instant" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b88cd59ee5f71fea89a62248fc8f387d44400cefe05ef548466d61ced9029a7" +checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" dependencies = [ - "autocfg 1.0.0", - "hashbrown 0.8.1", + "cfg-if 0.1.10", ] [[package]] name = "integer-sqrt" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f65877bf7d44897a473350b1046277941cee20b263397e90869c50b6e766088b" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] [[package]] name = "intervalier" @@ -1797,7 +2222,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "futures-timer 2.0.2", ] @@ -1857,21 +2282,21 @@ [[package]] name = "js-sys" -version = "0.3.42" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2" +checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" dependencies = [ "wasm-bindgen", ] [[package]] name = "jsonrpc-client-transports" -version = "14.2.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecbdaacc17243168d9d1fa6b2bd7556a27e1e60a621d8a2a6e590ae2b145d158" +checksum = "489b9c612e60c766f751ab40fcb43cbb55a1e10bb44a9b4307ed510ca598cbd7" dependencies = [ "failure", - "futures 0.1.29", + "futures 0.1.30", "jsonrpc-core", "jsonrpc-pubsub", "log", @@ -1882,11 +2307,11 @@ [[package]] name = "jsonrpc-core" -version = "14.2.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0747307121ffb9703afd93afbd0fb4f854c38fb873f2c8b90e0e902f27c7b62" +checksum = "0745a6379e3edc893c84ec203589790774e4247420033e71a76d3ab4687991fa" dependencies = [ - "futures 0.1.29", + "futures 0.1.30", "log", "serde", "serde_derive", @@ -1895,30 +2320,30 @@ [[package]] name = "jsonrpc-core-client" -version = "14.2.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34221123bc79b66279a3fde2d3363553835b43092d629b34f2e760c44dc94713" +checksum = "6f764902d7b891344a0acb65625f32f6f7c6db006952143bd650209fbe7d94db" dependencies = [ "jsonrpc-client-transports", ] [[package]] name = "jsonrpc-derive" -version = "14.2.1" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fadf6945e227246825a583514534d864554e9f23d80b3c77d034b10983db5ef" +checksum = "99a847f9ec7bb52149b2786a17c9cb260d6effc6b8eeb8c16b343a487a7563a3" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "jsonrpc-http-server" -version = "14.2.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da906d682799df05754480dac1b9e70ec92e12c19ebafd2662a5ea1c9fd6522" +checksum = "4fb5c4513b7b542f42da107942b7b759f27120b5cc894729f88254b28dff44b7" dependencies = [ "hyper 0.12.35", "jsonrpc-core", @@ -1931,9 +2356,9 @@ [[package]] name = "jsonrpc-ipc-server" -version = "14.2.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dedccd693325d833963b549e959137f30a7a0ea650cde92feda81dc0c1393cb5" +checksum = "cf50e53e4eea8f421a7316c5f63e395f7bc7c4e786a6dc54d76fab6ff7aa7ce7" dependencies = [ "jsonrpc-core", "jsonrpc-server-utils", @@ -1945,9 +2370,9 @@ [[package]] name = "jsonrpc-pubsub" -version = "14.2.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d44f5602a11d657946aac09357956d2841299ed422035edf140c552cb057986" +checksum = "639558e0604013be9787ae52f798506ae42bf4220fe587bdc5625871cc8b9c77" dependencies = [ "jsonrpc-core", "log", @@ -1958,9 +2383,9 @@ [[package]] name = "jsonrpc-server-utils" -version = "14.2.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56cbfb462e7f902e21121d9f0d1c2b77b2c5b642e1a4e8f4ebfa2e15b94402bb" +checksum = "72f1f3990650c033bd8f6bd46deac76d990f9bbfb5f8dc8c4767bf0a00392176" dependencies = [ "bytes 0.4.12", "globset", @@ -1974,16 +2399,16 @@ [[package]] name = "jsonrpc-ws-server" -version = "14.2.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903d3109fe7c4acb932b567e1e607e0f524ed04741b09fb0e61841bc40a022fc" +checksum = "6596fe75209b73a2a75ebe1dce4e60e03b88a2b25e8807b667597f6315150d22" dependencies = [ "jsonrpc-core", "jsonrpc-server-utils", "log", + "parity-ws", "parking_lot 0.10.2", "slab", - "ws", ] [[package]] @@ -2013,19 +2438,19 @@ [[package]] name = "kvdb" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e763b2a9b500ba47948061d1e8bc3b5f03a8a1f067dbcf822a4d2c84d2b54a3a" +checksum = "0315ef2f688e33844400b31f11c263f2b3dc21d8b9355c6891c5f185fae43f9a" dependencies = [ "parity-util-mem", - "smallvec 1.4.1", + "smallvec 1.4.2", ] [[package]] name = "kvdb-memorydb" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73027d5e228de6f503b5b7335d530404fc26230a6ae3e09b33ec6e45408509a4" +checksum = "73de822b260a3bdfb889dbbb65bb2d473eee2253973d6fa4a5d149a2a4a7c66e" dependencies = [ "kvdb", "parity-util-mem", @@ -2034,9 +2459,9 @@ [[package]] name = "kvdb-rocksdb" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84384eca250c7ff67877eda5336f28a86586aaee24acb945643590671f6bfce1" +checksum = "44947dd392f09475af614d740fe0320b66d01cb5b977f664bbbb5e45a70ea4c1" dependencies = [ "fs-swap", "kvdb", @@ -2047,7 +2472,7 @@ "parking_lot 0.10.2", "regex", "rocksdb", - "smallvec 1.4.1", + "smallvec 1.4.2", ] [[package]] @@ -2058,33 +2483,21 @@ [[package]] name = "lazycell" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] -name = "libc" -version = "0.2.73" +name = "leb128" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" +checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" [[package]] -name = "libflate" -version = "1.0.2" +name = "libc" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9bac9023e1db29c084f9f8cd9d3852e5e8fddf98fb47c4964a0ea4663d95949" -dependencies = [ - "adler32", - "crc32fast", - "libflate_lz77", - "rle-decode-fast", -] - -[[package]] -name = "libflate_lz77" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3286f09f7d4926fc486334f28d8d2e6ebe4f7f9994494b6dab27ddfad2c9b11b" +checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" [[package]] name = "libloading" @@ -2104,54 +2517,62 @@ [[package]] name = "libp2p" -version = "0.19.1" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057eba5432d3e740e313c6e13c9153d0cb76b4f71bfc2e5242ae5bdb7d41af67" +checksum = "571f5a4604c1a40d75651da141dfde29ad15329f537a779528803297d2220274" dependencies = [ + "atomic", "bytes 0.5.6", - "futures 0.3.5", + "futures 0.3.6", "lazy_static", "libp2p-core", "libp2p-core-derive", + "libp2p-deflate", "libp2p-dns", + "libp2p-floodsub", + "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-mdns", "libp2p-mplex", "libp2p-noise", "libp2p-ping", + "libp2p-plaintext", + "libp2p-pnet", + "libp2p-request-response", "libp2p-swarm", "libp2p-tcp", + "libp2p-uds", "libp2p-wasm-ext", "libp2p-websocket", "libp2p-yamux", "multihash", - "parity-multiaddr 0.9.1", + "parity-multiaddr", "parking_lot 0.10.2", "pin-project", - "smallvec 1.4.1", + "smallvec 1.4.2", "wasm-timer", ] [[package]] name = "libp2p-core" -version = "0.19.2" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a0387b930c3d4c2533dc4893c1e0394185ddcc019846121b1b27491e45a2c08" +checksum = "52f13ba8c7df0768af2eb391696d562c7de88cc3a35122531aaa6a7d77754d25" dependencies = [ "asn1_der", "bs58", "ed25519-dalek", "either", "fnv", - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", "lazy_static", "libsecp256k1", "log", "multihash", "multistream-select", - "parity-multiaddr 0.9.1", + "parity-multiaddr", "parking_lot 0.10.2", "pin-project", "prost", @@ -2160,7 +2581,7 @@ "ring", "rw-stream-sink", "sha2 0.8.2", - "smallvec 1.4.1", + "smallvec 1.4.2", "thiserror", "unsigned-varint 0.4.0", "void", @@ -2169,53 +2590,107 @@ [[package]] name = "libp2p-core-derive" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f09548626b737ed64080fde595e06ce1117795b8b9fc4d2629fa36561c583171" +checksum = "f753d9324cd3ec14bf04b8a8cd0d269c87f294153d6bf2a84497a63a5ad22213" dependencies = [ - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] +name = "libp2p-deflate" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74029ae187f35f4b8ddf26b9779a68b340045d708528a103917cdca49a296db5" +dependencies = [ + "flate2", + "futures 0.3.6", + "libp2p-core", +] + +[[package]] name = "libp2p-dns" -version = "0.19.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc186d9a941fd0207cf8f08ef225a735e2d7296258f570155e525f6ee732f87" +checksum = "7cf319822e08dd65c8e060d2354e9f952895bbc433f5706c75ed010c152aee5e" +dependencies = [ + "futures 0.3.6", + "libp2p-core", + "log", +] + +[[package]] +name = "libp2p-floodsub" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a9acb43a3e4a4e413e0c4abe0fa49308df7c6335c88534757b647199cb8a51" +dependencies = [ + "cuckoofilter", + "fnv", + "futures 0.3.6", + "libp2p-core", + "libp2p-swarm", + "prost", + "prost-build", + "rand 0.7.3", + "smallvec 1.4.2", +] + +[[package]] +name = "libp2p-gossipsub" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab20fcb60edebe3173bbb708c6ac3444afdf1e3152dc2866b10c4f5497f17467" dependencies = [ - "futures 0.3.5", + "base64 0.11.0", + "byteorder 1.3.4", + "bytes 0.5.6", + "fnv", + "futures 0.3.6", + "futures_codec", + "hex_fmt", "libp2p-core", + "libp2p-swarm", "log", + "lru_time_cache", + "prost", + "prost-build", + "rand 0.7.3", + "sha2 0.8.2", + "smallvec 1.4.2", + "unsigned-varint 0.4.0", + "wasm-timer", ] [[package]] name = "libp2p-identify" -version = "0.19.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f76075b170d908bae616f550ade410d9d27c013fa69042551dbfc757c7c094" +checksum = "56396ee63aa9164eacf40c2c5d2bda8c4133c2f57e1b0425d51d3a4e362583b1" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "libp2p-core", "libp2p-swarm", "log", "prost", "prost-build", - "smallvec 1.4.1", + "smallvec 1.4.2", "wasm-timer", ] [[package]] name = "libp2p-kad" -version = "0.19.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d6c1d5100973527ae70d82687465b17049c1b717a7964de38b8e65000878ff" +checksum = "cc7fa9047f8b8f544278a35c2d9d45d3b2c1785f2d86d4e1629d6edf97be3955" dependencies = [ "arrayvec 0.5.1", "bytes 0.5.6", "either", "fnv", - "futures 0.3.5", - "futures_codec 0.3.4", + "futures 0.3.6", + "futures_codec", "libp2p-core", "libp2p-swarm", "log", @@ -2224,45 +2699,45 @@ "prost-build", "rand 0.7.3", "sha2 0.8.2", - "smallvec 1.4.1", + "smallvec 1.4.2", "uint", - "unsigned-varint 0.3.3", + "unsigned-varint 0.4.0", "void", "wasm-timer", ] [[package]] name = "libp2p-mdns" -version = "0.19.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f55b2d4b80986e5bf158270ab23268ec0e7f644ece5436fbaabc5155472f357" +checksum = "3173b5a6b2f690c29ae07798d85b9441a131ac76ddae9015ef22905b623d0c69" dependencies = [ "async-std", "data-encoding", "dns-parser", "either", - "futures 0.3.5", + "futures 0.3.6", "lazy_static", "libp2p-core", "libp2p-swarm", "log", "net2", "rand 0.7.3", - "smallvec 1.4.1", + "smallvec 1.4.2", "void", "wasm-timer", ] [[package]] name = "libp2p-mplex" -version = "0.19.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be7d913a4cd57de2013257ec73f07d77bfce390b370023e2d59083e5ca079864" +checksum = "8a73a799cc8410b36e40b8f4c4b6babbcb9efd3727111bf517876e4acfa612d3" dependencies = [ "bytes 0.5.6", "fnv", - "futures 0.3.5", - "futures_codec 0.4.1", + "futures 0.3.6", + "futures_codec", "libp2p-core", "log", "parking_lot 0.10.2", @@ -2271,12 +2746,13 @@ [[package]] name = "libp2p-noise" -version = "0.19.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a03db664653369f46ee03fcec483a378c20195089bb43a26cb9fb0058009ac88" +checksum = "6ef6c490042f549fb1025f2892dfe6083d97a77558f450c1feebe748ca9eb15a" dependencies = [ - "curve25519-dalek", - "futures 0.3.5", + "bytes 0.5.6", + "curve25519-dalek 2.1.0", + "futures 0.3.6", "lazy_static", "libp2p-core", "log", @@ -2286,17 +2762,17 @@ "sha2 0.8.2", "snow", "static_assertions", - "x25519-dalek", + "x25519-dalek 0.6.0", "zeroize", ] [[package]] name = "libp2p-ping" -version = "0.19.3" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dedd34e35a9728d52d59ef36a218e411359a353f9011b2574b86ee790978f6" +checksum = "ad063c21dfcea4518ac9e8bd4119d33a5b26c41e674f602f41f05617a368a5c8" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "libp2p-core", "libp2p-swarm", "log", @@ -2306,28 +2782,81 @@ ] [[package]] -name = "libp2p-swarm" +name = "libp2p-plaintext" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903a12e99c72dbebefea258de887982adeacc7025baa1ceb10b7fa9928f54791" +dependencies = [ + "bytes 0.5.6", + "futures 0.3.6", + "futures_codec", + "libp2p-core", + "log", + "prost", + "prost-build", + "rw-stream-sink", + "unsigned-varint 0.4.0", + "void", +] + +[[package]] +name = "libp2p-pnet" version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce53ff4d127cf8b39adf84dbd381ca32d49bd85788cee08e6669da2495993930" +checksum = "37d0db10e139d22d7af0b23ed7949449ec86262798aa0fd01595abdbcb02dc87" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", + "log", + "pin-project", + "rand 0.7.3", + "salsa20", + "sha3 0.8.2", +] + +[[package]] +name = "libp2p-request-response" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c0c9e8a4cd69d97e9646c54313d007512f411aba8c5226cfcda16df6a6e84a3" +dependencies = [ + "async-trait", + "bytes 0.5.6", + "futures 0.3.6", "libp2p-core", + "libp2p-swarm", "log", + "lru 0.6.0", + "minicbor", "rand 0.7.3", - "smallvec 1.4.1", + "smallvec 1.4.2", + "unsigned-varint 0.5.1", + "wasm-timer", +] + +[[package]] +name = "libp2p-swarm" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7193e444210132237b81b755ec7fe53f1c4bd2f53cf719729b94c0c72eb6eaa1" +dependencies = [ + "either", + "futures 0.3.6", + "libp2p-core", + "log", + "rand 0.7.3", + "smallvec 1.4.2", "void", "wasm-timer", ] [[package]] name = "libp2p-tcp" -version = "0.19.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481500c5774c62e8c413e9535b3f33a0e3dbacf2da63b8d3056c686a9df4146" +checksum = "44f42ec130d7a37a7e47bf4398026b7ad9185c08ed26972e2720f8b94112796f" dependencies = [ "async-std", - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", "get_if_addrs", "ipnet", @@ -2337,12 +2866,24 @@ ] [[package]] +name = "libp2p-uds" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea7acb0a034f70d7db94c300eba3f65c0f6298820105624088a9609c9974d77" +dependencies = [ + "async-std", + "futures 0.3.6", + "libp2p-core", + "log", +] + +[[package]] name = "libp2p-wasm-ext" -version = "0.19.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f59fdbb5706f2723ca108c088b1c7a37f735a8c328021f0508007162627e9885" +checksum = "34c1faac6f92c21fbe155417957863ea822fba9e9fd5eb24c0912336a100e63f" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -2352,14 +2893,13 @@ [[package]] name = "libp2p-websocket" -version = "0.19.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "085fbe4c05c4116c2164ab4d5a521eb6e00516c444f61b3ee9f68c7b1e53580b" +checksum = "d650534ebd99f48f6fa292ed5db10d30df2444943afde4407ceeddab8e513fca" dependencies = [ "async-tls", - "bytes 0.5.6", "either", - "futures 0.3.5", + "futures 0.3.6", "libp2p-core", "log", "quicksink", @@ -2373,22 +2913,22 @@ [[package]] name = "libp2p-yamux" -version = "0.19.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da33e7b5f49c75c6a8afb0b8d1e229f5fa48be9f39bd14cdbc21459a02ac6fc" +checksum = "781d9b9f043dcdabc40640807125368596b849fd4d96cdca2dcf052fdf6f33fd" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "libp2p-core", - "parking_lot 0.10.2", + "parking_lot 0.11.0", "thiserror", "yamux", ] [[package]] name = "librocksdb-sys" -version = "6.7.4" +version = "6.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883213ae3d09bfc3d104aefe94b25ebb183b6f4d3a515b23b14817e1f4854005" +checksum = "eb5b56f651c204634b936be2f92dbb42c36867e00ff7fe2405591f3b9fa66f09" dependencies = [ "bindgen", "cc", @@ -2408,18 +2948,17 @@ "hmac-drbg", "rand 0.7.3", "sha2 0.8.2", - "subtle 2.2.3", + "subtle 2.3.0", "typenum", ] [[package]] name = "libz-sys" -version = "1.0.25" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" +checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655" dependencies = [ "cc", - "libc", "pkg-config", "vcpkg", ] @@ -2432,9 +2971,9 @@ [[package]] name = "linked_hash_set" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7c91c4c7bbeb4f2f7c4e5be11e6a05bd6830bc37249c47ce1ad86ad453ff9c" +checksum = "47186c6da4d81ca383c7c47c1bfc80f4b95f4720514d860a5407aaf4233f9588" dependencies = [ "linked-hash-map", ] @@ -2452,11 +2991,29 @@ [[package]] name = "lock_api" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +dependencies = [ + "scopeguard 0.3.3", +] + +[[package]] +name = "lock_api" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ - "scopeguard", + "scopeguard 1.1.0", +] + +[[package]] +name = "lock_api" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" +dependencies = [ + "scopeguard 1.1.0", ] [[package]] @@ -2465,7 +3022,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -2478,6 +3035,39 @@ ] [[package]] +name = "lru" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111b945ac72ec09eb7bc62a0fbdc3cc6e80555a7245f52a69d3921a75b53b153" +dependencies = [ + "hashbrown 0.8.2", +] + +[[package]] +name = "lru_time_cache" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +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" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + +[[package]] name = "matches" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2516,22 +3106,21 @@ [[package]] name = "memoffset" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" +checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", ] [[package]] name = "memory-db" -version = "0.21.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2999ff7a65d5a1d72172f6d51fa2ea03024b51aee709ba5ff81c3c629a2410" +checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a" dependencies = [ - "ahash", "hash-db", - "hashbrown 0.6.3", + "hashbrown 0.8.2", "parity-util-mem", ] @@ -2547,19 +3136,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78" dependencies = [ - "byteorder", + "byteorder 1.3.4", "keccak", "rand_core 0.5.1", "zeroize", ] [[package]] +name = "minicbor" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc03ad6f8f548db7194a5ff5a6f96342ecae4e3ef67d2bf18bacc0e245cd041" +dependencies = [ + "minicbor-derive", +] + +[[package]] +name = "minicbor-derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c214bf3d90099b52f3e4b328ae0fe34837fd0fab683ad1e10fceb4629106df48" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "miniz_oxide" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f" +checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" dependencies = [ "adler", + "autocfg 1.0.1", ] [[package]] @@ -2568,7 +3178,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "fuchsia-zircon", "fuchsia-zircon-sys", "iovec", @@ -2639,25 +3249,31 @@ ] [[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.2" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75db05d738947aa5389863aadafbcf2e509d7ba099dc2ddcdf4fc66bf7a9e03" +checksum = "567122ab6492f49b59def14ecc36e13e64dca4188196dd0cd41f9f3f979f3df6" dependencies = [ "blake2b_simd", "blake2s_simd", - "digest 0.8.1", - "sha-1", - "sha2 0.8.2", - "sha3", - "unsigned-varint 0.3.3", + "digest 0.9.0", + "sha-1 0.9.1", + "sha2 0.9.1", + "sha3 0.9.1", + "unsigned-varint 0.5.1", ] [[package]] name = "multimap" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" +checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" [[package]] name = "multistream-select" @@ -2666,10 +3282,10 @@ checksum = "c9157e87afbc2ef0d84cc0345423d715f445edde00141c93721c162de35a05e5" dependencies = [ "bytes 0.5.6", - "futures 0.3.5", + "futures 0.3.6", "log", "pin-project", - "smallvec 1.4.1", + "smallvec 1.4.2", "unsigned-varint 0.4.0", ] @@ -2685,7 +3301,7 @@ "matrixmultiply", "num-complex", "num-rational", - "num-traits 0.2.12", + "num-traits", "rand 0.6.5", "typenum", ] @@ -2700,39 +3316,38 @@ ] [[package]] -name = "net2" -version = "0.2.34" +name = "nb-connect" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +checksum = "8123a81538e457d44b933a02faf885d3fe8408806b23fa700e8f01c6c3a98998" dependencies = [ - "cfg-if", "libc", "winapi 0.3.9", ] [[package]] -name = "netstat2" -version = "0.8.1" +name = "net2" +version = "0.2.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29449d242064c48d3057a194b049a2bdcccadda16faa18a91468677b44e8d422" +checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" dependencies = [ - "bitflags", - "byteorder", - "enum-primitive-derive", + "cfg-if 0.1.10", "libc", - "num-traits 0.2.12", - "thiserror", + "winapi 0.3.9", ] [[package]] name = "nft" -version = "2.0.0-rc4" +version = "2.0.0" dependencies = [ - "futures 0.3.5", + "frame-benchmarking", + "frame-benchmarking-cli", + "futures 0.3.6", "jsonrpc-core", "log", "nft-runtime", "pallet-contracts-rpc", + "pallet-transaction-payment-rpc", "parking_lot 0.10.2", "sc-basic-authorship", "sc-cli", @@ -2743,8 +3358,12 @@ "sc-finality-grandpa", "sc-network", "sc-rpc", + "sc-rpc-api", "sc-service", "sc-transaction-pool", + "sp-api", + "sp-block-builder", + "sp-blockchain", "sp-consensus", "sp-consensus-aura", "sp-core", @@ -2754,15 +3373,20 @@ "sp-transaction-pool", "structopt", "substrate-build-script-utils", + "substrate-frame-rpc-system", ] [[package]] name = "nft-runtime" -version = "2.0.0-rc4" +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", @@ -2774,6 +3398,7 @@ "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "serde", "sp-api", @@ -2781,7 +3406,6 @@ "sp-consensus-aura", "sp-core", "sp-inherents", - "sp-io", "sp-offchain", "sp-runtime", "sp-session", @@ -2799,7 +3423,7 @@ dependencies = [ "bitflags", "cc", - "cfg-if", + "cfg-if 0.1.10", "libc", "void", ] @@ -2827,23 +3451,14 @@ ] [[package]] -name = "ntapi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] name = "num-bigint" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-integer", - "num-traits 0.2.12", + "num-traits", ] [[package]] @@ -2852,8 +3467,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" dependencies = [ - "autocfg 1.0.0", - "num-traits 0.2.12", + "autocfg 1.0.1", + "num-traits", ] [[package]] @@ -2862,8 +3477,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" dependencies = [ - "autocfg 1.0.0", - "num-traits 0.2.12", + "autocfg 1.0.1", + "num-traits", ] [[package]] @@ -2872,19 +3487,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-bigint", "num-integer", - "num-traits 0.2.12", -] - -[[package]] -name = "num-traits" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -dependencies = [ - "num-traits 0.2.12", + "num-traits", ] [[package]] @@ -2893,7 +3499,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "libm", ] @@ -2909,17 +3515,43 @@ [[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" + +[[package]] +name = "once_cell" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "532c29a261168a45ce28948f9537ddd7a5dd272cc513b3017b1e82a88f962c37" +dependencies = [ + "parking_lot 0.7.1", +] + +[[package]] name = "once_cell" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" dependencies = [ - "parking_lot 0.10.2", + "parking_lot 0.11.0", ] [[package]] @@ -2951,8 +3583,8 @@ [[package]] name = "pallet-aura" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "frame-system", @@ -2969,9 +3601,24 @@ ] [[package]] +name = "pallet-authorship" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-authorship", + "sp-inherents", + "sp-runtime", + "sp-std", +] + +[[package]] name = "pallet-balances" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-benchmarking", "frame-support", @@ -2984,9 +3631,10 @@ [[package]] name = "pallet-contracts" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ + "bitflags", "frame-support", "frame-system", "pallet-contracts-primitives", @@ -3004,8 +3652,8 @@ [[package]] name = "pallet-contracts-primitives" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -3014,8 +3662,8 @@ [[package]] name = "pallet-contracts-rpc" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -3033,8 +3681,8 @@ [[package]] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -3045,8 +3693,8 @@ [[package]] name = "pallet-finality-tracker" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "frame-system", @@ -3061,11 +3709,13 @@ [[package]] name = "pallet-grandpa" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +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", + "pallet-authorship", "pallet-finality-tracker", "pallet-session", "parity-scale-codec", @@ -3081,11 +3731,13 @@ [[package]] name = "pallet-nft" -version = "2.0.0-rc4" +version = "2.0.0" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "log", + "pallet-contracts", "pallet-transaction-payment", "parity-scale-codec", "serde", @@ -3097,8 +3749,8 @@ [[package]] name = "pallet-randomness-collective-flip" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "frame-system", @@ -3110,8 +3762,8 @@ [[package]] name = "pallet-session" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "frame-system", @@ -3130,8 +3782,8 @@ [[package]] name = "pallet-sudo" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "frame-system", @@ -3144,8 +3796,8 @@ [[package]] name = "pallet-timestamp" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-benchmarking", "frame-support", @@ -3154,6 +3806,7 @@ "parity-scale-codec", "serde", "sp-inherents", + "sp-io", "sp-runtime", "sp-std", "sp-timestamp", @@ -3161,23 +3814,43 @@ [[package]] name = "pallet-transaction-payment" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "frame-system", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "serde", - "smallvec 1.4.1", + "smallvec 1.4.2", + "sp-core", + "sp-io", "sp-runtime", "sp-std", ] [[package]] +name = "pallet-transaction-payment-rpc" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +dependencies = [ + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", + "pallet-transaction-payment-rpc-runtime-api", + "parity-scale-codec", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-rpc", + "sp-runtime", +] + +[[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "frame-support", "parity-scale-codec", @@ -3203,31 +3876,13 @@ [[package]] name = "parity-multiaddr" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f77055f9e81921a8cc7bebeb6cded3d128931d51f1e3dd6251f0770a6d431477" +checksum = "2165a93382a93de55868dcbfa11e4a8f99676a9164eee6a2b4a9479ad319c257" dependencies = [ "arrayref", "bs58", - "byteorder", - "data-encoding", - "parity-multihash", - "percent-encoding 2.1.0", - "serde", - "static_assertions", - "unsigned-varint 0.3.3", - "url 2.1.1", -] - -[[package]] -name = "parity-multiaddr" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc20af3143a62c16e7c9e92ea5c6ae49f7d271d97d4d8fe73afc28f0514a3d0f" -dependencies = [ - "arrayref", - "bs58", - "byteorder", + "byteorder 1.3.4", "data-encoding", "multihash", "percent-encoding 2.1.0", @@ -3235,28 +3890,13 @@ "static_assertions", "unsigned-varint 0.4.0", "url 2.1.1", -] - -[[package]] -name = "parity-multihash" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a1cd2ba02391b81367bec529fb209019d718684fdc8ad6a712c2b536e46f775" -dependencies = [ - "blake2 0.8.1", - "bytes 0.5.6", - "rand 0.7.3", - "sha-1", - "sha2 0.8.2", - "sha3", - "unsigned-varint 0.3.3", ] [[package]] name = "parity-scale-codec" -version = "1.3.1" +version = "1.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74f02beb35d47e0706155c9eac554b50c671e0d868fe8296bcdf44a9a4847bf" +checksum = "7c740e5fbcb6847058b40ac7e5574766c6388f585e184d769910fe0d3a2ca861" dependencies = [ "arrayvec 0.5.1", "bitvec", @@ -3267,14 +3907,14 @@ [[package]] name = "parity-scale-codec-derive" -version = "1.2.0" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" +checksum = "198db82bb1c18fc00176004462dd809b2a6d851669550aa17af6dacd21ae0c14" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] @@ -3290,7 +3930,7 @@ checksum = "1e57fea504fea33f9fbb5f49f378359030e7e026a6ab849bb9e8f0787376f1bf" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "libc", "log", "mio-named-pipes", @@ -3304,16 +3944,17 @@ [[package]] name = "parity-util-mem" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6e2583649a3ca84894d1d71da249abcfda54d5aca24733d72ca10d0f02361c" +checksum = "297ff91fa36aec49ce183484b102f6b75b46776822bd81525bfc4cc9b0dd0f5c" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", + "hashbrown 0.8.2", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot 0.10.2", "primitive-types", - "smallvec 1.4.1", + "smallvec 1.4.2", "winapi 0.3.9", ] @@ -3324,7 +3965,7 @@ checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" dependencies = [ "proc-macro2", - "syn 1.0.34", + "syn", "synstructure", ] @@ -3335,12 +3976,46 @@ checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" [[package]] +name = "parity-ws" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e02a625dd75084c2a7024f07c575b61b782f729d18702dabb3cdbf31911dc61" +dependencies = [ + "byteorder 1.3.4", + "bytes 0.4.12", + "httparse", + "log", + "mio", + "mio-extras", + "rand 0.7.3", + "sha-1 0.8.2", + "slab", + "url 2.1.1", +] + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "parking_lot" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +dependencies = [ + "lock_api 0.1.5", + "parking_lot_core 0.4.0", +] + +[[package]] name = "parking_lot" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" dependencies = [ - "lock_api", + "lock_api 0.3.4", "parking_lot_core 0.6.2", "rustc_version", ] @@ -3351,18 +4026,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ - "lock_api", + "lock_api 0.3.4", "parking_lot_core 0.7.2", ] [[package]] +name = "parking_lot" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" +dependencies = [ + "instant", + "lock_api 0.4.1", + "parking_lot_core 0.8.0", +] + +[[package]] name = "parking_lot_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +dependencies = [ + "libc", + "rand 0.6.5", + "rustc_version", + "smallvec 0.6.13", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" dependencies = [ - "cfg-if", - "cloudabi", + "cfg-if 0.1.10", + "cloudabi 0.0.3", "libc", "redox_syscall", "rustc_version", @@ -3376,11 +4075,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ - "cfg-if", - "cloudabi", + "cfg-if 0.1.10", + "cloudabi 0.0.3", + "libc", + "redox_syscall", + "smallvec 1.4.2", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi 0.1.0", + "instant", "libc", "redox_syscall", - "smallvec 1.4.1", + "smallvec 1.4.2", "winapi 0.3.9", ] @@ -3409,8 +4123,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" dependencies = [ - "byteorder", + "byteorder 1.3.4", "crypto-mac 0.7.0", + "rayon", ] [[package]] @@ -3443,29 +4158,29 @@ [[package]] name = "pin-project" -version = "0.4.22" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" +checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.22" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" +checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "pin-project-lite" -version = "0.1.7" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" +checksum = "e555d9e657502182ac97b539fb3dae8b79cda19e3e4f8ffb5e8de4f18df93c95" [[package]] name = "pin-utils" @@ -3475,9 +4190,9 @@ [[package]] name = "pkg-config" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platforms" @@ -3486,29 +4201,42 @@ checksum = "feb3b2b1033b8a60b4da6ee470325f887758c95d5320f52f9ce0df055a55940e" [[package]] +name = "polling" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab773feb154f12c49ffcfd66ab8bdcf9a1843f950db48b0d8be9d4393783b058" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "log", + "wepoll-sys", + "winapi 0.3.9", +] + +[[package]] name = "poly1305" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b42192ab143ed7619bf888a7f9c6733a9a2153b218e2cd557cfdb52fbf9bb1" +checksum = "22ce46de8e53ee414ca4d02bfefac75d8c12fba948b76622a40b4be34dfce980" dependencies = [ "universal-hash", ] [[package]] name = "polyval" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9a50142b55ab3ed0e9f68dfb3709f1d90d29da24e91033f28b96330643107dc" +checksum = "a5884790f1ce3553ad55fec37b5aaac5882e0e845a2612df744d6c85c9bf046c" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "universal-hash", ] [[package]] name = "ppv-lite86" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" +checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" [[package]] name = "primitive-types" @@ -3518,7 +4246,7 @@ dependencies = [ "fixed-hash", "impl-codec", - "impl-serde 0.3.1", + "impl-serde", "uint", ] @@ -3533,35 +4261,33 @@ [[package]] name = "proc-macro-error" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", "version_check", ] [[package]] name = "proc-macro-error-attr" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", - "syn-mid", + "quote", "version_check", ] [[package]] name = "proc-macro-hack" -version = "0.5.16" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" +checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" [[package]] name = "proc-macro-nested" @@ -3571,39 +4297,24 @@ [[package]] name = "proc-macro2" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" -dependencies = [ - "unicode-xid 0.2.1", -] - -[[package]] -name = "procfs" -version = "0.7.9" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c434e93ef69c216e68e4f417c927b4f31502c3560b72cfdb6827e2321c5c6b3e" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "bitflags", - "byteorder", - "chrono", - "hex", - "lazy_static", - "libc", - "libflate", + "unicode-xid", ] [[package]] name = "prometheus" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0575e258dab62268e7236d7307caa38848acbda7ec7ab87bd9093791e999d20" +checksum = "30d70cf4412832bcac9cffe27906f4a66e450d323525e977168c70d1b36120ae" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "fnv", "lazy_static", - "protobuf", - "spin", + "parking_lot 0.11.0", + "regex", "thiserror", ] @@ -3644,8 +4355,8 @@ "anyhow", "itertools 0.8.2", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] @@ -3657,20 +4368,14 @@ "bytes 0.5.6", "prost", ] - -[[package]] -name = "protobuf" -version = "2.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d883f78645c21b7281d21305181aa1f4dd9e9363e7cf2566c93121552cff003e" [[package]] name = "pwasm-utils" -version = "0.12.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" +checksum = "0f53bc2558e8376358ebdc28301546471d67336584f6438ed4b7c7457a055fd7" dependencies = [ - "byteorder", + "byteorder 1.3.4", "log", "parity-wasm", ] @@ -3694,12 +4399,6 @@ [[package]] name = "quote" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" - -[[package]] -name = "quote" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" @@ -3742,7 +4441,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi", + "cloudabi 0.0.3", "fuchsia-cprng", "libc", "rand_core 0.3.1", @@ -3774,7 +4473,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.15", "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", @@ -3823,7 +4522,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.15", ] [[package]] @@ -3870,7 +4569,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" dependencies = [ - "cloudabi", + "cloudabi 0.0.3", "fuchsia-cprng", "libc", "rand_core 0.4.2", @@ -3907,6 +4606,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" @@ -3914,11 +4624,11 @@ [[package]] name = "rayon" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080" +checksum = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "crossbeam-deque", "either", "rayon-core", @@ -3926,12 +4636,12 @@ [[package]] name = "rayon-core" -version = "1.7.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" +checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf" dependencies = [ + "crossbeam-channel", "crossbeam-deque", - "crossbeam-queue", "crossbeam-utils", "lazy_static", "num_cpus", @@ -3954,11 +4664,11 @@ [[package]] name = "redox_users" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" +checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" dependencies = [ - "getrandom", + "getrandom 0.1.15", "redox_syscall", "rust-argon2", ] @@ -3979,15 +4689,26 @@ checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", +] + +[[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.3.9" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +checksum = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" dependencies = [ "aho-corasick", "memchr", @@ -3996,40 +4717,47 @@ ] [[package]] +name = "regex-automata" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +dependencies = [ + "byteorder 1.3.4", + "regex-syntax", +] + +[[package]] name = "regex-syntax" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "region" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" dependencies = [ + "bitflags", + "libc", + "mach", "winapi 0.3.9", ] [[package]] -name = "rental" -version = "0.5.5" +name = "remove_dir_all" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8545debe98b2b139fb04cad8618b530e9b07c152d99a5de83c860b877d67847f" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "rental-impl", - "stable_deref_trait", + "winapi 0.3.9", ] [[package]] -name = "rental-impl" -version = "0.5.5" +name = "retain_mut" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de" -dependencies = [ - "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", -] +checksum = "e005d658ad26eacc2b6c506dfde519f4e277e328d0eb3379ca61647d70a8f531" [[package]] name = "ring" @@ -4039,7 +4767,7 @@ dependencies = [ "cc", "libc", - "once_cell", + "once_cell 1.4.1", "spin", "untrusted", "web-sys", @@ -4047,16 +4775,10 @@ ] [[package]] -name = "rle-decode-fast" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" - -[[package]] name = "rocksdb" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61aa17a99a2413cd71c1106691bf59dad7de0cd5099127f90e9d99c429c40d4a" +checksum = "23d83c02c429044d58474eaf5ae31e062d0de894e21125b47437ec0edc1397e6" dependencies = [ "libc", "librocksdb-sys", @@ -4074,11 +4796,11 @@ [[package]] name = "rust-argon2" -version = "0.7.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" +checksum = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19" dependencies = [ - "base64", + "base64 0.12.3", "blake2b_simd", "constant_time_eq", "crossbeam-utils", @@ -4086,9 +4808,9 @@ [[package]] name = "rustc-demangle" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +checksum = "b2610b7f643d18c87dff3b489950269617e6601a51f1f05aa5daefee36f64f0b" [[package]] name = "rustc-hash" @@ -4113,11 +4835,11 @@ [[package]] name = "rustls" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1" +checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" dependencies = [ - "base64", + "base64 0.12.3", "log", "ring", "sct", @@ -4126,9 +4848,9 @@ [[package]] name = "rustls-native-certs" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75ffeb84a6bd9d014713119542ce415db3a3e4748f0bfce1e1416cd224a23a5" +checksum = "629d439a7672da82dd955498445e496ee2096fe2117b9f796558a43fdb9e59b8" dependencies = [ "openssl-probe", "rustls", @@ -4142,7 +4864,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "pin-project", "static_assertions", ] @@ -4163,11 +4885,31 @@ ] [[package]] +name = "salsa20" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2324b0e8c3bb9a586a571fdb3136f70e7e2c748de00a78043f86e0cff91f91fe" +dependencies = [ + "byteorder 1.3.4", + "salsa20-core", + "stream-cipher 0.3.2", +] + +[[package]] +name = "salsa20-core" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fe6cc1b9f5a5867853ade63099de70f042f7679e408d1ffe52821c9248e6e69" +dependencies = [ + "stream-cipher 0.3.2", +] + +[[package]] name = "sc-basic-authorship" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -4188,8 +4930,8 @@ [[package]] name = "sc-block-builder" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -4198,16 +4940,18 @@ "sp-blockchain", "sp-consensus", "sp-core", + "sp-inherents", "sp-runtime", "sp-state-machine", ] [[package]] name = "sc-chain-spec" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "impl-trait-for-tuples", + "parity-scale-codec", "sc-chain-spec-derive", "sc-network", "sc-telemetry", @@ -4220,40 +4964,46 @@ [[package]] name = "sc-chain-spec-derive" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "sc-cli" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "ansi_term 0.12.1", "atty", + "bip39", "chrono", "derive_more", - "env_logger", "fdlimit", - "futures 0.3.5", + "futures 0.3.6", + "hex", "lazy_static", + "libp2p", "log", "names", "nix", + "parity-scale-codec", "parity-util-mem", + "rand 0.7.3", "regex", "rpassword", "sc-client-api", "sc-informant", + "sc-keystore", "sc-network", "sc-service", "sc-telemetry", "sc-tracing", + "serde", "serde_json", "sp-blockchain", "sp-core", @@ -4266,17 +5016,20 @@ "structopt", "substrate-prometheus-endpoint", "time", - "tokio 0.2.21", + "tokio 0.2.22", + "tracing", + "tracing-log", + "tracing-subscriber", ] [[package]] name = "sc-client-api" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", "fnv", - "futures 0.3.5", + "futures 0.3.6", "hash-db", "hex-literal", "kvdb", @@ -4307,8 +5060,8 @@ [[package]] name = "sc-client-db" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "blake2-rfc", "hash-db", @@ -4324,6 +5077,7 @@ "sc-client-api", "sc-executor", "sc-state-db", + "sp-arithmetic", "sp-blockchain", "sp-consensus", "sp-core", @@ -4336,8 +5090,8 @@ [[package]] name = "sc-consensus" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "sc-client-api", "sp-blockchain", @@ -4347,11 +5101,11 @@ [[package]] name = "sc-consensus-aura" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -4378,10 +5132,10 @@ [[package]] name = "sc-consensus-slots" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -4392,6 +5146,7 @@ "sp-application-crypto", "sp-blockchain", "sp-consensus", + "sp-consensus-slots", "sp-core", "sp-inherents", "sp-runtime", @@ -4400,8 +5155,8 @@ [[package]] name = "sc-executor" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", "lazy_static", @@ -4412,6 +5167,7 @@ "parking_lot 0.10.2", "sc-executor-common", "sc-executor-wasmi", + "sc-executor-wasmtime", "sp-api", "sp-core", "sp-externalities", @@ -4427,8 +5183,8 @@ [[package]] name = "sc-executor-common" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", "log", @@ -4444,8 +5200,8 @@ [[package]] name = "sc-executor-wasmi" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "log", "parity-scale-codec", @@ -4458,15 +5214,32 @@ ] [[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-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "assert_matches", "derive_more", "finality-grandpa", "fork-tree", - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -4497,14 +5270,13 @@ [[package]] name = "sc-informant" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "ansi_term 0.12.1", - "futures 0.3.5", + "futures 0.3.6", "log", "parity-util-mem", - "parking_lot 0.10.2", "sc-client-api", "sc-network", "sp-blockchain", @@ -4516,8 +5288,8 @@ [[package]] name = "sc-keystore" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", "hex", @@ -4527,13 +5299,13 @@ "serde_json", "sp-application-crypto", "sp-core", - "subtle 2.2.3", + "subtle 2.3.0", ] [[package]] name = "sc-light" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "hash-db", "lazy_static", @@ -4551,9 +5323,11 @@ [[package]] name = "sc-network" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ + "async-std", + "async-trait", "bitflags", "bs58", "bytes 0.5.6", @@ -4562,16 +5336,16 @@ "erased-serde", "fnv", "fork-tree", - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", - "futures_codec 0.3.4", + "futures_codec", "hex", "ip_network", "libp2p", "linked-hash-map", "linked_hash_set", "log", - "lru", + "lru 0.4.3", "nohash-hasher", "parity-scale-codec", "parking_lot 0.10.2", @@ -4595,7 +5369,7 @@ "sp-utils", "substrate-prometheus-endpoint", "thiserror", - "unsigned-varint 0.3.3", + "unsigned-varint 0.4.0", "void", "wasm-timer", "zeroize", @@ -4603,14 +5377,14 @@ [[package]] name = "sc-network-gossip" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", "libp2p", "log", - "lru", + "lru 0.4.3", "sc-network", "sp-runtime", "wasm-timer", @@ -4618,14 +5392,14 @@ [[package]] name = "sc-offchain" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "bytes 0.5.6", "fnv", - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", - "hyper 0.13.7", + "hyper 0.13.8", "hyper-rustls", "log", "num_cpus", @@ -4645,10 +5419,10 @@ [[package]] name = "sc-peerset" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "libp2p", "log", "serde_json", @@ -4658,8 +5432,8 @@ [[package]] name = "sc-proposer-metrics" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -4667,10 +5441,10 @@ [[package]] name = "sc-rpc" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", @@ -4699,11 +5473,11 @@ [[package]] name = "sc-rpc-api" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.6", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -4723,9 +5497,10 @@ [[package]] name = "sc-rpc-server" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ + "futures 0.1.30", "jsonrpc-core", "jsonrpc-http-server", "jsonrpc-ipc-server", @@ -4735,30 +5510,29 @@ "serde", "serde_json", "sp-runtime", + "substrate-prometheus-endpoint", ] [[package]] name = "sc-service" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", "directories", "exit-future", - "futures 0.1.29", - "futures 0.3.5", + "futures 0.1.30", + "futures 0.3.6", "futures-timer 3.0.2", "hash-db", + "jsonrpc-core", "jsonrpc-pubsub", "lazy_static", "log", - "netstat2", - "parity-multiaddr 0.7.3", "parity-scale-codec", "parity-util-mem", "parking_lot 0.10.2", "pin-project", - "procfs", "rand 0.7.3", "sc-block-builder", "sc-chain-spec", @@ -4785,16 +5559,17 @@ "sp-consensus", "sp-core", "sp-externalities", + "sp-inherents", "sp-io", "sp-runtime", "sp-session", "sp-state-machine", + "sp-tracing", "sp-transaction-pool", "sp-trie", "sp-utils", "sp-version", "substrate-prometheus-endpoint", - "sysinfo", "tempfile", "tracing", "wasm-timer", @@ -4802,8 +5577,8 @@ [[package]] name = "sc-state-db" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "log", "parity-scale-codec", @@ -4816,11 +5591,10 @@ [[package]] name = "sc-telemetry" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "bytes 0.5.6", - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", "libp2p", "log", @@ -4838,8 +5612,8 @@ [[package]] name = "sc-tracing" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "erased-serde", "log", @@ -4850,20 +5624,23 @@ "serde_json", "slog", "sp-tracing", + "tracing", "tracing-core", + "tracing-subscriber", ] [[package]] name = "sc-transaction-graph" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.6", "linked-hash-map", "log", "parity-util-mem", "parking_lot 0.10.2", + "retain_mut", "serde", "sp-blockchain", "sp-core", @@ -4875,11 +5652,11 @@ [[package]] name = "sc-transaction-pool" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.6", "futures-diagnose", "intervalier", "log", @@ -4917,23 +5694,55 @@ dependencies = [ "arrayref", "arrayvec 0.5.1", - "curve25519-dalek", - "getrandom", + "curve25519-dalek 2.1.0", + "getrandom 0.1.15", "merlin", "rand 0.7.3", "rand_core 0.5.1", "sha2 0.8.2", - "subtle 2.2.3", + "subtle 2.3.0", "zeroize", ] [[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" +checksum = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" + +[[package]] +name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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" @@ -4944,10 +5753,19 @@ ] [[package]] +name = "secrecy" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9182278ed645df3477a9c27bfee0621c621aa16f6972635f7f795dae3d81070f" +dependencies = [ + "zeroize", +] + +[[package]] name = "security-framework" -version = "0.4.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" +checksum = "ad502866817f0575705bd7be36e2b2535cc33262d493aa733a2ec862baa2bc2b" dependencies = [ "bitflags", "core-foundation", @@ -4958,9 +5776,9 @@ [[package]] name = "security-framework-sys" -version = "0.4.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" +checksum = "51ceb04988b17b6d1dcd555390fa822ca5637b4a14e1f5099f13d351bed4d6c7" dependencies = [ "core-foundation-sys", "libc", @@ -4980,38 +5798,32 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "send_wrapper" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0eddf2e8f50ced781f288c19f18621fa72a3779e3cb58dbf23b07469b0abeb4" [[package]] name = "serde" -version = "1.0.114" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" +checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.114" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" +checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "serde_json" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" +checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" dependencies = [ "itoa", "ryu", @@ -5031,10 +5843,17 @@ ] [[package]] -name = "sha1" -version = "0.6.0" +name = "sha-1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 0.1.10", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", +] [[package]] name = "sha2" @@ -5055,7 +5874,7 @@ checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" dependencies = [ "block-buffer 0.9.0", - "cfg-if", + "cfg-if 0.1.10", "cpuid-bool", "digest 0.9.0", "opaque-debug 0.3.0", @@ -5075,6 +5894,27 @@ ] [[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sharded-slab" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" +dependencies = [ + "lazy_static", +] + +[[package]] name = "shlex" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5082,15 +5922,21 @@ [[package]] name = "signal-hook-registry" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" dependencies = [ "arc-swap", "libc", ] [[package]] +name = "signature" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" + +[[package]] name = "slab" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5136,8 +5982,8 @@ checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] @@ -5151,35 +5997,35 @@ [[package]] name = "smallvec" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" +checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "snow" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32bf8474159a95551661246cda4976e89356999e3cbfef36f493dacc3fae1e8e" +checksum = "795dd7aeeee24468e5a32661f6d27f7b5cbed802031b2d7640c7b10f8fb2dd50" dependencies = [ "aes-gcm", - "blake2 0.9.0", + "blake2", "chacha20poly1305", "rand 0.7.3", "rand_core 0.5.1", "ring", "rustc_version", "sha2 0.9.1", - "subtle 2.2.3", - "x25519-dalek", + "subtle 2.3.0", + "x25519-dalek 1.1.0", ] [[package]] name = "socket2" -version = "0.3.12" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "redox_syscall", "winapi 0.3.9", @@ -5187,28 +6033,24 @@ [[package]] name = "soketto" -version = "0.3.2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9dab3f95c9ebdf3a88268c19af668f637a3c5039c2c56ff2d40b1b2d64a25b" +checksum = "b5c71ed3d54db0a699f4948e1bb3e45b450fa31fe602621dee6680361d569c88" dependencies = [ - "base64", + "base64 0.12.3", "bytes 0.5.6", "flate2", - "futures 0.3.5", - "http 0.2.1", + "futures 0.3.6", "httparse", "log", "rand 0.7.3", - "sha1", - "smallvec 1.4.1", - "static_assertions", - "thiserror", + "sha-1 0.9.1", ] [[package]] name = "sp-allocator" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", "log", @@ -5219,8 +6061,8 @@ [[package]] name = "sp-api" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "hash-db", "parity-scale-codec", @@ -5234,20 +6076,20 @@ [[package]] name = "sp-api-proc-macro" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "blake2-rfc", "proc-macro-crate", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "sp-application-crypto" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "serde", @@ -5258,11 +6100,11 @@ [[package]] name = "sp-arithmetic" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "integer-sqrt", - "num-traits 0.2.12", + "num-traits", "parity-scale-codec", "serde", "sp-debug-derive", @@ -5270,9 +6112,20 @@ ] [[package]] +name = "sp-authorship" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +dependencies = [ + "parity-scale-codec", + "sp-inherents", + "sp-runtime", + "sp-std", +] + +[[package]] name = "sp-block-builder" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "sp-api", @@ -5283,24 +6136,25 @@ [[package]] name = "sp-blockchain" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", "log", - "lru", + "lru 0.4.3", "parity-scale-codec", "parking_lot 0.10.2", "sp-block-builder", "sp-consensus", + "sp-database", "sp-runtime", "sp-state-machine", ] [[package]] name = "sp-chain-spec" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "serde", "serde_json", @@ -5308,22 +6162,24 @@ [[package]] name = "sp-consensus" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.6", "futures-timer 3.0.2", "libp2p", "log", "parity-scale-codec", "parking_lot 0.10.2", "serde", + "sp-api", "sp-core", "sp-inherents", "sp-runtime", "sp-state-machine", "sp-std", + "sp-trie", "sp-utils", "sp-version", "substrate-prometheus-endpoint", @@ -5332,8 +6188,8 @@ [[package]] name = "sp-consensus-aura" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "sp-api", @@ -5345,25 +6201,35 @@ ] [[package]] +name = "sp-consensus-slots" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +dependencies = [ + "parity-scale-codec", + "sp-runtime", +] + +[[package]] name = "sp-core" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "base58", "blake2-rfc", - "byteorder", + "byteorder 1.3.4", "derive_more", + "dyn-clonable", "ed25519-dalek", - "futures 0.3.5", + "futures 0.3.6", "hash-db", "hash256-std-hasher", "hex", - "impl-serde 0.3.1", + "impl-serde", "lazy_static", "libsecp256k1", "log", "merlin", - "num-traits 0.2.12", + "num-traits", "parity-scale-codec", "parity-util-mem", "parking_lot 0.10.2", @@ -5371,6 +6237,7 @@ "rand 0.7.3", "regex", "schnorrkel", + "secrecy", "serde", "sha2 0.8.2", "sp-debug-derive", @@ -5388,8 +6255,8 @@ [[package]] name = "sp-database" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -5397,18 +6264,18 @@ [[package]] name = "sp-debug-derive" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "sp-externalities" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "environmental", "parity-scale-codec", @@ -5418,8 +6285,8 @@ [[package]] name = "sp-finality-grandpa" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "finality-grandpa", "log", @@ -5434,8 +6301,8 @@ [[package]] name = "sp-finality-tracker" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -5444,8 +6311,8 @@ [[package]] name = "sp-inherents" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", "parity-scale-codec", @@ -5456,10 +6323,10 @@ [[package]] name = "sp-io" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "hash-db", "libsecp256k1", "log", @@ -5473,12 +6340,14 @@ "sp-tracing", "sp-trie", "sp-wasm-interface", + "tracing", + "tracing-core", ] [[package]] name = "sp-keyring" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "lazy_static", "sp-core", @@ -5488,8 +6357,8 @@ [[package]] name = "sp-offchain" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "sp-api", "sp-core", @@ -5498,8 +6367,8 @@ [[package]] name = "sp-panic-handler" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "backtrace", "log", @@ -5507,8 +6376,8 @@ [[package]] name = "sp-rpc" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "serde", "sp-core", @@ -5516,8 +6385,8 @@ [[package]] name = "sp-runtime" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "either", "hash256-std-hasher", @@ -5538,14 +6407,15 @@ [[package]] name = "sp-runtime-interface" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "primitive-types", "sp-externalities", "sp-runtime-interface-proc-macro", "sp-std", + "sp-storage", "sp-tracing", "sp-wasm-interface", "static_assertions", @@ -5553,20 +6423,20 @@ [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "sp-sandbox" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "sp-core", @@ -5578,8 +6448,8 @@ [[package]] name = "sp-serializer" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "serde", "serde_json", @@ -5587,8 +6457,8 @@ [[package]] name = "sp-session" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "sp-api", @@ -5600,8 +6470,8 @@ [[package]] name = "sp-staking" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -5610,20 +6480,20 @@ [[package]] name = "sp-state-machine" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "hash-db", - "itertools 0.9.0", "log", - "num-traits 0.2.12", + "num-traits", "parity-scale-codec", "parking_lot 0.10.2", "rand 0.7.3", - "smallvec 1.4.1", + "smallvec 1.4.2", "sp-core", "sp-externalities", "sp-panic-handler", + "sp-std", "sp-trie", "trie-db", "trie-root", @@ -5631,15 +6501,16 @@ [[package]] name = "sp-std" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" [[package]] name = "sp-storage" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "impl-serde 0.2.3", + "impl-serde", + "parity-scale-codec", "ref-cast", "serde", "sp-debug-derive", @@ -5648,8 +6519,8 @@ [[package]] name = "sp-timestamp" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5662,34 +6533,36 @@ [[package]] name = "sp-tracing" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "log", - "rental", + "parity-scale-codec", + "sp-std", "tracing", + "tracing-core", + "tracing-subscriber", ] [[package]] name = "sp-transaction-pool" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "derive_more", - "futures 0.3.5", + "futures 0.3.6", "log", "parity-scale-codec", "serde", "sp-api", "sp-blockchain", "sp-runtime", - "sp-utils", ] [[package]] name = "sp-trie" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "hash-db", "memory-db", @@ -5702,10 +6575,10 @@ [[package]] name = "sp-utils" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "futures-core", "futures-timer 3.0.2", "lazy_static", @@ -5714,10 +6587,10 @@ [[package]] name = "sp-version" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ - "impl-serde 0.2.3", + "impl-serde", "parity-scale-codec", "serde", "sp-runtime", @@ -5726,8 +6599,8 @@ [[package]] name = "sp-wasm-interface" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5764,14 +6637,24 @@ [[package]] name = "stream-cipher" -version = "0.4.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f8ed9974042b8c3672ff3030a69fcc03b74c47c3d1ecb7755e8a3626011e88" +checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" dependencies = [ - "generic-array 0.14.3", + "generic-array 0.12.3", ] [[package]] +name = "stream-cipher" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c80e15f898d8d8f25db24c253ea615cc14acf418ff307822995814e7d42cfa89" +dependencies = [ + "block-cipher", + "generic-array 0.14.4", +] + +[[package]] name = "string" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5788,9 +6671,9 @@ [[package]] name = "structopt" -version = "0.3.15" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de2f5e239ee807089b62adce73e48c625e0ed80df02c7ab3f068f5db5281065c" +checksum = "126d630294ec449fae0b16f964e35bf3c74f940da9dca17ee9b905f7b3112eb8" dependencies = [ "clap", "lazy_static", @@ -5799,15 +6682,15 @@ [[package]] name = "structopt-derive" -version = "0.4.8" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "510413f9de616762a4fbeab62509bf15c729603b72d7cd71280fbca431b1c118" +checksum = "65e51c492f9e23a220534971ff5afc14037289de430e3c83f9daf6a1b6ae91e8" dependencies = [ "heck", "proc-macro-error", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] @@ -5827,48 +6710,73 @@ dependencies = [ "heck", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "substrate-bip39" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c004e8166d6e0aa3a9d5fa673e5b7098ff25f930de1013a21341988151e681bb" +checksum = "bed6646a0159b9935b5d045611560eeef842b78d7adc3ba36f5ca325a13a0236" dependencies = [ "hmac", "pbkdf2", "schnorrkel", "sha2 0.8.2", + "zeroize", ] [[package]] name = "substrate-build-script-utils" -version = "2.0.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "platforms", ] [[package]] +name = "substrate-frame-rpc-system" +version = "2.0.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" +dependencies = [ + "frame-system-rpc-runtime-api", + "futures 0.3.6", + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-rpc-api", + "serde", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-core", + "sp-runtime", + "sp-transaction-pool", +] + +[[package]] name = "substrate-prometheus-endpoint" -version = "0.8.0-rc4" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +version = "0.8.0" +source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca" dependencies = [ "async-std", "derive_more", "futures-util", - "hyper 0.13.7", + "hyper 0.13.8", "log", "prometheus", - "tokio 0.2.21", + "tokio 0.2.22", ] [[package]] name = "substrate-wasm-builder-runner" version = "1.0.6" -source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a965994514ab35d3893e9260245f2947fd1981cdd4fffd2c6e6d1a9ce02e6a" [[package]] name = "subtle" @@ -5878,50 +6786,19 @@ [[package]] name = "subtle" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" - -[[package]] -name = "syn" -version = "0.11.11" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -dependencies = [ - "quote 0.3.15", - "synom", - "unicode-xid 0.0.4", -] +checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" [[package]] name = "syn" -version = "1.0.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b" -dependencies = [ - "proc-macro2", - "quote 1.0.7", - "unicode-xid 0.2.1", -] - -[[package]] -name = "syn-mid" -version = "0.5.0" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" +checksum = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", -] - -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -dependencies = [ - "unicode-xid 0.0.4", + "quote", + "unicode-xid", ] [[package]] @@ -5931,31 +6808,22 @@ checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", - "unicode-xid 0.2.1", + "quote", + "syn", + "unicode-xid", ] [[package]] -name = "sysinfo" -version = "0.13.4" +name = "take_mut" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac193374347e7c263c5f547524f36ff8ec6702d56c8799c8331d26dffe8c1e" -dependencies = [ - "cfg-if", - "doc-comment", - "libc", - "ntapi", - "once_cell", - "rayon", - "winapi 0.3.9", -] +checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" [[package]] -name = "take_mut" -version = "0.2.2" +name = "target-lexicon" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" [[package]] name = "tempfile" @@ -5963,7 +6831,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "rand 0.7.3", "redox_syscall", @@ -5991,22 +6859,22 @@ [[package]] name = "thiserror" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" +checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" +checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] @@ -6029,11 +6897,12 @@ [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi 0.3.9", ] @@ -6045,7 +6914,7 @@ dependencies = [ "failure", "hmac", - "once_cell", + "once_cell 1.4.1", "pbkdf2", "rand 0.7.3", "rustc-hash", @@ -6064,9 +6933,9 @@ [[package]] name = "tinyvec" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" +checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" [[package]] name = "tokio" @@ -6075,7 +6944,7 @@ checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "mio", "num_cpus", "tokio-codec", @@ -6094,9 +6963,9 @@ [[package]] name = "tokio" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" dependencies = [ "bytes 0.5.6", "fnv", @@ -6122,7 +6991,7 @@ dependencies = [ "bytes 0.4.12", "either", - "futures 0.1.29", + "futures 0.1.30", ] [[package]] @@ -6132,7 +7001,7 @@ checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "tokio-io", ] @@ -6142,7 +7011,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" dependencies = [ - "futures 0.1.29", + "futures 0.1.30", "tokio-executor 0.1.10", ] @@ -6153,7 +7022,7 @@ checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" dependencies = [ "crossbeam-utils", - "futures 0.1.29", + "futures 0.1.30", ] [[package]] @@ -6173,7 +7042,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" dependencies = [ - "futures 0.1.29", + "futures 0.1.30", "tokio-io", "tokio-threadpool", ] @@ -6185,7 +7054,7 @@ checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "log", ] @@ -6196,7 +7065,7 @@ checksum = "9d282d483052288b2308ba5ee795f5673b159c9bdf63c385a05609da782a5eae" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "mio", "mio-named-pipes", "tokio 0.1.22", @@ -6209,7 +7078,7 @@ checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" dependencies = [ "crossbeam-utils", - "futures 0.1.29", + "futures 0.1.30", "lazy_static", "log", "mio", @@ -6223,13 +7092,13 @@ [[package]] name = "tokio-rustls" -version = "0.13.1" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15cb62a0d2770787abc96e99c1cd98fcf17f94959f3af63ca85bdfb203f051b4" +checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a" dependencies = [ "futures-core", "rustls", - "tokio 0.2.21", + "tokio 0.2.22", "webpki", ] @@ -6239,7 +7108,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162" dependencies = [ - "futures 0.1.29", + "futures 0.1.30", ] [[package]] @@ -6249,7 +7118,7 @@ checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" dependencies = [ "fnv", - "futures 0.1.29", + "futures 0.1.30", ] [[package]] @@ -6270,7 +7139,7 @@ checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "iovec", "mio", "tokio-io", @@ -6286,7 +7155,7 @@ "crossbeam-deque", "crossbeam-queue", "crossbeam-utils", - "futures 0.1.29", + "futures 0.1.30", "lazy_static", "log", "num_cpus", @@ -6301,7 +7170,7 @@ checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" dependencies = [ "crossbeam-utils", - "futures 0.1.29", + "futures 0.1.30", "slab", "tokio-executor 0.1.10", ] @@ -6313,7 +7182,7 @@ checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "log", "mio", "tokio-codec", @@ -6328,7 +7197,7 @@ checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" dependencies = [ "bytes 0.4.12", - "futures 0.1.29", + "futures 0.1.30", "iovec", "libc", "log", @@ -6350,14 +7219,14 @@ "futures-sink", "log", "pin-project-lite", - "tokio 0.2.21", + "tokio 0.2.22", ] [[package]] name = "toml" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" +checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" dependencies = [ "serde", ] @@ -6370,47 +7239,91 @@ [[package]] name = "tracing" -version = "0.1.16" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" +checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "log", + "pin-project-lite", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" +checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", ] [[package]] name = "tracing-core" -version = "0.1.11" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f" +checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" dependencies = [ "lazy_static", ] [[package]] +name = "tracing-log" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef0a5e15477aa303afbfac3a44cba9b6430fdaad52423b1e6c0dbbe28c3eedd" +dependencies = [ + "ansi_term 0.12.1", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec 1.4.2", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] name = "trie-db" -version = "0.21.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb230c24c741993b04cfccbabb45acff6f6480c5f00d3ed8794ea43db3a9d727" +checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0" dependencies = [ "hash-db", - "hashbrown 0.6.3", + "hashbrown 0.8.2", "log", "rustc-hex", - "smallvec 1.4.1", + "smallvec 1.4.2", ] [[package]] @@ -6430,11 +7343,13 @@ [[package]] name = "twox-hash" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bfd5b7557925ce778ff9b9ef90e3ade34c524b5ff10e239c69a42d546d2af56" +checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" dependencies = [ + "cfg-if 0.1.10", "rand 0.7.3", + "static_assertions", ] [[package]] @@ -6445,11 +7360,11 @@ [[package]] name = "uint" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" +checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" dependencies = [ - "byteorder", + "byteorder 1.3.4", "crunchy", "rustc-hex", "static_assertions", @@ -6493,12 +7408,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" @@ -6512,30 +7421,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" dependencies = [ - "generic-array 0.14.3", - "subtle 2.2.3", + "generic-array 0.14.4", + "subtle 2.3.0", ] [[package]] name = "unsigned-varint" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f67332660eb59a6f1eb24ff1220c9e8d01738a8503c6002e30bcfe4bd9f2b4a9" +checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5" dependencies = [ "bytes 0.5.6", "futures-io", "futures-util", - "futures_codec 0.3.4", + "futures_codec", ] [[package]] name = "unsigned-varint" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5" +checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35" dependencies = [ - "bytes 0.5.6", - "futures_codec 0.4.1", + "futures-io", + "futures-util", ] [[package]] @@ -6573,6 +7482,12 @@ checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" [[package]] +name = "vec-arena" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d" + +[[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6591,12 +7506,18 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] name = "want" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" dependencies = [ - "futures 0.1.29", + "futures 0.1.30", "log", "try-lock", ] @@ -6618,37 +7539,43 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] name = "wasm-bindgen" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3edbcc9536ab7eababcc6d2374a0b7bfe13a2b6d562c5e07f370456b1a8f33d" +checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ed2fb8c84bfad20ea66b26a3743f3e7ba8735a69fe7d95118c33ec8fc1244d" +checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" dependencies = [ "bumpalo", "lazy_static", "log", "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.15" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ad6e4e8b2b7f8c90b6e09a9b590ea15cb0d1dbe28502b5a405cd95d1981671" +checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "js-sys", "wasm-bindgen", "web-sys", @@ -6656,44 +7583,43 @@ [[package]] name = "wasm-bindgen-macro" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb071268b031a64d92fc6cf691715ca5a40950694d8f683c5bb43db7c730929e" +checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" dependencies = [ - "quote 1.0.7", + "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6" +checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b6c0220ded549d63860c78c38f3bcc558d1ca3f4efa74942c536ddbbb55e87" +checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" [[package]] name = "wasm-timer" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324c5e65a08699c9c4334ba136597ab22b85dccd4b65dd1e36ccf8f723a95b54" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "js-sys", - "parking_lot 0.9.0", + "parking_lot 0.11.0", "pin-utils", - "send_wrapper", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -6708,7 +7634,7 @@ "libc", "memory_units", "num-rational", - "num-traits 0.2.12", + "num-traits", "parity-wasm", "wasmi-validation", ] @@ -6723,10 +7649,195 @@ ] [[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.42" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2" +checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" dependencies = [ "js-sys", "wasm-bindgen", @@ -6761,6 +7872,15 @@ ] [[package]] +name = "wepoll-sys" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "142bc2cba3fe88be1a8fcb55c727fa4cd5b0cf2d7438722792e22f26f04bc1e0" +dependencies = [ + "cc", +] + +[[package]] name = "which" version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6811,24 +7931,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "ws" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51a2c47b5798ccc774ffb93ff536aec7c4275d722fd9c740c83cdd1af1f2d94" -dependencies = [ - "byteorder", - "bytes 0.4.12", - "httparse", - "log", - "mio", - "mio-extras", - "rand 0.7.3", - "sha-1", - "slab", - "url 2.1.1", -] [[package]] name = "ws2_32-sys" @@ -6846,42 +7948,84 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "637ff90c9540fa3073bb577e65033069e4bae7c79d49d74aa3ffdf5342a53217" dependencies = [ - "curve25519-dalek", + "curve25519-dalek 2.1.0", "rand_core 0.5.1", "zeroize", ] [[package]] +name = "x25519-dalek" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc614d95359fd7afc321b66d2107ede58b246b844cf5d8a0adcca413e439f088" +dependencies = [ + "curve25519-dalek 3.0.0", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] name = "yamux" -version = "0.4.7" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd37e58a1256a0b328ce9c67d8b62ecdd02f4803ba443df478835cb1a41a637c" +checksum = "9aeb8c4043cac71c3c299dff107171c220d179492350ea198e109a414981b83c" dependencies = [ - "futures 0.3.5", + "futures 0.3.6", "log", "nohash-hasher", - "parking_lot 0.10.2", + "parking_lot 0.11.0", "rand 0.7.3", "static_assertions", ] [[package]] name = "zeroize" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" +checksum = "05f33972566adbd2d3588b0491eb94b98b43695c4ef897903470ede4f3f5a28a" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" +checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16" dependencies = [ "proc-macro2", - "quote 1.0.7", - "syn 1.0.34", + "quote", + "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/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM phusion/baseimage:0.10.2 as builder LABEL maintainer="gz@usetech.com" -ENV WASM_TOOLCHAIN=nightly-2020-05-01 +ENV WASM_TOOLCHAIN=nightly-2020-10-01 ARG PROFILE=release @@ -17,19 +17,23 @@ WORKDIR /nft_parachain COPY . . -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \ - export PATH="$PATH:$HOME/.cargo/bin" && \ +RUN export CARGO_HOME="/cargo-home" && curl https://sh.rustup.rs -sSf | sh -s -- -y +RUN export PATH="/cargo-home/bin:$PATH" && \ + export CARGO_HOME="/cargo-home" && \ + cargo fetch +RUN export PATH="/cargo-home/bin:$PATH" && \ + export CARGO_HOME="/cargo-home" && \ rustup toolchain uninstall $(rustup toolchain list) && \ - rustup default 1.44.0 && \ rustup toolchain install $WASM_TOOLCHAIN && \ rustup target add wasm32-unknown-unknown --toolchain $WASM_TOOLCHAIN && \ rustup target list --installed && \ - rustup show && \ - cargo build "--$PROFILE" + rustup show + +RUN export PATH="/cargo-home/bin:$PATH" && \ + export CARGO_HOME="/cargo-home" && \ + cargo +$WASM_TOOLCHAIN build "--$PROFILE" # && \ # cargo test - -RUN cd target/release && ls -la # ===== RUN ====== --- a/README.md +++ b/README.md @@ -115,7 +115,23 @@ Additional CLI usage options are available and may be shown by running `cargo run -- --help`. +## Benchmarks +First of all, add rust toolchain and make it default. +```bash +rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-01 +``` + +Then in "/node/src" run build command below +```bash +cargo +nightly-2020-10-01 build --release --features runtime-benchmarks +``` + +Run benchmark +```bash +target/release/nft benchmark --chain dev --pallet "pallet_nft" --extrinsic "*" --repeat 1 +``` + ## UI custom types ``` { @@ -151,9 +167,9 @@ "CollectionMode": { "_enum": { "Invalid": null, - "NFT": "u32", + "NFT": null, "Fungible": "u32", - "ReFungible": "(u32, u32)" + "ReFungible": "u32" } }, "Ownership": { @@ -173,7 +189,8 @@ "NftItemType": { "Collection": "u64", "Owner": "AccountId", - "Data": "Vec" + "ConstData": "Vec", + "VariableData": "Vec" }, "Ownership": { "owner": "AccountId", @@ -182,7 +199,8 @@ "ReFungibleItemType": { "Collection": "u64", "Owner": "Vec>", - "Data": "Vec" + "ConstData": "Vec", + "VariableData": "Vec" }, "CollectionType": { "Owner": "AccountId", @@ -192,11 +210,12 @@ "Name": "Vec", "Description": "Vec", "TokenPrefix": "Vec", - "CustomDataSize": "u32", "MintMode": "bool", "OffchainSchema": "Vec", "Sponsor": "AccountId", - "UnconfirmedSponsor": "AccountId" + "UnconfirmedSponsor": "AccountId", + "VariableOnChainSchema": "Vec", + "ConstOnChainSchema": "Vec" }, "ApprovePermissions": { "Approved": "AccountId", @@ -205,7 +224,23 @@ "RawData": "Vec", "Address": "AccountId", "LookupSource": "AccountId", - "Weight": "u64" + "Weight": "u64", + "CreateNftData": { + "const_data": "Vec", + "variable_data": "Vec" + }, + "CreateFungibleData": {}, + "CreateReFungibleData": { + "const_data": "Vec", + "variable_data": "Vec" + }, + "CreateItemData": { + "_enum": { + "NFT": "CreateNftData", + "Fungible": "CreateFungibleData", + "ReFungible": "CreateReFungibleData" + } + } } ``` \ No newline at end of file --- /dev/null +++ b/doc/milestone_1.md @@ -0,0 +1,65 @@ +## Milestone 1 + +**User Paid Fees and Sponsored. Finish/Debug white listing and spam/DOS protection** + +Implementation of two models +If collection sponsor is set and confirmed for collection instance that means Sponsored Economic Model has chosen. Otherwise default economic model User Paid Fees is set. +For Sponsored Economic Model exists timeouts for token transactions. For every NFT type timeouts defined separately. Timeouts and white list limits together prevented spam and malicious actions. + +Set sponsor +`nft`.`set_collection_sponsor` +Confirm sponsor +`nft`.`confirm_sponsorship` + +A white list mode presented by collection property `access` and can be enabled with `set_public_access_mode`. Rules provide spam/DOS protection +While collection in the white list mode rules below are active: +Owner can add address to white list +Admin can add address to white list +Non-privileged user cannot add address to white list +Owner can remove address from white list +Admin can remove address from white list +Non-privileged user cannot remove address from white list +If Public Access mode is set to WhiteList, tokens can’t be transferred from a non-whitelisted address with transfer or transferFrom +If Public Access mode is set to WhiteList, tokens can’t be transferred to a non-whitelisted address with transfer or transferFrom +If Public Access mode is set to WhiteList, tokens can’t be destroyed by a non-whitelisted address (even if it owned them before enabling WhiteList mode) +If Public Access mode is set to WhiteList, token transfers can’t be Approved by a non-whitelisted address (see Approve method). +If Public Access mode is set to WhiteList, tokens can be transferred to a whitelisted address with transfer or transferFrom +If Public Access mode is set to WhiteList, tokens can be transferred from a whitelisted address with transfer or transferFrom +If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens can be created by owner. +If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens can be created by admin. +If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens cannot be created by non-privileged and white listed address. +If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens cannot be created by non-privileged and non-white listed address. +If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens can be created by owner. +If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens can be created by admin. +If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens cannot be created by non-privileged and non-white listed address. +If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens can be created by non-privileged and white listed address. + +**Add missing custom types (CollectionMode, FungibleItemType, ReFungibleItemType)** + +Follow types defined +``` +pub struct NftItemType { + pub collection: u64, + pub owner: AccountId, + pub data: Vec, +} +pub struct FungibleItemType { + pub collection: u64, + pub owner: AccountId, + pub value: u128, +} +pub struct ReFungibleItemType { + pub collection: u64, + pub owner: Vec>, + pub data: Vec, +} +``` + +**Add substrate bounds for number of collections, owned tokens, and number of collection admins.** + +Bounds defined in chain specification and can be set with 'sudo' privileges `nft`.`set_chain_limits`. + +**Add/document extra genesis** + +Extra genesis defined in `node/src/chain_spec.rs` file. Configuration consist from 5 items: +Collection list, Nft items list, Fungible items list, Refungible items list, Chain limits \ No newline at end of file --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,7 +1,7 @@ [build-dependencies.substrate-build-script-utils] git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' +branch = 'v2.0.0_release' +version = '2.0.0' [[bin]] name = 'nft' @@ -15,7 +15,7 @@ license = 'Unlicense' name = 'nft' repository = 'https://github.com/substrate-developer-hub/nft/' -version = '2.0.0-rc4' +version = '2.0.0' [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] @@ -25,102 +25,38 @@ log = '0.4.8' parking_lot = '0.10.0' structopt = '0.3.8' -jsonrpc-core = '14.0.5' +jsonrpc-core = '15.0.0' -[dependencies.nft-runtime] -path = '../runtime' -version = '2.0.0-rc4' - -[dependencies.sc-basic-authorship] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' +# 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.sc-cli] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.sc-client-api] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sc-consensus] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.pallet-contracts-rpc] -git = 'https://github.com/usetech-llc/substrate.git' -version = '0.8.0-rc4' -branch = 'rc4_ext_dispatch_reenabled' - -[dependencies.sc-rpc] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' - -[dependencies.sc-consensus-aura] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.sc-executor] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.sc-finality-grandpa] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.sc-network] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.sc-service] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.sc-transaction-pool] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-consensus] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.sp-consensus-aura] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.sp-core] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-finality-grandpa] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-inherents] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-runtime] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-transaction-pool] -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' +[features] +default = [] +runtime-benchmarks = ['nft-runtime/runtime-benchmarks'] --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -38,70 +38,95 @@ (get_from_seed::(s), get_from_seed::(s)) } -pub fn development_config() -> ChainSpec { - 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, - ) +pub fn development_config() -> Result { + 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() -> ChainSpec { - 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, - ) +pub fn local_testnet_config() -> Result { + 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,42 +134,43 @@ ) -> 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 { owner: get_account_id_from_seed::("Alice"), - mode: CollectionMode::NFT(50), + mode: CollectionMode::NFT, access: AccessMode::Normal, decimal_points: 0, name: vec![], description: vec![], token_prefix: vec![], - custom_data_size: 50, mint_mode: false, offchain_schema: vec![], sponsor: get_account_id_from_seed::("Alice"), unconfirmed_sponsor: get_account_id_from_seed::("Alice"), + const_on_chain_schema: vec![], + variable_on_chain_schema: vec![] }, )], nft_item_id: vec![], @@ -160,7 +186,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 @@ -1,11 +1,39 @@ -use sc_cli::{RunCmd, Subcommand}; use structopt::StructOpt; +use sc_cli::RunCmd; #[derive(Debug, StructOpt)] pub struct Cli { - #[structopt(subcommand)] - pub subcommand: Option, + #[structopt(subcommand)] + pub subcommand: Option, + + #[structopt(flatten)] + pub run: RunCmd, +} + +#[derive(Debug, StructOpt)] +pub enum Subcommand { + /// Build a chain specification. + BuildSpec(sc_cli::BuildSpecCmd), + + /// Validate blocks. + CheckBlock(sc_cli::CheckBlockCmd), + + /// Export blocks. + ExportBlocks(sc_cli::ExportBlocksCmd), + + /// Export the state of a given block into a chain spec. + ExportState(sc_cli::ExportStateCmd), + + /// Import blocks. + ImportBlocks(sc_cli::ImportBlocksCmd), - #[structopt(flatten)] - pub run: RunCmd, + /// Remove the whole chain. + PurgeChain(sc_cli::PurgeChainCmd), + + /// Revert the chain to a previous state. + Revert(sc_cli::RevertCmd), + + // The custom benchmark subcommmand benchmarking runtime pallets. + #[structopt(name = "benchmark", about = "Benchmark runtime pallets.")] + Benchmark(frame_benchmarking_cli::BenchmarkCmd), } --- a/node/src/command.rs +++ b/node/src/command.rs @@ -15,63 +15,121 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::chain_spec; -use crate::cli::Cli; -use crate::service; -use sc_cli::SubstrateCli; +use crate::{chain_spec, service}; +use crate::cli::{Cli, Subcommand}; +use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec}; +use sc_service::PartialComponents; +use nft_runtime::Block; impl SubstrateCli for Cli { - fn impl_name() -> &'static str { - "Substrate Node" - } + fn impl_name() -> String { + "Substrate Node".into() + } - fn impl_version() -> &'static str { - env!("SUBSTRATE_CLI_IMPL_VERSION") - } + fn impl_version() -> String { + env!("SUBSTRATE_CLI_IMPL_VERSION").into() + } - fn description() -> &'static str { - env!("CARGO_PKG_DESCRIPTION") - } + fn description() -> String { + env!("CARGO_PKG_DESCRIPTION").into() + } - fn author() -> &'static str { - env!("CARGO_PKG_AUTHORS") - } + fn author() -> String { + env!("CARGO_PKG_AUTHORS").into() + } - fn support_url() -> &'static str { - "support.anonymous.an" - } + fn support_url() -> String { + "support.anonymous.an".into() + } - fn copyright_start_year() -> i32 { - 2017 - } + fn copyright_start_year() -> i32 { + 2017 + } - fn executable_name() -> &'static str { - env!("CARGO_PKG_NAME") - } + fn load_spec(&self, id: &str) -> Result, String> { + Ok(match id { + "dev" => Box::new(chain_spec::development_config()?), + "" | "local" => Box::new(chain_spec::local_testnet_config()?), + path => Box::new(chain_spec::ChainSpec::from_json_file( + std::path::PathBuf::from(path), + )?), + }) + } - fn load_spec(&self, id: &str) -> Result, String> { - Ok(match id { - "dev" => Box::new(chain_spec::development_config()), - "" | "local" => Box::new(chain_spec::local_testnet_config()), - path => Box::new(chain_spec::ChainSpec::from_json_file( - std::path::PathBuf::from(path), - )?), - }) - } + fn native_runtime_version(_: &Box) -> &'static RuntimeVersion { + &nft_runtime::VERSION + } } /// Parse and run command line arguments pub fn run() -> sc_cli::Result<()> { - let cli = Cli::from_args(); + let cli = Cli::from_args(); + + match &cli.subcommand { + Some(Subcommand::BuildSpec(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) + }, + Some(Subcommand::CheckBlock(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, import_queue, ..} + = service::new_partial(&config)?; + Ok((cmd.run(client, import_queue), task_manager)) + }) + }, + Some(Subcommand::ExportBlocks(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, ..} + = service::new_partial(&config)?; + Ok((cmd.run(client, config.database), task_manager)) + }) + }, + Some(Subcommand::ExportState(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, ..} + = service::new_partial(&config)?; + Ok((cmd.run(client, config.chain_spec), task_manager)) + }) + }, + Some(Subcommand::ImportBlocks(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, import_queue, ..} + = service::new_partial(&config)?; + Ok((cmd.run(client, import_queue), task_manager)) + }) + }, + Some(Subcommand::PurgeChain(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.database)) + }, + Some(Subcommand::Revert(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, backend, ..} + = service::new_partial(&config)?; + Ok((cmd.run(client, backend), task_manager)) + }) + }, + Some(Subcommand::Benchmark(cmd)) => { + if cfg!(feature = "runtime-benchmarks") { + let runner = cli.create_runner(cmd)?; - match &cli.subcommand { - Some(subcommand) => { - let runner = cli.create_runner(subcommand)?; - runner.run_subcommand(subcommand, |config| Ok(new_full_start!(config).0)) - } - None => { - let runner = cli.create_runner(&cli.run)?; - runner.run_node(service::new_light, service::new_full, nft_runtime::VERSION) - } - } + 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 { + Role::Light => service::new_light(config), + _ => service::new_full(config), + }) + } + } } --- /dev/null +++ b/node/src/lib.rs @@ -0,0 +1,3 @@ +pub mod chain_spec; +pub mod service; +pub mod rpc; --- a/node/src/main.rs +++ b/node/src/main.rs @@ -6,6 +6,7 @@ mod service; mod cli; mod command; +mod rpc; fn main() -> sc_cli::Result<()> { command::run() --- /dev/null +++ b/node/src/rpc.rs @@ -0,0 +1,69 @@ +//! A collection of node-specific RPC methods. +//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer +//! used by Substrate nodes. This file extends those RPC definitions with +//! capabilities that are specific to this project's runtime configuration. + +#![warn(missing_docs)] + +use std::sync::Arc; + +use nft_runtime::{opaque::Block, AccountId, Balance, Index, BlockNumber}; +use sp_api::ProvideRuntimeApi; +use sp_blockchain::{Error as BlockChainError, HeaderMetadata, HeaderBackend}; +use sp_block_builder::BlockBuilder; +pub use sc_rpc_api::DenyUnsafe; +use sp_transaction_pool::TransactionPool; +use pallet_contracts_rpc::{Contracts, ContractsApi}; + +/// Full client dependencies. +pub struct FullDeps { + /// The client instance to use. + pub client: Arc, + /// Transaction pool instance. + pub pool: Arc

, + /// Whether to deny unsafe calls + pub deny_unsafe: DenyUnsafe, +} + +/// Instantiate all full RPC extensions. +pub fn create_full( + deps: FullDeps, +) -> jsonrpc_core::IoHandler where + C: ProvideRuntimeApi, + C: HeaderBackend + HeaderMetadata + 'static, + C: Send + Sync + 'static, + C::Api: substrate_frame_rpc_system::AccountNonceApi, + C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, + C::Api: BlockBuilder, + C::Api: pallet_contracts_rpc::ContractsRuntimeApi, + P: TransactionPool + 'static, +{ + use substrate_frame_rpc_system::{FullSystem, SystemApi}; + use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi}; + + let mut io = jsonrpc_core::IoHandler::default(); + let FullDeps { + client, + pool, + deny_unsafe, + } = deps; + + io.extend_with( + SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)) + ); + + io.extend_with( + TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone())) + ); + + io.extend_with( + ContractsApi::to_delegate(Contracts::new(client.clone())) + ); + + // Extend this RPC with a custom API by using the following syntax. + // `YourRpcStruct` should have a reference to a client, which is needed + // to call into the runtime. + // `io.extend_with(YourRpcTrait::to_delegate(YourRpcStruct::new(ReferenceToClient, ...)));` + + io +} --- a/node/src/service.rs +++ b/node/src/service.rs @@ -1,274 +1,303 @@ //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. +use std::sync::Arc; +use std::time::Duration; +use sc_client_api::{ExecutorProvider, RemoteBackend}; use nft_runtime::{self, opaque::Block, RuntimeApi}; -use sc_client_api::ExecutorProvider; -use sc_consensus::LongestChain; +use sc_service::{error::Error as ServiceError, Configuration, TaskManager}; +use sp_inherents::InherentDataProviders; use sc_executor::native_executor_instance; pub use sc_executor::NativeExecutor; -use sc_finality_grandpa::{ - FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState, - StorageAndProofProvider, -}; -use sc_service::{error::Error as ServiceError, AbstractService, Configuration, ServiceBuilder}; -use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; -use sp_inherents::InherentDataProviders; -use std::sync::Arc; -use std::time::Duration; +use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair}; +use sc_finality_grandpa::{FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState}; // Our native executor instance. native_executor_instance!( - pub Executor, + pub Executor, nft_runtime::api::dispatch, nft_runtime::native_version, + frame_benchmarking::benchmarking::HostFunctions, ); -/// Starts a `ServiceBuilder` for a full service. -/// -/// Use this macro if you don't actually need the full service, but just the builder in order to -/// be able to perform chain operations. -macro_rules! new_full_start { - ($config:expr) => {{ - use jsonrpc_core::IoHandler; - use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; - use std::sync::Arc; - - let mut import_setup = None; - let inherent_data_providers = sp_inherents::InherentDataProviders::new(); +type FullClient = sc_service::TFullClient; +type FullBackend = sc_service::TFullBackend; +type FullSelectChain = sc_consensus::LongestChain; - let builder = sc_service::ServiceBuilder::new_full::< - nft_runtime::opaque::Block, - nft_runtime::RuntimeApi, - crate::service::Executor, - >($config)? - .with_select_chain(|_config, backend| Ok(sc_consensus::LongestChain::new(backend.clone())))? - .with_transaction_pool(|builder| { - let pool_api = sc_transaction_pool::FullChainApi::new(builder.client().clone()); - Ok(sc_transaction_pool::BasicPool::new( - builder.config().transaction_pool.clone(), - std::sync::Arc::new(pool_api), - builder.prometheus_registry(), - )) - })? - .with_import_queue( - |_config, client, mut select_chain, _transaction_pool, spawn_task_handle, registry| { - let select_chain = select_chain - .take() - .ok_or_else(|| sc_service::Error::SelectChainRequired)?; +pub fn new_partial(config: &Configuration) -> Result, + sc_transaction_pool::FullPool, + ( + sc_consensus_aura::AuraBlockImport< + Block, + FullClient, + sc_finality_grandpa::GrandpaBlockImport, + AuraPair + >, + sc_finality_grandpa::LinkHalf + ) +>, ServiceError> { + let inherent_data_providers = sp_inherents::InherentDataProviders::new(); - let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import( - client.clone(), - &(client.clone() as Arc<_>), - select_chain, - )?; + let (client, backend, keystore, task_manager) = + sc_service::new_full_parts::(&config)?; + let client = Arc::new(client); - let aura_block_import = - sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( - grandpa_block_import.clone(), - client.clone(), - ); + let select_chain = sc_consensus::LongestChain::new(backend.clone()); - let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( - sc_consensus_aura::slot_duration(&*client)?, - aura_block_import, - Some(Box::new(grandpa_block_import.clone())), - None, - client, - inherent_data_providers.clone(), - spawn_task_handle, - registry, - )?; + let transaction_pool = sc_transaction_pool::BasicPool::new_full( + config.transaction_pool.clone(), + config.prometheus_registry(), + task_manager.spawn_handle(), + client.clone(), + ); - import_setup = Some((grandpa_block_import, grandpa_link)); + let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import( + client.clone(), &(client.clone() as Arc<_>), select_chain.clone(), + )?; - Ok(import_queue) - }, - )? - .with_rpc_extensions(|builder| -> Result, _> { - let handler = pallet_contracts_rpc::Contracts::new(builder.client().clone()); - let delegate = pallet_contracts_rpc::ContractsApi::to_delegate(handler); + let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( + grandpa_block_import.clone(), client.clone(), + ); - let mut io = IoHandler::default(); - io.extend_with(delegate); - Ok(io) - })?; + let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _, _>( + sc_consensus_aura::slot_duration(&*client)?, + aura_block_import.clone(), + Some(Box::new(grandpa_block_import.clone())), + None, + client.clone(), + inherent_data_providers.clone(), + &task_manager.spawn_handle(), + config.prometheus_registry(), + sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()), + )?; - (builder, import_setup, inherent_data_providers) - }}; + Ok(sc_service::PartialComponents { + client, backend, task_manager, import_queue, keystore, select_chain, transaction_pool, + inherent_data_providers, + other: (aura_block_import, grandpa_link), + }) } /// Builds a new service for a full client. -pub fn new_full(config: Configuration) -> Result { - let role = config.role.clone(); - let force_authoring = config.force_authoring; - let name = config.network.node_name.clone(); - let disable_grandpa = config.disable_grandpa; +pub fn new_full(config: Configuration) -> Result { + let sc_service::PartialComponents { + client, backend, mut task_manager, import_queue, keystore, select_chain, transaction_pool, + inherent_data_providers, + other: (block_import, grandpa_link), + } = new_partial(&config)?; - let (builder, mut import_setup, inherent_data_providers) = new_full_start!(config); + let finality_proof_provider = + GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone()); - let (block_import, grandpa_link) = import_setup.take().expect( - "Link Half and Block Import are present for Full Services or setup failed before. qed", - ); + let (network, network_status_sinks, system_rpc_tx, network_starter) = + sc_service::build_network(sc_service::BuildNetworkParams { + config: &config, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + spawn_handle: task_manager.spawn_handle(), + import_queue, + on_demand: None, + block_announce_validator_builder: None, + finality_proof_request_builder: None, + finality_proof_provider: Some(finality_proof_provider.clone()), + })?; - let service = builder - .with_finality_proof_provider(|client, backend| { - // GenesisAuthoritySetProvider is implemented for StorageAndProofProvider - let provider = client as Arc>; - Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) - })? - .build_full()?; + if config.offchain_worker.enabled { + sc_service::build_offchain_workers( + &config, backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(), + ); + } - if role.is_authority() { - let proposer = sc_basic_authorship::ProposerFactory::new( - service.client(), - service.transaction_pool(), - service.prometheus_registry().as_ref(), - ); + let role = config.role.clone(); + let force_authoring = config.force_authoring; + let name = config.network.node_name.clone(); + let enable_grandpa = !config.disable_grandpa; + let prometheus_registry = config.prometheus_registry().cloned(); + let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default(); - let client = service.client(); - let select_chain = service - .select_chain() - .ok_or(ServiceError::SelectChainRequired)?; + let rpc_extensions_builder = { + let client = client.clone(); + let pool = transaction_pool.clone(); - let can_author_with = - sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); + Box::new(move |deny_unsafe, _| { + let deps = crate::rpc::FullDeps { + client: client.clone(), + pool: pool.clone(), + deny_unsafe, + }; - let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _>( - sc_consensus_aura::slot_duration(&*client)?, - client, - select_chain, - block_import, - proposer, - service.network(), - inherent_data_providers.clone(), - force_authoring, - service.keystore(), - can_author_with, - )?; + crate::rpc::create_full(deps) + }) + }; - // the AURA authoring task is considered essential, i.e. if it - // fails we take down the service with it. - service - .spawn_essential_task_handle() - .spawn_blocking("aura", aura); - } + sc_service::spawn_tasks(sc_service::SpawnTasksParams { + network: network.clone(), + client: client.clone(), + keystore: keystore.clone(), + task_manager: &mut task_manager, + transaction_pool: transaction_pool.clone(), + telemetry_connection_sinks: telemetry_connection_sinks.clone(), + rpc_extensions_builder: rpc_extensions_builder, + on_demand: None, + remote_blockchain: None, + backend, network_status_sinks, system_rpc_tx, config, + })?; - // if the node isn't actively participating in consensus then it doesn't - // need a keystore, regardless of which protocol we use below. - let keystore = if role.is_authority() { - Some(service.keystore() as sp_core::traits::BareCryptoStorePtr) - } else { - None - }; + if role.is_authority() { + let proposer = sc_basic_authorship::ProposerFactory::new( + client.clone(), + transaction_pool, + prometheus_registry.as_ref(), + ); - let grandpa_config = sc_finality_grandpa::Config { - // FIXME #1578 make this available through chainspec - gossip_duration: Duration::from_millis(333), - justification_period: 512, - name: Some(name), - observer_enabled: false, - keystore, - is_authority: role.is_network_authority(), - }; + let can_author_with = + sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); - let enable_grandpa = !disable_grandpa; - if enable_grandpa { - // start the full GRANDPA voter - // NOTE: non-authorities could run the GRANDPA observer protocol, but at - // this point the full voter should provide better guarantees of block - // and vote data availability than the observer. The observer has not - // been tested extensively yet and having most nodes in a network run it - // could lead to finality stalls. - let grandpa_config = sc_finality_grandpa::GrandpaParams { - config: grandpa_config, - link: grandpa_link, - network: service.network(), - inherent_data_providers: inherent_data_providers.clone(), - telemetry_on_connect: Some(service.telemetry_on_connect_stream()), - voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(), - prometheus_registry: service.prometheus_registry(), - shared_voter_state: SharedVoterState::empty(), - }; + let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _>( + sc_consensus_aura::slot_duration(&*client)?, + client.clone(), + select_chain, + block_import, + proposer, + network.clone(), + inherent_data_providers.clone(), + force_authoring, + keystore.clone(), + can_author_with, + )?; + + // the AURA authoring task is considered essential, i.e. if it + // fails we take down the service with it. + task_manager.spawn_essential_handle().spawn_blocking("aura", aura); + } + + // if the node isn't actively participating in consensus then it doesn't + // need a keystore, regardless of which protocol we use below. + let keystore = if role.is_authority() { + Some(keystore as sp_core::traits::BareCryptoStorePtr) + } else { + None + }; + + let grandpa_config = sc_finality_grandpa::Config { + // FIXME #1578 make this available through chainspec + gossip_duration: Duration::from_millis(333), + justification_period: 512, + name: Some(name), + observer_enabled: false, + keystore, + is_authority: role.is_network_authority(), + }; + + if enable_grandpa { + // start the full GRANDPA voter + // NOTE: non-authorities could run the GRANDPA observer protocol, but at + // this point the full voter should provide better guarantees of block + // and vote data availability than the observer. The observer has not + // been tested extensively yet and having most nodes in a network run it + // could lead to finality stalls. + let grandpa_config = sc_finality_grandpa::GrandpaParams { + config: grandpa_config, + link: grandpa_link, + network, + inherent_data_providers, + telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()), + voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(), + prometheus_registry, + shared_voter_state: SharedVoterState::empty(), + }; - // the GRANDPA voter task is considered infallible, i.e. - // if it fails we take down the service with it. - service.spawn_essential_task_handle().spawn_blocking( - "grandpa-voter", - sc_finality_grandpa::run_grandpa_voter(grandpa_config)?, - ); - } else { - sc_finality_grandpa::setup_disabled_grandpa( - service.client(), - &inherent_data_providers, - service.network(), - )?; - } + // the GRANDPA voter task is considered infallible, i.e. + // if it fails we take down the service with it. + task_manager.spawn_essential_handle().spawn_blocking( + "grandpa-voter", + sc_finality_grandpa::run_grandpa_voter(grandpa_config)? + ); + } else { + sc_finality_grandpa::setup_disabled_grandpa( + client, + &inherent_data_providers, + network, + )?; + } - Ok(service) + network_starter.start_network(); + Ok(task_manager) } /// Builds a new service for a light client. -pub fn new_light(config: Configuration) -> Result { - let inherent_data_providers = InherentDataProviders::new(); +pub fn new_light(config: Configuration) -> Result { + let (client, backend, keystore, mut task_manager, on_demand) = + sc_service::new_light_parts::(&config)?; + + let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light( + config.transaction_pool.clone(), + config.prometheus_registry(), + task_manager.spawn_handle(), + client.clone(), + on_demand.clone(), + )); - ServiceBuilder::new_light::(config)? - .with_select_chain(|_config, backend| Ok(LongestChain::new(backend.clone())))? - .with_transaction_pool(|builder| { - let fetcher = builder - .fetcher() - .ok_or_else(|| "Trying to start light transaction pool without active fetcher")?; + let grandpa_block_import = sc_finality_grandpa::light_block_import( + client.clone(), backend.clone(), &(client.clone() as Arc<_>), + Arc::new(on_demand.checker().clone()) as Arc<_>, + )?; + let finality_proof_import = grandpa_block_import.clone(); + let finality_proof_request_builder = + finality_proof_import.create_finality_proof_request_builder(); + + let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _, _>( + sc_consensus_aura::slot_duration(&*client)?, + grandpa_block_import, + None, + Some(Box::new(finality_proof_import)), + client.clone(), + InherentDataProviders::new(), + &task_manager.spawn_handle(), + config.prometheus_registry(), + sp_consensus::NeverCanAuthor, + )?; - let pool_api = - sc_transaction_pool::LightChainApi::new(builder.client().clone(), fetcher.clone()); - let pool = sc_transaction_pool::BasicPool::with_revalidation_type( - builder.config().transaction_pool.clone(), - Arc::new(pool_api), - builder.prometheus_registry(), - sc_transaction_pool::RevalidationType::Light, - ); - Ok(pool) - })? - .with_import_queue_and_fprb( - |_config, - client, - backend, - fetcher, - _select_chain, - _tx_pool, - spawn_task_handle, - prometheus_registry| { - let fetch_checker = fetcher - .map(|fetcher| fetcher.checker().clone()) - .ok_or_else(|| { - "Trying to start light import queue without active fetch checker" - })?; - let grandpa_block_import = sc_finality_grandpa::light_block_import( - client.clone(), - backend, - &(client.clone() as Arc<_>), - Arc::new(fetch_checker), - )?; - let finality_proof_import = grandpa_block_import.clone(); - let finality_proof_request_builder = - finality_proof_import.create_finality_proof_request_builder(); + let finality_proof_provider = + GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone()); + + let (network, network_status_sinks, system_rpc_tx, network_starter) = + sc_service::build_network(sc_service::BuildNetworkParams { + config: &config, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + spawn_handle: task_manager.spawn_handle(), + import_queue, + on_demand: Some(on_demand.clone()), + block_announce_validator_builder: None, + finality_proof_request_builder: Some(finality_proof_request_builder), + finality_proof_provider: Some(finality_proof_provider), + })?; + + if config.offchain_worker.enabled { + sc_service::build_offchain_workers( + &config, backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(), + ); + } + + sc_service::spawn_tasks(sc_service::SpawnTasksParams { + remote_blockchain: Some(backend.remote_blockchain()), + transaction_pool, + task_manager: &mut task_manager, + on_demand: Some(on_demand), + rpc_extensions_builder: Box::new(|_, _| ()), + telemetry_connection_sinks: sc_service::TelemetryConnectionSinks::default(), + config, + client, + keystore, + backend, + network, + network_status_sinks, + system_rpc_tx, + })?; - let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( - sc_consensus_aura::slot_duration(&*client)?, - grandpa_block_import, - None, - Some(Box::new(finality_proof_import)), - client, - inherent_data_providers.clone(), - spawn_task_handle, - prometheus_registry, - )?; + network_starter.start_network(); - Ok((import_queue, finality_proof_request_builder)) - }, - )? - .with_finality_proof_provider(|client, backend| { - // GenesisAuthoritySetProvider is implemented for StorageAndProofProvider - let provider = client as Arc>; - Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) - })? - .build_light() + Ok(task_manager) } --- a/pallets/nft/Cargo.toml +++ b/pallets/nft/Cargo.toml @@ -1,37 +1,52 @@ +[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 git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' +branch = 'v2.0.0_release' +version = '2.0.0' [dependencies.frame-system] default-features = false git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' +branch = 'v2.0.0_release' +version = '2.0.0' + [dev-dependencies.sp-core] default-features = false git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' +branch = 'v2.0.0_release' +version = '2.0.0' [dev-dependencies.sp-io] default-features = false git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' +branch = 'v2.0.0_release' +version = '2.0.0' [dependencies.sp-runtime] default-features = false git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' +branch = 'v2.0.0_release' +version = '2.0.0' [dependencies] # third-party dependencies @@ -41,27 +56,50 @@ [dependencies.sp-std] default-features = false git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' +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 = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' +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-rc4' -[package.metadata.docs.rs] -targets = ['x86_64-unknown-linux-gnu'] +[dependencies.frame-benchmarking] +version = "2.0.0" +default-features = false +git = 'https://github.com/usetech-llc/substrate.git' +branch = 'v2.0.0_release' +optional = true + +[dependencies.pallet-contracts] +default-features = false +git = 'https://github.com/usetech-llc/substrate.git' +package = 'pallet-contracts' +branch = 'v2.0.0_release' +version = '2.0.0' + +[dependencies.pallet-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.pallet-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.pallet-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' [features] default = ['std'] @@ -70,6 +108,11 @@ "serde/std", 'frame-support/std', 'frame-system/std', + 'pallet-balances/std', + 'pallet-timestamp/std', + 'pallet-randomness-collective-flip/std', + 'sp-std/std', 'sp-runtime/std', - 'sp-std/std', + 'frame-benchmarking/std', ] +runtime-benchmarks = ["frame-benchmarking"] --- /dev/null +++ b/pallets/nft/src/benchmarking.rs @@ -0,0 +1,353 @@ +#[cfg(feature = "runtime-benchmarks")] +// mod benchmarking { + use super::*; + use sp_std::prelude::*; + use frame_system::RawOrigin; + // use frame_support::{ensure, traits::OnFinalize}; + use frame_benchmarking::{benchmarks, account, whitelisted_caller}; // , TrackedStorageKey, + use crate::Module as Nft; + + const SEED: u32 = 1; + + fn default_nft_data() -> CreateItemData { + CreateItemData::NFT(CreateNftData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] }) + } + + fn default_fungible_data () -> CreateItemData { + CreateItemData::Fungible(CreateFungibleData { }) + } + + fn default_re_fungible_data () -> CreateItemData { + CreateItemData::ReFungible(CreateReFungibleData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] }) + } + + + benchmarks! { + + _ {} + + create_collection { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = account("caller", 0, SEED); + }: create_collection(RawOrigin::Signed(caller.clone()), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode) + verify { + assert_eq!(Nft::::collection(2).owner, caller); + } + + destroy_collection { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + }: destroy_collection(RawOrigin::Signed(caller.clone()), 2) + + add_to_white_list { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + let whitelist_account: T::AccountId = account("admin", 0, SEED); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + }: add_to_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account) + + remove_from_white_list { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + let whitelist_account: T::AccountId = account("admin", 0, SEED); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + Nft::::add_to_white_list(RawOrigin::Signed(caller.clone()).into(), 2, whitelist_account.clone())?; + }: remove_from_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account) + + set_public_access_mode { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + }: set_public_access_mode(RawOrigin::Signed(caller.clone()), 2, AccessMode::WhiteList) + + set_mint_permission { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + }: set_mint_permission(RawOrigin::Signed(caller.clone()), 2, true) + + change_collection_owner { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let new_owner: T::AccountId = account("admin", 0, SEED); + }: change_collection_owner(RawOrigin::Signed(caller.clone()), 2, new_owner) + + add_collection_admin { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let new_admin: T::AccountId = account("admin", 0, SEED); + }: add_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin) + + remove_collection_admin { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let new_admin: T::AccountId = account("admin", 0, SEED); + Nft::::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), 2, new_admin.clone())?; + }: remove_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin) + + set_collection_sponsor { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + }: set_collection_sponsor(RawOrigin::Signed(caller.clone()), 2, caller.clone()) + + confirm_sponsorship { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + Nft::::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?; + }: confirm_sponsorship(RawOrigin::Signed(caller.clone()), 2) + + remove_collection_sponsor { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + Nft::::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?; + Nft::::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), 2)?; + }: remove_collection_sponsor(RawOrigin::Signed(caller.clone()), 2) + + // nft item + create_item_nft { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_nft_data(); + + }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data) + + #[extra] + create_item_nft_large { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + let nft_data = CreateNftData { + const_data: vec![], + variable_data: vec![] + }; + for i in 0..1998 { + nft_data.const_data.push(10); + nft_data.variable_data.push(10); + } + let mut data = CreateItemData::NFT(nft_data); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + + }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data) + + // fungible item + create_item_fungible { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::Fungible(3); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_fungible_data(); + + }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data) + + // refungible item + create_item_refungible { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::ReFungible(3); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_re_fungible_data(); + + }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data) + + burn_item { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_nft_data(); + Nft::::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?; + + }: burn_item(RawOrigin::Signed(caller.clone()), 2, 1) + + transfer_nft { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let recipient: T::AccountId = account("recipient", 0, SEED); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_nft_data(); + Nft::::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?; + + }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1) + + transfer_fungible { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::Fungible(3); + let recipient: T::AccountId = account("recipient", 0, SEED); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_fungible_data(); + Nft::::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?; + + }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1) + + transfer_refungible { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::ReFungible(3); + let recipient: T::AccountId = account("recipient", 0, SEED); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_re_fungible_data(); + Nft::::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?; + + }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1) + + approve { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::ReFungible(3); + let recipient: T::AccountId = account("recipient", 0, SEED); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_re_fungible_data(); + Nft::::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?; + + }: approve(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1) + + // Nft + transfer_from_nft { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let recipient: T::AccountId = account("recipient", 0, SEED); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_nft_data(); + Nft::::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?; + Nft::::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?; + + }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1) + + // Fungible + transfer_from_fungible { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::Fungible(3); + let recipient: T::AccountId = account("recipient", 0, SEED); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_fungible_data(); + Nft::::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?; + Nft::::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?; + + }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1) + + // ReFungible + transfer_from_refungible { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::ReFungible(3); + let recipient: T::AccountId = account("recipient", 0, SEED); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_re_fungible_data(); + Nft::::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?; + Nft::::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?; + + }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1) + + set_offchain_schema { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::ReFungible(3); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + + }: set_offchain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec()) + + set_const_on_chain_schema { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::ReFungible(3); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + }: set_const_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec()) + + set_variable_on_chain_schema { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::ReFungible(3); + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + }: set_variable_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec()) + + set_variable_meta_data { + let col_name1: Vec = "Test1".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1".to_vec(); + let mode: CollectionMode = CollectionMode::NFT; + let caller: T::AccountId = T::AccountId::from(whitelisted_caller()); + Nft::::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?; + let data = default_nft_data(); + Nft::::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?; + + }: set_variable_meta_data(RawOrigin::Signed(caller.clone()), 2, 1, [1, 2, 3].to_vec()) +} \ No newline at end of file --- /dev/null +++ b/pallets/nft/src/default_weights.rs @@ -0,0 +1,115 @@ +use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; + +impl crate::WeightInfo for () { + fn create_collection() -> Weight { + (70_000_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(5 as Weight)) + } + fn destroy_collection() -> Weight { + (90_000_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(5 as Weight)) + } + fn add_to_white_list() -> Weight { + (30_000_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn remove_from_white_list() -> Weight { + (35_000_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_public_access_mode() -> Weight { + (27_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_mint_permission() -> Weight { + (27_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn change_collection_owner() -> Weight { + (27_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn add_collection_admin() -> Weight { + (32_000_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn remove_collection_admin() -> Weight { + (50_000_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_collection_sponsor() -> Weight { + (32_000_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn confirm_sponsorship() -> Weight { + (22_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn remove_collection_sponsor() -> Weight { + (24_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn create_item(s: usize, ) -> Weight { + (130_000_000 as Weight) + .saturating_add((2135 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) + .saturating_add(DbWeight::get().writes(8 as Weight)) + } + fn burn_item() -> Weight { + (170_000_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) + .saturating_add(DbWeight::get().writes(7 as Weight)) + } + fn transfer() -> Weight { + (125_000_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(7 as Weight)) + } + fn approve() -> Weight { + (45_000_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn transfer_from() -> Weight { + (150_000_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) + .saturating_add(DbWeight::get().writes(8 as Weight)) + } + fn set_offchain_schema() -> Weight { + (33_000_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_const_on_chain_schema() -> Weight { + (11_100_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_variable_on_chain_schema() -> Weight { + (11_100_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_variable_meta_data() -> Weight { + (17_500_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + // fn enable_contract_sponsoring() -> Weight { + // (0 as Weight) + // .saturating_add(DbWeight::get().reads(1 as Weight)) + // .saturating_add(DbWeight::get().writes(1 as Weight)) + // } +} --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -27,15 +27,15 @@ use sp_runtime::sp_std::prelude::Vec; use sp_runtime::{ traits::{ - DispatchInfoOf, Dispatchable, PostDispatchInfoOf, SaturatedConversion, Saturating, - SignedExtension, Zero, + DispatchInfoOf, Dispatchable, PostDispatchInfoOf, Saturating, SignedExtension, Zero, }, transaction_validity::{ - InvalidTransaction, TransactionPriority, TransactionValidity, TransactionValidityError, - ValidTransaction, + InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction, }, FixedPointOperand, FixedU128, }; +use pallet_contracts::ContractAddressFor; +use sp_runtime::traits::StaticLookup; #[cfg(test)] mod mock; @@ -43,6 +43,8 @@ #[cfg(test)] mod tests; +mod default_weights; + // Structs // #region @@ -50,21 +52,20 @@ #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum CollectionMode { Invalid, - // custom data size - NFT(u32), + NFT, // decimal points Fungible(u32), - // custom data size and decimal points - ReFungible(u32, u32), + // decimal points + ReFungible(u32), } impl Into for CollectionMode { fn into(self) -> u8 { match self { CollectionMode::Invalid => 0, - CollectionMode::NFT(_) => 1, + CollectionMode::NFT => 1, CollectionMode::Fungible(_) => 2, - CollectionMode::ReFungible(_, _) => 3, + CollectionMode::ReFungible(_) => 3, } } } @@ -104,11 +105,12 @@ pub name: Vec, // 64 include null escape char pub description: Vec, // 256 include null escape char pub token_prefix: Vec, // 16 include null escape char - pub custom_data_size: u32, pub mint_mode: bool, pub offchain_schema: Vec, pub sponsor: AccountId, // Who pays fees. If set to default address, the fees are applied to the transaction sender pub unconfirmed_sponsor: AccountId, // Sponsor address that has not yet confirmed sponsorship + pub variable_on_chain_schema: Vec, // + pub const_on_chain_schema: Vec, // } #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)] @@ -123,7 +125,8 @@ pub struct NftItemType { pub collection: u64, pub owner: AccountId, - pub data: Vec, + pub const_data: Vec, + pub variable_data: Vec, } #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)] @@ -139,7 +142,8 @@ pub struct ReFungibleItemType { pub collection: u64, pub owner: Vec>, - pub data: Vec, + pub const_data: Vec, + pub variable_data: Vec, } #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)] @@ -181,10 +185,98 @@ pub refungible_sponsor_transfer_timeout: u32, } -pub trait Trait: system::Trait { +pub trait WeightInfo { + fn create_collection() -> Weight; + fn destroy_collection() -> Weight; + fn add_to_white_list() -> Weight; + fn remove_from_white_list() -> Weight; + fn set_public_access_mode() -> Weight; + fn set_mint_permission() -> Weight; + fn change_collection_owner() -> Weight; + fn add_collection_admin() -> Weight; + fn remove_collection_admin() -> Weight; + fn set_collection_sponsor() -> Weight; + fn confirm_sponsorship() -> Weight; + fn remove_collection_sponsor() -> Weight; + fn create_item(s: usize) -> Weight; + fn burn_item() -> Weight; + fn transfer() -> Weight; + fn approve() -> Weight; + fn transfer_from() -> Weight; + fn set_offchain_schema() -> Weight; + fn set_const_on_chain_schema() -> Weight; + fn set_variable_on_chain_schema() -> Weight; + fn set_variable_meta_data() -> Weight; + // fn enable_contract_sponsoring() -> Weight; +} + +#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct CreateNftData { + pub const_data: Vec, + pub variable_data: Vec, +} + +#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct CreateFungibleData { +} + +#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct CreateReFungibleData { + pub const_data: Vec, + pub variable_data: Vec, +} + +#[derive(Encode, Decode, Debug, Clone, PartialEq)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum CreateItemData { + NFT(CreateNftData), + Fungible(CreateFungibleData), + ReFungible(CreateReFungibleData) +} + +impl CreateItemData { + pub fn len(&self) -> usize { + let len = match self { + CreateItemData::NFT(data) => data.variable_data.len() + data.const_data.len(), + CreateItemData::ReFungible(data) => data.variable_data.len() + data.const_data.len(), + _ => 0 + }; + + return len; + } +} + +impl From for CreateItemData { + fn from(item: CreateNftData) -> Self { + CreateItemData::NFT(item) + } +} + +impl From for CreateItemData { + fn from(item: CreateReFungibleData) -> Self { + CreateItemData::ReFungible(item) + } +} + +impl From for CreateItemData { + fn from(item: CreateFungibleData) -> Self { + CreateItemData::Fungible(item) + } +} + +pub trait Trait: system::Trait + Sized + transaction_payment::Trait + pallet_contracts::Trait { type Event: From> + Into<::Event>; + + /// Weight information for extrinsics in this pallet. + type WeightInfo: WeightInfo; } +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; + // #endregion decl_storage! { @@ -227,9 +319,9 @@ pub FungibleTransferBasket get(fn fungible_transfer_basket): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => Vec>; pub ReFungibleTransferBasket get(fn refungible_transfer_basket): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => T::BlockNumber; - // Sponsorship - pub ContractSponsor get(fn contract_sponsor): map hasher(identity) T::AccountId => T::AccountId; - pub UnconfirmedContractSponsor get(fn unconfirmed_contract_sponsor): map hasher(identity) T::AccountId => T::AccountId; + // Contract Sponsorship and Ownership + pub ContractOwner get(fn contract_owner): map hasher(identity) T::AccountId => T::AccountId; + pub ContractSelfSponsoring get(fn contract_self_sponsoring): map hasher(identity) T::AccountId => bool; } add_extra_genesis { build(|config: &GenesisConfig| { @@ -322,7 +414,7 @@ /// /// * mode: [CollectionMode] collection type and type dependent data. // returns collection ID - #[weight = 0] + #[weight = T::WeightInfo::create_collection()] pub fn create_collection(origin, collection_name: Vec, collection_description: Vec, @@ -331,25 +423,10 @@ // Anyone can create a collection let who = ensure_signed(origin)?; - let custom_data_size = match mode { - CollectionMode::NFT(size) => { - - // bound Custom data size - ensure!(size < ChainLimit::get().custom_data_limit, "Custom data size bound exceeded"); - size - }, - CollectionMode::ReFungible(size, _) => { - // bound Custom data size - ensure!(size < ChainLimit::get().custom_data_limit, "Custom data size bound exceeded"); - size - }, - _ => 0 - }; - let decimal_points = match mode { CollectionMode::Fungible(points) => points, - CollectionMode::ReFungible(_, points) => points, + CollectionMode::ReFungible(points) => points, _ => 0 }; @@ -395,9 +472,10 @@ decimal_points: decimal_points, token_prefix: prefix, offchain_schema: Vec::new(), - custom_data_size: custom_data_size, sponsor: T::AccountId::default(), unconfirmed_sponsor: T::AccountId::default(), + variable_on_chain_schema: Vec::new(), + const_on_chain_schema: Vec::new(), }; // Add new collection to map @@ -418,7 +496,7 @@ /// # Arguments /// /// * collection_id: collection to destroy. - #[weight = 0] + #[weight = T::WeightInfo::destroy_collection()] pub fn destroy_collection(origin, collection_id: u64) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -465,7 +543,7 @@ /// * collection_id. /// /// * address. - #[weight = 0] + #[weight = T::WeightInfo::add_to_white_list()] pub fn add_to_white_list(origin, collection_id: u64, address: T::AccountId) -> DispatchResult{ let sender = ensure_signed(origin)?; @@ -500,7 +578,7 @@ /// * collection_id. /// /// * address. - #[weight = 0] + #[weight = T::WeightInfo::remove_from_white_list()] pub fn remove_from_white_list(origin, collection_id: u64, address: T::AccountId) -> DispatchResult{ let sender = ensure_signed(origin)?; @@ -529,7 +607,7 @@ /// * collection_id. /// /// * mode: [AccessMode] - #[weight = 0] + #[weight = T::WeightInfo::set_public_access_mode()] pub fn set_public_access_mode(origin, collection_id: u64, mode: AccessMode) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -555,7 +633,7 @@ /// * collection_id. /// /// * mint_permission: Boolean parameter. If True, allows minting to Anyone with conditions above. - #[weight = 0] + #[weight = T::WeightInfo::set_mint_permission()] pub fn set_mint_permission(origin, collection_id: u64, mint_permission: bool) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -579,7 +657,7 @@ /// * collection_id. /// /// * new_owner. - #[weight = 0] + #[weight = T::WeightInfo::change_collection_owner()] pub fn change_collection_owner(origin, collection_id: u64, new_owner: T::AccountId) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -604,7 +682,7 @@ /// * collection_id: ID of the Collection to add admin for. /// /// * new_admin_id: Address of new admin to add. - #[weight = 0] + #[weight = T::WeightInfo::add_collection_admin()] pub fn add_collection_admin(origin, collection_id: u64, new_admin_id: T::AccountId) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -638,7 +716,7 @@ /// * collection_id: ID of the Collection to remove admin for. /// /// * account_id: Address of admin to remove. - #[weight = 0] + #[weight = T::WeightInfo::remove_collection_admin()] pub fn remove_collection_admin(origin, collection_id: u64, account_id: T::AccountId) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -663,7 +741,7 @@ /// * collection_id. /// /// * new_sponsor. - #[weight = 0] + #[weight = T::WeightInfo::set_collection_sponsor()] pub fn set_collection_sponsor(origin, collection_id: u64, new_sponsor: T::AccountId) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -685,7 +763,7 @@ /// # Arguments /// /// * collection_id. - #[weight = 0] + #[weight = T::WeightInfo::confirm_sponsorship()] pub fn confirm_sponsorship(origin, collection_id: u64) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -710,7 +788,7 @@ /// # Arguments /// /// * collection_id. - #[weight = 0] + #[weight = T::WeightInfo::remove_collection_sponsor()] pub fn remove_collection_sponsor(origin, collection_id: u64) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -739,12 +817,18 @@ /// # Arguments /// /// * collection_id: ID of the collection. - /// - /// * properties: Array of bytes that contains NFT properties. Since NFT Module is agnostic of properties meaning, it is treated purely as an array of bytes. /// /// * owner: Address, initial owner of the NFT. - #[weight = 0] - pub fn create_item(origin, collection_id: u64, properties: Vec, owner: T::AccountId) -> DispatchResult { + /// + /// * data: Token data to store on chain. + // #[weight = + // (130_000_000 as Weight) + // .saturating_add((2135 as Weight).saturating_mul((properties.len() as u64) as Weight)) + // .saturating_add(RocksDbWeight::get().reads(10 as Weight)) + // .saturating_add(RocksDbWeight::get().writes(8 as Weight))] + + #[weight = T::WeightInfo::create_item(data.len())] + pub fn create_item(origin, collection_id: u64, owner: T::AccountId, data: CreateItemData) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -811,7 +895,7 @@ /// * collection_id: ID of the collection. /// /// * item_id: ID of NFT to burn. - #[weight = 0] + #[weight = T::WeightInfo::burn_item()] pub fn burn_item(origin, collection_id: u64, item_id: u64) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -829,9 +913,9 @@ match target_collection.mode { - CollectionMode::NFT(_) => Self::burn_nft_item(collection_id, item_id)?, + CollectionMode::NFT => Self::burn_nft_item(collection_id, item_id)?, CollectionMode::Fungible(_) => Self::burn_fungible_item(collection_id, item_id)?, - CollectionMode::ReFungible(_, _) => Self::burn_refungible_item(collection_id, item_id, sender.clone())?, + CollectionMode::ReFungible(_) => Self::burn_refungible_item(collection_id, item_id, sender.clone())?, _ => () }; @@ -864,7 +948,7 @@ /// * Non-Fungible Mode: Ignored /// * Fungible Mode: Must specify transferred amount /// * Re-Fungible Mode: Must specify transferred portion (between 0 and 1) - #[weight = 0] + #[weight = T::WeightInfo::transfer()] pub fn transfer(origin, recipient: T::AccountId, collection_id: u64, item_id: u64, value: u64) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -882,9 +966,9 @@ match target_collection.mode { - CollectionMode::NFT(_) => Self::transfer_nft(collection_id, item_id, sender.clone(), recipient)?, + CollectionMode::NFT => Self::transfer_nft(collection_id, item_id, sender.clone(), recipient)?, CollectionMode::Fungible(_) => Self::transfer_fungible(collection_id, item_id, value, sender.clone(), recipient)?, - CollectionMode::ReFungible(_, _) => Self::transfer_refungible(collection_id, item_id, value, sender.clone(), recipient)?, + CollectionMode::ReFungible(_) => Self::transfer_refungible(collection_id, item_id, value, sender.clone(), recipient)?, _ => () }; @@ -906,7 +990,7 @@ /// * collection_id. /// /// * item_id: ID of the item. - #[weight = 0] + #[weight = T::WeightInfo::approve()] pub fn approve(origin, approved: T::AccountId, collection_id: u64, item_id: u64) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -964,7 +1048,7 @@ /// * item_id: ID of the item. /// /// * value: Amount to transfer. - #[weight = 0] + #[weight = T::WeightInfo::transfer_from()] pub fn transfer_from(origin, from: T::AccountId, recipient: T::AccountId, collection_id: u64, item_id: u64, value: u64 ) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -974,8 +1058,11 @@ if >::contains_key(collection_id, (item_id, from.clone())) { let list_itm = >::get(collection_id, (item_id, from.clone())); let opt_item = list_itm.iter().find(|i| i.approved == sender.clone()); - appoved_transfer = opt_item.is_some(); - ensure!(opt_item.unwrap().amount >= value, "Requested value more than approved"); + if opt_item.is_some() + { + appoved_transfer = true; + ensure!(opt_item.unwrap().amount >= value, "Requested value more than approved"); + } } // Transfer permissions check @@ -996,9 +1083,9 @@ match target_collection.mode { - CollectionMode::NFT(_) => Self::transfer_nft(collection_id, item_id, from, recipient)?, + CollectionMode::NFT => Self::transfer_nft(collection_id, item_id, from, recipient)?, CollectionMode::Fungible(_) => Self::transfer_fungible(collection_id, item_id, value, from.clone(), recipient)?, - CollectionMode::ReFungible(_, _) => Self::transfer_refungible(collection_id, item_id, value, from.clone(), recipient)?, + CollectionMode::ReFungible(_) => Self::transfer_refungible(collection_id, item_id, value, from.clone(), recipient)?, _ => () }; @@ -1033,7 +1120,49 @@ /// * collection_id. /// /// * schema: String representing the offchain data schema. - #[weight = 0] + #[weight = T::WeightInfo::set_variable_meta_data()] + pub fn set_variable_meta_data ( + origin, + collection_id: u64, + item_id: u64, + data: Vec + ) -> DispatchResult { + let sender = ensure_signed(origin)?; + + Self::collection_exists(collection_id)?; + + // Modify permissions check + let target_collection = >::get(collection_id); + ensure!(Self::is_item_owner(sender.clone(), collection_id, item_id) || + Self::is_owner_or_admin_permissions(collection_id, sender.clone()), + "Only item owner, collection owner and admins can modify item"); + + Self::item_exists(collection_id, item_id, &target_collection.mode)?; + + match target_collection.mode + { + CollectionMode::NFT => Self::set_nft_variable_data(collection_id, item_id, data)?, + CollectionMode::ReFungible(_) => Self::set_re_fungible_variable_data(collection_id, item_id, data)?, + _ => () + }; + + Ok(()) + } + + + /// Set off-chain data schema. + /// + /// # Permissions + /// + /// * Collection Owner + /// * Collection Admin + /// + /// # Arguments + /// + /// * collection_id. + /// + /// * schema: String representing the offchain data schema. + #[weight = T::WeightInfo::set_offchain_schema()] pub fn set_offchain_schema( origin, collection_id: u64, @@ -1049,6 +1178,62 @@ Ok(()) } + /// Set const on-chain data schema. + /// + /// # Permissions + /// + /// * Collection Owner + /// * Collection Admin + /// + /// # Arguments + /// + /// * collection_id. + /// + /// * schema: String representing the const on-chain data schema. + #[weight = T::WeightInfo::set_const_on_chain_schema()] + pub fn set_const_on_chain_schema ( + origin, + collection_id: u64, + schema: Vec + ) -> DispatchResult { + let sender = ensure_signed(origin)?; + Self::check_owner_or_admin_permissions(collection_id, sender.clone())?; + + let mut target_collection = >::get(collection_id); + target_collection.const_on_chain_schema = schema; + >::insert(collection_id, target_collection); + + Ok(()) + } + + /// Set variable on-chain data schema. + /// + /// # Permissions + /// + /// * Collection Owner + /// * Collection Admin + /// + /// # Arguments + /// + /// * collection_id. + /// + /// * schema: String representing the variable on-chain data schema. + #[weight = T::WeightInfo::set_const_on_chain_schema()] + pub fn set_variable_on_chain_schema ( + origin, + collection_id: u64, + schema: Vec + ) -> DispatchResult { + let sender = ensure_signed(origin)?; + Self::check_owner_or_admin_permissions(collection_id, sender.clone())?; + + let mut target_collection = >::get(collection_id); + target_collection.variable_on_chain_schema = schema; + >::insert(collection_id, target_collection); + + Ok(()) + } + // Sudo permissions function #[weight = 0] pub fn set_chain_limits( @@ -1058,7 +1243,37 @@ ensure_root(origin)?; ::put(limits); Ok(()) - } + } + + /// Enable smart contract self-sponsoring. + /// + /// # Permissions + /// + /// * Contract Owner + /// + /// # Arguments + /// + /// * contract address + /// * enable flag + /// + #[weight = 0] + pub fn enable_contract_sponsoring( + origin, + contract_address: T::AccountId, + enable: bool + ) -> DispatchResult { + let sender = ensure_signed(origin)?; + let mut is_owner = false; + if >::contains_key(contract_address.clone()) { + let owner = >::get(&contract_address); + is_owner = sender == owner; + } + ensure!(is_owner, "Only contract owner may call this method"); + + >::insert(contract_address, enable); + Ok(()) + } + } } @@ -1356,13 +1571,13 @@ let target_collection = >::get(collection_id); match target_collection.mode { - CollectionMode::NFT(_) => { + CollectionMode::NFT => { >::get(collection_id, item_id).owner == subject } CollectionMode::Fungible(_) => { >::get(collection_id, item_id).owner == subject } - CollectionMode::ReFungible(_, _) => { + CollectionMode::ReFungible(_) => { >::get(collection_id, item_id) .owner .iter() @@ -1597,7 +1812,50 @@ >::remove(collection_id, (item_id, old_owner)); Ok(()) } + + fn item_exists( + collection_id: u64, + item_id: u64, + mode: &CollectionMode + ) -> DispatchResult { + match mode { + CollectionMode::NFT => ensure!(>::contains_key(collection_id, item_id), "Item does not exists"), + CollectionMode::ReFungible(_) => ensure!(>::contains_key(collection_id, item_id), "Item does not exists"), + CollectionMode::Fungible(_) => ensure!(>::contains_key(collection_id, item_id), "Item does not exists"), + _ => () + }; + + Ok(()) + } + + fn set_re_fungible_variable_data( + collection_id: u64, + item_id: u64, + data: Vec + ) -> DispatchResult { + let mut item = >::get(collection_id, item_id); + + item.variable_data = data; + >::insert(collection_id, item_id, item); + + Ok(()) + } + + fn set_nft_variable_data( + collection_id: u64, + item_id: u64, + data: Vec + ) -> DispatchResult { + let mut item = >::get(collection_id, item_id); + + item.variable_data = data; + + >::insert(collection_id, item_id, item); + + Ok(()) + } + fn init_collection(item: &CollectionType) { // check params assert!( @@ -1771,11 +2029,11 @@ /// Require the transactor pay for themselves and maybe include a tip to gain additional priority /// in the queue. #[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct ChargeTransactionPayment( - #[codec(compact)] BalanceOf, +pub struct ChargeTransactionPayment( + #[codec(compact)] BalanceOf ); -impl sp_std::fmt::Debug +impl sp_std::fmt::Debug for ChargeTransactionPayment { #[cfg(feature = "std")] @@ -1788,10 +2046,9 @@ } } -impl ChargeTransactionPayment +impl ChargeTransactionPayment where - T::Call: - Dispatchable + IsSubType, T>, + T::Call: Dispatchable + IsSubType> + IsSubType>, BalanceOf: Send + Sync + FixedPointOperand, { /// utility constructor. Used only in client/factory code. @@ -1821,15 +2078,16 @@ // Set fee based on call type. Creating collection costs 1 Unique. // All other transactions have traditional fees so far - let fee = match call.is_sub_type() { - Some(Call::create_collection(..)) => >::from(1_000_000_000), - _ => Self::traditional_fee(len, info, tip), // Flat fee model, use only for testing purposes - // _ => >::from(100) - }; + // let fee = match call.is_sub_type() { + // Some(Call::create_collection(..)) => >::from(1_000_000_000), + // _ => Self::traditional_fee(len, info, tip), // Flat fee model, use only for testing purposes + // // _ => >::from(100) + // }; + let fee = Self::traditional_fee(len, info, tip); // Determine who is paying transaction fee based on ecnomic model // Parse call to extract collection ID and access collection sponsor - let sponsor: T::AccountId = match call.is_sub_type() { + let mut sponsor: T::AccountId = match IsSubType::>::is_sub_type(call) { Some(Call::create_item(collection_id, _properties, _owner)) => { >::get(collection_id).sponsor } @@ -1838,7 +2096,7 @@ // sponsor timeout let sponsor_transfer = match _collection_mode { - CollectionMode::NFT(_) => { + CollectionMode::NFT => { let basket = >::get(collection_id, _item_id); let block_number = >::block_number() as T::BlockNumber; let limit_time = basket + ChainLimit::get().nft_sponsor_transfer_timeout.into(); @@ -1872,7 +2130,7 @@ true } } - CollectionMode::ReFungible(_, _) => { + CollectionMode::ReFungible(_) => { let basket = >::get(collection_id, _item_id); let block_number = >::block_number() as T::BlockNumber; let limit_time = basket + ChainLimit::get().nft_sponsor_transfer_timeout.into(); @@ -1898,6 +2156,39 @@ _ => T::AccountId::default(), }; + // Sponsor smart contracts + sponsor = match IsSubType::>::is_sub_type(call) { + + // On instantiation: set the contract owner + Some(pallet_contracts::Call::instantiate(_endowment, _gas_limit, code_hash, data)) => { + + let new_contract_address = ::DetermineContractAddress::contract_address_for( + code_hash, + &data, + &who, + ); + >::insert(new_contract_address.clone(), who.clone()); + + T::AccountId::default() + }, + + // When the contract is called, check if the sponsoring is enabled and pay fees from contract endowment if it is + Some(pallet_contracts::Call::call(dest, _value, _gas_limit, _data)) => { + + let mut sp = T::AccountId::default(); + let called_contract: T::AccountId = T::Lookup::lookup((*dest).clone()).unwrap_or(T::AccountId::default()); + if >::contains_key(called_contract.clone()) { + if >::get(called_contract.clone()) { + sp = called_contract; + } + } + + sp + }, + + _ => sponsor, + }; + let mut who_pays_fee: T::AccountId = sponsor.clone(); if sponsor == T::AccountId::default() { who_pays_fee = who.clone(); @@ -1924,12 +2215,12 @@ } } -impl SignedExtension + +impl SignedExtension for ChargeTransactionPayment where BalanceOf: Send + Sync + From + FixedPointOperand, - T::Call: - Dispatchable + IsSubType, T>, + T::Call: Dispatchable + IsSubType> + IsSubType>, { const IDENTIFIER: &'static str = "ChargeTransactionPayment"; type AccountId = T::AccountId; @@ -1947,18 +2238,12 @@ fn validate( &self, - who: &Self::AccountId, - call: &Self::Call, - info: &DispatchInfoOf, - len: usize, + _who: &Self::AccountId, + _call: &Self::Call, + _info: &DispatchInfoOf, + _len: usize, ) -> TransactionValidity { - let (fee, _) = self.withdraw_fee(who, call, info, len)?; - - let mut r = ValidTransaction::default(); - // NOTE: we probably want to maximize the _fee (of any type) per weight unit_ here, which - // will be a bit more than setting the priority to tip. For now, this is enough. - r.priority = fee.saturated_into::(); - Ok(r) + Ok(ValidTransaction::default()) } fn pre_dispatch( @@ -2009,4 +2294,5 @@ Ok(()) } } + // #endregion --- a/pallets/nft/src/mock.rs +++ b/pallets/nft/src/mock.rs @@ -1,20 +1,27 @@ // Creating mock runtime here use crate::{Module, Trait}; + +use pallet_contracts::{ + ContractAddressFor, TrieId, TrieIdGenerator, +}; + use frame_support::{ impl_outer_origin, parameter_types, weights::{ - constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, - Weight, + // constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, IdentityFee, }, }; use frame_system as system; +use transaction_payment; use sp_core::H256; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup, Saturating}, Perbill, }; +pub use pallet_balances; impl_outer_origin! { pub enum Origin for Test {} @@ -35,33 +42,122 @@ } 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 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 = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); +} + +parameter_types! { + pub const ExistentialDeposit: u64 = 1; + pub const MaxLocks: u32 = 50; +} + +type System = frame_system::Module; +impl pallet_balances::Trait for Test { + type AccountStore = System; + type Balance = u64; + type DustRemoval = (); 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 ExistentialDeposit = ExistentialDeposit; + type WeightInfo = (); + type MaxLocks = MaxLocks; +} + +parameter_types! { + pub const TransactionByteFee: u64 = 1; +} +impl transaction_payment::Trait for Test { + type Currency = pallet_balances::Module; + type OnTransactionPayment = (); + type TransactionByteFee = TransactionByteFee; + type WeightToFee = IdentityFee; + type FeeMultiplierUpdate = (); +} + + +parameter_types! { + pub const MinimumPeriod: u64 = 1; +} +impl pallet_timestamp::Trait for Test { + type Moment = u64; + type OnTimestampSet = (); + type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); +} + +type Timestamp = pallet_timestamp::Module; +type Randomness = pallet_randomness_collective_flip::Module; + +parameter_types! { + pub const TombstoneDeposit: u64 = 1; + pub const RentByteFee: u64 = 1; + pub const RentDepositOffset: u64 = 1; + pub const SurchargeReward: u64 = 1; +} + +pub struct DummyTrieIdGenerator; +impl TrieIdGenerator for DummyTrieIdGenerator { + fn trie_id(account_id: &u64) -> TrieId { + let new_seed = *account_id + 1; + let mut res = vec![]; + res.extend_from_slice(&new_seed.to_le_bytes()); + res.extend_from_slice(&account_id.to_le_bytes()); + res + } +} + +pub struct DummyContractAddressFor; +impl ContractAddressFor for DummyContractAddressFor { + fn contract_address_for(_code_hash: &H256, _data: &[u8], origin: &u64) -> u64 { + *origin + 1 + } +} + +impl pallet_contracts::Trait for Test { + type Time = Timestamp; + type Randomness = Randomness; + type Currency = pallet_balances::Module; + type Event = (); + type DetermineContractAddress = DummyContractAddressFor; + type TrieIdGenerator = DummyTrieIdGenerator; + type RentPayment = (); + type SignedClaimHandicap = pallet_contracts::DefaultSignedClaimHandicap; + type TombstoneDeposit = TombstoneDeposit; + type StorageSizeOffset = pallet_contracts::DefaultStorageSizeOffset; + type RentByteFee = RentByteFee; + type RentDepositOffset = RentDepositOffset; + type SurchargeReward = SurchargeReward; + type MaxDepth = pallet_contracts::DefaultMaxDepth; + type MaxValueSize = pallet_contracts::DefaultMaxValueSize; + type WeightPrice = (); } + impl Trait for Test { - type Event = (); + type Event = (); + type WeightInfo = (); + } pub type TemplateModule = Module; --- a/pallets/nft/src/tests.rs +++ b/pallets/nft/src/tests.rs @@ -1,21 +1,16 @@ // Tests to be written here use crate::mock::*; -use crate::{AccessMode, ApprovePermissions, CollectionMode, Ownership, ChainLimits}; +use crate::{AccessMode, ApprovePermissions, CollectionMode, Ownership, ChainLimits, CreateItemData, CreateNftData, CreateFungibleData, CreateReFungibleData}; use frame_support::{assert_noop, assert_ok}; use frame_system::{ RawOrigin }; -// Use cases tests region -// #region -#[test] -fn create_nft_item() { - new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); +fn default_collection_numbers_limit() -> u64 { + 10 +} - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, +fn default_limits() { + assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { + collection_numbers_limit: default_collection_numbers_limit(), account_token_ownership_limit: 10, collections_admins_limit: 5, custom_data_limit: 2048, @@ -23,24 +18,72 @@ fungible_sponsor_transfer_timeout: 15, refungible_sponsor_transfer_timeout: 15, })); +} + +fn default_nft_data() -> CreateNftData { + CreateNftData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] } +} + +fn default_fungible_data () -> CreateFungibleData { + CreateFungibleData { } +} + +fn default_re_fungible_data () -> CreateReFungibleData { + CreateReFungibleData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] } +} + +fn create_test_collection_for_owner(mode: &CollectionMode, owner: u64, id: u64) -> u64 { + let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( + let origin1 = Origin::signed(owner); + assert_ok!(TemplateModule::create_collection( origin1.clone(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), - mode + mode.clone() )); - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_ok!(TemplateModule::create_item( + let saved_col_name: Vec = "Test1\0\0".encode_utf16().collect::>(); + let saved_description: Vec = "TestDescription1\0\0".encode_utf16().collect::>(); + let saved_prefix: Vec = b"token_prefix1\0\0".to_vec(); + assert_eq!(TemplateModule::collection(id).owner, owner); + assert_eq!(TemplateModule::collection(id).name, saved_col_name); + assert_eq!(TemplateModule::collection(id).mode, *mode); + assert_eq!(TemplateModule::collection(id).description, saved_description); + assert_eq!(TemplateModule::collection(id).token_prefix, saved_prefix); + id +} + +fn create_test_collection(mode: &CollectionMode, id: u64) -> u64 { + create_test_collection_for_owner(&mode, 1, id) +} + +fn create_test_item(collection_id: u64, data: &CreateItemData) { + let origin1 = Origin::signed(1); + assert_ok!(TemplateModule::create_item( origin1.clone(), + collection_id, 1, - [1, 2, 3].to_vec(), - 1 + data.clone() )); - assert_eq!(TemplateModule::nft_item_id(1, 1).data, [1, 2, 3].to_vec()); + +} + +// Use cases tests region +// #region +#[test] +fn create_nft_item() { + new_test_ext().execute_with(|| { + default_limits(); + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + + let data = default_nft_data(); + create_test_item(collection_id, &data.clone().into()); + assert_eq!(TemplateModule::nft_item_id(collection_id, 1).const_data, data.const_data); + assert_eq!(TemplateModule::nft_item_id(collection_id, 1).variable_data, data.variable_data); }); } @@ -91,43 +134,21 @@ #[test] fn create_refungible_item() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::ReFungible(2000, 3); + default_limits(); + let collection_id = create_test_collection(&CollectionMode::ReFungible(3), 1); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + let data = default_re_fungible_data(); + create_test_item(collection_id, &data.clone().into()); + assert_eq!( + TemplateModule::refungible_item_id(collection_id, 1).const_data, + data.const_data + ); assert_eq!( - TemplateModule::refungible_item_id(1, 1).data, - [1, 2, 3].to_vec() + TemplateModule::refungible_item_id(collection_id, 1).variable_data, + data.variable_data ); assert_eq!( - TemplateModule::refungible_item_id(1, 1).owner[0], + TemplateModule::refungible_item_id(collection_id, 1).owner[0], Ownership { owner: 1, fraction: 1000 @@ -190,38 +211,14 @@ #[test] fn create_fungible_item() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::Fungible(3); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + let data = default_fungible_data(); + create_test_item(collection_id, &data.into()); - let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [].to_vec(), - 1 - )); - assert_eq!(TemplateModule::fungible_item_id(1, 1).owner, 1); + assert_eq!(TemplateModule::fungible_item_id(collection_id, 1).owner, 1); }); } @@ -273,38 +270,16 @@ #[test] fn transfer_fungible_item() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::Fungible(3); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [].to_vec(), - 1 - )); + let data = default_fungible_data(); + create_test_item(collection_id, &data.into()); + assert_eq!(TemplateModule::fungible_item_id(1, 1).owner, 1); assert_eq!(TemplateModule::balance_count(1, 1), 1000); assert_eq!(TemplateModule::address_tokens(1, 1), [1]); @@ -315,7 +290,7 @@ assert_eq!(TemplateModule::fungible_item_id(1, 1).value, 1000); assert_eq!(TemplateModule::balance_count(1, 1), 0); assert_eq!(TemplateModule::balance_count(1, 2), 1000); - assert_eq!(TemplateModule::address_tokens(1, 1), []); + // assert_eq!(TemplateModule::address_tokens(1, 1), []); assert_eq!(TemplateModule::address_tokens(1, 2), [1]); // split item scenario @@ -341,44 +316,25 @@ #[test] fn transfer_refungible_item() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::ReFungible(2000, 3); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::ReFungible(3), 1); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + let data = default_re_fungible_data(); + create_test_item(collection_id, &data.clone().into()); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); assert_eq!( - TemplateModule::refungible_item_id(1, 1).data, - [1, 2, 3].to_vec() + TemplateModule::refungible_item_id(collection_id, 1).const_data, + data.const_data + ); + assert_eq!( + TemplateModule::refungible_item_id(collection_id, 1).variable_data, + data.variable_data ); assert_eq!( - TemplateModule::refungible_item_id(1, 1).owner[0], + TemplateModule::refungible_item_id(collection_id, 1).owner[0], Ownership { owner: 1, fraction: 1000 @@ -398,7 +354,7 @@ ); assert_eq!(TemplateModule::balance_count(1, 1), 0); assert_eq!(TemplateModule::balance_count(1, 2), 1000); - assert_eq!(TemplateModule::address_tokens(1, 1), []); + // assert_eq!(TemplateModule::address_tokens(1, 1), []); assert_eq!(TemplateModule::address_tokens(1, 2), [1]); // split item scenario @@ -448,47 +404,22 @@ #[test] fn transfer_nft_item() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); - let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); - assert_eq!(TemplateModule::nft_item_id(1, 1).data, [1, 2, 3].to_vec()); + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); assert_eq!(TemplateModule::balance_count(1, 1), 1); assert_eq!(TemplateModule::address_tokens(1, 1), [1]); + let origin1 = Origin::signed(1); // default scenario assert_ok!(TemplateModule::transfer(origin1.clone(), 2, 1, 1, 1000)); assert_eq!(TemplateModule::nft_item_id(1, 1).owner, 2); assert_eq!(TemplateModule::balance_count(1, 1), 0); assert_eq!(TemplateModule::balance_count(1, 2), 1); - assert_eq!(TemplateModule::address_tokens(1, 1), []); + // assert_eq!(TemplateModule::address_tokens(1, 1), []); assert_eq!(TemplateModule::address_tokens(1, 2), [1]); }); } @@ -496,39 +427,65 @@ #[test] fn nft_approve_and_transfer_from() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_ok!(TemplateModule::create_item( - origin1.clone(), + assert_eq!(TemplateModule::balance_count(1, 1), 1); + assert_eq!(TemplateModule::address_tokens(1, 1), [1]); + + // neg transfer + assert_noop!(TemplateModule::transfer_from( + origin2.clone(), 1, - [1, 2, 3].to_vec(), + 2, + 1, + 1, + 1), "Only item owner, collection owner and admins can modify items"); + + // do approve + assert_ok!(TemplateModule::approve(origin1.clone(), 2, 1, 1)); + assert_eq!(TemplateModule::approved(1, (1, 1)).len(), 1); + assert_eq!( + TemplateModule::approved(1, (1, 1))[0], + ApprovePermissions { + approved: 2, + amount: 100000000 + } + ); + + assert_ok!(TemplateModule::transfer_from( + origin2.clone(), + 1, + 2, + 1, + 1, 1 )); - assert_eq!(TemplateModule::nft_item_id(1, 1).data, [1, 2, 3].to_vec()); + assert_eq!(TemplateModule::approved(1, (1, 1)).len(), 0); + }); +} + +#[test] +fn nft_approve_and_transfer_from_white_list() { + new_test_ext().execute_with(|| { + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + + let origin1 = Origin::signed(1); + let origin2 = Origin::signed(2); + + let data = default_nft_data(); + create_test_item(collection_id, &data.clone().into()); + + assert_eq!(TemplateModule::nft_item_id(1, 1).const_data, data.const_data); assert_eq!(TemplateModule::balance_count(1, 1), 1); assert_eq!(TemplateModule::address_tokens(1, 1), [1]); @@ -574,49 +531,16 @@ #[test] fn refungible_approve_and_transfer_from() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::ReFungible(2000, 3); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::ReFungible(3), 1); + let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); - assert_eq!( - TemplateModule::refungible_item_id(1, 1).data, - [1, 2, 3].to_vec() - ); - assert_eq!( - TemplateModule::refungible_item_id(1, 1).owner[0], - Ownership { - owner: 1, - fraction: 1000 - } - ); + let data = default_re_fungible_data(); + create_test_item(collection_id, &data.into()); + assert_eq!(TemplateModule::balance_count(1, 1), 1000); assert_eq!(TemplateModule::address_tokens(1, 1), [1]); @@ -674,39 +598,16 @@ #[test] fn fungible_approve_and_transfer_from() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::Fungible(3); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1); + + let data = default_fungible_data(); + create_test_item(collection_id, &data.into()); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [].to_vec(), - 1 - )); - assert_eq!(TemplateModule::fungible_item_id(1, 1).owner, 1); assert_eq!(TemplateModule::balance_count(1, 1), 1000); assert_eq!(TemplateModule::address_tokens(1, 1), [1]); @@ -770,7 +671,7 @@ )); assert_eq!(TemplateModule::balance_count(1, 1), 0); assert_eq!(TemplateModule::balance_count(1, 3), 1000); - assert_eq!(TemplateModule::address_tokens(1, 1), []); + // assert_eq!(TemplateModule::address_tokens(1, 1), []); assert_eq!(TemplateModule::address_tokens(1, 3), [2]); assert_eq!(TemplateModule::approved(1, (1, 1)).len(), 0); @@ -780,103 +681,44 @@ #[test] fn change_collection_owner() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::change_collection_owner( origin1.clone(), - 1, + collection_id, 2 )); - assert_eq!(TemplateModule::collection(1).owner, 2); + assert_eq!(TemplateModule::collection(collection_id).owner, 2); }); } #[test] fn destroy_collection() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_ok!(TemplateModule::destroy_collection(origin1.clone(), 1)); + assert_ok!(TemplateModule::destroy_collection(origin1.clone(), collection_id)); }); } #[test] fn burn_nft_item() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); - - assert_eq!(TemplateModule::nft_item_id(1, 1).data, [1, 2, 3].to_vec()); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2)); + + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); // check balance (collection with id = 1, user id = 1) assert_eq!(TemplateModule::balance_count(1, 1), 1); @@ -895,36 +737,15 @@ #[test] fn burn_fungible_item() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::Fungible(3); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::Fungible(3), 1); + let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [].to_vec(), - 1 - )); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2)); + + let data = default_fungible_data(); + create_test_item(collection_id, &data.into()); // check balance (collection with id = 1, user id = 1) assert_eq!(TemplateModule::balance_count(1, 1), 1000); @@ -943,55 +764,27 @@ #[test] fn burn_refungible_item() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::ReFungible(200, 3); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::ReFungible(3), 1); let origin1 = Origin::signed(1); - let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_mint_permission( origin1.clone(), - 1, + collection_id, true )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1)); assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); - assert_ok!(TemplateModule::create_item( - origin2.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); - - assert_eq!( - TemplateModule::refungible_item_id(1, 1).data, - [1, 2, 3].to_vec() - ); + + let data = default_re_fungible_data(); + create_test_item(collection_id, &data.into()); // check balance (collection with id = 1, user id = 2) assert_eq!(TemplateModule::balance_count(1, 1), 1000); @@ -1010,110 +803,38 @@ #[test] fn add_collection_admin() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - + default_limits(); + + let collection1_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1); + create_test_collection_for_owner(&CollectionMode::NFT, 2, 2); + create_test_collection_for_owner(&CollectionMode::NFT, 3, 3); + let origin1 = Origin::signed(1); - let origin2 = Origin::signed(2); - let origin3 = Origin::signed(3); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode.clone() - )); - assert_ok!(TemplateModule::create_collection( - origin2.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode.clone() - )); - assert_ok!(TemplateModule::create_collection( - origin3.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode.clone() - )); - - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_eq!(TemplateModule::collection(2).owner, 2); - assert_eq!(TemplateModule::collection(3).owner, 3); // collection admin - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 3)); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection1_id, 2)); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection1_id, 3)); - assert_eq!(TemplateModule::admin_list_collection(1).contains(&2), true); - assert_eq!(TemplateModule::admin_list_collection(1).contains(&3), true); + assert_eq!(TemplateModule::admin_list_collection(collection1_id).contains(&2), true); + assert_eq!(TemplateModule::admin_list_collection(collection1_id).contains(&3), true); }); } #[test] fn remove_collection_admin() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection1_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1); + create_test_collection_for_owner(&CollectionMode::NFT, 2, 2); + create_test_collection_for_owner(&CollectionMode::NFT, 3, 3); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - let origin3 = Origin::signed(3); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode.clone() - )); - assert_ok!(TemplateModule::create_collection( - origin2.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode.clone() - )); - assert_ok!(TemplateModule::create_collection( - origin3.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode.clone() - )); - - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_eq!(TemplateModule::collection(2).owner, 2); - assert_eq!(TemplateModule::collection(3).owner, 3); - // collection admin - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 3)); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection1_id, 2)); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection1_id, 3)); assert_eq!(TemplateModule::admin_list_collection(1).contains(&2), true); assert_eq!(TemplateModule::admin_list_collection(1).contains(&3), true); @@ -1131,125 +852,48 @@ #[test] fn balance_of() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let nft_mode: CollectionMode = CollectionMode::NFT(2000); - let furg_mode: CollectionMode = CollectionMode::Fungible(3); - let refung_mode: CollectionMode = CollectionMode::ReFungible(2000, 3); - - let origin1 = Origin::signed(1); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - nft_mode.clone() - )); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - furg_mode.clone() - )); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - refung_mode.clone() - )); - - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_eq!(TemplateModule::collection(2).owner, 1); - assert_eq!(TemplateModule::collection(3).owner, 1); - + default_limits(); + + let nft_collection_id = create_test_collection(&CollectionMode::NFT, 1); + let fungible_collection_id = create_test_collection(&CollectionMode::Fungible(3), 2); + let re_fungible_collection_id = create_test_collection(&CollectionMode::ReFungible(3), 3); + // check balance before - assert_eq!(TemplateModule::balance_count(1, 1), 0); - assert_eq!(TemplateModule::balance_count(2, 1), 0); - assert_eq!(TemplateModule::balance_count(3, 1), 0); - - // create item - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 1, 1].to_vec(), - 1 - )); + assert_eq!(TemplateModule::balance_count(nft_collection_id, 1), 0); + assert_eq!(TemplateModule::balance_count(fungible_collection_id, 1), 0); + assert_eq!(TemplateModule::balance_count(re_fungible_collection_id, 1), 0); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 2, - [].to_vec(), - 1 - )); - - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 3, - [1, 1, 1].to_vec(), - 1 - )); + let nft_data = default_nft_data(); + create_test_item(nft_collection_id, &nft_data.into()); + + let fungible_data = default_fungible_data(); + create_test_item(fungible_collection_id, &fungible_data.into()); + + let re_fungible_data = default_re_fungible_data(); + create_test_item(re_fungible_collection_id, &re_fungible_data.into()); // check balance (collection with id = 1, user id = 1) - assert_eq!(TemplateModule::balance_count(1, 1), 1); - assert_eq!(TemplateModule::balance_count(2, 1), 1000); - assert_eq!(TemplateModule::balance_count(3, 1), 1000); - assert_eq!(TemplateModule::nft_item_id(1, 1).owner, 1); - assert_eq!(TemplateModule::fungible_item_id(2, 1).owner, 1); - assert_eq!(TemplateModule::refungible_item_id(3, 1).owner[0].owner, 1); + assert_eq!(TemplateModule::balance_count(nft_collection_id, 1), 1); + assert_eq!(TemplateModule::balance_count(fungible_collection_id, 1), 1000); + assert_eq!(TemplateModule::balance_count(re_fungible_collection_id, 1), 1000); + assert_eq!(TemplateModule::nft_item_id(nft_collection_id, 1).owner, 1); + assert_eq!(TemplateModule::fungible_item_id(fungible_collection_id, 1).owner, 1); + assert_eq!(TemplateModule::refungible_item_id(re_fungible_collection_id, 1).owner[0].owner, 1); }); } #[test] fn approve() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let nft_mode: CollectionMode = CollectionMode::NFT(2000); - let origin1 = Origin::signed(1); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - nft_mode.clone() - )); - - assert_eq!(TemplateModule::collection(1).owner, 1); - - // create item - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 1, 1].to_vec(), - 1 - )); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); + let origin1 = Origin::signed(1); + // approve assert_ok!(TemplateModule::approve(origin1.clone(), 2, 1, 1)); assert_eq!(TemplateModule::approved(1, (1, 1))[0].approved, 2); @@ -1259,40 +903,14 @@ #[test] fn transfer_from() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_eq!(TemplateModule::collection(1).owner, 1); - - // create item - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 1, 1].to_vec(), - 1 - )); + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); // approve assert_ok!(TemplateModule::approve(origin1.clone(), 2, 1, 1)); @@ -1335,99 +953,41 @@ #[test] fn owner_can_add_address_to_white_list() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - let origin1 = Origin::signed(1); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); - assert_eq!(TemplateModule::white_list(1)[0], 2); + let origin1 = Origin::signed(1); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); + assert_eq!(TemplateModule::white_list(collection_id)[0], 2); }); } #[test] fn admin_can_add_address_to_white_list() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); - assert_ok!(TemplateModule::add_to_white_list(origin2.clone(), 1, 3)); - assert_eq!(TemplateModule::white_list(1)[0], 3); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin2.clone(), collection_id, 3)); + assert_eq!(TemplateModule::white_list(collection_id)[0], 3); }); } #[test] fn nonprivileged_user_cannot_add_address_to_white_list() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - let origin1 = Origin::signed(1); - let origin2 = Origin::signed(2); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + let origin2 = Origin::signed(2); assert_noop!( - TemplateModule::add_to_white_list(origin2.clone(), 1, 3), + TemplateModule::add_to_white_list(origin2.clone(), collection_id, 3), "You do not have permissions to modify this collection" ); }); @@ -1436,17 +996,9 @@ #[test] fn nobody_can_add_address_to_white_list_of_nonexisting_collection() { new_test_ext().execute_with(|| { + default_limits(); + let origin1 = Origin::signed(1); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); assert_noop!( TemplateModule::add_to_white_list(origin1.clone(), 1, 2), @@ -1458,33 +1010,14 @@ #[test] fn nobody_can_add_address_to_white_list_of_deleted_collection() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - let origin1 = Origin::signed(1); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::destroy_collection(origin1.clone(), 1)); + let origin1 = Origin::signed(1); + assert_ok!(TemplateModule::destroy_collection(origin1.clone(), collection_id)); assert_noop!( - TemplateModule::add_to_white_list(origin1.clone(), 1, 2), + TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2), "This collection does not exist" ); }); @@ -1494,166 +1027,81 @@ #[test] fn address_is_already_added_to_white_list() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); - assert_eq!(TemplateModule::white_list(1)[0], 2); - assert_eq!(TemplateModule::white_list(1).len(), 1); + + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); + assert_eq!(TemplateModule::white_list(collection_id)[0], 2); + assert_eq!(TemplateModule::white_list(collection_id).len(), 1); }); } #[test] fn owner_can_remove_address_from_white_list() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - let origin1 = Origin::signed(1); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); + let origin1 = Origin::signed(1); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); assert_ok!(TemplateModule::remove_from_white_list( origin1.clone(), - 1, + collection_id, 2 )); - assert_eq!(TemplateModule::white_list(1).len(), 0); + assert_eq!(TemplateModule::white_list(collection_id).len(), 0); }); } #[test] fn admin_can_remove_address_from_white_list() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2)); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 3)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 3)); assert_ok!(TemplateModule::remove_from_white_list( origin2.clone(), - 1, + collection_id, 3 )); - assert_eq!(TemplateModule::white_list(1).len(), 0); + assert_eq!(TemplateModule::white_list(collection_id).len(), 0); }); } #[test] fn nonprivileged_user_cannot_remove_address_from_white_list() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); assert_noop!( - TemplateModule::remove_from_white_list(origin2.clone(), 1, 2), + TemplateModule::remove_from_white_list(origin2.clone(), collection_id, 2), "You do not have permissions to modify this collection" ); - assert_eq!(TemplateModule::white_list(1)[0], 2); + assert_eq!(TemplateModule::white_list(collection_id)[0], 2); }); } #[test] fn nobody_can_remove_address_from_white_list_of_nonexisting_collection() { new_test_ext().execute_with(|| { + default_limits(); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - assert_noop!( TemplateModule::remove_from_white_list(origin1.clone(), 1, 2), "This collection does not exist" @@ -1664,38 +1112,19 @@ #[test] fn nobody_can_remove_address_from_white_list_of_deleted_collection() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); - assert_ok!(TemplateModule::destroy_collection(origin1.clone(), 1)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); + assert_ok!(TemplateModule::destroy_collection(origin1.clone(), collection_id)); assert_noop!( - TemplateModule::remove_from_white_list(origin2.clone(), 1, 2), + TemplateModule::remove_from_white_list(origin2.clone(), collection_id, 2), "This collection does not exist" ); - assert_eq!(TemplateModule::white_list(1).len(), 0); + assert_eq!(TemplateModule::white_list(collection_id).len(), 0); }); } @@ -1703,42 +1132,23 @@ #[test] fn address_is_already_removed_from_white_list() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); assert_ok!(TemplateModule::remove_from_white_list( origin1.clone(), - 1, + collection_id, 2 )); assert_ok!(TemplateModule::remove_from_white_list( origin1.clone(), - 1, + collection_id, 2 )); - assert_eq!(TemplateModule::white_list(1).len(), 0); + assert_eq!(TemplateModule::white_list(collection_id).len(), 0); }); } @@ -1746,44 +1156,21 @@ #[test] fn white_list_test_1() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); assert_noop!( TemplateModule::transfer(origin1.clone(), 3, 1, 1, 1), @@ -1795,41 +1182,17 @@ #[test] fn white_list_test_2() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1)); @@ -1856,41 +1219,18 @@ #[test] fn white_list_test_3() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); + + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); - assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1)); @@ -1905,45 +1245,22 @@ #[test] fn white_list_test_4() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1)); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 1)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); // do approve assert_ok!(TemplateModule::approve(origin1.clone(), 1, 1, 1)); @@ -1951,7 +1268,7 @@ assert_ok!(TemplateModule::remove_from_white_list( origin1.clone(), - 1, + collection_id, 2 )); @@ -1966,41 +1283,18 @@ #[test] fn white_list_test_5() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_noop!( @@ -2014,32 +1308,14 @@ #[test] fn white_list_test_6() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); @@ -2056,45 +1332,22 @@ #[test] fn white_list_test_7() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); + let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); - assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1)); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 1)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); assert_ok!(TemplateModule::transfer(origin1.clone(), 2, 1, 1, 1)); }); @@ -2103,45 +1356,22 @@ #[test] fn white_list_test_8() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); + let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_eq!(TemplateModule::collection(1).owner, 1); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); - assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 1)); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 1)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); // do approve assert_ok!(TemplateModule::approve(origin1.clone(), 1, 1, 1)); @@ -2162,47 +1392,24 @@ #[test] fn white_list_test_9() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::set_mint_permission( origin1.clone(), - 1, + collection_id, false )); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); }); } @@ -2210,49 +1417,31 @@ #[test] fn white_list_test_10() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::set_mint_permission( origin1.clone(), - 1, + collection_id, false )); - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2)); assert_ok!(TemplateModule::create_item( origin2.clone(), - 1, - [1, 2, 3].to_vec(), - 2 + collection_id, + 2, + default_nft_data().into() )); }); } @@ -2261,46 +1450,28 @@ #[test] fn white_list_test_11() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::set_mint_permission( origin1.clone(), - 1, + collection_id, false )); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); assert_noop!( - TemplateModule::create_item(origin2.clone(), 1, [1, 2, 3].to_vec(), 2), - "Collection is not in mint mode" + TemplateModule::create_item(origin2.clone(), 1, 2, default_nft_data().into()), + "Public minting is not allowed for this collection." ); }); } @@ -2309,45 +1480,27 @@ #[test] fn white_list_test_12() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::set_mint_permission( origin1.clone(), - 1, + collection_id, false )); assert_noop!( - TemplateModule::create_item(origin2.clone(), 1, [1, 2, 3].to_vec(), 2), - "Collection is not in mint mode" + TemplateModule::create_item(origin2.clone(), 1, 2, default_nft_data().into()), + "Public minting is not allowed for this collection." ); }); } @@ -2356,47 +1509,25 @@ #[test] fn white_list_test_13() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::set_mint_permission( origin1.clone(), - 1, + collection_id, true )); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + let data = default_nft_data(); + create_test_item(collection_id, &data.into()); }); } @@ -2404,49 +1535,31 @@ #[test] fn white_list_test_14() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::set_mint_permission( origin1.clone(), - 1, + collection_id, true )); - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2)); assert_ok!(TemplateModule::create_item( origin2.clone(), 1, - [1, 2, 3].to_vec(), - 2 + 2, + default_nft_data().into() )); }); } @@ -2455,44 +1568,26 @@ #[test] fn white_list_test_15() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::set_mint_permission( origin1.clone(), - 1, + collection_id, true )); assert_noop!( - TemplateModule::create_item(origin2.clone(), 1, [1, 2, 3].to_vec(), 2), + TemplateModule::create_item(origin2.clone(), 1, 2, default_nft_data().into()), "Address is not in white list" ); }); @@ -2502,48 +1597,30 @@ #[test] fn white_list_test_16() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); let origin2 = Origin::signed(2); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); assert_ok!(TemplateModule::set_public_access_mode( origin1.clone(), - 1, + collection_id, AccessMode::WhiteList )); assert_ok!(TemplateModule::set_mint_permission( origin1.clone(), - 1, + collection_id, true )); - assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), 1, 2)); + assert_ok!(TemplateModule::add_to_white_list(origin1.clone(), collection_id, 2)); assert_ok!(TemplateModule::create_item( origin2.clone(), 1, - [1, 2, 3].to_vec(), - 2 + 2, + default_nft_data().into() )); }); } @@ -2552,29 +1629,9 @@ #[test] fn total_number_collections_bound() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); + default_limits(); + + create_test_collection(&CollectionMode::NFT, 1); }); } @@ -2582,41 +1639,25 @@ #[test] fn total_number_collections_bound_neg() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); + default_limits(); let origin1 = Origin::signed(1); - - for _ in 0..10 { - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode.clone() - )); + for i in 0..default_collection_numbers_limit() { + create_test_collection(&CollectionMode::NFT, i + 1); } + let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); + let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); + let token_prefix1: Vec = b"token_prefix1\0".to_vec(); + // 11-th collection in chain. Expects error assert_noop!(TemplateModule::create_collection( origin1.clone(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), - mode.clone() + CollectionMode::NFT ), "Total collections bound exceeded"); }); } @@ -2625,43 +1666,13 @@ #[test] fn owned_tokens_bound() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { - collection_numbers_limit: 10, - account_token_ownership_limit: 10, - collections_admins_limit: 5, - custom_data_limit: 2048, - nft_sponsor_transfer_timeout: 15, - fungible_sponsor_transfer_timeout: 15, - refungible_sponsor_transfer_timeout: 15, - })); - - let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + let data = default_nft_data(); + create_test_item(collection_id, &data.clone().into()); + create_test_item(collection_id, &data.into()); }); } @@ -2669,11 +1680,6 @@ #[test] fn owned_tokens_bound_neg() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { collection_numbers_limit: 10, account_token_ownership_limit: 1, @@ -2683,28 +1689,18 @@ fungible_sponsor_transfer_timeout: 15, refungible_sponsor_transfer_timeout: 15, })); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::create_item( - origin1.clone(), - 1, - [1, 2, 3].to_vec(), - 1 - )); + let data = default_nft_data(); + create_test_item(collection_id, &data.clone().into()); assert_noop!(TemplateModule::create_item( origin1.clone(), 1, - [1, 2, 3].to_vec(), - 1 + 1, + data.into() ), "Owned tokens by a single address bound exceeded"); }); } @@ -2713,11 +1709,6 @@ #[test] fn collection_admins_bound() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { collection_numbers_limit: 10, account_token_ownership_limit: 10, @@ -2727,18 +1718,13 @@ fungible_sponsor_transfer_timeout: 15, refungible_sponsor_transfer_timeout: 15, })); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 3)); + + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2)); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 3)); }); } @@ -2746,11 +1732,6 @@ #[test] fn collection_admins_bound_neg() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); - assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { collection_numbers_limit: 10, account_token_ownership_limit: 1, @@ -2760,78 +1741,167 @@ fungible_sponsor_transfer_timeout: 15, refungible_sponsor_transfer_timeout: 15, })); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( - origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); - assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), 1, 2)); - assert_noop!(TemplateModule::add_collection_admin(origin1.clone(), 1, 3), "Number of collection admins bound exceeded"); + assert_ok!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 2)); + assert_noop!(TemplateModule::add_collection_admin(origin1.clone(), collection_id, 3), "Number of collection admins bound exceeded"); }); } -// Custom data size. Positive test +// NFT custom data size. Negative test const_data. #[test] -fn custom_data_size_bound() { +fn custom_data_size_nft_const_data_bound_neg() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { + collection_numbers_limit: 10, + account_token_ownership_limit: 10, + collections_admins_limit: 5, + custom_data_limit: 2, + nft_sponsor_transfer_timeout: 15, + fungible_sponsor_transfer_timeout: 15, + refungible_sponsor_transfer_timeout: 15, + })); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + let origin1 = Origin::signed(1); + let too_big_const_data = CreateItemData::NFT(CreateNftData{ + const_data: vec![1, 2, 3, 4], + variable_data: vec![] + }); + + assert_noop!(TemplateModule::create_item( + origin1.clone(), + collection_id, + 1, + too_big_const_data + ), "const_data exceeded data limit."); + }); +} + +// NFT custom data size. Negative test variable_data. +#[test] +fn custom_data_size_nft_variable_data_bound_neg() { + new_test_ext().execute_with(|| { assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { collection_numbers_limit: 10, account_token_ownership_limit: 10, collections_admins_limit: 5, - custom_data_limit: 2048, + custom_data_limit: 2, nft_sponsor_transfer_timeout: 15, fungible_sponsor_transfer_timeout: 15, refungible_sponsor_transfer_timeout: 15, })); + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + let origin1 = Origin::signed(1); - assert_ok!(TemplateModule::create_collection( + let too_big_const_data = CreateItemData::NFT(CreateNftData{ + const_data: vec![], + variable_data: vec![1, 2, 3, 4] + }); + + assert_noop!(TemplateModule::create_item( origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - )); + collection_id, + 1, + too_big_const_data + ), "variable_data exceeded data limit."); }); } -// Custom data size. Negotive test +// Re fungible custom data size. Negative test const_data. #[test] -fn custom_data_size_bound_neg() { +fn custom_data_size_re_fungible_const_data_bound_neg() { new_test_ext().execute_with(|| { - let col_name1: Vec = "Test1\0".encode_utf16().collect::>(); - let col_desc1: Vec = "TestDescription1\0".encode_utf16().collect::>(); - let token_prefix1: Vec = b"token_prefix1\0".to_vec(); - let mode: CollectionMode = CollectionMode::NFT(2000); + assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { + collection_numbers_limit: 10, + account_token_ownership_limit: 10, + collections_admins_limit: 5, + custom_data_limit: 2, + nft_sponsor_transfer_timeout: 15, + fungible_sponsor_transfer_timeout: 15, + refungible_sponsor_transfer_timeout: 15, + })); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + + let origin1 = Origin::signed(1); + let too_big_const_data = CreateItemData::NFT(CreateNftData{ + const_data: vec![1, 2, 3, 4], + variable_data: vec![] + }); + + assert_noop!(TemplateModule::create_item( + origin1.clone(), + collection_id, + 1, + too_big_const_data + ), "const_data exceeded data limit."); + }); +} +// Re fungible custom data size. Negative test variable_data. +#[test] +fn custom_data_size_re_fungible_variable_data_bound_neg() { + new_test_ext().execute_with(|| { assert_ok!(TemplateModule::set_chain_limits(RawOrigin::Root.into(), ChainLimits { collection_numbers_limit: 10, account_token_ownership_limit: 10, collections_admins_limit: 5, - custom_data_limit: 200, + custom_data_limit: 2, nft_sponsor_transfer_timeout: 15, fungible_sponsor_transfer_timeout: 15, refungible_sponsor_transfer_timeout: 15, })); + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + let origin1 = Origin::signed(1); - assert_noop!(TemplateModule::create_collection( + let too_big_const_data = CreateItemData::NFT(CreateNftData{ + const_data: vec![], + variable_data: vec![1, 2, 3, 4] + }); + + assert_noop!(TemplateModule::create_item( origin1.clone(), - col_name1.clone(), - col_desc1.clone(), - token_prefix1.clone(), - mode - ), "Custom data size bound exceeded"); + collection_id, + 1, + too_big_const_data + ), "variable_data exceeded data limit."); }); } // #endregion + +#[test] +fn set_const_on_chain_schema() { + new_test_ext().execute_with(|| { + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + + let origin1 = Origin::signed(1); + assert_ok!(TemplateModule::set_const_on_chain_schema(origin1, collection_id, b"test const on chain schema".to_vec())); + + assert_eq!(TemplateModule::collection(collection_id).const_on_chain_schema, b"test const on chain schema".to_vec()); + assert_eq!(TemplateModule::collection(collection_id).variable_on_chain_schema, b"".to_vec()); + }); +} + +#[test] +fn set_variable_on_chain_schema() { + new_test_ext().execute_with(|| { + default_limits(); + + let collection_id = create_test_collection(&CollectionMode::NFT, 1); + + let origin1 = Origin::signed(1); + assert_ok!(TemplateModule::set_variable_on_chain_schema(origin1, collection_id, b"test variable on chain schema".to_vec())); + + assert_eq!(TemplateModule::collection(collection_id).const_on_chain_schema, b"".to_vec()); + assert_eq!(TemplateModule::collection(collection_id).variable_on_chain_schema, b"test variable on chain schema".to_vec()); + }); +} \ No newline at end of file --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -1,186 +1,3 @@ -[dependencies.aura] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-aura' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.balances] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-balances' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[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 = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.contracts-primitives] -git = 'https://github.com/usetech-llc/substrate.git' -default-features = false -package = 'pallet-contracts-primitives' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[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-rc4' -branch = 'rc4_ext_dispatch_reenabled' - -[dependencies.frame-executive] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.frame-support] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.grandpa] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-grandpa' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.randomness-collective-flip] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-randomness-collective-flip' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[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 = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-block-builder] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-consensus-aura] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '0.8.0-rc4' - -[dependencies.sp-core] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-inherents] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-io] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-offchain] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-runtime] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-session] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-std] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-transaction-pool] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sp-version] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.sudo] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-sudo' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.system] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'frame-system' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.nft] -default-features = false -package = 'pallet-nft' -path = '../pallets/nft' -version = '2.0.0-rc4' - -[dependencies.timestamp] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-timestamp' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' - -[dependencies.transaction-payment] -default-features = false -git = 'https://github.com/usetech-llc/substrate.git' -package = 'pallet-transaction-payment' -branch = 'rc4_ext_dispatch_reenabled' -version = '2.0.0-rc4' -[build-dependencies.wasm-builder-runner] -git = 'https://github.com/usetech-llc/substrate.git' -package = 'substrate-wasm-builder-runner' -branch = 'rc4_ext_dispatch_reenabled' -version = '1.0.5' - [package] authors = ['Substrate DevHub '] edition = '2018' @@ -188,39 +5,99 @@ license = 'Unlicense' name = 'nft-runtime' repository = 'https://github.com/usetech-llc/nft_parachain/' -version = '2.0.0-rc4' +version = '2.0.0' + [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', + 'pallet-nft/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', - 'grandpa/std', - 'randomness-collective-flip/std', - 'serde', + 'frame-system/std', + 'frame-system-rpc-runtime-api/std', + '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', 'sp-core/std', 'sp-inherents/std', - 'sp-io/std', 'sp-offchain/std', 'sp-runtime/std', 'sp-session/std', 'sp-std/std', 'sp-transaction-pool/std', 'sp-version/std', - 'sudo/std', - 'system/std', - 'timestamp/std', - 'transaction-payment/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; @@ -84,6 +84,8 @@ /// Digest item type. pub type DigestItem = generic::DigestItem; +mod nft_weights; + /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats /// of data like extrinsics, allowing for them to continue syncing the network through upgrades @@ -194,62 +196,69 @@ type AvailableBlockRatio = AvailableBlockRatio; /// Version of the runtime. type Version = Version; - /// Converts a module to the index of the module in `construct_runtime!`. - /// This type is being generated by `construct_runtime!`. - type ModuleToIndex = ModuleToIndex; + /// This type is being generated by `construct_runtime!`. + type PalletInfo = PalletInfo; /// What to do if a new account is created. type OnNewAccount = (); /// 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 { - type Event = Event; - type Call = Call; +impl pallet_grandpa::Trait for Runtime { + type Event = Event; + type Call = Call; - type KeyOwnerProofSystem = (); + type KeyOwnerProofSystem = (); - type KeyOwnerProof = - >::Proof; + type KeyOwnerProof = + >::Proof; - type KeyOwnerIdentification = >::IdentificationTuple; + type KeyOwnerIdentification = >::IdentificationTuple; + + type HandleEquivocation = (); - type HandleEquivocation = (); + type WeightInfo = (); } parameter_types! { pub const MinimumPeriod: u64 = SLOT_DURATION / 2; } -impl timestamp::Trait for Runtime { - /// A timestamp: milliseconds since the unix epoch. - type Moment = u64; - type OnTimestampSet = Aura; - type MinimumPeriod = MinimumPeriod; +impl pallet_timestamp::Trait for Runtime { + /// A timestamp: milliseconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = Aura; + type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); } parameter_types! { // pub const ExistentialDeposit: u128 = 500; pub const ExistentialDeposit: u128 = 0; + pub const MaxLocks: u32 = 50; } -impl balances::Trait for Runtime { - /// The type for recording an account's balance. - type Balance = Balance; - /// The ubiquitous event type. - type Event = Event; - type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; +impl pallet_balances::Trait for Runtime { + type MaxLocks = MaxLocks; + /// The type for recording an account's balance. + type Balance = Balance; + /// The ubiquitous event type. + type Event = Event; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); } pub const MILLICENTS: Balance = 1_000_000_000; @@ -263,46 +272,46 @@ pub const SurchargeReward: Balance = 150 * MILLICENTS; } -impl contracts::Trait for Runtime { - type Call = Call; - type Time = Timestamp; - type Randomness = RandomnessCollectiveFlip; - type Currency = Balances; - type Event = Event; - type DetermineContractAddress = contracts::SimpleAddressDeterminer; - type TrieIdGenerator = contracts::TrieIdFromParentCounter; - type RentPayment = (); - type SignedClaimHandicap = contracts::DefaultSignedClaimHandicap; - type TombstoneDeposit = TombstoneDeposit; - type StorageSizeOffset = contracts::DefaultStorageSizeOffset; - type RentByteFee = RentByteFee; - type RentDepositOffset = RentDepositOffset; - type SurchargeReward = SurchargeReward; - type MaxDepth = contracts::DefaultMaxDepth; - type MaxValueSize = contracts::DefaultMaxValueSize; - type WeightPrice = transaction_payment::Module; +impl pallet_contracts::Trait for Runtime { + type Time = Timestamp; + type Randomness = RandomnessCollectiveFlip; + type Currency = Balances; + type Event = Event; + type DetermineContractAddress = pallet_contracts::SimpleAddressDeterminer; + type TrieIdGenerator = pallet_contracts::TrieIdFromParentCounter; + type RentPayment = (); + type SignedClaimHandicap = pallet_contracts::DefaultSignedClaimHandicap; + type TombstoneDeposit = TombstoneDeposit; + type StorageSizeOffset = pallet_contracts::DefaultStorageSizeOffset; + type RentByteFee = RentByteFee; + type RentDepositOffset = RentDepositOffset; + type SurchargeReward = SurchargeReward; + type MaxDepth = pallet_contracts::DefaultMaxDepth; + type MaxValueSize = pallet_contracts::DefaultMaxValueSize; + type WeightPrice = pallet_transaction_payment::Module; } parameter_types! { - pub const TransactionByteFee: Balance = 1; + pub const TransactionByteFee: Balance = 10 * MILLICENTS; } -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 = (); + 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; + type WeightInfo = nft_weights::WeightInfo; } construct_runtime!( @@ -312,15 +321,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(Timestamp)}, - 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}, } ); @@ -342,7 +351,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; @@ -354,7 +363,7 @@ impl_runtime_apis! { - impl contracts_rpc_runtime_api::ContractsApi + impl pallet_contracts_rpc_runtime_api::ContractsApi for Runtime { fn call( @@ -364,27 +373,28 @@ gas_limit: u64, input_data: Vec, ) -> ContractExecResult { - let exec_result = - Contracts::bare_call(origin, dest.into(), value, gas_limit, input_data); - match exec_result { - Ok(v) => ContractExecResult::Success { - status: v.status, - data: v.data, - }, - Err(_) => ContractExecResult::Error, - } + let (exec_result, gas_consumed) = + Contracts::bare_call(origin, dest.into(), value, gas_limit, input_data); + match exec_result { + Ok(v) => ContractExecResult::Success { + flags: v.flags.bits(), + data: v.data, + gas_consumed: gas_consumed, + }, + Err(_) => ContractExecResult::Error, + } } 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) } } @@ -471,29 +481,74 @@ } } - impl fg_primitives::GrandpaApi for Runtime { - fn grandpa_authorities() -> GrandpaAuthorityList { - Grandpa::grandpa_authorities() - } + impl fg_primitives::GrandpaApi for Runtime { + fn grandpa_authorities() -> GrandpaAuthorityList { + Grandpa::grandpa_authorities() + } - fn submit_report_equivocation_extrinsic( - _equivocation_proof: fg_primitives::EquivocationProof< - ::Hash, - NumberFor, - >, - _key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof, - ) -> Option<()> { - None - } + fn submit_report_equivocation_unsigned_extrinsic( + _equivocation_proof: fg_primitives::EquivocationProof< + ::Hash, + NumberFor, + >, + _key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof, + ) -> Option<()> { + None + } - fn generate_key_ownership_proof( - _set_id: fg_primitives::SetId, - _authority_id: GrandpaId, - ) -> Option { - // NOTE: this is the only implementation possible since we've - // defined our key owner proof type as a bottom type (i.e. a type - // with no values). - None - } + fn generate_key_ownership_proof( + _set_id: fg_primitives::SetId, + _authority_id: GrandpaId, + ) -> Option { + // NOTE: this is the only implementation possible since we've + // defined our key owner proof type as a bottom type (i.e. a type + // with no values). + None + } } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Index { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + fn query_info( + uxt: ::Extrinsic, + len: u32, + ) -> 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}; + + let whitelist: Vec = vec![ + // Alice account + hex_literal::hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d").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, pallet_nft, Nft); + + if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } + Ok(batches) + } + } } --- /dev/null +++ b/runtime/src/nft_weights.rs @@ -0,0 +1,111 @@ +use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; + +pub struct WeightInfo; +impl pallet_nft::WeightInfo for WeightInfo { + fn create_collection() -> Weight { + (70_000_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(5 as Weight)) + } + fn destroy_collection() -> Weight { + (90_000_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(5 as Weight)) + } + fn add_to_white_list() -> Weight { + (30_000_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn remove_from_white_list() -> Weight { + (35_000_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_public_access_mode() -> Weight { + (27_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_mint_permission() -> Weight { + (27_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn change_collection_owner() -> Weight { + (27_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn add_collection_admin() -> Weight { + (32_000_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn remove_collection_admin() -> Weight { + (50_000_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_collection_sponsor() -> Weight { + (32_000_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn confirm_sponsorship() -> Weight { + (22_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn remove_collection_sponsor() -> Weight { + (24_000_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn create_item(s: usize, ) -> Weight { + (130_000_000 as Weight) + .saturating_add((2135 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(10 as Weight)) + .saturating_add(DbWeight::get().writes(8 as Weight)) + } + fn burn_item() -> Weight { + (170_000_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) + .saturating_add(DbWeight::get().writes(7 as Weight)) + } + fn transfer() -> Weight { + (125_000_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(7 as Weight)) + } + fn approve() -> Weight { + (45_000_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn transfer_from() -> Weight { + (150_000_000 as Weight) + .saturating_add(DbWeight::get().reads(9 as Weight)) + .saturating_add(DbWeight::get().writes(8 as Weight)) + } + fn set_offchain_schema() -> Weight { + (33_000_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_const_on_chain_schema() -> Weight { + (11_100_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_variable_on_chain_schema() -> Weight { + (11_100_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_variable_meta_data() -> Weight { + (17_500_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } +} --- a/tests/flipper-src/.gitignore +++ b/tests/flipper-src/.gitignore @@ -6,4 +6,4 @@ # Remove Cargo.lock when creating an executable, leave it for libraries # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock -Cargo.lock +Cargo.lock \ No newline at end of file --- a/tests/flipper-src/.ink/abi_gen/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "abi-gen" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2018" -publish = false - -[[bin]] -name = "abi-gen" -path = "main.rs" - -[dependencies] -contract = { path = "../..", package = "flipper", default-features = false, features = ["ink-generate-abi"] } -ink_lang = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_lang", default-features = false, features = ["ink-generate-abi"] } -serde = "1.0" -serde_json = "1.0" --- a/tests/flipper-src/.ink/abi_gen/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() -> Result<(), std::io::Error> { - let abi = ::generate_abi(); - let contents = serde_json::to_string_pretty(&abi)?; - std::fs::create_dir("target").ok(); - std::fs::write("target/metadata.json", contents)?; - Ok(()) -} --- a/tests/flipper-src/Cargo.toml +++ b/tests/flipper-src/Cargo.toml @@ -1,67 +1,35 @@ [package] name = "flipper" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] +version = "3.0.0-rc1" +authors = ["Parity Technologies "] edition = "2018" [dependencies] -ink_abi = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_abi", default-features = false, features = ["derive"], optional = true } -ink_primitives = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_primitives", default-features = false } -ink_core = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_core", default-features = false } -ink_lang = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_lang", default-features = false } +ink_primitives = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false } +ink_metadata = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false } +ink_storage = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false } +ink_lang = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false } -scale = { package = "parity-scale-codec", version = "1.2", default-features = false, features = ["derive"] } - -[dependencies.type-metadata] -git = "https://github.com/type-metadata/type-metadata.git" -rev = "02eae9f35c40c943b56af5b60616219f2b72b47d" -default-features = false -features = ["derive"] -optional = true +scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } +scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } [lib] name = "flipper" path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", - # Required for ABI generation, and using this contract as a dependency. - # If using `cargo contract build`, it will be automatically disabled to produce a smaller Wasm binary - "rlib", -] +crate-type = ["cdylib"] [features] -default = ["test-env"] +default = ["std"] std = [ - "ink_abi/std", - "ink_core/std", "ink_primitives/std", + "ink_metadata", + "ink_metadata/std", + "ink_env/std", + "ink_storage/std", + "ink_lang/std", "scale/std", - "type-metadata/std", -] -test-env = [ - "std", - "ink_lang/test-env", -] -ink-generate-abi = [ - "std", - "ink_abi", - "type-metadata", - "ink_core/ink-generate-abi", - "ink_lang/ink-generate-abi", -] -ink-as-dependency = [] - -[profile.release] -panic = "abort" -lto = true -opt-level = "z" -overflow-checks = true - -[workspace] -members = [ - ".ink/abi_gen" + "scale-info", + "scale-info/std", ] -exclude = [ - ".ink" -] +ink-as-dependency = [] \ No newline at end of file --- a/tests/flipper-src/build.sh +++ b/tests/flipper-src/build.sh @@ -1,2 +1,3 @@ +rustup component add rust-src --toolchain nightly cargo +nightly contract build cargo +nightly contract generate-metadata --- a/tests/flipper-src/lib.rs +++ b/tests/flipper-src/lib.rs @@ -1,70 +1,64 @@ +// Copyright 2018-2020 Parity Technologies (UK) Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #![cfg_attr(not(feature = "std"), no_std)] use ink_lang as ink; -#[ink::contract(version = "0.1.0")] -mod flipper { - use ink_core::storage; - - /// Defines the storage of your contract. - /// Add new fields to the below struct in order - /// to add new static storage fields to your contract. +#[ink::contract] +pub mod flipper { #[ink(storage)] - struct Flipper { - /// Stores a single `bool` value on the storage. - value: storage::Value, + pub struct Flipper { + value: bool, } impl Flipper { - /// Constructor that initializes the `bool` value to the given `init_value`. + /// Creates a new flipper smart contract initialized with the given value. #[ink(constructor)] - fn new(&mut self, init_value: bool) { - self.value.set(init_value); + pub fn new(init_value: bool) -> Self { + Self { value: init_value } } - /// Constructor that initializes the `bool` value to `false`. - /// - /// Constructors can delegate to other constructors. + /// Creates a new flipper smart contract initialized to `false`. #[ink(constructor)] - fn default(&mut self) { - self.new(false) + pub fn default() -> Self { + Self::new(Default::default()) } - /// A message that can be called on instantiated contracts. - /// This one flips the value of the stored `bool` from `true` - /// to `false` and vice versa. + /// Flips the current value of the Flipper's bool. #[ink(message)] - fn flip(&mut self) { - *self.value = !self.get(); + pub fn flip(&mut self) { + self.value = !self.value; } - /// Simply returns the current value of our `bool`. + /// Returns the current value of the Flipper's bool. #[ink(message)] - fn get(&self) -> bool { - *self.value + pub fn get(&self) -> bool { + self.value } } - /// Unit tests in Rust are normally defined within such a `#[cfg(test)]` - /// module and test functions are marked with a `#[test]` attribute. - /// The below code is technically just normal Rust code. #[cfg(test)] mod tests { - /// Imports all the definitions from the outer scope so we can use them here. use super::*; - /// We test if the default constructor does its job. #[test] fn default_works() { - // Note that even though we defined our `#[ink(constructor)]` - // above as `&mut self` functions that return nothing we can call - // them in test code as if they were normal Rust constructors - // that take no `self` argument but return `Self`. let flipper = Flipper::default(); assert_eq!(flipper.get(), false); } - /// We test a simple use case of our contract. #[test] fn it_works() { let mut flipper = Flipper::new(false); @@ -73,4 +67,4 @@ assert_eq!(flipper.get(), true); } } -} +} \ No newline at end of file --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -3916,282 +3916,143 @@ } }, "@polkadot/api": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.34.1.tgz", - "integrity": "sha512-3gCibNRchH+XbEdULS1bwiV1RgarZW1PDw1Y1mAQBVqPrUpkYqntp1D52SQOpAbRzldkwk296Sj+mx9/IeDRXA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-2.3.1.tgz", + "integrity": "sha512-B9ZOb1PiPaAlke4wQHoivVQ5ZCQWn5bgLjhVIGdcEZ4WjIcxApmzTV4ruSfqVoRKpRiVOyV3Dx/VUQDD/WgBFw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api-derive": "1.34.1", - "@polkadot/keyring": "^3.4.1", - "@polkadot/metadata": "1.34.1", - "@polkadot/rpc-core": "1.34.1", - "@polkadot/rpc-provider": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", + "@babel/runtime": "^7.12.1", + "@polkadot/api-derive": "2.3.1", + "@polkadot/keyring": "^3.6.1", + "@polkadot/metadata": "2.3.1", + "@polkadot/rpc-core": "2.3.1", + "@polkadot/rpc-provider": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/types-known": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", "bn.js": "^5.1.3", "eventemitter3": "^4.0.7", "rxjs": "^6.6.3" }, "dependencies": { - "@polkadot/metadata": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz", - "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3" - } - }, - "@polkadot/types": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz", - "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" - } - }, - "@polkadot/types-known": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz", - "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==", + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "bn.js": "^5.1.3" + "regenerator-runtime": "^0.13.4" } }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/api-contract": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-contract/-/api-contract-1.34.1.tgz", - "integrity": "sha512-oXh7An6E9wdbczXQhw+TfIkoKLQr4t0j3OwxubrhS5Qn6f99xGoAkk0BIKjsHPGIbMHEJoywmmLrDUAeTxExgg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-contract/-/api-contract-2.3.1.tgz", + "integrity": "sha512-hqRU2mGkHK84dtqZSX71tFCuBmBiV/6H7pJwj5E7UPcd124LM2ETXYJ9T0ElxbAHmZQD7yv+2ZM/ncvGC/A68Q==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api": "1.34.1", - "@polkadot/rpc-core": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", + "@babel/runtime": "^7.12.1", + "@polkadot/api": "2.3.1", + "@polkadot/rpc-core": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", "bn.js": "^5.1.3", "rxjs": "^6.6.3" }, "dependencies": { - "@polkadot/api": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.34.1.tgz", - "integrity": "sha512-3gCibNRchH+XbEdULS1bwiV1RgarZW1PDw1Y1mAQBVqPrUpkYqntp1D52SQOpAbRzldkwk296Sj+mx9/IeDRXA==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api-derive": "1.34.1", - "@polkadot/keyring": "^3.4.1", - "@polkadot/metadata": "1.34.1", - "@polkadot/rpc-core": "1.34.1", - "@polkadot/rpc-provider": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3", - "eventemitter3": "^4.0.7", - "rxjs": "^6.6.3" - } - }, - "@polkadot/api-derive": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-1.34.1.tgz", - "integrity": "sha512-LMlCkNJRp29MwKa36crYuY6cZpnkHCFrPCv9dmJEuDbMqrK+EAhXM9/6sTDYJ4uKNhyetJKe9rXslkXdI6pidA==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api": "1.34.1", - "@polkadot/rpc-core": "1.34.1", - "@polkadot/rpc-provider": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" - } - }, - "@polkadot/metadata": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz", - "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3" - } - }, - "@polkadot/rpc-core": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-1.34.1.tgz", - "integrity": "sha512-BVQDyBEkbRe5b/u8p9UPpTCj0sDZ32sTmPEP43Klc4s9+oHtiNvOFYvkjK5oyW9dlcOwXi8HpLsQxGAeMtM7Tw==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/rpc-provider": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" - } - }, - "@polkadot/rpc-provider": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-1.34.1.tgz", - "integrity": "sha512-bebeis9mB4LS9Spk1WSHoadZHsyHmK4gyyC6uKSLZxHZmnopWna6zWnOBIrYHRz7qDHSZC5eNTseuU8NJXtscA==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "@polkadot/x-fetch": "^0.3.2", - "@polkadot/x-ws": "^0.3.2", - "bn.js": "^5.1.3", - "eventemitter3": "^4.0.7" - } - }, - "@polkadot/types": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz", - "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" - } - }, - "@polkadot/types-known": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz", - "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==", + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "bn.js": "^5.1.3" + "regenerator-runtime": "^0.13.4" } }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/api-derive": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-1.34.1.tgz", - "integrity": "sha512-LMlCkNJRp29MwKa36crYuY6cZpnkHCFrPCv9dmJEuDbMqrK+EAhXM9/6sTDYJ4uKNhyetJKe9rXslkXdI6pidA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-2.3.1.tgz", + "integrity": "sha512-FcDEx+/1Io7zOHPjbQAEzXB0KenA9emgY+96aHS4yPV/OVmAifU0IAxudZdMVp7uVC2dWq9iFvjxx84yCXgVRA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/api": "1.34.1", - "@polkadot/rpc-core": "1.34.1", - "@polkadot/rpc-provider": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", + "@babel/runtime": "^7.12.1", + "@polkadot/api": "2.3.1", + "@polkadot/rpc-core": "2.3.1", + "@polkadot/rpc-provider": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", "bn.js": "^5.1.3", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "dependencies": { - "@polkadot/metadata": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz", - "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3" - } - }, - "@polkadot/types": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz", - "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" - } - }, - "@polkadot/types-known": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz", - "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==", + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "bn.js": "^5.1.3" + "regenerator-runtime": "^0.13.4" } }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, @@ -4277,193 +4138,193 @@ } }, "@polkadot/keyring": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-3.4.1.tgz", - "integrity": "sha512-x8FxzDzyFX5ai+tnPaxAFUBV/2Mw/om8sRoMh+fT6Jzh3nC7pXfecH5ticJPKe73v/y42hn9xM0tiAI5P8Ohcw==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-3.6.1.tgz", + "integrity": "sha512-JbW4M5Ct3HaX3vgoa/UWAQVF/0sc1PbbA2D6v0KKaJkXl+EYVP9uyOYAoRCppB6ENZThz7CUJVQp8trs8WTrFQ==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.4.1", - "@polkadot/util-crypto": "3.4.1" + "@babel/runtime": "^7.12.1", + "@polkadot/util": "3.6.1", + "@polkadot/util-crypto": "3.6.1" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/metadata": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz", - "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-2.3.1.tgz", + "integrity": "sha512-F/QwDDR/d9mcqToDqndRTUYvMt/GYzjQ+kNGjQYBOIDRqF9zDbPHAXruqcHd0Y5MMpPMRBZGNaqPOb3BMrIdOQ==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", + "@babel/runtime": "^7.12.1", + "@polkadot/types": "2.3.1", + "@polkadot/types-known": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", "bn.js": "^5.1.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, + "@polkadot/networks": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-3.6.1.tgz", + "integrity": "sha512-PEEw/vTZaKf32vuAUeFXYNJei+b/s3hr7msMKfvoYeKDU/otgt9Mgkqrh6VCaE6+lHHgX8vLbH70pCqQrGG/uA==", + "requires": { + "@babel/runtime": "^7.12.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, "@polkadot/rpc-core": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-1.34.1.tgz", - "integrity": "sha512-BVQDyBEkbRe5b/u8p9UPpTCj0sDZ32sTmPEP43Klc4s9+oHtiNvOFYvkjK5oyW9dlcOwXi8HpLsQxGAeMtM7Tw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-2.3.1.tgz", + "integrity": "sha512-SWYU6azxNwWkhz6bm/wpRPQZ/5KJ2hnEXPS4EN77q7EFH4c4k9mNtVyjUQFkKJsG7T85vxaCCWwhx60aYCZVeA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/rpc-provider": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", + "@babel/runtime": "^7.12.1", + "@polkadot/metadata": "2.3.1", + "@polkadot/rpc-provider": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "dependencies": { - "@polkadot/metadata": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz", - "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3" - } - }, - "@polkadot/types": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz", - "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==", + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" + "regenerator-runtime": "^0.13.4" } }, - "@polkadot/types-known": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz", - "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "bn.js": "^5.1.3" - } - }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/rpc-provider": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-1.34.1.tgz", - "integrity": "sha512-bebeis9mB4LS9Spk1WSHoadZHsyHmK4gyyC6uKSLZxHZmnopWna6zWnOBIrYHRz7qDHSZC5eNTseuU8NJXtscA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-2.3.1.tgz", + "integrity": "sha512-lRN68RosWvtBA844PWqhYEV2ifT3T9SUyAP2WvRYyWVPiMmXjw57qG1zHKQWgZk5aFzeaHKSYgsKTmkWz9IM4g==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "@polkadot/x-fetch": "^0.3.2", - "@polkadot/x-ws": "^0.3.2", + "@babel/runtime": "^7.12.1", + "@polkadot/metadata": "2.3.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", + "@polkadot/x-fetch": "^0.3.3", + "@polkadot/x-ws": "^0.3.3", "bn.js": "^5.1.3", "eventemitter3": "^4.0.7" }, "dependencies": { - "@polkadot/metadata": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz", - "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==", + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/types-known": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "bn.js": "^5.1.3" - } - }, - "@polkadot/types": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz", - "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", - "@types/bn.js": "^4.11.6", - "bn.js": "^5.1.3", - "memoizee": "^0.4.14", - "rxjs": "^6.6.3" - } - }, - "@polkadot/types-known": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz", - "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==", - "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", - "bn.js": "^5.1.3" + "regenerator-runtime": "^0.13.4" } }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, @@ -4477,58 +4338,88 @@ } }, "@polkadot/types": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz", - "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-2.3.1.tgz", + "integrity": "sha512-G3cyYYV+vYmpkMjPirwOA/zLreb1uBrKpEMWTvtTuCz/sNwcbCT5hI/KZCzNo1PueOQAowroKPe4yQ793dqVPw==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/metadata": "1.34.1", - "@polkadot/util": "^3.4.1", - "@polkadot/util-crypto": "^3.4.1", + "@babel/runtime": "^7.12.1", + "@polkadot/metadata": "2.3.1", + "@polkadot/util": "^3.6.1", + "@polkadot/util-crypto": "^3.6.1", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "memoizee": "^0.4.14", "rxjs": "^6.6.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, "@polkadot/types-known": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz", - "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-2.3.1.tgz", + "integrity": "sha512-34yuvDraW9Sjy5ookQZf55sBKLOsTqos+WQdTu6DUxtRuwvMP9DEAGcs2m6AFvWxwZps+3zFGUvzn6SMHsSJ5Q==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/types": "1.34.1", - "@polkadot/util": "^3.4.1", + "@babel/runtime": "^7.12.1", + "@polkadot/types": "2.3.1", + "@polkadot/util": "^3.6.1", "bn.js": "^5.1.3" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, @@ -4546,12 +4437,13 @@ } }, "@polkadot/util-crypto": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.4.1.tgz", - "integrity": "sha512-RdTAiJ6dFE8nQJ7/wQkvYa6aNZG3Lusf/r7UmPJ56dZldvDTP3OdekzcfYdogU8hSJrE/xX84ii4DrHLnXXfAQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.6.1.tgz", + "integrity": "sha512-mRCijOXrxTa2JD5vpNvr1MHSj3NaSGaImg1yzAf3l7nw7zNGjLy1K3qQNcFgr8+0NHyPKk5lCIehtwGTRZYsiA==", "requires": { - "@babel/runtime": "^7.11.2", - "@polkadot/util": "3.4.1", + "@babel/runtime": "^7.12.1", + "@polkadot/networks": "3.6.1", + "@polkadot/util": "3.6.1", "@polkadot/wasm-crypto": "^1.4.1", "base-x": "^3.0.8", "bip39": "^3.0.2", @@ -4565,18 +4457,33 @@ "xxhashjs": "^0.2.2" }, "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, "@polkadot/util": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz", - "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz", + "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", + "@polkadot/x-textdecoder": "^0.3.3", + "@polkadot/x-textencoder": "^0.3.3", "@types/bn.js": "^4.11.6", "bn.js": "^5.1.3", "camelcase": "^5.3.1", "chalk": "^4.1.0", - "ip-regex": "^4.1.0" + "ip-regex": "^4.2.0" } + }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" } } }, @@ -4586,30 +4493,79 @@ "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ==" }, "@polkadot/x-fetch": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-0.3.2.tgz", - "integrity": "sha512-lk9M8ql/kBBqiZ8KOWj7LFK7P9OxDgVn2fZPNELJzQbfFZwFF8umBPDIWlQIK7wTnlRsQlzOuf6MGEyMK5p42w==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-0.3.3.tgz", + "integrity": "sha512-Osa+ifkqlndIW5U5jLnuugLYTd6q/cHkjdfisyYgNev/etsEtXkqesbGvF/UKw5FgZBxhK8sj6jjfProfh2NZw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", "@types/node-fetch": "^2.5.7", "node-fetch": "^2.6.1" }, "dependencies": { - "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, + "@polkadot/x-textdecoder": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-0.3.3.tgz", + "integrity": "sha512-ehbPUUNn34kJh/RV8eQwyLnAFcMQSbtGPKqGRB7GSa/bL7P6hh1QGxB4DwvtlFU//bDTlofsv44ydpjDNmfWLg==", + "requires": { + "@babel/runtime": "^7.12.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, + "@polkadot/x-textencoder": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-0.3.3.tgz", + "integrity": "sha512-klbz82L5LxDJTFoCO64G/EFfY1mKXHDlteJMDGFTOim/1oK1ypLOG8/7BmncmQAw2BevA0r1YkvWN+F3muJSag==", + "requires": { + "@babel/runtime": "^7.12.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } } } }, "@polkadot/x-ws": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-0.3.2.tgz", - "integrity": "sha512-1aiG11Py8sgzJsz19melMzvBOn5zeMmfjCPoMryX4//063E0mcfnkujg4O6pTMygxJdFGAV1INB9wvMU9Dg9Wg==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-0.3.3.tgz", + "integrity": "sha512-t06ID5QLYi5B8bzlT2fcYsQ09yfLf5Uq9idunKRZj13EwSELaqvZFfn2UmiDFiIB1H5u7c2y+VDWbIdqE8ZxKw==", "requires": { - "@babel/runtime": "^7.11.2", + "@babel/runtime": "^7.12.1", "@types/websocket": "^1.0.1", "websocket": "^1.0.32" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } } }, "@sindresorhus/is": { @@ -16840,6 +16796,11 @@ "lower-case": "^1.1.1" } }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, "node-fetch-npm": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.4.tgz", --- a/tests/package.json +++ b/tests/package.json @@ -23,9 +23,9 @@ "license": "Apache 2.0", "homepage": "", "dependencies": { - "@polkadot/api": "^1.34.1", - "@polkadot/api-contract": "^1.34.1", - "@polkadot/types": "^1.34.1", + "@polkadot/api": "^2.3.1", + "@polkadot/api-contract": "^2.3.1", + "@polkadot/types": "^2.3.1", "@polkadot/util": "^3.4.1", "@types/bn.js": "^4.11.6", "chai-as-promised": "^7.1.1" --- a/tests/src/contracts.test.ts +++ b/tests/src/contracts.test.ts @@ -1,129 +1,91 @@ import { expect } from "chai"; import usingApi from "./substrate/substrate-api"; -import promisifySubstrate from "./substrate/promisify-substrate"; import fs from "fs"; -import privateKey from "./substrate/privateKey"; -import { compactAddLength, u8aToU8a } from '@polkadot/util'; -import { Hash, AccountId } from "@polkadot/types/interfaces"; -import { Abi, PromiseContract } from "@polkadot/api-contract"; -import { ISubmittableResult, IKeyringPair } from "@polkadot/types/types"; -import BN from "bn.js"; -import { alicesPublicKey, bobsPublicKey } from "./accounts"; -import { ApiPromise } from "@polkadot/api"; -import { GenericAccountId, u128 } from "@polkadot/types"; -import getBalance from "./substrate/get-balance"; +import { Abi, BlueprintPromise, CodePromise } from "@polkadot/api-contract"; +import { IKeyringPair } from "@polkadot/types/types"; +import { Keyring } from "@polkadot/api"; +import { ApiTypes, SubmittableExtrinsic } from "@polkadot/api/types"; +const value = 0; +const gasLimit = 3000n * 1000000n; -function deployContract(api: ApiPromise, contract: Uint8Array, privateKey: IKeyringPair): Promise { - return promisifySubstrate(api, () => { - return new Promise(async (resolve, reject) => { - const unsubscribe = api.tx.contracts.putCode(contract).signAndSend(privateKey, async result => { - if(!result.isInBlock){ - return; +function deployBlueprint(alice: IKeyringPair, code: CodePromise): Promise { + return new Promise(async (resolve, reject) => { + const unsub = await code + .createBlueprint() + .signAndSend(alice, (result) => { + if (result.status.isInBlock || result.status.isFinalized) { + // here we have an additional field in the result, containing the blueprint + resolve(result.blueprint); + unsub(); } + }) + }); +} - const record = result.findRecord('contracts', 'CodeStored'); +function deployContract(alice: IKeyringPair, blueprint: BlueprintPromise) : Promise { + return new Promise(async (resolve, reject) => { + const endowment = 1000000000000000n; + const initValue = true; - if(record) { - (await unsubscribe)(); - resolve(record.event.data[0] as unknown as Hash); - } else { - reject('Failed to find contract hash in putCode transaction result.'); - } - }); - }) - })(); + const unsub = await blueprint.tx + .new(endowment, gasLimit, initValue) + .signAndSend(alice, (result) => { + if (result.status.isInBlock || result.status.isFinalized) { + unsub(); + resolve(result); + } + }); + }); } -function instantiateContract(api: ApiPromise, contractHash: Hash, args: Uint8Array, privateKey: IKeyringPair): Promise { - return promisifySubstrate(api, () => { - return new Promise((resolve, reject) => { - const unsubscribe = api.tx.contracts.instantiate(1000000000000000n, 1000000000000n, contractHash, args) - .signAndSend(privateKey, async (result:ISubmittableResult) => { - if(!result.isInBlock) { - return; - } - const record = result.findRecord('contracts', 'Instantiated'); - if(record) { - (await unsubscribe)(); - expect(alicesPublicKey).to.be.equal(record.event.data[0].toString()); - resolve(record.event.data[1] as AccountId); - } else { - reject('Failed to find instantiated event.'); - } - }); - }); - })(); -} - -function txContractCall(api: ApiPromise, privateKey: IKeyringPair, address: string, call: Uint8Array): Promise { - return promisifySubstrate(api, async () => { - return new Promise(async (resolve, reject) => { - api.tx.contracts.call(address, 0, 1000000000000n, call) - .signAndSend(privateKey, async result => { - if(!result.isInBlock) { - return; - } +function runTransaction(privateKey: IKeyringPair, extrinsic: SubmittableExtrinsic) { + return new Promise(async (resolve, reject) => { + extrinsic.signAndSend(privateKey, async result => { + if(!result.isInBlock) { + return; + } - if(result.findRecord('system', 'ExtrinsicSuccess')) { - resolve(); - } - else { - reject('Failed to execute tx call.'); - } - }) - }); - })(); + if(result.findRecord('system', 'ExtrinsicSuccess')) { + resolve(); + } + else { + reject('Failed to flip value.'); + } + }) + }); } describe('Contracts', () => { it(`Can deploy smart contract Flipper, instantiate it and call it's get and flip messages.`, async () => { await usingApi(async api => { + const keyring = new Keyring({ type: 'sr25519' }); + const alice = keyring.addFromUri("//Alice"); + const wasm = fs.readFileSync('./src/flipper/flipper.wasm'); - const contract = compactAddLength(u8aToU8a(wasm)); - + const metadata = JSON.parse(fs.readFileSync('./src/flipper/metadata.json').toString('utf-8')); - const abi = new Abi(api.registry as any, metadata); + const abi = new Abi(metadata); - const alicesPrivateKey = privateKey('//Alice'); + const code = new CodePromise(api, abi, wasm); - const contractHash = await deployContract(api, contract, alicesPrivateKey); - - const args = abi.constructors[0](true); - const instanceAccountId = await instantiateContract(api, contractHash, args, alicesPrivateKey); + const blueprint = await deployBlueprint(alice, code); + const contract = (await deployContract(alice, blueprint))['contract']; - const contractInstance = new PromiseContract(api, abi, instanceAccountId); const getFlipValue = async () => { - return await promisifySubstrate(api, async () => { - const result = await contractInstance.call('rpc', 'get', 0, new BN('1000000000000')) - .send(alicesPublicKey); - if(!result.isSuccess) { - throw 'Failed to get flipper value'; - } - return result.output && result.output.valueOf && result.output.valueOf(); - })(); + const result = await contract.query.get(alice.address, value, gasLimit); + + if(!result.result.isSuccess) { + throw `Failed to get flipper value`; + } + return (result.result.asSuccess.data[0] == 0x00) ? false : true; } const initialGetResponse = await getFlipValue(); expect(initialGetResponse).to.be.true; - await promisifySubstrate(api, async () => { - return new Promise(async (resolve, reject) => { - api.tx.contracts.call(contractInstance.address.toString(), 0, 1000000000000n, contractInstance.getMessage('flip').fn()) - .signAndSend(alicesPrivateKey, async result => { - if(!result.isInBlock) { - return; - } - - if(result.findRecord('system', 'ExtrinsicSuccess')) { - resolve(); - } - else { - reject('Failed to flip value.'); - } - }) - }); - })(); + const flip = contract.exec('flip', value, gasLimit); + await runTransaction(alice, flip); const afterFlipGetResponse = await getFlipValue(); @@ -131,30 +93,31 @@ }); }); - it('Can transfer balance using smart contract.', async () => { + it.skip('Can transfer balance using smart contract.', async () => { await usingApi(async api => { - const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]); - const wasm = fs.readFileSync('./src/balance-transfer-contract/calls.wasm'); - const contract = compactAddLength(u8aToU8a(wasm)); + // const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]); + // const wasm = fs.readFileSync('./src/balance-transfer-contract/calls.wasm'); + // const contract = compactAddLength(u8aToU8a(wasm)); + + // const metadata = JSON.parse(fs.readFileSync('./src/balance-transfer-contract/metadata.json').toString('utf-8')); + // const abi = new Abi(api.registry as any, metadata); - const metadata = JSON.parse(fs.readFileSync('./src/balance-transfer-contract/metadata.json').toString('utf-8')); - const abi = new Abi(api.registry as any, metadata); + // const alicesPrivateKey = privateKey('//Alice'); - const alicesPrivateKey = privateKey('//Alice'); + // const contractHash = await deployContract(api, contract, alicesPrivateKey); - const contractHash = await deployContract(api, contract, alicesPrivateKey); + // // const args = abi.constructors[0](); + // const instanceAccountId = await instantiateContract(api, contractHash, /*args,*/ alicesPrivateKey); + // const contractInstance = new ContractPromise(api, abi, instanceAccountId); + // const bob = new GenericAccountId(api.registry, bobsPublicKey); - const args = abi.constructors[0](); - const instanceAccountId = await instantiateContract(api, contractHash, args, alicesPrivateKey); - const contractInstance = new PromiseContract(api, abi, instanceAccountId); - const bob = new GenericAccountId(api.registry, bobsPublicKey); - const call = contractInstance.getMessage('balance_transfer').fn(bob, new u128(api.registry, 1000000)); - await txContractCall(api, alicesPrivateKey, contractInstance.address.toString(), call); + // const transfer = contractInstance.exec('balance_transfer', 0, 1000000000000n, [bob, new u128(api.registry, 1000000)]); + // await runTransaction(alicesPrivateKey, transfer); - const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]); + // const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]); - expect(alicesBalanceAfter < alicesBalanceBefore).to.be.true; - expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true; + // expect(alicesBalanceAfter < alicesBalanceBefore).to.be.true; + // expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true; }); }) }); --- a/tests/src/flipper/metadata.json +++ b/tests/src/flipper/metadata.json @@ -1,204 +1,106 @@ { - "registry": { - "strings": [ - "Storage", - "flipper", - "__ink_private", - "__ink_storage", - "value", - "Value", - "ink_core", - "storage", - "cell", - "SyncCell", - "sync_cell", - "Key", - "ink_primitives", - "new", - "init_value", - "bool", - "default", - "flip", - "get" - ], - "types": [ - { - "id": { - "custom.name": 1, - "custom.namespace": [ - 2, - 2, - 3, - 4 - ], - "custom.params": [] - }, - "def": { - "struct.fields": [ - { - "name": 5, - "type": 2 - } - ] - } - }, - { - "id": { - "custom.name": 6, - "custom.namespace": [ - 7, - 8, - 5 - ], - "custom.params": [ - 3 - ] - }, - "def": { - "struct.fields": [ - { - "name": 9, - "type": 4 - } - ] - } - }, - { - "id": "bool", - "def": "builtin" - }, - { - "id": { - "custom.name": 10, - "custom.namespace": [ - 7, - 8, - 9, - 11 - ], - "custom.params": [ - 3 - ] - }, - "def": { - "struct.fields": [ - { - "name": 9, - "type": 5 - } - ] - } - }, - { - "id": { - "custom.name": 12, - "custom.namespace": [ - 13 - ], - "custom.params": [] - }, - "def": { - "tuple_struct.types": [ - 6 - ] - } - }, - { - "id": { - "array.len": 32, - "array.type": 7 - }, - "def": "builtin" - }, - { - "id": "u8", - "def": "builtin" - } - ] + "metadataVersion": "0.1.0", + "source": { + "hash": "0x36431d9da78a6bb099474e49c9e35a9c3a04272b58815634082626109826cac6", + "language": "ink! 3.0.0-rc1", + "compiler": "rustc 1.49.0-nightly" }, - "storage": { - "struct.type": 1, - "struct.fields": [ - { - "name": 5, - "layout": { - "struct.type": 2, - "struct.fields": [ - { - "name": 9, - "layout": { - "range.offset": "0x0000000000000000000000000000000000000000000000000000000000000000", - "range.len": 1, - "range.elem_type": 3 - } - } - ] - } - } + "contract": { + "name": "flipper", + "version": "3.0.0-rc1", + "authors": [ + "Parity Technologies " ] }, - "contract": { - "name": 2, + "spec": { "constructors": [ { - "name": 14, - "selector": "[\"0x5E\",\"0xBD\",\"0x88\",\"0xD6\"]", "args": [ { - "name": 15, + "name": "init_value", "type": { - "ty": 3, - "display_name": [ - 16 - ] + "displayName": [ + "bool" + ], + "type": 1 } } ], "docs": [ - "Constructor that initializes the `bool` value to the given `init_value`." - ] + " Creates a new flipper smart contract initialized with the given value." + ], + "name": [ + "new" + ], + "selector": "0xd183512b" }, { - "name": 17, - "selector": "[\"0x02\",\"0x22\",\"0xFF\",\"0x18\"]", "args": [], "docs": [ - "Constructor that initializes the `bool` value to `false`.", - "", - "Constructors can delegate to other constructors." - ] + " Creates a new flipper smart contract initialized to `false`." + ], + "name": [ + "default" + ], + "selector": "0x6a3712e2" } ], + "docs": [], + "events": [], "messages": [ { - "name": 18, - "selector": "[\"0x8C\",\"0x97\",\"0xDB\",\"0x39\"]", - "mutates": true, "args": [], - "return_type": null, "docs": [ - "A message that can be called on instantiated contracts.", - "This one flips the value of the stored `bool` from `true`", - "to `false` and vice versa." - ] + " Flips the current value of the Flipper's bool." + ], + "mutates": true, + "name": [ + "flip" + ], + "payable": false, + "returnType": null, + "selector": "0xc096a5f3" }, { - "name": 19, - "selector": "[\"0x25\",\"0x44\",\"0x4A\",\"0xFE\"]", - "mutates": false, "args": [], - "return_type": { - "ty": 3, - "display_name": [ - 16 - ] - }, "docs": [ - "Simply returns the current value of our `bool`." - ] + " Returns the current value of the Flipper's bool." + ], + "mutates": false, + "name": [ + "get" + ], + "payable": false, + "returnType": { + "displayName": [ + "bool" + ], + "type": 1 + }, + "selector": "0x1e5ca456" } - ], - "events": [], - "docs": [] - } + ] + }, + "storage": { + "struct": { + "fields": [ + { + "layout": { + "cell": { + "key": "0x0000000000000000000000000000000000000000000000000000000000000000", + "ty": 1 + } + }, + "name": "value" + } + ] + } + }, + "types": [ + { + "def": { + "primitive": "bool" + } + } + ] } \ No newline at end of file -- gitstuff