From 7d92b84093ffa411e61376e267a2e3b5155259a3 Mon Sep 17 00:00:00 2001 From: Nacho Pal Date: Thu, 22 Apr 2021 13:26:30 +0800 Subject: [PATCH 1/3] updated to be compatible with substrate v3.0.0 --- Cargo.lock | 527 +++++++++++++++++++++++++++++++---------------------- Cargo.toml | 16 +- src/lib.rs | 130 ++++++++----- 3 files changed, 398 insertions(+), 275 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5cd13d..b88465f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,9 +27,9 @@ checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" [[package]] name = "ahash" -version = "0.3.8" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" [[package]] name = "aho-corasick" @@ -49,6 +49,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "anyhow" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" + [[package]] name = "arrayref" version = "0.3.6" @@ -70,6 +76,23 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "arrayvec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a2f58b0bb10c380af2b26e57212856b8c9a59e0925b4c20f4a174a49734eaf7" + +[[package]] +name = "async-trait" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "autocfg" version = "1.0.1" @@ -102,20 +125,16 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "bitmask" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da9b3d9f6f585199287a473f4f8dfab6566cf827d15c00c219f53c645687ead" - [[package]] name = "bitvec" -version = "0.17.4" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" +checksum = "1f682656975d3a682daff957be4ddeb65d6ad656737cd821f2d00685ae466af1" dependencies = [ - "either", + "funty", "radium", + "tap", + "wyz", ] [[package]] @@ -160,9 +179,9 @@ dependencies = [ [[package]] name = "byte-slice-cast" -version = "0.3.5" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" +checksum = "65c1bf4a04a88c54f589125563643d773f3254b5c38571395e2b591c693bbc81" [[package]] name = "byte-tools" @@ -207,15 +226,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - [[package]] name = "cloudabi" version = "0.1.0" @@ -253,6 +263,16 @@ dependencies = [ "subtle 1.0.0", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.4", + "subtle 2.3.0", +] + [[package]] name = "curve25519-dalek" version = "2.1.0" @@ -261,7 +281,7 @@ checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" dependencies = [ "byteorder", "digest 0.8.1", - "rand_core", + "rand_core 0.5.1", "subtle 2.3.0", "zeroize", ] @@ -274,7 +294,7 @@ checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307" dependencies = [ "byteorder", "digest 0.9.0", - "rand_core", + "rand_core 0.5.1", "subtle 2.3.0", "zeroize", ] @@ -352,7 +372,7 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek 3.0.0", "ed25519", - "rand", + "rand 0.7.3", "serde", "sha2 0.9.2", "zeroize", @@ -370,28 +390,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6576a1755ddffd988788025e75bce9e74b018f7cc226198fe931d077911c6d7e" -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "fake-simd" version = "0.1.2" @@ -400,21 +398,21 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fixed-hash" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" dependencies = [ "byteorder", - "rand", + "rand 0.8.3", "rustc-hex", "static_assertions", ] [[package]] name = "frame-metadata" -version = "12.0.0" +version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b5640bfcb7111643807c63cd38ecdcc923d3253e525f23ab6b366002bf8ecd5" +checksum = "073f7bef18421362441a1708f8528e442234954611f95bdc554b313fb321948e" dependencies = [ "parity-scale-codec", "serde", @@ -424,11 +422,11 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "807c32da14bd0e5fb751095335a07938cda6f1488f57d7b0539118e3434980a8" +checksum = "04e521e6214615bd82ba6b5fc7fd40a9cc14fdeb40f83da5eba12aa2f8179fb8" dependencies = [ - "bitmask", + "bitflags", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", @@ -443,6 +441,7 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", + "sp-staking", "sp-state-machine", "sp-std", "sp-tracing", @@ -450,10 +449,11 @@ dependencies = [ [[package]] name = "frame-support-procedural" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "508dc2eb44a802f1876e3dc97a76aed8f18b993f75f6cb1975cb83cf45a5d981" +checksum = "2668e24cbaba7f0e91d0c92a94bd1ae425a942608ad0b775db32477f5df4da9e" dependencies = [ + "Inflector", "frame-support-procedural-tools", "proc-macro2", "quote", @@ -462,9 +462,9 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f6d1dd14477123180c47024bcc24c1a624ea8631b4f00080d14089907397f4" +checksum = "d4f88cfd111e004590f4542b75e6d3302137b9067d7e7219e4ac47a535c3b5c1" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -475,9 +475,9 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad38379ecedd632f286c7b94a4b9a15bffb635194de4dbf2b4458bc46cee28f" +checksum = "79285388b120ac96c15a791c56b26b9264f7231324fbe0fd05026acd92bf2e6a" dependencies = [ "proc-macro2", "quote", @@ -486,9 +486,9 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d172404f0e44b867f5fd14465a27f298b8828b53d7a7a555d3759e1dec3c8f0d" +checksum = "f5fedbff05d665c00bf4e089b4377fcb15b8bd37ebc3e5fc06665474cf6e25d7" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -501,6 +501,12 @@ dependencies = [ "sp-version", ] +[[package]] +name = "funty" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + [[package]] name = "futures" version = "0.3.8" @@ -640,6 +646,17 @@ dependencies = [ "wasi 0.9.0+wasi-snapshot-preview1", ] +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", +] + [[package]] name = "gimli" version = "0.23.0" @@ -663,12 +680,11 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" dependencies = [ "ahash", - "autocfg", ] [[package]] @@ -692,10 +708,20 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" dependencies = [ - "crypto-mac", + "crypto-mac 0.7.0", "digest 0.8.1", ] +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + [[package]] name = "hmac-drbg" version = "0.2.0" @@ -704,14 +730,14 @@ checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" dependencies = [ "digest 0.8.1", "generic-array 0.12.3", - "hmac", + "hmac 0.7.1", ] [[package]] name = "impl-codec" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" +checksum = "df170efa359aebdd5cb7fe78edcc67107748e4737bdca8a8fb40d15ea7a877ed" dependencies = [ "parity-scale-codec", ] @@ -727,9 +753,9 @@ dependencies = [ [[package]] name = "impl-trait-for-tuples" -version = "0.1.3" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" +checksum = "d5dacb10c5b3bb92d46ba347505a9041e676bb20ad220101326bffb0c93031ee" dependencies = [ "proc-macro2", "quote", @@ -788,21 +814,12 @@ dependencies = [ "crunchy", "digest 0.8.1", "hmac-drbg", - "rand", + "rand 0.7.3", "sha2 0.8.2", "subtle 2.3.0", "typenum", ] -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - [[package]] name = "lock_api" version = "0.4.2" @@ -851,9 +868,9 @@ checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memory-db" -version = "0.24.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a" +checksum = "814bbecfc0451fc314eeea34f05bbcd5b98a7ad7af37faee088b86a1e633f1d4" dependencies = [ "hash-db", "hashbrown", @@ -874,7 +891,7 @@ checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78" dependencies = [ "byteorder", "keccak", - "rand_core", + "rand_core 0.5.1", "zeroize", ] @@ -958,7 +975,7 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" dependencies = [ - "parking_lot 0.11.1", + "parking_lot", ] [[package]] @@ -975,11 +992,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "parity-scale-codec" -version = "1.3.5" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c740e5fbcb6847058b40ac7e5574766c6388f585e184d769910fe0d3a2ca861" +checksum = "e0f518afaa5a47d0d6386229b0a6e01e86427291d643aa4cabb4992219f504f8" dependencies = [ - "arrayvec 0.5.2", + "arrayvec 0.7.0", "bitvec", "byte-slice-cast", "parity-scale-codec-derive", @@ -988,9 +1005,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "1.2.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "198db82bb1c18fc00176004462dd809b2a6d851669550aa17af6dacd21ae0c14" +checksum = "f44c5f94427bd0b5076e8f7e15ca3f60a4d8ac0077e4793884e6fdfd8915344e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1000,15 +1017,15 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297ff91fa36aec49ce183484b102f6b75b46776822bd81525bfc4cc9b0dd0f5c" +checksum = "664a8c6b8e62d8f9f2f937e391982eb433ab285b4cd9545b342441e04a906e42" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "hashbrown", "impl-trait-for-tuples", "parity-util-mem-derive", - "parking_lot 0.10.2", + "parking_lot", "primitive-types", "winapi", ] @@ -1030,16 +1047,6 @@ version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" -[[package]] -name = "parking_lot" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.2", -] - [[package]] name = "parking_lot" version = "0.11.1" @@ -1047,22 +1054,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", - "lock_api 0.4.2", - "parking_lot_core 0.8.0", -] - -[[package]] -name = "parking_lot_core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi 0.0.3", - "libc", - "redox_syscall", - "smallvec", - "winapi", + "lock_api", + "parking_lot_core", ] [[package]] @@ -1072,7 +1065,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" dependencies = [ "cfg-if 0.1.10", - "cloudabi 0.1.0", + "cloudabi", "instant", "libc", "redox_syscall", @@ -1082,31 +1075,27 @@ dependencies = [ [[package]] name = "paste" -version = "0.1.18" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -dependencies = [ - "paste-impl", - "proc-macro-hack", -] +checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" [[package]] -name = "paste-impl" -version = "0.1.18" +name = "pbkdf2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" dependencies = [ - "proc-macro-hack", + "byteorder", + "crypto-mac 0.7.0", ] [[package]] name = "pbkdf2" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" dependencies = [ - "byteorder", - "crypto-mac", + "crypto-mac 0.8.0", ] [[package]] @@ -1149,9 +1138,9 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "primitive-types" -version = "0.7.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd39dcacf71411ba488570da7bbc89b717225e46478b30ba99b92db6b149809" +checksum = "2415937401cb030a2a0a4d922483f945fa068f52a7dbb22ce0fe5f2b6f6adace" dependencies = [ "fixed-hash", "impl-codec", @@ -1182,9 +1171,9 @@ checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ "unicode-xid", ] @@ -1200,9 +1189,9 @@ dependencies = [ [[package]] name = "radium" -version = "0.3.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" [[package]] name = "rand" @@ -1210,14 +1199,25 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.15", "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.2.2", + "rand_core 0.5.1", "rand_hc", "rand_pcg", ] +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.2", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -1225,7 +1225,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.2", ] [[package]] @@ -1234,7 +1244,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.15", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +dependencies = [ + "getrandom 0.2.2", ] [[package]] @@ -1243,7 +1262,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", ] [[package]] @@ -1252,7 +1271,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core", + "rand_core 0.5.1", ] [[package]] @@ -1351,10 +1370,11 @@ dependencies = [ "arrayref", "arrayvec 0.5.2", "curve25519-dalek 2.1.0", - "getrandom", + "getrandom 0.1.15", "merlin", - "rand", - "rand_core", + "rand 0.7.3", + "rand_core 0.5.1", + "serde", "sha2 0.8.2", "subtle 2.3.0", "zeroize", @@ -1374,9 +1394,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "secrecy" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9182278ed645df3477a9c27bfee0621c621aa16f6972635f7f795dae3d81070f" +checksum = "0673d6a6449f5e7d12a1caf424fd9363e2af3a4953023ed455e3c4beef4597c0" dependencies = [ "zeroize", ] @@ -1482,9 +1502,9 @@ checksum = "7acad6f34eb9e8a259d3283d1e8c1d34d7415943d4895f65cc73813c7396fc85" [[package]] name = "sp-application-crypto" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "885eca124aa6ce0bba57c08bc48c4357096996d630a77f572580ef8e2e4df034" +checksum = "c52e2e6d43036b97c4fce1ed87c5262c1ffdc78c655ada4d3024a3f8094bdd2c" dependencies = [ "parity-scale-codec", "serde", @@ -1495,9 +1515,9 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "667775bc50eb214225df18c92e4ec57acc7e2dc78d7d210eb4dd930db1a73995" +checksum = "d0f1c69966c192d1dee8521f0b29ece2b14db07b9b44d801a94e295234761645" dependencies = [ "integer-sqrt", "num-traits", @@ -1509,14 +1529,13 @@ dependencies = [ [[package]] name = "sp-core" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e92ac5c674ee2cd9219d084301b4cbb82b28a94a0f3087bf4bea0ef3067ebb5c" +checksum = "abbc8d4e9b8a7d5819ed26f1374017bb32833ef4890e4ff065e1da30669876bc" dependencies = [ "base58", "blake2-rfc", "byteorder", - "derive_more", "dyn-clonable", "ed25519-dalek", "futures", @@ -1531,20 +1550,21 @@ dependencies = [ "num-traits", "parity-scale-codec", "parity-util-mem", - "parking_lot 0.10.2", + "parking_lot", "primitive-types", - "rand", + "rand 0.7.3", "regex", "schnorrkel", "secrecy", "serde", - "sha2 0.8.2", + "sha2 0.9.2", "sp-debug-derive", "sp-externalities", "sp-runtime-interface", "sp-std", "sp-storage", "substrate-bip39", + "thiserror", "tiny-bip39", "tiny-keccak", "twox-hash", @@ -1554,9 +1574,9 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3750b084e0f4677f6e834a974f30b1ba97fc2fe00185c9d03611a2228446dc" +checksum = "e80275f23b4e7ba8f54dec5f90f016530e7307d2ee9445f617ab986cbe97f31e" dependencies = [ "proc-macro2", "quote", @@ -1565,9 +1585,9 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d87fcd0e0fc5e025459cfe769803488d4894e36d0f8cef80b5239d2e7ef6580" +checksum = "2fdc625f8c7b13b9a136d334888b21b5743d2081cb666cb03efca1dc9b8f74d1" dependencies = [ "environmental", "parity-scale-codec", @@ -1577,31 +1597,32 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "365e5aee23640631e63e8634f1d804e33c8fcb521f4052910f29abaa2df1c1cf" +checksum = "2542380b535c6941502a0a3069a657eb5abb70fd67b11afa164d4a4b038ba73a" dependencies = [ - "derive_more", "parity-scale-codec", - "parking_lot 0.10.2", + "parking_lot", "sp-core", "sp-std", + "thiserror", ] [[package]] name = "sp-io" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e1dee9244eb6cba1bef9b3a4ec288185e1380e455f1fd348b60252592c1cf0" +checksum = "33fd69f0a6e91bedc2fb1c5cc3689c212474b6c918274cb4cb14dbbe3c428c14" dependencies = [ "futures", "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot 0.10.2", + "parking_lot", "sp-core", "sp-externalities", + "sp-keystore", "sp-runtime-interface", "sp-state-machine", "sp-std", @@ -1612,21 +1633,37 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "sp-keystore" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db6ccd2baf189112355338e8b224dc513cd239b974dbd717f12b3dc7a7248c3b" +dependencies = [ + "async-trait", + "derive_more", + "futures", + "merlin", + "parity-scale-codec", + "parking_lot", + "schnorrkel", + "sp-core", + "sp-externalities", +] + [[package]] name = "sp-panic-handler" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "492126eb766b3b6740e4e4929d6527d37708598b7296a664f3680c0f0c1fc573" +checksum = "54702e109f1c8a870dd4065a497d2612d42cec5817126e96cc0658c5ea975784" dependencies = [ "backtrace", - "log", ] [[package]] name = "sp-runtime" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62542f8ce9d5fcb43a4dd3c3a53326d33aacf9b0bc9d353d6fe9fd5ff3031747" +checksum = "dfa4b353b76f04616dbdb8d269d58dcac47acb31c006d3b70e7b64233e68695e" dependencies = [ "either", "hash256-std-hasher", @@ -1635,22 +1672,22 @@ dependencies = [ "parity-scale-codec", "parity-util-mem", "paste", - "rand", + "rand 0.7.3", "serde", "sp-application-crypto", "sp-arithmetic", "sp-core", - "sp-inherents", "sp-io", "sp-std", ] [[package]] name = "sp-runtime-interface" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7e363c480cc8c9019b84f85d10c0b56a184079d5d840d2d1d55087ad835dc6" +checksum = "b2e5c88b4bc8d607e4e2ff767a85db58cf7101f3dd6064f06929342ea67fe8fb" dependencies = [ + "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", "sp-externalities", @@ -1664,9 +1701,9 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cf56a38544293e54dbe0aa7b6aed1e046bfc704b6fc3de7255897dca98ccb1" +checksum = "19a6c7c2251512c9e533d15db8a863b06ece1cbee778130dd9adbe44b6b39aa9" dependencies = [ "Inflector", "proc-macro-crate", @@ -1675,39 +1712,51 @@ dependencies = [ "syn", ] +[[package]] +name = "sp-staking" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc729eb10f8809c61a1fe439ac118a4413de004aaf863003ee8752ac0b596e73" +dependencies = [ + "parity-scale-codec", + "sp-runtime", + "sp-std", +] + [[package]] name = "sp-state-machine" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f58335de98bca196683a8ef22195a8a43b457b8bc705dba3124138ffc2ee720" +checksum = "46fa4143e58e9130f726d4e8a9b86f3530a8bd19a2eedcdcf4af205f4b5a6d4f" dependencies = [ "hash-db", "log", "num-traits", "parity-scale-codec", - "parking_lot 0.10.2", - "rand", + "parking_lot", + "rand 0.7.3", "smallvec", "sp-core", "sp-externalities", "sp-panic-handler", "sp-std", "sp-trie", + "thiserror", "trie-db", "trie-root", ] [[package]] name = "sp-std" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2d6e166cead2d3b1d3d8fe0e787d076b7d0296b1760a0d7d340846d0ba42c5" +checksum = "35391ea974fa5ee869cb094d5b437688fbf3d8127d64d1b9fed5822a1ed39b12" [[package]] name = "sp-storage" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4625e6f8f40995939560f48f89028f658b7929657c68d01c571c81ab5619ff" +checksum = "86af458d4a0251c490cdde9dcaaccb88d398f3b97ac6694cdd49ed9337e6b961" dependencies = [ "impl-serde", "parity-scale-codec", @@ -1719,9 +1768,9 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9a5c42c5450991ca3a28c190e75122f5ccedbcb024953e7c357e7aa2afd8534" +checksum = "567382d8d4e14fb572752863b5cd57a78f9e9a6583332b590b726f061f3ea957" dependencies = [ "log", "parity-scale-codec", @@ -1733,9 +1782,9 @@ dependencies = [ [[package]] name = "sp-trie" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3aae57c8ae81ba978503137a8c625d2963eb425dd90dec0d96b4ed18d8bfd55" +checksum = "b85b7f745da41ef825c6f7b93f1fdc897b03df94a4884adfbb70fbcd0aed1298" dependencies = [ "hash-db", "memory-db", @@ -1748,9 +1797,9 @@ dependencies = [ [[package]] name = "sp-version" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21935199c8765f0d02facc718f9c83149a70ea684fb03612e5161c682b38a301" +checksum = "dbeffa538a13d715d30e01d57a2636ba32845b737a29a3ea32403576588222e7" dependencies = [ "impl-serde", "parity-scale-codec", @@ -1761,9 +1810,9 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c28225e8b7ec7e260f8b46443f8731abda206334cb75c740d2407693f38167" +checksum = "b214e125666a6416cf30a70cc6a5dacd34a4e5197f8a3d479f714af7e1dc7a47" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -1779,7 +1828,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "substrate-account-set" -version = "0.4.0" +version = "3.0.0" dependencies = [ "frame-support", "frame-system", @@ -1797,8 +1846,8 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bed6646a0159b9935b5d045611560eeef842b78d7adc3ba36f5ca325a13a0236" dependencies = [ - "hmac", - "pbkdf2", + "hmac 0.7.1", + "pbkdf2 0.3.0", "schnorrkel", "sha2 0.8.2", "zeroize", @@ -1818,9 +1867,9 @@ checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" [[package]] name = "syn" -version = "1.0.52" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c1e438504729046a5cfae47f97c30d6d083c7d91d94603efdae3477fc070d4c" +checksum = "b9505f307c872bab8eb46f77ae357c8eba1fdacead58ee5a850116b1d7f82883" dependencies = [ "proc-macro2", "quote", @@ -1839,6 +1888,32 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "thiserror" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thread_local" version = "1.0.1" @@ -1861,18 +1936,20 @@ dependencies = [ [[package]] name = "tiny-bip39" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0165e045cc2ae1660270ca65e1676dbaab60feb0f91b10f7d0665e9b47e31f2" +checksum = "d9e44c4759bae7f1032e286a7ef990bd9ed23fe831b7eeba0beb97484c2e59b8" dependencies = [ - "failure", - "hmac", + "anyhow", + "hmac 0.8.1", "once_cell", - "pbkdf2", - "rand", + "pbkdf2 0.4.0", + "rand 0.7.3", "rustc-hash", - "sha2 0.8.2", + "sha2 0.9.2", + "thiserror", "unicode-normalization", + "zeroize", ] [[package]] @@ -1985,9 +2062,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.22.1" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0" +checksum = "ec051edf7f0fc9499a2cb0947652cab2148b9d7f61cee7605e312e9f970dacaf" dependencies = [ "hash-db", "hashbrown", @@ -2012,7 +2089,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" dependencies = [ "cfg-if 0.1.10", - "rand", + "rand 0.7.3", "static_assertions", ] @@ -2024,13 +2101,13 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" -version = "0.8.5" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" +checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e" dependencies = [ "byteorder", "crunchy", - "rustc-hex", + "hex", "static_assertions", ] @@ -2112,11 +2189,17 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + [[package]] name = "zeroize" -version = "1.1.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f33972566adbd2d3588b0491eb94b98b43695c4ef897903470ede4f3f5a28a" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" dependencies = [ "zeroize_derive", ] diff --git a/Cargo.toml b/Cargo.toml index 173f81a..f75258b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-account-set" -version = "0.4.0" +version = "3.0.0" authors = ["Gautam Dhameja "] edition = "2018" license = "Apache-2.0" @@ -23,13 +23,13 @@ std = [ default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.3.4' +version = '2.0.0' [dependencies] serde = { features = ['derive'], optional = true, version = '1.0.101' } -sp-std = { default-features = false, version = '2.0.0' } -sp-runtime = { default-features = false, version = '2.0.0' } -sp-core = { default-features = false, version = '2.0.0' } -frame-support = { default-features = false, version = '2.0.0' } -frame-system = { default-features = false, version = '2.0.0' } -sp-io = { default-features = false, version = '2.0.0' } +sp-std = { default-features = false, version = '3.0.0' } +sp-runtime = { default-features = false, version = '3.0.0' } +sp-core = { default-features = false, version = '3.0.0' } +frame-support = { default-features = false, version = '3.0.0' } +frame-system = { default-features = false, version = '3.0.0' } +sp-io = { default-features = false, version = '3.0.0' } diff --git a/src/lib.rs b/src/lib.rs index 4532d68..cb72700 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,12 +9,7 @@ use sp_std::prelude::*; use codec::{Decode, Encode}; use sp_std::marker::PhantomData; use sp_std::fmt::Debug; -use frame_support::{ - decl_event, decl_storage, decl_module, - dispatch, - weights::DispatchInfo, -}; -use frame_system::{self as system, ensure_root}; +use frame_support::{weights::DispatchInfo}; use sp_runtime::{ transaction_validity::{ ValidTransaction, TransactionValidityError, @@ -24,62 +19,100 @@ use sp_runtime::{ traits::{SignedExtension, DispatchInfoOf, Dispatchable} }; -pub trait Trait: system::Trait { - type Event: From> + Into<::Event>; -} +pub use pallet::*; -decl_storage! { - trait Store for Module as AccountSet { - // The allow-list is a _set_ of accounts. - // We map to (), and use the map for faster lookups. - AllowedAccounts get(fn allowed_accounts) config(): map hasher(blake2_128_concat) T::AccountId => (); - } -} +#[frame_support::pallet] +pub mod pallet { + use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*}; + use frame_system::pallet_prelude::*; + use super::*; + + /// Configure the pallet by specifying the parameters and types on which it depends. + #[pallet::config] + pub trait Config: frame_system::Config { + type Event: From> + IsType<::Event>; + } + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + // The pallet's runtime storage items. + #[pallet::storage] + #[pallet::getter(fn validators)] + pub type AllowedAccounts = StorageMap<_, Blake2_128Concat, T::AccountId, ()>; + + #[pallet::event] + #[pallet::metadata(T::AccountId = "AccountId")] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + // When a new account is added to the allow-list. + AccountAllowed(T::AccountId), + // When an account is removed from the allow-list. + AccountRemoved(T::AccountId), + } + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::genesis_config] + pub struct GenesisConfig{ + pub allowed_accounts: Vec<(T::AccountId, ())>, + } -decl_module! { - pub struct Module for enum Call where origin: T::Origin { + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + Self { allowed_accounts: Vec::new() } + } + } - fn deposit_event() = default; + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + Pallet::::initialize_allowed_accounts(&self.allowed_accounts); + } + } - /// Add a new account to the allow-list. + #[pallet::call] + impl Pallet { + /// Add a new account to the allow-list. /// Can only be called by the root. - #[weight = 0] - pub fn add_account(origin, new_account: T::AccountId) -> dispatch::DispatchResult { + #[pallet::weight(0)] + pub fn add_account(origin: OriginFor, new_account: T::AccountId) -> DispatchResultWithPostInfo { ensure_root(origin)?; >::insert(&new_account, ()); - Self::deposit_event(RawEvent::AccountAllowed(new_account)); + Self::deposit_event(Event::AccountAllowed(new_account)); - Ok(()) + Ok(().into()) } - /// Remove an account from the allow-list. + /// Remove an account from the allow-list. /// Can only be called by the root. - #[weight = 0] - pub fn remove_account(origin, account_to_remove: T::AccountId) -> dispatch::DispatchResult { + #[pallet::weight(0)] + pub fn remove_account(origin: OriginFor, account_to_remove: T::AccountId) -> DispatchResultWithPostInfo { ensure_root(origin)?; >::remove(&account_to_remove); - Self::deposit_event(RawEvent::AccountRemoved(account_to_remove)); + Self::deposit_event(Event::AccountRemoved(account_to_remove)); - Ok(()) + Ok(().into()) } - } + } } -decl_event!( - pub enum Event - where - AccountId = ::AccountId, - { - // When a new account is added to the allow-list. - AccountAllowed(AccountId), - // When an account is removed from the allow-list. - AccountRemoved(AccountId), - } -); +impl Pallet { + fn initialize_allowed_accounts(allowed_accounts: &[(T::AccountId, ())]) { + if !allowed_accounts.is_empty() { + for (account, extrinsics) in allowed_accounts.iter() { + >::insert(account, extrinsics); + } + } + } +} /// The following section implements the `SignedExtension` trait /// for the `AllowAccount` type. @@ -94,11 +127,18 @@ decl_event!( /// and the extrinsics are filtered out before they hit the pallet logic. /// The `AllowAccount` struct. -#[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct AllowAccount(PhantomData); +#[derive(Encode, Decode, Clone, Eq, PartialEq, Default)] +pub struct AllowAccount(PhantomData); + +impl AllowAccount { + /// utility constructor. Used only in client/factory code. + pub fn new() -> Self { + Self(PhantomData) + } +} /// Debug impl for the `AllowAccount` struct. -impl Debug for AllowAccount { +impl Debug for AllowAccount { #[cfg(feature = "std")] fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "AllowAccount") @@ -111,7 +151,7 @@ impl Debug for AllowAccount { } /// Implementation of the `SignedExtension` trait for the `AllowAccount` struct. -impl SignedExtension for AllowAccount where +impl SignedExtension for AllowAccount where T::Call: Dispatchable { type AccountId = T::AccountId; type Call = T::Call; From 3e4ac9f81e163ab925fcf02e933b9fb6caeedd1a Mon Sep 17 00:00:00 2001 From: Nacho Pal Date: Thu, 22 Apr 2021 13:50:55 +0800 Subject: [PATCH 2/3] readme updated to v3.0.0 --- readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index eeb303e..2eb9727 100644 --- a/readme.md +++ b/readme.md @@ -22,7 +22,7 @@ default-features = false ```rust pub use accountset; -impl accountset::Trait for Runtime { +impl accountset::Config for Runtime { type Event = Event; } @@ -53,6 +53,8 @@ pub type SignedExtra = ( * Add a genesis configuration for the module in the `src/chain_spec.rs` file. This configuration adds the initial account ids to the account allow-list. ```rust + use node_template_runtime::{..., AccountSetConfig}; + ... accountset: Some(AccountSetConfig { allowed_accounts: vec![ (get_account_id_from_seed::("Alice"), ()), From 65e02b745b0e2f87a38098e9ff3ce4d0aaca41ea Mon Sep 17 00:00:00 2001 From: Nacho Pal Date: Thu, 22 Apr 2021 18:34:31 +0800 Subject: [PATCH 3/3] remove wrong getter --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index cb72700..14662c0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,7 +39,6 @@ pub mod pallet { // The pallet's runtime storage items. #[pallet::storage] - #[pallet::getter(fn validators)] pub type AllowedAccounts = StorageMap<_, Blake2_128Concat, T::AccountId, ()>; #[pallet::event]