diff --git a/Cargo.lock b/Cargo.lock index f6e86d75..9f4b8b40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,11 +14,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.26.2", + "gimli 0.27.3", ] [[package]] @@ -110,9 +110,9 @@ dependencies = [ [[package]] name = "array-bytes" -version = "4.2.0" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" +checksum = "6f840fb7195bcfc5e17ea40c26e5ce6d5b9ce5d584466e17703209657e459ae0" [[package]] name = "arrayref" @@ -350,9 +350,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.10.3" +version = "0.15.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +checksum = "6100bc57b6209840798d95cb2775684849d332f7bd788db2a8c8caf7ef82a41a" dependencies = [ "smallvec", ] @@ -407,6 +407,26 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +[[package]] +name = "const-random" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.11", + "once_cell", + "tiny-keccak", +] + [[package]] name = "constant_time_eq" version = "0.3.0" @@ -445,9 +465,9 @@ dependencies = [ [[package]] name = "cranelift-entity" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f42ea692c7b450ad18b8c9889661505d51c09ec4380cf1c2d278dbb2da22cae1" +checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" dependencies = [ "serde", ] @@ -512,7 +532,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.42#f603a61ff370fc33740c9373833c3c6ba1486846" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v1.0.0#0d17cf6bef320f156f2859d6d2b0abd4154ae1d5" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -650,12 +670,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - [[package]] name = "dyn-clonable" version = "0.9.0" @@ -810,15 +824,15 @@ dependencies = [ [[package]] name = "expander" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f360349150728553f92e4c997a16af8915f418d3a0f21b440d34c5632f16ed84" +checksum = "5f86a749cf851891866c10515ef6c299b5c69661465e9c3bbe7e07a2b77fb0f7" dependencies = [ "blake2", "fs-err", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] @@ -873,7 +887,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-support-procedural", @@ -897,9 +911,9 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "15.1.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" +checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" dependencies = [ "cfg-if", "parity-scale-codec", @@ -910,7 +924,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "bitflags 1.3.2", "environmental", @@ -919,7 +933,7 @@ dependencies = [ "impl-trait-for-tuples", "k256", "log", - "once_cell", + "macro_magic", "parity-scale-codec", "paste", "scale-info", @@ -929,6 +943,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-core-hashing-proc-macro", + "sp-debug-derive", "sp-inherents", "sp-io", "sp-runtime", @@ -943,13 +958,15 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "cfg-expr", "derive-syn-parse", + "expander", "frame-support-procedural-tools", "itertools", + "macro_magic", "proc-macro-warning", "proc-macro2", "quote", @@ -959,7 +976,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -971,7 +988,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro2", "quote", @@ -981,8 +998,9 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ + "cfg-if", "frame-support", "log", "parity-scale-codec", @@ -1083,12 +1101,6 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" - [[package]] name = "futures-util" version = "0.3.29" @@ -1151,11 +1163,12 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" dependencies = [ "fallible-iterator", + "indexmap 1.9.3", "stable_deref_trait", ] @@ -1461,12 +1474,6 @@ version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - [[package]] name = "libsecp256k1" version = "0.7.1" @@ -1561,6 +1568,54 @@ dependencies = [ "libc", ] +[[package]] +name = "macro_magic" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aee866bfee30d2d7e83835a4574aad5b45adba4cc807f2a3bbba974e5d4383c9" +dependencies = [ + "macro_magic_core", + "macro_magic_macros", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "macro_magic_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e766a20fd9c72bab3e1e64ed63f36bd08410e75803813df210d1ce297d7ad00" +dependencies = [ + "const-random", + "derive-syn-parse", + "macro_magic_core_macros", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "macro_magic_core_macros" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "macro_magic_macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" +dependencies = [ + "macro_magic_core", + "quote", + "syn 2.0.39", +] + [[package]] name = "matchers" version = "0.0.1" @@ -1597,9 +1652,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.6.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] @@ -1613,12 +1668,6 @@ dependencies = [ "hash-db", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "merlin" version = "2.0.1" @@ -1673,17 +1722,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" -[[package]] -name = "num-bigint" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-complex" version = "0.4.4" @@ -1720,7 +1758,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", - "num-bigint", "num-integer", "num-traits", ] @@ -1746,12 +1783,12 @@ dependencies = [ [[package]] name = "object" -version = "0.29.0" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "crc32fast", - "hashbrown 0.12.3", + "hashbrown 0.13.2", "indexmap 1.9.3", "memchr", ] @@ -1786,7 +1823,7 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -1955,7 +1992,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -1973,7 +2010,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -2119,8 +2156,8 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.42" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#6f991987c0b4cbbd7d4badc9ef08d83da5fefbfd" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v1.0.0#c9ec8c5a15959ce711bb60aa79add58f560d61e9" dependencies = [ "parity-scale-codec", "scale-info", @@ -2131,8 +2168,8 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.9.42" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#6f991987c0b4cbbd7d4badc9ef08d83da5fefbfd" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v1.0.0#c9ec8c5a15959ce711bb60aa79add58f560d61e9" dependencies = [ "bounded-collections", "derive_more", @@ -2148,8 +2185,8 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.9.42" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#6f991987c0b4cbbd7d4badc9ef08d83da5fefbfd" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v1.0.0#c9ec8c5a15959ce711bb60aa79add58f560d61e9" dependencies = [ "bitvec", "hex-literal 0.4.1", @@ -2227,9 +2264,9 @@ dependencies = [ [[package]] name = "proc-macro-warning" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e99670bafb56b9a106419397343bdbc8b8742c3cc449fec6345f86173f47cd4" +checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" dependencies = [ "proc-macro2", "quote", @@ -2813,7 +2850,7 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "hash-db", "log", @@ -2821,6 +2858,7 @@ dependencies = [ "scale-info", "sp-api-proc-macro", "sp-core", + "sp-externalities", "sp-metadata-ir", "sp-runtime", "sp-state-machine", @@ -2833,7 +2871,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "blake2", @@ -2846,8 +2884,8 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "23.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -2859,8 +2897,8 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "16.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "integer-sqrt", "num-traits", @@ -2874,7 +2912,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -2887,7 +2925,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -2898,8 +2936,8 @@ dependencies = [ [[package]] name = "sp-core" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "21.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", "bitflags 1.3.2", @@ -2937,29 +2975,28 @@ dependencies = [ "substrate-bip39", "thiserror", "tiny-bip39", + "tracing", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "9.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.7", "sha2 0.10.8", "sha3", - "sp-std", "twox-hash", ] [[package]] name = "sp-core-hashing-proc-macro" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "9.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ - "proc-macro2", "quote", "sp-core-hashing", "syn 2.0.39", @@ -2967,8 +3004,8 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro2", "quote", @@ -2977,8 +3014,8 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "0.19.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "environmental", "parity-scale-codec", @@ -2989,13 +3026,12 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-core", "sp-runtime", "sp-std", "thiserror", @@ -3003,13 +3039,12 @@ dependencies = [ [[package]] name = "sp-io" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "23.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "bytes", "ed25519", "ed25519-dalek", - "futures", "libsecp256k1", "log", "parity-scale-codec", @@ -3029,8 +3064,8 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "24.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "lazy_static", "sp-core", @@ -3040,13 +3075,11 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "0.27.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ - "futures", "parity-scale-codec", "parking_lot", - "serde", "sp-core", "sp-externalities", "thiserror", @@ -3055,7 +3088,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -3065,8 +3098,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "backtrace", "lazy_static", @@ -3075,8 +3108,8 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "24.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "either", "hash256-std-hasher", @@ -3097,8 +3130,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "17.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -3115,8 +3148,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "11.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "proc-macro-crate", @@ -3128,8 +3161,9 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ + "impl-trait-for-tuples", "parity-scale-codec", "scale-info", "serde", @@ -3140,8 +3174,8 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "0.28.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "hash-db", "log", @@ -3156,17 +3190,18 @@ dependencies = [ "sp-trie", "thiserror", "tracing", + "trie-db", ] [[package]] name = "sp-std" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" [[package]] name = "sp-storage" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "13.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3179,11 +3214,9 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", - "futures-timer", - "log", "parity-scale-codec", "sp-inherents", "sp-runtime", @@ -3193,8 +3226,8 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "10.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "sp-std", @@ -3205,8 +3238,8 @@ dependencies = [ [[package]] name = "sp-trie" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "22.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "ahash 0.8.6", "hash-db", @@ -3228,8 +3261,8 @@ dependencies = [ [[package]] name = "sp-version" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "22.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3245,8 +3278,8 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3256,22 +3289,21 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "14.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", "sp-std", - "wasmi", "wasmtime", ] [[package]] name = "sp-weights" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +version = "20.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -3514,6 +3546,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -3816,44 +3857,11 @@ version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" -[[package]] -name = "wasmi" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" -dependencies = [ - "parity-wasm", - "wasmi-validation", - "wasmi_core", -] - -[[package]] -name = "wasmi-validation" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" -dependencies = [ - "parity-wasm", -] - -[[package]] -name = "wasmi_core" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" -dependencies = [ - "downcast-rs", - "libm", - "memory_units", - "num-rational", - "num-traits", -] - [[package]] name = "wasmparser" -version = "0.100.0" +version = "0.102.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" dependencies = [ "indexmap 1.9.3", "url", @@ -3861,9 +3869,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a222f5fa1e14b2cefc286f1b68494d7a965f4bf57ec04c59bb62673d639af6" +checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" dependencies = [ "anyhow", "bincode", @@ -3871,7 +3879,7 @@ dependencies = [ "indexmap 1.9.3", "libc", "log", - "object 0.29.0", + "object 0.30.4", "once_cell", "paste", "psm", @@ -3881,30 +3889,30 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-asm-macros" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4407a7246e7d2f3d8fb1cf0c72fda8dbafdb6dd34d555ae8bea0e5ae031089cc" +checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-environ" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b8b50962eae38ee319f7b24900b7cf371f03eebdc17400c1dc8575fc10c9a7" +checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" dependencies = [ "anyhow", "cranelift-entity", - "gimli 0.26.2", + "gimli 0.27.3", "indexmap 1.9.3", "log", - "object 0.29.0", + "object 0.30.4", "serde", "target-lexicon", "thiserror", @@ -3914,52 +3922,52 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffaed4f9a234ba5225d8e64eac7b4a5d13b994aeb37353cde2cbeb3febda9eaa" +checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" dependencies = [ - "addr2line 0.17.0", + "addr2line 0.19.0", "anyhow", "bincode", "cfg-if", "cpp_demangle", - "gimli 0.26.2", + "gimli 0.27.3", "log", - "object 0.29.0", + "object 0.30.4", "rustc-demangle", "serde", "target-lexicon", "wasmtime-environ", "wasmtime-jit-icache-coherence", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-jit-debug" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" +checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" dependencies = [ "once_cell", ] [[package]] name = "wasmtime-jit-icache-coherence" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a28ae1e648461bfdbb79db3efdaee1bca5b940872e4175390f465593a2e54c" +checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" dependencies = [ "cfg-if", "libc", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-runtime" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e704b126e4252788ccfc3526d4d4511d4b23c521bf123e447ac726c14545217b" +checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" dependencies = [ "anyhow", "cc", @@ -3976,14 +3984,14 @@ dependencies = [ "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-types" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e5572c5727c1ee7e8f28717aaa8400e4d22dcbd714ea5457d85b5005206568" +checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" dependencies = [ "cranelift-entity", "serde", @@ -4051,21 +4059,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -4230,8 +4223,8 @@ dependencies = [ [[package]] name = "xcm" -version = "0.9.42" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#6f991987c0b4cbbd7d4badc9ef08d83da5fefbfd" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v1.0.0#c9ec8c5a15959ce711bb60aa79add58f560d61e9" dependencies = [ "bounded-collections", "derivative", @@ -4246,8 +4239,8 @@ dependencies = [ [[package]] name = "xcm-procedural" -version = "0.9.42" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.42#6f991987c0b4cbbd7d4badc9ef08d83da5fefbfd" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v1.0.0#c9ec8c5a15959ce711bb60aa79add58f560d61e9" dependencies = [ "Inflector", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 6c90abfd..c0acb968 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "claims", "enclave-bridge", diff --git a/claims/Cargo.toml b/claims/Cargo.toml index e10001ce..b6d4fe97 100644 --- a/claims/Cargo.toml +++ b/claims/Cargo.toml @@ -7,53 +7,53 @@ edition = "2021" [dependencies] libsecp256k1 = { version = "0.7.0", default-features = false, optional = true } -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] } +parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } rustc-hex = { version = "2.1.0", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.13", default-features = false } -serde_derive = { version = "1.0.13", optional = true } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { version = "1.0.171", default-features = false } +serde_derive = { version = "1.0.171", optional = true } # substrate dependencies -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } -sp-std = { package = "sp-std", default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", features = ["serde"] } +sp-std = { package = "sp-std", default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } # local -claims-primitives = { package = "claims-primitives", path = "../primitives/claims", default-features = false } +claims-primitives = { package = "claims-primitives", path = "../primitives/claims", default-features = false, features = ["serde_derive"] } [dev-dependencies] hex-literal = "0.3.3" libsecp256k1 = "0.7.0" -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } -pallet-vesting = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +pallet-vesting = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } serde_json = { version = "1.0" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } [features] default = ["std"] no_std = [] std = [ + "claims-primitives/std", + "frame-support/std", + "frame-system/std", "parity-scale-codec/std", "rustc-hex/std", "scale-info/std", - "serde_derive", "serde/std", - "sp-std/std", + "serde_derive", "sp-io/std", - "frame-support/std", "sp-runtime/std", - "frame-system/std", - "claims-primitives/std", + "sp-std/std", ] runtime-benchmarks = [ - "libsecp256k1/hmac", - "libsecp256k1/static-context", "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "libsecp256k1/hmac", + "libsecp256k1/static-context", ] try-runtime = ["frame-support/try-runtime"] diff --git a/claims/src/lib.rs b/claims/src/lib.rs index 29284341..f68a0b4f 100644 --- a/claims/src/lib.rs +++ b/claims/src/lib.rs @@ -28,15 +28,13 @@ pub use pallet::*; use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_io::{crypto::secp256k1_ecdsa_recover, hashing::keccak_256}; -#[cfg(feature = "std")] -use sp_runtime::traits::Zero; use sp_runtime::{ - traits::{CheckedSub, DispatchInfoOf, SignedExtension}, + traits::{CheckedSub, DispatchInfoOf, SignedExtension, Zero}, transaction_validity::{ InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction, }, }; -use sp_std::{fmt::Debug, prelude::*, vec}; +use sp_std::{fmt::Debug, prelude::*, vec, vec::Vec}; type CurrencyOf = <::VestingSchedule as VestingSchedule< ::AccountId, @@ -85,7 +83,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// The overarching event type. type RuntimeEvent: From> + IsType<::RuntimeEvent>; - type VestingSchedule: VestingSchedule; + type VestingSchedule: VestingSchedule>; #[pallet::constant] type Prefix: Get<&'static [u8]>; type MoveClaimOrigin: EnsureOrigin; @@ -131,7 +129,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn vesting)] pub(super) type Vesting = - StorageMap<_, Identity, EthereumAddress, (BalanceOf, BalanceOf, T::BlockNumber)>; + StorageMap<_, Identity, EthereumAddress, (BalanceOf, BalanceOf, BlockNumberFor)>; /// The statement kind that must be signed, if any. #[pallet::storage] @@ -142,22 +140,16 @@ pub mod pallet { pub(super) type Preclaims = StorageMap<_, Identity, T::AccountId, EthereumAddress>; #[allow(clippy::type_complexity)] + #[derive(frame_support::DefaultNoBound)] #[pallet::genesis_config] pub struct GenesisConfig { pub claims: Vec<(EthereumAddress, BalanceOf, Option, Option)>, - pub vesting: Vec<(EthereumAddress, (BalanceOf, BalanceOf, T::BlockNumber))>, - } - - #[cfg(feature = "std")] - impl Default for GenesisConfig { - fn default() -> Self { - GenesisConfig { claims: Default::default(), vesting: Default::default() } - } + pub vesting: Vec<(EthereumAddress, (BalanceOf, BalanceOf, BlockNumberFor))>, } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { // build `Claims` self.claims.iter().map(|(a, b, _, _)| (a, b)).for_each(|(a, b)| { @@ -257,7 +249,7 @@ pub mod pallet { origin: OriginFor, who: EthereumAddress, value: BalanceOf, - vesting_schedule: Option<(BalanceOf, BalanceOf, T::BlockNumber)>, + vesting_schedule: Option<(BalanceOf, BalanceOf, BlockNumberFor)>, statement: Option, ) -> DispatchResult { ensure_root(origin)?; @@ -639,7 +631,7 @@ mod tests { use parity_scale_codec::Encode; use sp_core::H256; - use sp_runtime::{DispatchError::Token, TokenError::Frozen}; + use sp_runtime::{generic, DispatchError::Token, TokenError::Frozen}; // The testing primitives are very useful for avoiding having to work with signatures // or public keys. `u64` is used as the `AccountId` and no `Signature`s are required. use super::Call as ClaimsCall; @@ -647,25 +639,22 @@ mod tests { assert_err, assert_noop, assert_ok, dispatch::{DispatchError::BadOrigin, GetDispatchInfo, Pays}, ord_parameter_types, parameter_types, - traits::{ExistenceRequirement, GenesisBuild, WithdrawReasons}, + traits::{ExistenceRequirement, WithdrawReasons}, }; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, Identity, IdentityLookup}, transaction_validity::TransactionLongevity, + BuildStorage, }; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; - type Block = frame_system::mocking::MockBlock; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Vesting: pallet_vesting::{Pallet, Call, Storage, Config, Event}, Claims: super::pallet::{Pallet, Call, Storage, Config, Event, ValidateUnsigned}, @@ -679,16 +668,15 @@ mod tests { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); + type Block = generic::Block; type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -716,8 +704,8 @@ mod tests { type MaxReserves = (); type ReserveIdentifier = [u8; 8]; type WeightInfo = (); - type HoldIdentifier = (); type FreezeIdentifier = (); + type RuntimeHoldReason = (); type MaxHolds = (); type MaxFreezes = (); } @@ -772,7 +760,7 @@ mod tests { // This function basically just builds a genesis storage key/value store according to // our desired mockup. pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); // We use default for brevity, but you can configure as desired if needed. pallet_balances::GenesisConfig::::default() .assimilate_storage(&mut t) diff --git a/enclave-bridge/Cargo.toml b/enclave-bridge/Cargo.toml index 9267e4da..ea3bc531 100644 --- a/enclave-bridge/Cargo.toml +++ b/enclave-bridge/Cargo.toml @@ -9,10 +9,10 @@ license = "MS-RSL" edition = "2021" [dependencies] -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } log = { version = "0.4.14", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0", features = ["derive"], optional = true } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { version = "1.0.171", features = ["derive"], optional = true } # local enclave-bridge-primitives = { path = "../primitives/enclave-bridge", default-features = false } @@ -20,46 +20,45 @@ pallet-teerex = { path = "../teerex", default-features = false } teerex-primitives = { path = "../primitives/teerex", default-features = false } # substrate dependencies -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -timestamp = { package = "pallet-timestamp", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +timestamp = { package = "pallet-timestamp", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } # benchmarking -frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } hex-literal = { version = "0.3.2", optional = true } -pallet-balances = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +pallet-balances = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } test-utils = { path = "../test-utils", default-features = false, optional = true } [dev-dependencies] env_logger = "0.9.0" -externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } hex-literal = "0.3.2" -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } test-utils = { path = "../test-utils" } [features] default = ["std"] std = [ "codec/std", - "log/std", - "scale-info/std", - "serde", - # local - "pallet-teerex/std", "enclave-bridge-primitives/std", - # substrate "frame-support/std", "frame-system/std", + "log/std", + "pallet-teerex/std", + "scale-info/std", + "serde", "sp-core/std", "sp-io/std", "sp-runtime/std", "sp-std/std", + "teerex-primitives/std", "timestamp/std", ] runtime-benchmarks = [ diff --git a/enclave-bridge/src/lib.rs b/enclave-bridge/src/lib.rs index 5e533ebc..4f8b1cc6 100644 --- a/enclave-bridge/src/lib.rs +++ b/enclave-bridge/src/lib.rs @@ -29,7 +29,7 @@ use frame_support::{ pallet_prelude::ConstU32, traits::{Currency, ExistenceRequirement}, }; -use frame_system::{self, ensure_signed}; +use frame_system::{self, ensure_signed, pallet_prelude::BlockNumberFor}; use pallet_teerex::Pallet as Teerex; use sp_core::{bounded::BoundedVec, H256}; use sp_runtime::traits::{SaturatedConversion, Saturating}; @@ -38,10 +38,8 @@ use teerex_primitives::{EnclaveFingerprint, MultiEnclave}; // Disambiguate associated types pub type AccountId = ::AccountId; pub type BalanceOf = <::Currency as Currency>>::Balance; -pub type ShardSignerStatus = ShardSignerStatusGeneric< - ::AccountId, - ::BlockNumber, ->; +pub type ShardSignerStatus = + ShardSignerStatusGeneric<::AccountId, BlockNumberFor>; pub type ShardSignerStatusVec = BoundedVec, ConstU32>; @@ -94,7 +92,7 @@ pub mod pallet { shard: ShardIdentifier, block_hash: H256, trusted_calls_merkle_root: H256, - block_number: T::BlockNumber, + block_number: BlockNumberFor, }, /// An enclave has published some [hash] with some metadata [data]. PublishedHash { @@ -141,7 +139,7 @@ pub mod pallet { _, Blake2_128Concat, ShardIdentifier, - UpgradableShardConfig, + UpgradableShardConfig>, OptionQuery, >; @@ -173,7 +171,7 @@ pub mod pallet { origin: OriginFor, shard: ShardIdentifier, block_hash: H256, - block_number: T::BlockNumber, + block_number: BlockNumberFor, trusted_calls_merkle_root: H256, ) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; @@ -318,46 +316,48 @@ pub mod pallet { origin: OriginFor, shard: ShardIdentifier, shard_config: ShardConfig, - enactment_delay: T::BlockNumber, + enactment_delay: BlockNumberFor, ) -> DispatchResultWithPostInfo { let maybe_sender = ensure_signed_or_root(origin)?; let current_block_number = >::block_number(); - let new_upgradable_shard_config: UpgradableShardConfig = - match Self::get_maybe_updated_shard_config(shard, current_block_number, false) { - Some(old_config) => { - if let Some(sender) = maybe_sender { - let enclave = Teerex::::get_sovereign_enclave(&sender)?; - ensure!( - old_config.enclave_fingerprint == enclave.fingerprint(), - Error::::WrongFingerprintForShard - ); - Self::touch_shard( - shard, - &sender, - enclave.fingerprint(), - current_block_number, - )?; - } - UpgradableShardConfig::from(old_config).with_pending_upgrade( - shard_config, - current_block_number.saturating_add(enactment_delay), - ) - }, - None => { - // if shard does not exist, we allow any ShardIdentifier to be created by any registered enclave or root - if let Some(sender) = maybe_sender { - let enclave = Teerex::::get_sovereign_enclave(&sender)?; - Self::touch_shard( - shard, - &sender, - enclave.fingerprint(), - current_block_number, - )?; - } - shard_config.into() - }, - }; + let new_upgradable_shard_config: UpgradableShardConfig< + T::AccountId, + BlockNumberFor, + > = match Self::get_maybe_updated_shard_config(shard, current_block_number, false) { + Some(old_config) => { + if let Some(sender) = maybe_sender { + let enclave = Teerex::::get_sovereign_enclave(&sender)?; + ensure!( + old_config.enclave_fingerprint == enclave.fingerprint(), + Error::::WrongFingerprintForShard + ); + Self::touch_shard( + shard, + &sender, + enclave.fingerprint(), + current_block_number, + )?; + } + UpgradableShardConfig::from(old_config).with_pending_upgrade( + shard_config, + current_block_number.saturating_add(enactment_delay), + ) + }, + None => { + // if shard does not exist, we allow any ShardIdentifier to be created by any registered enclave or root + if let Some(sender) = maybe_sender { + let enclave = Teerex::::get_sovereign_enclave(&sender)?; + Self::touch_shard( + shard, + &sender, + enclave.fingerprint(), + current_block_number, + )?; + } + shard_config.into() + }, + }; >::insert(shard, new_upgradable_shard_config.clone()); @@ -412,7 +412,7 @@ impl Pallet { pub fn get_sovereign_enclave_and_touch_shard( enclave_signer: &T::AccountId, shard: ShardIdentifier, - current_block_number: T::BlockNumber, + current_block_number: BlockNumberFor, ) -> Result<(MultiEnclave>, ShardSignerStatusVec), DispatchErrorWithPostInfo> { let enclave = Teerex::::get_sovereign_enclave(enclave_signer)?; ensure!( @@ -429,7 +429,7 @@ impl Pallet { pub fn get_maybe_updated_shard_config( shard: ShardIdentifier, - current_block_number: T::BlockNumber, + current_block_number: BlockNumberFor, apply_due_update: bool, ) -> Option> { Self::shard_config(shard).map(|current| { @@ -455,7 +455,7 @@ impl Pallet { shard: ShardIdentifier, enclave_signer: &T::AccountId, enclave_fingerprint: EnclaveFingerprint, - current_block_number: T::BlockNumber, + current_block_number: BlockNumberFor, ) -> Result, DispatchErrorWithPostInfo> { let new_status = ShardSignerStatus:: { signer: enclave_signer.clone(), diff --git a/enclave-bridge/src/mock.rs b/enclave-bridge/src/mock.rs index 58292c5d..627b9f60 100644 --- a/enclave-bridge/src/mock.rs +++ b/enclave-bridge/src/mock.rs @@ -18,13 +18,14 @@ // Creating mock runtime here use crate as pallet_enclave_bridge; use crate::Config; -use frame_support::{self, pallet_prelude::GenesisBuild, parameter_types}; +use frame_support::{self, parameter_types}; use frame_system as system; use sp_core::H256; use sp_keyring::AccountKeyring; use sp_runtime::{ generic, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, + BuildStorage, }; pub type Signature = sp_runtime::MultiSignature; @@ -33,7 +34,6 @@ pub type Address = sp_runtime::MultiAddress; pub type BlockNumber = u32; pub type Header = generic::Header; -pub type Block = generic::Block; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -47,12 +47,9 @@ pub type SignedExtra = ( ); frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Timestamp: timestamp::{Pallet, Call, Storage, Inherent}, Teerex: pallet_teerex::{Pallet, Call, Storage, Event}, @@ -67,16 +64,15 @@ impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); + type Block = generic::Block; type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -106,7 +102,7 @@ impl pallet_balances::Config for Test { type WeightInfo = (); type MaxReserves = (); type ReserveIdentifier = (); - type HoldIdentifier = (); + type RuntimeHoldReason = (); type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); @@ -146,17 +142,19 @@ impl Config for Test { // This function basically just builds a genesis storage key/value store according to // our desired mockup. RA from enclave compiled in debug mode is allowed pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(AccountKeyring::Alice.to_account_id(), 1 << 60)], } .assimilate_storage(&mut t) .unwrap(); - let teerex_config = pallet_teerex::GenesisConfig { + let _teerex_config = pallet_teerex::GenesisConfig:: { allow_sgx_debug_mode: true, allow_skipping_attestation: true, - }; - GenesisBuild::::assimilate_storage(&teerex_config, &mut t).unwrap(); + _config: Default::default(), + } + .assimilate_storage(&mut t) + .unwrap(); let mut ext: sp_io::TestExternalities = t.into(); ext.execute_with(|| System::set_block_number(1)); diff --git a/enclave-bridge/src/tests/test_shard_status.rs b/enclave-bridge/src/tests/test_shard_status.rs index 2ad5293a..56062d3d 100644 --- a/enclave-bridge/src/tests/test_shard_status.rs +++ b/enclave-bridge/src/tests/test_shard_status.rs @@ -16,9 +16,9 @@ */ use super::*; -use crate::{Error, Event as EnclaveBridgeEvent, ShardConfigRegistry}; -use enclave_bridge_primitives::{ShardConfig, ShardIdentifier, UpgradableShardConfig}; -use frame_support::{assert_err, assert_noop, assert_ok}; +use crate::{Error, Event as EnclaveBridgeEvent}; +use enclave_bridge_primitives::ShardIdentifier; +use frame_support::{assert_noop, assert_ok}; use sp_keyring::AccountKeyring; use teerex_primitives::EnclaveFingerprint; diff --git a/parentchain/Cargo.toml b/parentchain/Cargo.toml index ca0b327c..36e903f1 100644 --- a/parentchain/Cargo.toml +++ b/parentchain/Cargo.toml @@ -9,35 +9,34 @@ license = "Apache-2.0" edition = "2021" [dependencies] -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } log = { version = "0.4.14", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.13", features = ["derive"], optional = true } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { version = "1.0.171", features = ["derive"], optional = true } # substrate dependencies -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [dev-dependencies] env_logger = "0.9.0" -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [features] default = ["std"] std = [ "codec/std", - "log/std", - "scale-info/std", - "serde", - # substrate dependencies "frame-support/std", "frame-system/std", + "log/std", "pallet-balances/std", + "scale-info/std", + "serde", "sp-core/std", "sp-io/std", "sp-runtime/std", diff --git a/parentchain/src/lib.rs b/parentchain/src/lib.rs index bb9029e5..497a374c 100644 --- a/parentchain/src/lib.rs +++ b/parentchain/src/lib.rs @@ -33,7 +33,7 @@ pub mod pallet { type Moment: Parameter + Default + AtLeast32Bit - + Scale + + Scale, Output = Self::Moment> + Copy + MaxEncodedLen + scale_info::StaticTypeInfo; @@ -44,12 +44,12 @@ pub mod pallet { pub enum Event, I: 'static = ()> { /// a parentchain block has been registered SetBlock { - block_number: T::BlockNumber, + block_number: BlockNumberFor, parent_hash: T::Hash, block_hash: T::Hash, }, SetCreationBlock { - block_number: T::BlockNumber, + block_number: BlockNumberFor, block_hash: T::Hash, }, ShardVaultInitialized { @@ -97,7 +97,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn block_number)] pub(super) type Number, I: 'static = ()> = - StorageValue<_, T::BlockNumber, OptionQuery>; + StorageValue<_, BlockNumberFor, OptionQuery>; /// The current block timestamp. Set by `set_now`. /// this is not guaranteed by the pallet to be consistent with block_number or hash @@ -127,7 +127,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn creation_block_number)] pub(super) type CreationBlockNumber, I: 'static = ()> = - StorageValue<_, T::BlockNumber, OptionQuery>; + StorageValue<_, BlockNumberFor, OptionQuery>; /// The creation block timestamp. Set by `set_creation_timestamp`. #[pallet::storage] @@ -142,7 +142,7 @@ pub mod pallet { impl, I: 'static> Pallet { #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::set_block())] - pub fn set_block(origin: OriginFor, header: T::Header) -> DispatchResult { + pub fn set_block(origin: OriginFor, header: HeaderFor) -> DispatchResult { ensure_root(origin)?; >::put(header.number()); >::put(header.parent_hash()); @@ -203,7 +203,7 @@ pub mod pallet { } #[pallet::call_index(5)] #[pallet::weight(T::WeightInfo::set_creation_block())] - pub fn set_creation_block(origin: OriginFor, header: T::Header) -> DispatchResult { + pub fn set_creation_block(origin: OriginFor, header: HeaderFor) -> DispatchResult { ensure_root(origin)?; >::put(header.number()); >::put(header.hash()); diff --git a/parentchain/src/mock.rs b/parentchain/src/mock.rs index ac618b0c..949ccb58 100644 --- a/parentchain/src/mock.rs +++ b/parentchain/src/mock.rs @@ -23,6 +23,7 @@ use sp_keyring::AccountKeyring; use sp_runtime::{ generic, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, + BuildStorage, }; pub type Signature = sp_runtime::MultiSignature; @@ -31,7 +32,6 @@ pub type Address = sp_runtime::MultiAddress; pub type BlockNumber = u32; pub type Header = generic::Header; -pub type Block = generic::Block; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -45,12 +45,9 @@ pub type SignedExtra = ( ); frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Event}, + System: frame_system::{Pallet, Call, Config, Event}, Balances: pallet_balances::{Pallet, Call, Config, Event}, ParentchainIntegritee: pallet_parentchain::::{Pallet, Call, Event}, ParentchainTargetA: pallet_parentchain::::{Pallet, Call, Event}, @@ -79,16 +76,15 @@ impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); + type Block = generic::Block; type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -118,7 +114,7 @@ impl pallet_balances::Config for Test { type WeightInfo = (); type MaxReserves = (); type ReserveIdentifier = (); - type HoldIdentifier = (); + type RuntimeHoldReason = (); type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); @@ -127,7 +123,7 @@ impl pallet_balances::Config for Test { // This function basically just builds a genesis storage key/value store according to // our desired mockup. RA from enclave compiled in debug mode is allowed pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(AccountKeyring::Alice.to_account_id(), 1 << 60)], } diff --git a/primitives/claims/Cargo.toml b/primitives/claims/Cargo.toml index 14bad1ee..fc8c64e2 100644 --- a/primitives/claims/Cargo.toml +++ b/primitives/claims/Cargo.toml @@ -8,25 +8,25 @@ license = "Apache-2.0" edition = "2021" [dependencies] -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] } +parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } rustc-hex = { version = "2.1.0", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.13", default-features = false } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { version = "1.0.171", default-features = false, optional = true, features = ["alloc", "derive"] } # substrate dependencies -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } [features] default = ["std"] -no_std = [] +serde_derive = ["serde"] std = [ "parity-scale-codec/std", - "scale-info/std", "rustc-hex/std", - "sp-std/std", + "scale-info/std", + "serde/std", "sp-io/std", "sp-runtime/std", - "serde/std", + "sp-std/std", ] diff --git a/primitives/claims/src/lib.rs b/primitives/claims/src/lib.rs index 744fe653..40e84075 100644 --- a/primitives/claims/src/lib.rs +++ b/primitives/claims/src/lib.rs @@ -17,12 +17,16 @@ //!Primitives for claims #![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(not(feature = "std"))] +extern crate alloc; +#[cfg(not(feature = "std"))] +use alloc::{format, string::String}; use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; -#[cfg(feature = "std")] use serde::{self, Deserialize, Deserializer, Serialize, Serializer}; use sp_runtime::RuntimeDebug; - +use sp_std::vec::Vec; /// Copied from https://github.com/paritytech/polkadot/blob/master/primitives/src/v1/mod.rs /// Custom validity errors used in Polkadot while validating transactions. #[repr(u8)] @@ -44,10 +48,22 @@ impl From for u8 { } /// The kind of statement an account needs to make for a claim to be valid. -#[derive(Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug, TypeInfo)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[derive( + Encode, + Decode, + Clone, + Copy, + Eq, + PartialEq, + Default, + RuntimeDebug, + TypeInfo, + Serialize, + Deserialize, +)] pub enum StatementKind { /// Statement required to be made by non-SAFT holders. + #[default] Regular, /// Statement required to be made by SAFT holders. Saft, @@ -69,19 +85,12 @@ impl StatementKind { } } -impl Default for StatementKind { - fn default() -> Self { - StatementKind::Regular - } -} - /// An Ethereum address (i.e. 20 bytes, used to represent an Ethereum account). /// /// This gets serialized to the 0x-prefixed hex representation. #[derive(Clone, Copy, PartialEq, Eq, Encode, Decode, Default, RuntimeDebug, TypeInfo)] pub struct EthereumAddress(pub [u8; 20]); -#[cfg(feature = "std")] impl Serialize for EthereumAddress { fn serialize(&self, serializer: S) -> Result where @@ -92,7 +101,6 @@ impl Serialize for EthereumAddress { } } -#[cfg(feature = "std")] impl<'de> Deserialize<'de> for EthereumAddress { fn deserialize(deserializer: D) -> Result where diff --git a/primitives/common/Cargo.toml b/primitives/common/Cargo.toml index 5d0118fc..c596670d 100644 --- a/primitives/common/Cargo.toml +++ b/primitives/common/Cargo.toml @@ -8,14 +8,14 @@ license = "Apache-2.0" edition = "2021" [dependencies] -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } derive_more = "0.99.16" -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } # substrate deps -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [features] default = ["std"] @@ -23,6 +23,6 @@ std = [ "codec/std", "scale-info/std", "sp-core/std", - "sp-std/std", "sp-runtime/std", + "sp-std/std", ] diff --git a/primitives/enclave-bridge/Cargo.toml b/primitives/enclave-bridge/Cargo.toml index 658c422c..8b433cfd 100644 --- a/primitives/enclave-bridge/Cargo.toml +++ b/primitives/enclave-bridge/Cargo.toml @@ -8,17 +8,17 @@ license = "Apache-2.0" edition = "2021" [dependencies] -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } common-primitives = { path = "../common", default-features = false } log = { version = "0.4.14", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.13", default-features = false } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { version = "1.0.171", default-features = false } # substrate dependencies -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [dev-dependencies] hex-literal = "0.3.4" @@ -30,7 +30,6 @@ std = [ "common-primitives/std", "scale-info/std", "serde/std", - # substrate "sp-core/std", "sp-io/std", "sp-runtime/std", diff --git a/primitives/sidechain/Cargo.toml b/primitives/sidechain/Cargo.toml index 95935610..5fb8dcef 100644 --- a/primitives/sidechain/Cargo.toml +++ b/primitives/sidechain/Cargo.toml @@ -9,15 +9,15 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full"] } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.13", default-features = false } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { version = "1.0.171", default-features = false } # substrate dependencies -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [features] @@ -29,7 +29,6 @@ std = [ "codec/std", "scale-info/std", "serde/std", - # substrate "sp-core/std", "sp-io/std", "sp-runtime/std", diff --git a/primitives/teeracle/Cargo.toml b/primitives/teeracle/Cargo.toml index d4081edb..73f2e261 100644 --- a/primitives/teeracle/Cargo.toml +++ b/primitives/teeracle/Cargo.toml @@ -15,13 +15,13 @@ common-primitives = { path = "../common", default-features = false } substrate-fixed = { tag = "v0.5.9", default-features = false, git = "https://github.com/encointer/substrate-fixed.git" } # substrate -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [features] default = ["std"] std = [ "common-primitives/std", - "substrate-fixed/std", "sp-std/std", + "substrate-fixed/std", ] diff --git a/primitives/teerex/Cargo.toml b/primitives/teerex/Cargo.toml index 24b1d7de..331da7ae 100644 --- a/primitives/teerex/Cargo.toml +++ b/primitives/teerex/Cargo.toml @@ -8,17 +8,17 @@ license = "Apache-2.0" edition = "2021" [dependencies] -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } common-primitives = { path = "../common", default-features = false } derive_more = "0.99.16" log = { version = "0.4.14", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.13", default-features = false } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { version = "1.0.171", default-features = false } # substrate dependencies -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [dev-dependencies] hex-literal = "0.3.4" @@ -31,7 +31,6 @@ std = [ "log/std", "scale-info/std", "serde/std", - # substrate "sp-core/std", "sp-runtime/std", "sp-std/std", diff --git a/primitives/teerex/src/lib.rs b/primitives/teerex/src/lib.rs index fa225509..2642195b 100644 --- a/primitives/teerex/src/lib.rs +++ b/primitives/teerex/src/lib.rs @@ -28,18 +28,13 @@ use sp_std::prelude::*; pub const TEEREX: &str = "teerex"; -#[derive(Encode, Decode, Copy, Clone, PartialEq, Eq, sp_core::RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, Copy, Clone, PartialEq, Eq, Default, sp_core::RuntimeDebug, TypeInfo)] pub enum SgxBuildMode { Debug, + #[default] Production, } -impl Default for SgxBuildMode { - fn default() -> Self { - SgxBuildMode::Production - } -} - #[derive(Encode, Decode, Copy, Clone, PartialEq, Eq, sp_core::RuntimeDebug, TypeInfo)] pub enum SgxAttestationMethod { Skip { proxied: bool }, diff --git a/primitives/xcm-transactor/Cargo.toml b/primitives/xcm-transactor/Cargo.toml index 427f4801..21db7954 100644 --- a/primitives/xcm-transactor/Cargo.toml +++ b/primitives/xcm-transactor/Cargo.toml @@ -13,14 +13,14 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = common-primitives = { path = "../common", default-features = false } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } # xcm/polkadot -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0", default-features = false } # cumulus -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42", default-features = false } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0", default-features = false } [features] default = ["std"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 23ed88e6..317bf8c4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2022-10-22" +channel = "nightly-2023-06-01" targets = ["wasm32-unknown-unknown"] profile = "default" # include rustfmt, clippy diff --git a/sidechain/Cargo.toml b/sidechain/Cargo.toml index 7ac60b0c..b34dcce2 100644 --- a/sidechain/Cargo.toml +++ b/sidechain/Cargo.toml @@ -9,10 +9,10 @@ license = "MS-RSL" edition = "2021" [dependencies] -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } log = { version = "0.4.14", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.13", features = ["derive"], optional = true } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { version = "1.0.171", features = ["derive"], optional = true } # local enclave-bridge-primitives = { path = "../primitives/enclave-bridge", default-features = false } @@ -21,51 +21,49 @@ pallet-teerex = { path = "../teerex", default-features = false } sidechain-primitives = { path = "../primitives/sidechain", default-features = false } # substrate dependencies -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } # benchmarking -frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } hex-literal = { version = "0.3.2", optional = true } -pallet-balances = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +pallet-balances = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } teerex-primitives = { path = "../primitives/teerex", default-features = false } test-utils = { path = "../test-utils", default-features = false, optional = true } [dev-dependencies] env_logger = "0.9.0" -externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } hex-literal = "0.3.2" -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } test-utils = { path = "../test-utils" } [features] default = ["std"] std = [ "codec/std", - "log/std", - "scale-info/std", - "serde", - # local - "pallet-teerex/std", - "pallet-enclave-bridge/std", - "sidechain-primitives/std", "enclave-bridge-primitives/std", - "teerex-primitives/std", - # substrate "frame-support/std", "frame-system/std", + "log/std", + "pallet-enclave-bridge/std", + "pallet-teerex/std", "pallet-timestamp/std", + "scale-info/std", + "serde", + "sidechain-primitives/std", "sp-core/std", "sp-io/std", "sp-runtime/std", "sp-std/std", + "teerex-primitives/std", ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/sidechain/src/mock.rs b/sidechain/src/mock.rs index cbbe1b9d..001610d4 100644 --- a/sidechain/src/mock.rs +++ b/sidechain/src/mock.rs @@ -17,7 +17,7 @@ // Creating mock runtime here use crate as pallet_sidechain; -use frame_support::{pallet_prelude::GenesisBuild, parameter_types}; +use frame_support::parameter_types; use frame_system as system; use pallet_sidechain::Config; use sp_core::H256; @@ -25,6 +25,7 @@ use sp_keyring::AccountKeyring; use sp_runtime::{ generic, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, + BuildStorage, }; pub type Signature = sp_runtime::MultiSignature; @@ -33,7 +34,6 @@ pub type Address = sp_runtime::MultiAddress; pub type BlockNumber = u32; pub type Header = generic::Header; -pub type Block = generic::Block; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -47,12 +47,9 @@ pub type SignedExtra = ( ); frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Teerex: pallet_teerex::{Pallet, Call, Storage, Event}, @@ -68,16 +65,15 @@ impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); + type Block = generic::Block; type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -107,10 +103,10 @@ impl pallet_balances::Config for Test { type WeightInfo = (); type MaxReserves = (); type ReserveIdentifier = (); - type HoldIdentifier = (); type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeHoldReason = (); } parameter_types! { @@ -156,17 +152,19 @@ impl Config for Test { // This function basically just builds a genesis storage key/value store according to // our desired mockup. RA from enclave compiled in debug mode is allowed pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(AccountKeyring::Alice.to_account_id(), 1 << 60)], } .assimilate_storage(&mut t) .unwrap(); - let teerex_config = pallet_teerex::GenesisConfig { + pallet_teerex::GenesisConfig:: { allow_sgx_debug_mode: true, allow_skipping_attestation: true, - }; - GenesisBuild::::assimilate_storage(&teerex_config, &mut t).unwrap(); + _config: Default::default(), + } + .assimilate_storage(&mut t) + .unwrap(); let mut ext: sp_io::TestExternalities = t.into(); ext.execute_with(|| System::set_block_number(1)); diff --git a/teeracle/Cargo.toml b/teeracle/Cargo.toml index 051c39c9..1573d163 100644 --- a/teeracle/Cargo.toml +++ b/teeracle/Cargo.toml @@ -9,9 +9,9 @@ license = "Apache-2.0" edition = "2021" [dependencies] -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } log = { version = "0.4.14", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } # local pallet-teerex = { path = "../teerex", default-features = false } @@ -22,47 +22,45 @@ teerex-primitives = { path = "../primitives/teerex", default-features = false } substrate-fixed = { tag = "v0.5.9", default-features = false, git = "https://github.com/encointer/substrate-fixed.git" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } # benchmarking -frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } hex-literal = { version = "0.3.2", optional = true } test-utils = { path = "../test-utils", optional = true, default-features = false } -timestamp = { package = "pallet-timestamp", default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +timestamp = { package = "pallet-timestamp", default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [dev-dependencies] -externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } hex-literal = "0.3.2" -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } test-utils = { path = "../test-utils" } -timestamp = { package = "pallet-timestamp", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +timestamp = { package = "pallet-timestamp", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [features] default = ["std"] std = [ "codec/std", - "log/std", - "scale-info/std", - # local - "pallet-teerex/std", - "teeracle-primitives/std", - # encointer - "substrate-fixed/std", - # substrate "frame-support/std", "frame-system/std", + "log/std", + "pallet-teerex/std", + "scale-info/std", "sp-core/std", "sp-io/std", "sp-runtime/std", "sp-std/std", + "substrate-fixed/std", + "teeracle-primitives/std", + "teerex-primitives/std", ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/teeracle/src/mock.rs b/teeracle/src/mock.rs index 4cf17574..19a74fce 100644 --- a/teeracle/src/mock.rs +++ b/teeracle/src/mock.rs @@ -15,7 +15,7 @@ */ use crate as pallet_teeracle; -use frame_support::{pallet_prelude::GenesisBuild, parameter_types}; +use frame_support::parameter_types; use frame_system as system; use pallet_teeracle::Config; use sp_core::H256; @@ -23,6 +23,7 @@ use sp_keyring::AccountKeyring; use sp_runtime::{ generic, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, + BuildStorage, }; pub type Signature = sp_runtime::MultiSignature; @@ -31,7 +32,6 @@ pub type Address = sp_runtime::MultiAddress; pub type BlockNumber = u32; pub type Header = generic::Header; -pub type Block = generic::Block; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -45,10 +45,7 @@ pub type SignedExtra = ( ); frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { System: frame_system, Balances: pallet_balances, @@ -65,16 +62,15 @@ impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); + type Block = generic::Block; type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -104,10 +100,10 @@ impl pallet_balances::Config for Test { type WeightInfo = (); type MaxReserves = (); type ReserveIdentifier = (); - type HoldIdentifier = (); type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeHoldReason = (); } parameter_types! { @@ -147,17 +143,19 @@ impl Config for Test { // This function basically just builds a genesis storage key/value store according to // our desired mockup. RA from enclave compiled in debug mode is allowed pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(AccountKeyring::Alice.to_account_id(), 1 << 60)], } .assimilate_storage(&mut t) .unwrap(); - let teerex_config = pallet_teerex::GenesisConfig { + pallet_teerex::GenesisConfig:: { allow_sgx_debug_mode: true, allow_skipping_attestation: true, - }; - GenesisBuild::::assimilate_storage(&teerex_config, &mut t).unwrap(); + _config: Default::default(), + } + .assimilate_storage(&mut t) + .unwrap(); let mut ext: sp_io::TestExternalities = t.into(); ext.execute_with(|| System::set_block_number(1)); diff --git a/teerex/Cargo.toml b/teerex/Cargo.toml index 0817a9d7..652753a9 100644 --- a/teerex/Cargo.toml +++ b/teerex/Cargo.toml @@ -9,11 +9,11 @@ license = "MS-RSL" edition = "2021" [dependencies] -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } hex = { default-features = false, version = "0.4.3", features = ["alloc"] } log = { version = "0.4.14", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0", features = ["derive"], optional = true } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { version = "1.0.171", features = ["derive"], optional = true } webpki = { git = "https://github.com/rustls/webpki", version = "=0.102.0-alpha.3", rev = "da923ed", package = "rustls-webpki", default-features = false, features = ["alloc", "ring"] } # local @@ -21,50 +21,48 @@ sgx-verify = { path = "sgx-verify", default-features = false } teerex-primitives = { path = "../primitives/teerex", default-features = false } # substrate dependencies -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -timestamp = { package = "pallet-timestamp", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +timestamp = { package = "pallet-timestamp", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } # benchmarking -frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } hex-literal = { version = "0.3.2", optional = true } -pallet-balances = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +pallet-balances = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } test-utils = { path = "../test-utils", default-features = false, optional = true } [dev-dependencies] env_logger = "0.9.0" -externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } hex-literal = "0.3.2" -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } test-utils = { path = "../test-utils" } -serde = { version = "1.0.140", features = ["derive"] } +serde = { version = "1.0.171", features = ["derive"] } serde_json = { version = "1.0", features = ["alloc"] } [features] default = ["std"] std = [ "codec/std", + "frame-support/std", + "frame-system/std", "log/std", "scale-info/std", "serde", - "webpki/std", - # local "sgx-verify/std", - "teerex-primitives/std", - # substrate - "frame-support/std", - "frame-system/std", "sp-core/std", "sp-io/std", "sp-runtime/std", "sp-std/std", + "teerex-primitives/std", "timestamp/std", + "webpki/std", ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/teerex/sgx-verify/Cargo.toml b/teerex/sgx-verify/Cargo.toml index 6e13b051..e9af6186 100644 --- a/teerex/sgx-verify/Cargo.toml +++ b/teerex/sgx-verify/Cargo.toml @@ -11,14 +11,14 @@ edition = "2021" [dependencies] base64 = { version = "0.13", default-features = false, features = ["alloc"] } chrono = { version = "0.4", default-features = false, features = ["serde"] } -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } der = { default-features = false, version = "0.6.0" } hex = { default-features = false, version = "0.4.3", features = ["alloc"] } hex-literal = { version = "0.3.2" } log = { version = "0.4.14", default-features = false } ring = { version = "0.16.20", default-features = false, features = ["alloc"] } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { default-features = false, version = "1.0.140", features = ["derive"] } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } +serde = { default-features = false, version = "1.0.171", features = ["derive"] } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } webpki = { git = "https://github.com/rustls/webpki", version = "=0.102.0-alpha.3", rev = "da923ed", package = "rustls-webpki", default-features = false, features = ["alloc", "ring"] } x509-cert = { default-features = false, version = "0.1.0", features = ["alloc"] } @@ -27,10 +27,10 @@ x509-cert = { default-features = false, version = "0.1.0", features = ["alloc"] teerex-primitives = { path = "../../primitives/teerex", default-features = false } # substrate dependencies -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [dev-dependencies] hex-literal = "0.3.4" diff --git a/teerex/sgx-verify/fuzz/Cargo.toml b/teerex/sgx-verify/fuzz/Cargo.toml index c28c9e95..11f9585e 100644 --- a/teerex/sgx-verify/fuzz/Cargo.toml +++ b/teerex/sgx-verify/fuzz/Cargo.toml @@ -9,7 +9,7 @@ cargo-fuzz = true [dependencies] base64 = { version = "0.13", default-features = false, features = ["alloc"] } -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } hex-literal = "0.3.4" libfuzzer-sys = "0.4" serde_json = { version = "1.0" } diff --git a/teerex/sgx-verify/src/tests.rs b/teerex/sgx-verify/src/tests.rs index e65c1e74..1d6dded9 100644 --- a/teerex/sgx-verify/src/tests.rs +++ b/teerex/sgx-verify/src/tests.rs @@ -21,7 +21,7 @@ use crate::{ test_data::{ consts::{TEST4_CERT, TEST4_MRENCLAVE, TEST4_SIGNER_PUB, TEST4_TIMESTAMP, TEST8_CERT}, dcap::{ - DCAP_QUOTE_CERT, PCK_CRL, QE_IDENTITY_CERT, TEST2_DCAP_QUOTE_HEX, TEST2_DCAP_TIMESTAMP, + DCAP_QUOTE_CERT, PCK_CRL, QE_IDENTITY_CERT, TEST2_DCAP_QUOTE_HEX, TEST_VALID_COLLATERAL_TIMESTAMP, }, }, diff --git a/teerex/src/lib.rs b/teerex/src/lib.rs index 8a56d39a..306e1aa9 100644 --- a/teerex/src/lib.rs +++ b/teerex/src/lib.rs @@ -266,14 +266,16 @@ pub mod pallet { StorageValue<_, bool, ValueQuery, DefaultAllowSkippingAttestation>; #[pallet::genesis_config] - #[cfg_attr(feature = "std", derive(Default))] - pub struct GenesisConfig { + #[derive(frame_support::DefaultNoBound)] + pub struct GenesisConfig { pub allow_sgx_debug_mode: bool, pub allow_skipping_attestation: bool, + #[serde(skip)] + pub _config: sp_std::marker::PhantomData, } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { SgxAllowDebugMode::::put(self.allow_sgx_debug_mode); AllowSkippingAttestation::::put(self.allow_skipping_attestation); diff --git a/teerex/src/migrations.rs b/teerex/src/migrations.rs index 30d179ec..d8a55e4f 100644 --- a/teerex/src/migrations.rs +++ b/teerex/src/migrations.rs @@ -52,7 +52,7 @@ pub mod v1 { impl OnRuntimeUpgrade for MigrateV0toV1 { #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { + fn pre_upgrade() -> Result, sp_runtime::DispatchError> { let onchain_version = Pallet::::on_chain_storage_version(); let enclave_count = v0::EnclaveCount::::get() as u64; @@ -103,7 +103,7 @@ pub mod v1 { } #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { + fn post_upgrade(state: Vec) -> Result<(), sp_runtime::DispatchError> { let (pre_onchain_version, _enclave_count, allow_debug_mode): ( StorageVersion, u64, @@ -135,7 +135,7 @@ pub mod v2 { impl OnRuntimeUpgrade for MigrateV1toV2 { #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { + fn pre_upgrade() -> Result, sp_runtime::DispatchError> { let current_version = Pallet::::current_storage_version(); let onchain_version = Pallet::::on_chain_storage_version(); ensure!(onchain_version == 1 && current_version == 2, "only migration from v1 to v2"); @@ -177,7 +177,7 @@ pub mod v2 { } #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { + fn post_upgrade(state: Vec) -> Result<(), sp_runtime::DispatchError> { assert_eq!(Pallet::::on_chain_storage_version(), 2, "must upgrade"); let _: u64 = diff --git a/teerex/src/mock.rs b/teerex/src/mock.rs index 56246486..19754722 100644 --- a/teerex/src/mock.rs +++ b/teerex/src/mock.rs @@ -17,7 +17,7 @@ // Creating mock runtime here use crate as pallet_teerex; -use frame_support::{self, pallet_prelude::GenesisBuild, parameter_types}; +use frame_support::{self, parameter_types}; use frame_system as system; use pallet_teerex::Config; use sp_core::H256; @@ -25,6 +25,7 @@ use sp_keyring::AccountKeyring; use sp_runtime::{ generic, traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, + BuildStorage, }; pub type Signature = sp_runtime::MultiSignature; @@ -33,7 +34,6 @@ pub type Address = sp_runtime::MultiAddress; pub type BlockNumber = u32; pub type Header = generic::Header; -pub type Block = generic::Block; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -47,12 +47,9 @@ pub type SignedExtra = ( ); frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Timestamp: timestamp::{Pallet, Call, Storage, Inherent}, Teerex: pallet_teerex::{Pallet, Call, Storage, Event}, @@ -66,16 +63,15 @@ impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); + type Block = generic::Block; type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -105,10 +101,10 @@ impl pallet_balances::Config for Test { type WeightInfo = (); type MaxReserves = (); type ReserveIdentifier = (); - type HoldIdentifier = (); type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeHoldReason = (); } parameter_types! { @@ -139,15 +135,19 @@ impl Config for Test { // This function basically just builds a genesis storage key/value store according to // our desired mockup. RA from enclave compiled in debug mode is allowed pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(AccountKeyring::Alice.to_account_id(), 1 << 60)], } .assimilate_storage(&mut t) .unwrap(); - let teerex_config = - crate::GenesisConfig { allow_sgx_debug_mode: true, allow_skipping_attestation: true }; - GenesisBuild::::assimilate_storage(&teerex_config, &mut t).unwrap(); + crate::GenesisConfig:: { + allow_sgx_debug_mode: true, + allow_skipping_attestation: true, + _config: Default::default(), + } + .assimilate_storage(&mut t) + .unwrap(); let mut ext: sp_io::TestExternalities = t.into(); ext.execute_with(|| System::set_block_number(1)); @@ -156,16 +156,20 @@ pub fn new_test_ext() -> sp_io::TestExternalities { //Build genesis storage for mockup, where RA from enclave compiled in debug mode is NOT allowed pub fn new_test_production_ext() -> sp_io::TestExternalities { - let mut t = system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(AccountKeyring::Alice.to_account_id(), 1 << 60)], } .assimilate_storage(&mut t) .unwrap(); - let teerex_config = - crate::GenesisConfig { allow_sgx_debug_mode: false, allow_skipping_attestation: false }; - GenesisBuild::::assimilate_storage(&teerex_config, &mut t).unwrap(); + crate::GenesisConfig:: { + allow_sgx_debug_mode: false, + allow_skipping_attestation: false, + _config: Default::default(), + } + .assimilate_storage(&mut t) + .unwrap(); let mut ext: sp_io::TestExternalities = t.into(); ext.execute_with(|| System::set_block_number(1)); diff --git a/teerex/src/tests/test_cases.rs b/teerex/src/tests/test_cases.rs index 8c11d09e..10c0297b 100644 --- a/teerex/src/tests/test_cases.rs +++ b/teerex/src/tests/test_cases.rs @@ -18,9 +18,8 @@ use crate::{ mock::*, test_helpers::{register_test_quoting_enclave, register_test_tcb_info}, - AllowSkippingAttestation, Error, - Error::TcbInfoIsOutdated, - Event as TeerexEvent, ProxiedEnclaves, SgxAllowDebugMode, SgxEnclave, SovereignEnclaves, + AllowSkippingAttestation, Error, Event as TeerexEvent, ProxiedEnclaves, SgxAllowDebugMode, + SgxEnclave, SovereignEnclaves, }; use frame_support::{assert_err, assert_ok}; use hex_literal::hex; @@ -32,10 +31,10 @@ use sgx_verify::{ verify_dcap_quote, }; use sp_keyring::AccountKeyring; -use std::default::Default; + use teerex_primitives::{ - AnySigner, Cpusvn, EnclaveInstanceAddress, MultiEnclave, SgxAttestationMethod, SgxBuildMode, - SgxQuotingEnclave, SgxReportData, SgxStatus, SgxTcbInfoOnChain, TcbStatus, TcbVersionStatus, + AnySigner, EnclaveInstanceAddress, MultiEnclave, SgxAttestationMethod, SgxBuildMode, + SgxReportData, SgxStatus, SgxTcbInfoOnChain, TcbStatus, TcbVersionStatus, }; use test_utils::test_data::{ consts::*, @@ -161,7 +160,7 @@ fn outdated_tcb_status_is_reported_correctly() { let quoting_enclave = qe_identity.to_quoting_enclave(); let quote_bytes = hex::decode(TEST2_DCAP_QUOTE_HEX.trim()).unwrap(); - let (fmspc, tcb_info, report) = + let (_fmspc, tcb_info, _report) = verify_dcap_quote(quote_bytes.as_slice(), 1693475073000, "ing_enclave).unwrap(); assert_eq!(tcb_info_onchain.verify_examinee(&tcb_info), Some(SgxStatus::GroupOutOfDate)); } diff --git a/xcm-transactor/Cargo.toml b/xcm-transactor/Cargo.toml index d27b2a7d..9cf64f70 100644 --- a/xcm-transactor/Cargo.toml +++ b/xcm-transactor/Cargo.toml @@ -9,34 +9,34 @@ license = "(GPL-3.0-only)" edition = "2021" [dependencies] -codec = { version = "3.0.0", default-features = false, features = ["derive"], package = "parity-scale-codec" } +codec = { version = "3.6.1", default-features = false, features = ["derive"], package = "parity-scale-codec" } log = { version = "0.4.14", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } # Local xcm-transactor-primitives = { default-features = false, path = "../primitives/xcm-transactor", features = ["dot", "ksm"] } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } # xcm/polkadot -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0" } # cumulus -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" } [dev-dependencies] -externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +externalities = { package = "sp-externalities", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } hex-literal = "0.3.2" -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } test-utils = { path = "../test-utils" } -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } # Re-introduce subxt whe we need it, maintaining it is a pain. # Remove unnecessary wasm stuff by disabling default features, also it lead @@ -49,17 +49,16 @@ default = ["std"] std = [ "codec/std", "cumulus-primitives-core/std", - "log/std", - "scale-info/std", - # substrate "frame-support/std", "frame-system/std", + "log/std", + "scale-info/std", "sp-core/std", "sp-io/std", "sp-runtime/std", "sp-std/std", - "xcm/std", "xcm-transactor-primitives/std", + "xcm/std", ] runtime-benchmarks = [] diff --git a/xcm-transactor/src/mock.rs b/xcm-transactor/src/mock.rs index 702ae5ba..9c464385 100644 --- a/xcm-transactor/src/mock.rs +++ b/xcm-transactor/src/mock.rs @@ -27,6 +27,7 @@ use sp_runtime::{ traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, }; +use sp_runtime::BuildStorage; use xcm::latest::prelude::*; use xcm_transactor_primitives::*; @@ -36,7 +37,6 @@ pub type Address = sp_runtime::MultiAddress; pub type BlockNumber = u32; pub type Header = generic::Header; -pub type Block = generic::Block; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -50,10 +50,7 @@ pub type SignedExtra = ( ); frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { System: frame_system, Balances: pallet_balances, @@ -68,16 +65,15 @@ impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); + type Block = generic::Block; type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -107,10 +103,10 @@ impl pallet_balances::Config for Test { type WeightInfo = (); type MaxReserves = (); type ReserveIdentifier = (); - type HoldIdentifier = (); type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeHoldReason = (); } parameter_types! { @@ -147,7 +143,7 @@ impl pallet_xcm_transactor::Config for Test { // This function basically just builds a genesis storage key/value store according to // our desired mockup. pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(AccountKeyring::Alice.to_account_id(), 1 << 60)], }