From 277355255dce727e6ced229994e40a5ec2d2c2f7 Mon Sep 17 00:00:00 2001 From: Vedhavyas Singareddi Date: Wed, 26 Aug 2020 20:39:14 +0530 Subject: [PATCH] Upgrade to rc6 (#64) --- Cargo.lock | 418 ++++++++++++++++++++++++------------ chainbridge/Cargo.toml | 18 +- chainbridge/src/lib.rs | 14 +- chainbridge/src/mock.rs | 17 +- chainbridge/src/tests.rs | 36 ++-- example-erc721/Cargo.toml | 18 +- example-erc721/src/mock.rs | 5 +- example-erc721/src/tests.rs | 36 +++- example-pallet/Cargo.toml | 18 +- example-pallet/src/mock.rs | 5 +- example-pallet/src/tests.rs | 34 +-- 11 files changed, 387 insertions(+), 232 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 25146d8..c9b2c70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,12 +27,9 @@ checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" [[package]] name = "ahash" -version = "0.2.18" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f33b5018f120946c1dcf279194f238a9f146725593ead1c08fa47ff22b0b5d3" -dependencies = [ - "const-random", -] +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" [[package]] name = "aho-corasick" @@ -157,7 +154,16 @@ dependencies = [ "block-padding", "byte-tools", "byteorder", - "generic-array", + "generic-array 0.12.3", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.4", ] [[package]] @@ -187,12 +193,6 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -[[package]] -name = "cc" -version = "1.0.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" - [[package]] name = "cfg-if" version = "0.1.10" @@ -215,15 +215,6 @@ dependencies = [ "substrate-wasm-builder-runner", ] -[[package]] -name = "clear_on_drop" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9cc5db465b294c3fa986d5bbb0f3017cd850bff6dd6c52f9ccff8b4d21b7b08" -dependencies = [ - "cc", -] - [[package]] name = "cloudabi" version = "0.0.3" @@ -233,32 +224,18 @@ dependencies = [ "bitflags", ] -[[package]] -name = "const-random" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f1af9ac737b2dd2d577701e59fd09ba34822f6f2ebdb30a7647405d9e55e16a" -dependencies = [ - "const-random-macro", - "proc-macro-hack", -] - -[[package]] -name = "const-random-macro" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25e4c606eb459dd29f7c57b2e0879f2b6f14ee130918c2b78ccb58a9624e6c7a" -dependencies = [ - "getrandom", - "proc-macro-hack", -] - [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + [[package]] name = "crunchy" version = "0.2.2" @@ -271,7 +248,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" dependencies = [ - "generic-array", + "generic-array 0.12.3", "subtle 1.0.0", ] @@ -282,7 +259,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" dependencies = [ "byteorder", - "digest", + "digest 0.8.1", + "rand_core 0.5.1", + "subtle 2.2.3", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307" +dependencies = [ + "byteorder", + "digest 0.9.0", "rand_core 0.5.1", "subtle 2.2.3", "zeroize", @@ -305,19 +295,66 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array", + "generic-array 0.12.3", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "dyn-clonable" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +dependencies = [ + "dyn-clonable-impl", + "dyn-clone", +] + +[[package]] +name = "dyn-clonable-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dyn-clone" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c53dc3a653e0f64081026e4bf048d48fec9fce90c66e8326ca7292df0ff2d82" + +[[package]] +name = "ed25519" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf038a7b6fd7ef78ad3348b63f3a17550877b0e28f8d68bcc94894d1412158bc" +dependencies = [ + "signature", ] [[package]] name = "ed25519-dalek" -version = "1.0.0-pre.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978710b352437433c97b2bff193f2fb1dfd58a093f863dd95e225a19baa599a2" +checksum = "53d2e93f837d749c16d118e7ddf7a4dfd0ac8f452cf51e46e9348824e5ef6851" dependencies = [ - "clear_on_drop", - "curve25519-dalek", + "curve25519-dalek 3.0.0", + "ed25519", "rand 0.7.3", - "sha2", + "serde", + "sha2 0.9.1", + "zeroize", ] [[package]] @@ -410,8 +447,8 @@ dependencies = [ [[package]] name = "frame-benchmarking" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "frame-support", "frame-system", @@ -423,12 +460,13 @@ dependencies = [ "sp-runtime", "sp-runtime-interface", "sp-std", + "sp-storage", ] [[package]] name = "frame-metadata" -version = "11.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "11.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "parity-scale-codec", "serde", @@ -438,8 +476,8 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "bitmask", "frame-metadata", @@ -463,8 +501,8 @@ dependencies = [ [[package]] name = "frame-support-procedural" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "frame-support-procedural-tools", "proc-macro2", @@ -474,8 +512,8 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -486,8 +524,8 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "proc-macro2", "quote", @@ -496,8 +534,8 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -621,6 +659,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.1.14" @@ -655,12 +703,12 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.6.3" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead" +checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" dependencies = [ "ahash", - "autocfg 0.1.7", + "autocfg 1.0.0", ] [[package]] @@ -685,7 +733,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" dependencies = [ "crypto-mac", - "digest", + "digest 0.8.1", ] [[package]] @@ -694,8 +742,8 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" dependencies = [ - "digest", - "generic-array", + "digest 0.8.1", + "generic-array 0.12.3", "hmac", ] @@ -743,6 +791,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f65877bf7d44897a473350b1046277941cee20b263397e90869c50b6e766088b" +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + [[package]] name = "keccak" version = "0.1.0" @@ -775,10 +832,10 @@ checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" dependencies = [ "arrayref", "crunchy", - "digest", + "digest 0.8.1", "hmac-drbg", "rand 0.7.3", - "sha2", + "sha2 0.8.2", "subtle 2.2.3", "typenum", ] @@ -829,11 +886,10 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "memory-db" -version = "0.20.1" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be512cb2ccb4ecbdca937fdd4a62ea5f09f8e7195466a85e4632b3d5bcce82e6" +checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a" dependencies = [ - "ahash", "hash-db", "hashbrown", "parity-util-mem", @@ -874,7 +930,7 @@ checksum = "aaa9fddbc34c8c35dd2108515587b8ce0cab396f17977b8c738568e4edb521a2" dependencies = [ "alga", "approx", - "generic-array", + "generic-array 0.12.3", "matrixmultiply", "num-complex", "num-rational", @@ -973,10 +1029,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "pallet-balances" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "frame-benchmarking", "frame-support", @@ -989,9 +1051,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "1.3.0" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329c8f7f4244ddb5c37c103641027a76c530e65e8e4b8240b29f81ea40508b17" +checksum = "34d38aeaffc032ec69faa476b3caaca8d4dd7f3f798137ff30359e5c7869ceb6" dependencies = [ "arrayvec 0.5.1", "bitvec", @@ -1002,9 +1064,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" +checksum = "cd20ff7e0399b274a5f5bb37b712fccb5b3a64b9128200d1c3cc40fe709cb073" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1014,11 +1076,12 @@ dependencies = [ [[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", + "hashbrown", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot", @@ -1414,6 +1477,27 @@ version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +[[package]] +name = "rental" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8545debe98b2b139fb04cad8618b530e9b07c152d99a5de83c860b877d67847f" +dependencies = [ + "rental-impl", + "stable_deref_trait", +] + +[[package]] +name = "rental-impl" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "rustc-demangle" version = "0.1.16" @@ -1440,12 +1524,12 @@ checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" dependencies = [ "arrayref", "arrayvec 0.5.1", - "curve25519-dalek", + "curve25519-dalek 2.1.0", "getrandom", "merlin", "rand 0.7.3", "rand_core 0.5.1", - "sha2", + "sha2 0.8.2", "subtle 2.2.3", "zeroize", ] @@ -1456,6 +1540,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "secrecy" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9182278ed645df3477a9c27bfee0621c621aa16f6972635f7f795dae3d81070f" +dependencies = [ + "zeroize", +] + [[package]] name = "serde" version = "1.0.112" @@ -1482,12 +1575,31 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.7.3", + "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", ] +[[package]] +name = "sha2" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[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" @@ -1496,14 +1608,14 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" +checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "sp-api" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "hash-db", "parity-scale-codec", @@ -1517,8 +1629,8 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -1529,8 +1641,8 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "parity-scale-codec", "serde", @@ -1541,8 +1653,8 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "integer-sqrt", "num-traits", @@ -1554,13 +1666,14 @@ dependencies = [ [[package]] name = "sp-core" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "base58", "blake2-rfc", "byteorder", "derive_more", + "dyn-clonable", "ed25519-dalek", "futures", "hash-db", @@ -1579,8 +1692,9 @@ dependencies = [ "rand 0.7.3", "regex", "schnorrkel", + "secrecy", "serde", - "sha2", + "sha2 0.8.2", "sp-debug-derive", "sp-externalities", "sp-runtime-interface", @@ -1596,8 +1710,8 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "proc-macro2", "quote", @@ -1606,8 +1720,8 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.8.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "0.8.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "environmental", "parity-scale-codec", @@ -1617,8 +1731,8 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "derive_more", "parity-scale-codec", @@ -1629,8 +1743,8 @@ dependencies = [ [[package]] name = "sp-io" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "futures", "hash-db", @@ -1643,14 +1757,15 @@ dependencies = [ "sp-runtime-interface", "sp-state-machine", "sp-std", + "sp-tracing", "sp-trie", "sp-wasm-interface", ] [[package]] name = "sp-panic-handler" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "backtrace", "log", @@ -1658,9 +1773,10 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ + "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", @@ -1679,14 +1795,15 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "parity-scale-codec", "primitive-types", "sp-externalities", "sp-runtime-interface-proc-macro", "sp-std", + "sp-storage", "sp-tracing", "sp-wasm-interface", "static_assertions", @@ -1694,8 +1811,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "Inflector", "proc-macro-crate", @@ -1706,15 +1823,17 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.8.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "0.8.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "hash-db", + "itertools", "log", "num-traits", "parity-scale-codec", "parking_lot", "rand 0.7.3", + "smallvec", "sp-core", "sp-externalities", "sp-panic-handler", @@ -1725,15 +1844,16 @@ dependencies = [ [[package]] name = "sp-std" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" [[package]] name = "sp-storage" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "impl-serde 0.2.3", + "parity-scale-codec", "ref-cast", "serde", "sp-debug-derive", @@ -1742,16 +1862,18 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ + "log", + "rental", "tracing", ] [[package]] name = "sp-trie" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "hash-db", "memory-db", @@ -1764,8 +1886,8 @@ dependencies = [ [[package]] name = "sp-version" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -1776,8 +1898,8 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0-rc3" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +version = "2.0.0-rc6" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -1785,6 +1907,12 @@ dependencies = [ "wasmi", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -1809,13 +1937,13 @@ dependencies = [ "hmac", "pbkdf2", "schnorrkel", - "sha2", + "sha2 0.8.2", ] [[package]] name = "substrate-wasm-builder-runner" version = "1.0.6" -source = "git+https://github.com/paritytech/substrate.git?rev=34695a85650b58bcd7d7e2a677cafc2921251d68#34695a85650b58bcd7d7e2a677cafc2921251d68" +source = "git+https://github.com/paritytech/substrate.git?rev=be8bb186d87b9d2b47a2907c9b51ae1e252362c3#be8bb186d87b9d2b47a2907c9b51ae1e252362c3" [[package]] name = "subtle" @@ -1873,7 +2001,7 @@ dependencies = [ "pbkdf2", "rand 0.7.3", "rustc-hash", - "sha2", + "sha2 0.8.2", "unicode-normalization", ] @@ -1903,9 +2031,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.15" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" +checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" dependencies = [ "cfg-if", "tracing-attributes", @@ -1914,9 +2042,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.8" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" +checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada" dependencies = [ "proc-macro2", "quote", @@ -1925,18 +2053,18 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.10" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +checksum = "4f0e00789804e99b20f12bc7003ca416309d28a6f495d6af58d1e2c2842461b5" dependencies = [ "lazy_static", ] [[package]] name = "trie-db" -version = "0.20.1" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc309f34008563989045a4c4dbcc5770467f3a3785ee80a9b5cc0d83362475f" +checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0" dependencies = [ "hash-db", "hashbrown", @@ -1996,6 +2124,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +[[package]] +name = "version_check" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" diff --git a/chainbridge/Cargo.toml b/chainbridge/Cargo.toml index af1c2b2..f2caa59 100644 --- a/chainbridge/Cargo.toml +++ b/chainbridge/Cargo.toml @@ -6,23 +6,23 @@ edition = '2018' [dependencies] # third-party dependencies -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] } serde = { version = "1.0.102", optional = true } # primitives -sp-std = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-runtime = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-io = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-core = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } +sp-std = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-runtime = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-io = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-core = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } # frame dependencies -frame-support = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -frame-system = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } +frame-support = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +frame-system = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } -pallet-balances = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } +pallet-balances = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } [build-dependencies] -wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68" } +wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3" } [features] default = ["std"] std = [ diff --git a/chainbridge/src/lib.rs b/chainbridge/src/lib.rs index 10d13a2..b3b6bb4 100644 --- a/chainbridge/src/lib.rs +++ b/chainbridge/src/lib.rs @@ -6,7 +6,7 @@ use frame_support::{ dispatch::DispatchResult, ensure, traits::{EnsureOrigin, Get}, - weights::{FunctionOf, GetDispatchInfo, Pays}, + weights::{GetDispatchInfo, Pays}, Parameter, }; @@ -292,11 +292,7 @@ decl_module! { /// # /// - weight of proposed call, regardless of whether execution is performed /// # - #[weight = FunctionOf( - |args: (&DepositNonce, &ChainId, &ResourceId, &Box<::Proposal>)| args.3.get_dispatch_info().weight + 195_000_000, - |args: (&DepositNonce, &ChainId, &ResourceId, &Box<::Proposal>)| args.3.get_dispatch_info().class, - Pays::Yes - )] + #[weight = (call.get_dispatch_info().weight + 195_000_000, call.get_dispatch_info().class, Pays::Yes)] pub fn acknowledge_proposal(origin, nonce: DepositNonce, src_id: ChainId, r_id: ResourceId, call: Box<::Proposal>) -> DispatchResult { let who = ensure_signed(origin)?; ensure!(Self::is_relayer(&who), Error::::MustBeRelayer); @@ -329,11 +325,7 @@ decl_module! { /// # /// - weight of proposed call, regardless of whether execution is performed /// # - #[weight = FunctionOf( - |args: (&DepositNonce, &ChainId, &Box<::Proposal>)| args.2.get_dispatch_info().weight + 195_000_000, - |args: (&DepositNonce, &ChainId, &Box<::Proposal>)| args.2.get_dispatch_info().class, - Pays::Yes - )] + #[weight = (prop.get_dispatch_info().weight + 195_000_000, prop.get_dispatch_info().class, Pays::Yes)] pub fn eval_vote_state(origin, nonce: DepositNonce, src_id: ChainId, prop: Box<::Proposal>) -> DispatchResult { ensure_signed(origin)?; diff --git a/chainbridge/src/mock.rs b/chainbridge/src/mock.rs index 9892290..abc874a 100644 --- a/chainbridge/src/mock.rs +++ b/chainbridge/src/mock.rs @@ -22,8 +22,9 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; - type Call = (); + type Call = Call; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -45,6 +46,7 @@ impl frame_system::Trait for Test { type AccountData = pallet_balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } parameter_types! { @@ -61,6 +63,7 @@ impl pallet_balances::Trait for Test { type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types! { @@ -121,16 +124,16 @@ pub fn new_test_ext_initialized( let mut t = new_test_ext(); t.execute_with(|| { // Set and check threshold - assert_ok!(Bridge::set_threshold(Origin::ROOT, TEST_THRESHOLD)); + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD)); assert_eq!(Bridge::relayer_threshold(), TEST_THRESHOLD); // Add relayers - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_A)); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_B)); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_C)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_A)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_B)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_C)); // Whitelist chain - assert_ok!(Bridge::whitelist_chain(Origin::ROOT, src_id)); + assert_ok!(Bridge::whitelist_chain(Origin::root(), src_id)); // Set and check resource ID mapped to some junk data - assert_ok!(Bridge::set_resource(Origin::ROOT, r_id, resource)); + assert_ok!(Bridge::set_resource(Origin::root(), r_id, resource)); assert_eq!(Bridge::resource_exists(r_id), true); }); t diff --git a/chainbridge/src/tests.rs b/chainbridge/src/tests.rs index 166b9db..7ea41d4 100644 --- a/chainbridge/src/tests.rs +++ b/chainbridge/src/tests.rs @@ -79,13 +79,13 @@ fn setup_resources() { let method = "Pallet.do_something".as_bytes().to_vec(); let method2 = "Pallet.do_somethingElse".as_bytes().to_vec(); - assert_ok!(Bridge::set_resource(Origin::ROOT, id, method.clone())); + assert_ok!(Bridge::set_resource(Origin::root(), id, method.clone())); assert_eq!(Bridge::resources(id), Some(method)); - assert_ok!(Bridge::set_resource(Origin::ROOT, id, method2.clone())); + assert_ok!(Bridge::set_resource(Origin::root(), id, method2.clone())); assert_eq!(Bridge::resources(id), Some(method2)); - assert_ok!(Bridge::remove_resource(Origin::ROOT, id)); + assert_ok!(Bridge::remove_resource(Origin::root(), id)); assert_eq!(Bridge::resources(id), None); }) } @@ -95,9 +95,9 @@ fn whitelist_chain() { new_test_ext().execute_with(|| { assert!(!Bridge::chain_whitelisted(0)); - assert_ok!(Bridge::whitelist_chain(Origin::ROOT, 0)); + assert_ok!(Bridge::whitelist_chain(Origin::root(), 0)); assert_noop!( - Bridge::whitelist_chain(Origin::ROOT, TestChainId::get()), + Bridge::whitelist_chain(Origin::root(), TestChainId::get()), Error::::InvalidChainId ); @@ -110,10 +110,10 @@ fn set_get_threshold() { new_test_ext().execute_with(|| { assert_eq!(::get(), 1); - assert_ok!(Bridge::set_threshold(Origin::ROOT, TEST_THRESHOLD)); + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD)); assert_eq!(::get(), TEST_THRESHOLD); - assert_ok!(Bridge::set_threshold(Origin::ROOT, 5)); + assert_ok!(Bridge::set_threshold(Origin::root(), 5)); assert_eq!(::get(), 5); assert_events(vec![ @@ -133,9 +133,9 @@ fn asset_transfer_success() { let amount = 100; let token_id = vec![1, 2, 3, 4]; - assert_ok!(Bridge::set_threshold(Origin::ROOT, TEST_THRESHOLD,)); + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD,)); - assert_ok!(Bridge::whitelist_chain(Origin::ROOT, dest_id.clone())); + assert_ok!(Bridge::whitelist_chain(Origin::root(), dest_id.clone())); assert_ok!(Bridge::transfer_fungible( dest_id.clone(), resource_id.clone(), @@ -190,7 +190,7 @@ fn asset_transfer_invalid_chain() { let bad_dest_id = 3; let resource_id = [4; 32]; - assert_ok!(Bridge::whitelist_chain(Origin::ROOT, chain_id.clone())); + assert_ok!(Bridge::whitelist_chain(Origin::root(), chain_id.clone())); assert_events(vec![Event::bridge(RawEvent::ChainWhitelisted( chain_id.clone(), ))]); @@ -215,25 +215,25 @@ fn asset_transfer_invalid_chain() { #[test] fn add_remove_relayer() { new_test_ext().execute_with(|| { - assert_ok!(Bridge::set_threshold(Origin::ROOT, TEST_THRESHOLD,)); + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD,)); assert_eq!(Bridge::relayer_count(), 0); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_A)); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_B)); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_C)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_A)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_B)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_C)); assert_eq!(Bridge::relayer_count(), 3); // Already exists assert_noop!( - Bridge::add_relayer(Origin::ROOT, RELAYER_A), + Bridge::add_relayer(Origin::root(), RELAYER_A), Error::::RelayerAlreadyExists ); // Confirm removal - assert_ok!(Bridge::remove_relayer(Origin::ROOT, RELAYER_B)); + assert_ok!(Bridge::remove_relayer(Origin::root(), RELAYER_B)); assert_eq!(Bridge::relayer_count(), 2); assert_noop!( - Bridge::remove_relayer(Origin::ROOT, RELAYER_B), + Bridge::remove_relayer(Origin::root(), RELAYER_B), Error::::RelayerInvalid ); assert_eq!(Bridge::relayer_count(), 2); @@ -423,7 +423,7 @@ fn execute_after_threshold_change() { assert_eq!(prop, expected); // Change threshold - assert_ok!(Bridge::set_threshold(Origin::ROOT, 1)); + assert_ok!(Bridge::set_threshold(Origin::root(), 1)); // Attempt to execute assert_ok!(Bridge::eval_vote_state( diff --git a/example-erc721/Cargo.toml b/example-erc721/Cargo.toml index c80778b..9c6aa33 100644 --- a/example-erc721/Cargo.toml +++ b/example-erc721/Cargo.toml @@ -6,26 +6,26 @@ edition = '2018' [dependencies] # third-party dependencies -codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] } serde = { version = "1.0.102", optional = true } # primitives -sp-std = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-runtime = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-io = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-core = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } +sp-std = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-runtime = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-io = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-core = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } # frame dependencies -frame-support = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -frame-system = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } +frame-support = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +frame-system = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } chainbridge = { path = "../chainbridge" , default-features = false } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } +pallet-balances = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } [build-dependencies] -wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68" } +wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3" } [features] default = ["std"] std = [ diff --git a/example-erc721/src/mock.rs b/example-erc721/src/mock.rs index ce50796..011796d 100644 --- a/example-erc721/src/mock.rs +++ b/example-erc721/src/mock.rs @@ -22,8 +22,9 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; - type Call = (); + type Call = Call; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -45,6 +46,7 @@ impl frame_system::Trait for Test { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } parameter_types! { @@ -61,6 +63,7 @@ impl pallet_balances::Trait for Test { type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types! { diff --git a/example-erc721/src/tests.rs b/example-erc721/src/tests.rs index 9acb84c..416a717 100644 --- a/example-erc721/src/tests.rs +++ b/example-erc721/src/tests.rs @@ -13,7 +13,12 @@ fn mint_burn_tokens() { let metadata_a: Vec = vec![1, 2, 3]; let metadata_b: Vec = vec![4, 5, 6]; - assert_ok!(Erc721::mint(Origin::ROOT, USER_A, id_a, metadata_a.clone())); + assert_ok!(Erc721::mint( + Origin::root(), + USER_A, + id_a, + metadata_a.clone() + )); assert_eq!( Erc721::tokens(id_a).unwrap(), Erc721Token { @@ -23,11 +28,16 @@ fn mint_burn_tokens() { ); assert_eq!(Erc721::token_count(), 1.into()); assert_noop!( - Erc721::mint(Origin::ROOT, USER_A, id_a, metadata_a.clone()), + Erc721::mint(Origin::root(), USER_A, id_a, metadata_a.clone()), Error::::TokenAlreadyExists ); - assert_ok!(Erc721::mint(Origin::ROOT, USER_A, id_b, metadata_b.clone())); + assert_ok!(Erc721::mint( + Origin::root(), + USER_A, + id_b, + metadata_b.clone() + )); assert_eq!( Erc721::tokens(id_b).unwrap(), Erc721Token { @@ -37,16 +47,16 @@ fn mint_burn_tokens() { ); assert_eq!(Erc721::token_count(), 2.into()); assert_noop!( - Erc721::mint(Origin::ROOT, USER_A, id_b, metadata_b.clone()), + Erc721::mint(Origin::root(), USER_A, id_b, metadata_b.clone()), Error::::TokenAlreadyExists ); - assert_ok!(Erc721::burn(Origin::ROOT, id_a)); + assert_ok!(Erc721::burn(Origin::root(), id_a)); assert_eq!(Erc721::token_count(), 1.into()); assert!(!::contains_key(&id_a)); assert!(!>::contains_key(&id_a)); - assert_ok!(Erc721::burn(Origin::ROOT, id_b)); + assert_ok!(Erc721::burn(Origin::root(), id_b)); assert_eq!(Erc721::token_count(), 0.into()); assert!(!::contains_key(&id_b)); assert!(!>::contains_key(&id_b)); @@ -61,8 +71,18 @@ fn transfer_tokens() { let metadata_a: Vec = vec![1, 2, 3]; let metadata_b: Vec = vec![4, 5, 6]; - assert_ok!(Erc721::mint(Origin::ROOT, USER_A, id_a, metadata_a.clone())); - assert_ok!(Erc721::mint(Origin::ROOT, USER_A, id_b, metadata_b.clone())); + assert_ok!(Erc721::mint( + Origin::root(), + USER_A, + id_a, + metadata_a.clone() + )); + assert_ok!(Erc721::mint( + Origin::root(), + USER_A, + id_b, + metadata_b.clone() + )); assert_ok!(Erc721::transfer(Origin::signed(USER_A), USER_B, id_a)); assert_eq!(Erc721::owner_of(id_a).unwrap(), USER_B); diff --git a/example-pallet/Cargo.toml b/example-pallet/Cargo.toml index a79cb4d..58c980a 100644 --- a/example-pallet/Cargo.toml +++ b/example-pallet/Cargo.toml @@ -10,24 +10,24 @@ codec = { package = "parity-scale-codec", version = "1.3.0", default-features = serde = { version = "1.0.102", optional = true } # primitives -sp-std = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-runtime = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-io = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-core = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -sp-arithmetic = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } +sp-std = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-runtime = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-io = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-core = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +sp-arithmetic = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } # frame dependencies -frame-support = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } -frame-system = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } +frame-support = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } +frame-system = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } chainbridge = { path = "../chainbridge" , default-features = false} example-erc721 = { path = "../example-erc721", default-features = false } [dev-dependencies] -pallet-balances = { version = "2.0.0-rc3", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68", default-features = false } +pallet-balances = { version = "2.0.0-rc6", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3", default-features = false } [build-dependencies] -wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", git = "https://github.com/paritytech/substrate.git", rev = "34695a85650b58bcd7d7e2a677cafc2921251d68" } +wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner", git = "https://github.com/paritytech/substrate.git", rev = "be8bb186d87b9d2b47a2907c9b51ae1e252362c3" } [features] default = ["std"] std = [ diff --git a/example-pallet/src/mock.rs b/example-pallet/src/mock.rs index 0272a67..0ad0979 100644 --- a/example-pallet/src/mock.rs +++ b/example-pallet/src/mock.rs @@ -24,8 +24,9 @@ parameter_types! { } impl frame_system::Trait for Test { + type BaseCallFilter = (); type Origin = Origin; - type Call = (); + type Call = Call; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -47,6 +48,7 @@ impl frame_system::Trait for Test { type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type SystemWeightInfo = (); } parameter_types! { @@ -63,6 +65,7 @@ impl pallet_balances::Trait for Test { type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types! { diff --git a/example-pallet/src/tests.rs b/example-pallet/src/tests.rs index 1751679..b4461d3 100644 --- a/example-pallet/src/tests.rs +++ b/example-pallet/src/tests.rs @@ -30,9 +30,9 @@ fn transfer_hash() { let resource_id = HashId::get(); let hash: H256 = "ABC".using_encoded(blake2_256).into(); - assert_ok!(Bridge::set_threshold(Origin::ROOT, TEST_THRESHOLD,)); + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD,)); - assert_ok!(Bridge::whitelist_chain(Origin::ROOT, dest_chain.clone())); + assert_ok!(Bridge::whitelist_chain(Origin::root(), dest_chain.clone())); assert_ok!(Example::transfer_hash( Origin::signed(1), hash.clone(), @@ -56,7 +56,7 @@ fn transfer_native() { let amount: u64 = 100; let recipient = vec![99]; - assert_ok!(Bridge::whitelist_chain(Origin::ROOT, dest_chain.clone())); + assert_ok!(Bridge::whitelist_chain(Origin::root(), dest_chain.clone())); assert_ok!(Example::transfer_native( Origin::signed(RELAYER_A), amount.clone(), @@ -87,7 +87,7 @@ fn transfer_erc721() { // Create a token assert_ok!(Erc721::mint( - Origin::ROOT, + Origin::root(), RELAYER_A, token_id, metadata.clone() @@ -101,7 +101,7 @@ fn transfer_erc721() { ); // Whitelist destination and transfer - assert_ok!(Bridge::whitelist_chain(Origin::ROOT, dest_chain.clone())); + assert_ok!(Bridge::whitelist_chain(Origin::root(), dest_chain.clone())); assert_ok!(Example::transfer_erc721( Origin::signed(RELAYER_A), recipient.clone(), @@ -144,11 +144,11 @@ fn execute_remark() { let r_id = bridge::derive_resource_id(src_id, b"hash"); let resource = b"Example.remark".to_vec(); - assert_ok!(Bridge::set_threshold(Origin::ROOT, TEST_THRESHOLD,)); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_A)); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_B)); - assert_ok!(Bridge::whitelist_chain(Origin::ROOT, src_id)); - assert_ok!(Bridge::set_resource(Origin::ROOT, r_id, resource)); + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD,)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_A)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_B)); + assert_ok!(Bridge::whitelist_chain(Origin::root(), src_id)); + assert_ok!(Bridge::set_resource(Origin::root(), r_id, resource)); assert_ok!(Bridge::acknowledge_proposal( Origin::signed(RELAYER_A), @@ -182,7 +182,7 @@ fn execute_remark_bad_origin() { ); // Don't allow root calls assert_noop!( - Example::remark(Origin::ROOT, hash), + Example::remark(Origin::root(), hash), DispatchError::BadOrigin ); }) @@ -258,12 +258,12 @@ fn create_sucessful_transfer_proposal() { let resource = b"Example.transfer".to_vec(); let proposal = make_transfer_proposal(RELAYER_A, 10); - assert_ok!(Bridge::set_threshold(Origin::ROOT, TEST_THRESHOLD,)); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_A)); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_B)); - assert_ok!(Bridge::add_relayer(Origin::ROOT, RELAYER_C)); - assert_ok!(Bridge::whitelist_chain(Origin::ROOT, src_id)); - assert_ok!(Bridge::set_resource(Origin::ROOT, r_id, resource)); + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD,)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_A)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_B)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_C)); + assert_ok!(Bridge::whitelist_chain(Origin::root(), src_id)); + assert_ok!(Bridge::set_resource(Origin::root(), r_id, resource)); // Create proposal (& vote) assert_ok!(Bridge::acknowledge_proposal(