diff --git a/Cargo.lock b/Cargo.lock index bd86df09ba..3f8c53bf6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1669,7 +1669,7 @@ dependencies = [ "serde_derive", "serde_json", "tinytemplate", - "tokio 1.14.0", + "tokio 1.15.0", "walkdir", ] @@ -1801,7 +1801,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" dependencies = [ - "sct", + "sct 0.6.1", ] [[package]] @@ -1951,7 +1951,7 @@ dependencies = [ "crossbeam-queue", "num_cpus", "serde", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -1972,7 +1972,7 @@ dependencies = [ "sp-core", "sp-runtime", "structopt", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -2493,6 +2493,7 @@ dependencies = [ "paste", "scale-info", "sp-api", + "sp-application-crypto", "sp-io", "sp-runtime", "sp-runtime-interface", @@ -2777,9 +2778,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27" +checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" dependencies = [ "futures-core", "futures-sink", @@ -2787,9 +2788,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445" +checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" [[package]] name = "futures-executor" @@ -2816,9 +2817,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11" +checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" [[package]] name = "futures-lite" @@ -2837,9 +2838,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd" +checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c" dependencies = [ "proc-macro2 1.0.33", "quote 1.0.10", @@ -2859,15 +2860,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af" +checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" [[package]] name = "futures-task" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12" +checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" [[package]] name = "futures-timer" @@ -2883,9 +2884,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e" +checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" dependencies = [ "futures 0.1.31", "futures-channel", @@ -3072,7 +3073,7 @@ dependencies = [ "http", "indexmap", "slab", - "tokio 1.14.0", + "tokio 1.15.0", "tokio-util 0.6.9", "tracing", ] @@ -3342,7 +3343,7 @@ dependencies = [ "itoa", "pin-project-lite 0.2.7", "socket2 0.4.2", - "tokio 1.14.0", + "tokio 1.15.0", "tower-service", "tracing", "want", @@ -3359,12 +3360,28 @@ dependencies = [ "hyper", "log", "rustls 0.19.1", - "rustls-native-certs", - "tokio 1.14.0", - "tokio-rustls", + "rustls-native-certs 0.5.0", + "tokio 1.15.0", + "tokio-rustls 0.22.0", "webpki 0.21.4", ] +[[package]] +name = "hyper-rustls" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +dependencies = [ + "http", + "hyper", + "log", + "rustls 0.20.2", + "rustls-native-certs 0.6.1", + "tokio 1.15.0", + "tokio-rustls 0.23.2", + "webpki-roots 0.22.1", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -3374,7 +3391,7 @@ dependencies = [ "bytes 1.1.0", "hyper", "native-tls", - "tokio 1.14.0", + "tokio 1.15.0", "tokio-native-tls", ] @@ -3910,7 +3927,7 @@ dependencies = [ "jsonrpc-core", "lazy_static", "log", - "tokio 1.14.0", + "tokio 1.15.0", "tokio-stream", "tokio-util 0.6.9", "unicase", @@ -3937,29 +3954,42 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6373a33d987866ccfe1af4bc11b089dce941764313f9fd8b7cf13fcb51b72dc5" dependencies = [ - "jsonrpsee-proc-macros", + "jsonrpsee-proc-macros 0.4.1", "jsonrpsee-types 0.4.1", - "jsonrpsee-utils", + "jsonrpsee-utils 0.4.1", "jsonrpsee-ws-client 0.4.1", ] +[[package]] +name = "jsonrpsee" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b02d34b7d70caa454dcf79914d70d9ef6edecef84b9261f499a9f3521b7935" +dependencies = [ + "jsonrpsee-http-client", + "jsonrpsee-proc-macros 0.5.1", + "jsonrpsee-types 0.5.1", + "jsonrpsee-utils 0.5.1", + "jsonrpsee-ws-client 0.5.1", +] + [[package]] name = "jsonrpsee-http-client" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20d31e34e000acb80fae4e36dacb63e458b10ad44c37cd9a46e782994c32c806" +checksum = "8ea17b6d6da182fc4b293e0bebea5cc72e194d9392f485fb4051488af3edd1cd" dependencies = [ "async-trait", "fnv", "hyper", - "hyper-rustls", - "jsonrpsee-types 0.4.1", - "jsonrpsee-utils", - "log", + "hyper-rustls 0.23.0", + "jsonrpsee-types 0.5.1", + "jsonrpsee-utils 0.5.1", "serde", "serde_json", "thiserror", - "tokio 1.14.0", + "tokio 1.15.0", + "tracing", "url 2.2.2", ] @@ -3976,6 +4006,18 @@ dependencies = [ "syn 1.0.82", ] +[[package]] +name = "jsonrpsee-proc-macros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfdf283c6c3403ce9969700177bbcf35a695576fc2d993f38ab32a690631a96" +dependencies = [ + "proc-macro-crate 1.1.0", + "proc-macro2 1.0.33", + "quote 1.0.10", + "syn 1.0.82", +] + [[package]] name = "jsonrpsee-types" version = "0.3.1" @@ -4013,17 +4055,47 @@ dependencies = [ "thiserror", ] +[[package]] +name = "jsonrpsee-types" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d822e0fc7be95e5085da5d61508bf5e3d5c1614dd235402086ec5c1cb15bdfa" +dependencies = [ + "anyhow", + "async-trait", + "beef", + "futures-channel", + "futures-util", + "hyper", + "serde", + "serde_json", + "soketto 0.7.1", + "thiserror", + "tracing", +] + [[package]] name = "jsonrpsee-utils" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0109c4f972058f3b1925b73a17210aff7b63b65967264d0045d15ee88fe84f0c" +dependencies = [ + "arrayvec 0.7.2", + "beef", + "jsonrpsee-types 0.4.1", +] + +[[package]] +name = "jsonrpsee-utils" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e722316d556c5228624fb1cc7ea672f6ed163e60183e93f11d3ee979417331cb" dependencies = [ "arrayvec 0.7.2", "beef", "futures-util", "hyper", - "jsonrpsee-types 0.4.1", + "jsonrpsee-types 0.5.1", ] [[package]] @@ -4039,13 +4111,13 @@ dependencies = [ "log", "pin-project 1.0.8", "rustls 0.19.1", - "rustls-native-certs", + "rustls-native-certs 0.5.0", "serde", "serde_json", "soketto 0.6.0", "thiserror", - "tokio 1.14.0", - "tokio-rustls", + "tokio 1.15.0", + "tokio-rustls 0.22.0", "tokio-util 0.6.9", "url 2.2.2", ] @@ -4064,14 +4136,38 @@ dependencies = [ "jsonrpsee-types 0.4.1", "log", "pin-project 1.0.8", - "rustls-native-certs", + "rustls-native-certs 0.5.0", + "serde", + "serde_json", + "soketto 0.7.1", + "thiserror", + "tokio 1.15.0", + "tokio-rustls 0.22.0", + "tokio-util 0.6.9", +] + +[[package]] +name = "jsonrpsee-ws-client" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "664d2c9443cb1171e2414c66e0f0b44040eb2cff073455a0d168984eee178159" +dependencies = [ + "async-trait", + "fnv", + "futures 0.3.18", + "http", + "jsonrpsee-types 0.5.1", + "pin-project 1.0.8", + "rustls-native-certs 0.6.1", "serde", "serde_json", "soketto 0.7.1", "thiserror", - "tokio 1.14.0", - "tokio-rustls", + "tokio 1.15.0", + "tokio-rustls 0.23.2", "tokio-util 0.6.9", + "tracing", + "webpki-roots 0.22.1", ] [[package]] @@ -4177,9 +4273,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.110" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b58a4469763e4e3a906c4ed786e1c70512d16aa88f84dded826da42640fc6a1c" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libloading" @@ -4970,6 +5066,17 @@ dependencies = [ "parity-util-mem", ] +[[package]] +name = "memory-db" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d505169b746dacf02f7d14d8c80b34edfd8212159c63d23c977739a0d960c626" +dependencies = [ + "hash-db", + "hashbrown", + "parity-util-mem", +] + [[package]] name = "memory_units" version = "0.3.0" @@ -5764,6 +5871,24 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-child-bounties" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-bounties", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-collective" version = "4.0.0-dev" @@ -5815,6 +5940,7 @@ dependencies = [ "scale-info", "serde", "sp-core", + "sp-rpc", "sp-runtime", "sp-std", ] @@ -5863,7 +5989,7 @@ dependencies = [ "sp-std", "static_assertions", "strum", - "strum_macros", + "strum_macros 0.23.1", ] [[package]] @@ -6044,6 +6170,21 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-preimage" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-proxy" version = "4.0.0-dev" @@ -6376,7 +6517,7 @@ dependencies = [ "libc", "log", "rand 0.7.3", - "tokio 1.14.0", + "tokio 1.15.0", "winapi 0.3.9", ] @@ -6822,7 +6963,7 @@ dependencies = [ "substrate-build-script-utils", "substrate-frame-cli", "tempfile", - "tokio 1.14.0", + "tokio 1.15.0", "try-runtime-cli", "wait-timeout", ] @@ -6887,6 +7028,7 @@ dependencies = [ "pallet-bounties", "pallet-bridge", "pallet-bridge-transfer", + "pallet-child-bounties", "pallet-collective", "pallet-democracy", "pallet-election-provider-multi-phase", @@ -6901,6 +7043,7 @@ dependencies = [ "pallet-multisig", "pallet-offences", "pallet-offences-benchmarking", + "pallet-preimage", "pallet-proxy", "pallet-randomness-collective-flip", "pallet-recovery", @@ -7047,7 +7190,7 @@ dependencies = [ "frame-system", "futures 0.3.18", "hex", - "jsonrpsee-types 0.4.1", + "jsonrpsee-types 0.5.1", "log", "pallet-balances", "pallet-grandpa", @@ -7074,7 +7217,7 @@ dependencies = [ "sp-rpc", "sp-runtime", "structopt", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -7969,7 +8112,7 @@ name = "remote-externalities" version = "0.10.0-dev" dependencies = [ "env_logger 0.9.0", - "jsonrpsee", + "jsonrpsee 0.4.1", "log", "parity-scale-codec", "serde", @@ -8011,7 +8154,7 @@ dependencies = [ "sp-core", "sqlx", "structopt", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -8040,7 +8183,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "tokio 1.14.0", + "tokio 1.15.0", "tokio-native-tls", "url 2.2.2", "wasm-bindgen", @@ -8245,7 +8388,7 @@ dependencies = [ "base64 0.12.3", "log", "ring 0.16.20", - "sct", + "sct 0.6.1", "webpki 0.21.4", ] @@ -8258,10 +8401,22 @@ dependencies = [ "base64 0.13.0", "log", "ring 0.16.20", - "sct", + "sct 0.6.1", "webpki 0.21.4", ] +[[package]] +name = "rustls" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84" +dependencies = [ + "log", + "ring 0.16.20", + "sct 0.7.0", + "webpki 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustls-native-certs" version = "0.5.0" @@ -8274,6 +8429,27 @@ dependencies = [ "security-framework", ] +[[package]] +name = "rustls-native-certs" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca9ebdfa27d3fc180e42879037b5338ab1c040c06affd00d8338598e7800943" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" +dependencies = [ + "base64 0.13.0", +] + [[package]] name = "rustversion" version = "1.0.6" @@ -8457,7 +8633,7 @@ dependencies = [ "structopt", "thiserror", "tiny-bip39", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -8623,7 +8799,6 @@ dependencies = [ "sc-client-api", "sc-consensus", "sc-telemetry", - "sp-api", "sp-arithmetic", "sp-blockchain", "sp-consensus", @@ -8653,6 +8828,7 @@ dependencies = [ "lazy_static", "libsecp256k1 0.7.0", "log", + "lru 0.6.6", "parity-scale-codec", "parking_lot", "sc-executor-common", @@ -8885,7 +9061,7 @@ dependencies = [ "futures-timer 3.0.2", "hex", "hyper", - "hyper-rustls", + "hyper-rustls 0.22.1", "num_cpus", "once_cell", "parity-scale-codec", @@ -8989,7 +9165,7 @@ dependencies = [ "log", "serde_json", "substrate-prometheus-endpoint", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -9050,7 +9226,7 @@ dependencies = [ "substrate-prometheus-endpoint", "tempfile", "thiserror", - "tokio 1.14.0", + "tokio 1.15.0", "tracing", "tracing-futures", ] @@ -9088,7 +9264,7 @@ dependencies = [ "substrate-test-runtime", "substrate-test-runtime-client", "tempfile", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -9307,6 +9483,16 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring 0.16.20", + "untrusted", +] + [[package]] name = "secp256k1" version = "0.20.3" @@ -9411,9 +9597,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.131" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ad69dfbd3e45369132cc64e6748c2d65cdfb001a2b1c232d128b4ad60561c1" +checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" dependencies = [ "serde_derive", ] @@ -9430,9 +9616,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.131" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b710a83c4e0dff6a3d511946b95274ad9ca9e5d3ae497b63fda866ac955358d2" +checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276" dependencies = [ "proc-macro2 1.0.33", "quote 1.0.10", @@ -9776,7 +9962,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "parity-scale-codec", "scale-info", @@ -9788,7 +9974,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "integer-sqrt", "num-traits", @@ -9932,7 +10118,7 @@ dependencies = [ [[package]] name = "sp-core" -version = "4.0.0-dev" +version = "4.1.0-dev" dependencies = [ "base58", "bitflags", @@ -9979,7 +10165,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "blake2-rfc", "byteorder", @@ -10009,7 +10195,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "proc-macro2 1.0.33", "quote 1.0.10", @@ -10018,7 +10204,7 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "environmental", "parity-scale-codec", @@ -10058,7 +10244,7 @@ dependencies = [ [[package]] name = "sp-io" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "futures 0.3.18", "hash-db", @@ -10091,7 +10277,7 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "async-trait", "derive_more", @@ -10147,7 +10333,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "backtrace", "lazy_static", @@ -10165,7 +10351,7 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "either", "hash256-std-hasher", @@ -10186,7 +10372,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "4.0.0-dev" +version = "4.1.0-dev" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -10202,7 +10388,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "Inflector", "proc-macro-crate 1.1.0", @@ -10257,7 +10443,7 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "hash-db", "log", @@ -10279,11 +10465,11 @@ dependencies = [ [[package]] name = "sp-std" -version = "4.0.0-dev" +version = "4.0.0" [[package]] name = "sp-storage" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10322,7 +10508,7 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "parity-scale-codec", "sp-std", @@ -10356,10 +10542,10 @@ dependencies = [ [[package]] name = "sp-trie" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "hash-db", - "memory-db", + "memory-db 0.28.0", "parity-scale-codec", "scale-info", "sp-core", @@ -10377,6 +10563,7 @@ dependencies = [ "parity-wasm 0.42.2", "scale-info", "serde", + "sp-core-hashing-proc-macro", "sp-runtime", "sp-std", "sp-version-proc-macro", @@ -10395,12 +10582,14 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "4.0.0-dev" +version = "4.1.0-dev" dependencies = [ "impl-trait-for-tuples", + "log", "parity-scale-codec", "sp-std", "wasmi", + "wasmtime", ] [[package]] @@ -10517,15 +10706,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d1bd069de53442e7a320f525a6d4deb8bb0621ac7a55f7eccbc2b58b57f43d0" dependencies = [ "once_cell", - "tokio 1.14.0", - "tokio-rustls", + "tokio 1.15.0", + "tokio-rustls 0.22.0", ] [[package]] name = "ss58-registry" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827441708a5dd8ca54e6b79690dc06d1bede78e61961e667f683c23c16ef964c" +checksum = "c83f0afe7e571565ef9aae7b0e4fb30fcaec4ebb9aea2f00489b772782aa03a4" dependencies = [ "Inflector", "proc-macro2 1.0.33", @@ -10670,7 +10859,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e" dependencies = [ - "strum_macros", + "strum_macros 0.22.0", ] [[package]] @@ -10685,6 +10874,19 @@ dependencies = [ "syn 1.0.82", ] +[[package]] +name = "strum_macros" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" +dependencies = [ + "heck", + "proc-macro2 1.0.33", + "quote 1.0.10", + "rustversion", + "syn 1.0.82", +] + [[package]] name = "substrate-bip39" version = "0.4.4" @@ -10748,7 +10950,7 @@ dependencies = [ "hyper", "log", "prometheus", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -10785,7 +10987,7 @@ dependencies = [ "frame-system", "frame-system-rpc-runtime-api", "log", - "memory-db", + "memory-db 0.27.0", "pallet-babe", "pallet-timestamp", "parity-scale-codec", @@ -10865,17 +11067,13 @@ dependencies = [ "frame-metadata", "futures 0.3.18", "hex", - "jsonrpsee-http-client", - "jsonrpsee-proc-macros", - "jsonrpsee-types 0.4.1", - "jsonrpsee-ws-client 0.4.1", + "jsonrpsee 0.5.1", "log", "num-traits", "parity-scale-codec", "scale-info", "serde", "serde_json", - "sp-arithmetic", "sp-core", "sp-runtime", "sp-version", @@ -11229,11 +11427,10 @@ dependencies = [ [[package]] name = "tokio" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144" +checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" dependencies = [ - "autocfg", "bytes 1.1.0", "libc", "memchr", @@ -11249,9 +11446,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2 1.0.33", "quote 1.0.10", @@ -11265,7 +11462,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ "native-tls", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -11275,10 +11472,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ "rustls 0.19.1", - "tokio 1.14.0", + "tokio 1.15.0", "webpki 0.21.4", ] +[[package]] +name = "tokio-rustls" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a27d5f2b839802bd8267fa19b0530f5a08b9c08cd417976be2a65d130fe1c11b" +dependencies = [ + "rustls 0.20.2", + "tokio 1.15.0", + "webpki 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-stream" version = "0.1.8" @@ -11287,7 +11495,7 @@ checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" dependencies = [ "futures-core", "pin-project-lite 0.2.7", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -11316,7 +11524,7 @@ dependencies = [ "futures-sink", "log", "pin-project-lite 0.2.7", - "tokio 1.14.0", + "tokio 1.15.0", ] [[package]] @@ -11443,9 +11651,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.22.6" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eac131e334e81b6b3be07399482042838adcd7957aa0010231d0813e39e02fa" +checksum = "e3ddae50680c12ef75bfbf58416ca6622fa43d879553f6cb2ed1a817346e1ffe" dependencies = [ "hash-db", "hashbrown", @@ -11456,9 +11664,9 @@ dependencies = [ [[package]] name = "trie-root" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "652931506d2c1244d7217a70b99f56718a7b4161b37f04e7cd868072a99f68cd" +checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" dependencies = [ "hash-db", ] @@ -11555,7 +11763,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" name = "try-runtime-cli" version = "0.10.0-dev" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.4.1", "log", "parity-scale-codec", "remote-externalities", @@ -11572,6 +11780,7 @@ dependencies = [ "sp-state-machine", "sp-version", "structopt", + "zstd", ] [[package]] @@ -12274,6 +12483,15 @@ dependencies = [ "webpki 0.21.4", ] +[[package]] +name = "webpki-roots" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c475786c6f47219345717a043a37ec04cb4bc185e28853adcc4fa0a947eba630" +dependencies = [ + "webpki 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wepoll-ffi" version = "0.1.2" diff --git a/crates/phactory/src/contracts/pink.rs b/crates/phactory/src/contracts/pink.rs index da1d86abe6..5fde400438 100644 --- a/crates/phactory/src/contracts/pink.rs +++ b/crates/phactory/src/contracts/pink.rs @@ -2,7 +2,7 @@ use crate::contracts; use crate::system::{TransactionError, TransactionResult}; use anyhow::{anyhow, Result}; use parity_scale_codec::{Decode, Encode}; -use phala_mq::{ContractGroupId, MessageOrigin}; +use phala_mq::{ContractClusterId, MessageOrigin}; use pink::runtime::ExecSideEffects; use runtime::{AccountId, BlockNumber}; @@ -32,12 +32,12 @@ pub enum QueryError { #[derive(Encode, Decode)] pub struct Pink { instance: pink::Contract, - group: ContractGroupId, + cluster_id: ContractClusterId, } impl Pink { pub fn instantiate( - group: ContractGroupId, + cluster_id: ContractClusterId, storage: &mut pink::Storage, origin: AccountId, wasm_bin: Vec, @@ -56,15 +56,15 @@ impl Pink { now, ) .map_err(|err| anyhow!("Instantiate contract failed: {:?} origin={:?}", err, origin,))?; - Ok((Self { group, instance }, effects)) + Ok((Self { cluster_id, instance }, effects)) } - pub fn from_address(address: AccountId, group: ContractGroupId) -> Self { + pub fn from_address(address: AccountId, cluster_id: ContractClusterId) -> Self { let instance = pink::Contract::from_address(address); - Self { instance, group } + Self { instance, cluster_id } } - pub fn address_to_id(address: &AccountId) -> contracts::NativeContractId { + pub fn address_to_id(address: &AccountId) -> contracts::ContractId { let inner: &[u8; 32] = address.as_ref(); inner.into() } @@ -86,8 +86,8 @@ impl contracts::NativeContract for Pink { let origin = origin.ok_or(QueryError::BadOrigin)?; match req { Query::InkMessage(input_data) => { - let storage = group_storage(&mut context.contract_groups, &self.group) - .expect("Pink group should always exists!"); + let storage = cluster_storage(&mut context.contract_clusters, &self.cluster_id) + .expect("Pink cluster should always exists!"); let (ink_result, _effects) = self.instance.bare_call( storage, @@ -118,8 +118,8 @@ impl contracts::NativeContract for Pink { _ => return Err(TransactionError::BadOrigin), }; - let storage = group_storage(&mut context.contract_groups, &self.group) - .expect("Pink group should always exists!"); + let storage = cluster_storage(&mut context.contract_clusters, &self.cluster_id) + .expect("Pink cluster should always exists!"); let (result, effects) = self .instance @@ -146,8 +146,8 @@ impl contracts::NativeContract for Pink { } fn on_block_end(&mut self, context: &mut contracts::NativeContext) -> TransactionResult { - let storage = group_storage(&mut context.contract_groups, &self.group) - .expect("Pink group should always exists!"); + let storage = cluster_storage(&mut context.contract_clusters, &self.cluster_id) + .expect("Pink cluster should always exists!"); let effects = self .instance .on_block_end(storage, context.block.block_number, context.block.now_ms) @@ -160,7 +160,7 @@ impl contracts::NativeContract for Pink { } impl NativeContractMore for Pink { - fn id(&self) -> contracts::NativeContractId { + fn id(&self) -> phala_mq::ContractId { Pink::address_to_id(&self.instance.address) } @@ -169,20 +169,20 @@ impl NativeContractMore for Pink { } } -fn group_storage<'a>( - groups: &'a mut group::GroupKeeper, - group_id: &ContractGroupId, +fn cluster_storage<'a>( + clusters: &'a mut cluster::ClusterKeeper, + cluster_id: &ContractClusterId, ) -> Result<&'a mut pink::Storage> { - groups - .get_group_storage_mut(group_id) - .ok_or(anyhow!("Contract group {:?} not found! qed!", group_id)) + clusters + .get_cluster_storage_mut(cluster_id) + .ok_or(anyhow!("Contract cluster {:?} not found! qed!", cluster_id)) } -pub mod group { +pub mod cluster { use super::Pink; use anyhow::Result; - use phala_mq::{ContractGroupId, ContractId}; + use phala_mq::{ContractClusterId, ContractId}; use phala_serde_more as more; use pink::{runtime::ExecSideEffects, types::AccountId}; use runtime::BlockNumber; @@ -191,14 +191,14 @@ pub mod group { use std::collections::{BTreeMap, BTreeSet}; #[derive(Default, Serialize, Deserialize)] - pub struct GroupKeeper { - groups: BTreeMap, + pub struct ClusterKeeper { + clusters: BTreeMap, } - impl GroupKeeper { + impl ClusterKeeper { pub fn instantiate_contract( &mut self, - group_id: ContractGroupId, + cluster_id: ContractClusterId, origin: AccountId, wasm_bin: Vec, input_data: Vec, @@ -207,11 +207,10 @@ pub mod group { block_number: BlockNumber, now: u64, ) -> Result { - let group = self - .get_group_or_default_mut(&group_id, contract_key); + let cluster = self.get_cluster_or_default_mut(&cluster_id, contract_key); let (_, effects) = Pink::instantiate( - group_id, - &mut group.storage, + cluster_id, + &mut cluster.storage, origin, wasm_bin, input_data, @@ -222,49 +221,51 @@ pub mod group { Ok(effects) } - pub fn get_group_storage_mut( + pub fn get_cluster_storage_mut( &mut self, - group_id: &ContractGroupId, + cluster_id: &ContractClusterId, ) -> Option<&mut pink::Storage> { - Some(&mut self.groups.get_mut(group_id)?.storage) + Some(&mut self.clusters.get_mut(cluster_id)?.storage) } - pub fn get_group_mut(&mut self, group_id: &ContractGroupId) -> Option<&mut Group> { - self.groups.get_mut(group_id) + pub fn get_cluster_mut(&mut self, cluster_id: &ContractClusterId) -> Option<&mut Cluster> { + self.clusters.get_mut(cluster_id) } - pub fn get_group_or_default_mut( + pub fn get_cluster_or_default_mut( &mut self, - group_id: &ContractGroupId, + cluster_id: &ContractClusterId, contract_key: &sr25519::Pair, - ) -> &mut Group { - self.groups - .entry(group_id.clone()) - .or_insert_with(|| Group { + ) -> &mut Cluster { + self.clusters.entry(cluster_id.clone()).or_insert_with(|| { + let mut cluster = Cluster { storage: Default::default(), contracts: Default::default(), key: contract_key.clone(), - }) + }; + cluster.set_id(cluster_id); + cluster + }) } pub fn commit_changes(&mut self) -> anyhow::Result<()> { - for group in self.groups.values_mut() { - group.commit_changes()?; + for cluster in self.clusters.values_mut() { + cluster.commit_changes()?; } Ok(()) } } #[derive(Serialize, Deserialize)] - pub struct Group { + pub struct Cluster { pub storage: pink::Storage, contracts: BTreeSet, #[serde(with = "more::key_bytes")] key: sr25519::Pair, } - impl Group { - /// Add a new contract to the group. Returns true if the contract is new. + impl Cluster { + /// Add a new contract to the cluster. Returns true if the contract is new. pub fn add_contract(&mut self, address: ContractId) -> bool { self.contracts.insert(address) } @@ -277,5 +278,9 @@ pub mod group { self.storage.commit_changes(); Ok(()) } + + pub fn set_id(&mut self, id: &ContractClusterId) { + self.storage.set_cluster_id(id.as_bytes()); + } } } diff --git a/crates/phactory/src/contracts/support.rs b/crates/phactory/src/contracts/support.rs index 966d3de35f..c168f36429 100644 --- a/crates/phactory/src/contracts/support.rs +++ b/crates/phactory/src/contracts/support.rs @@ -3,7 +3,7 @@ use phala_mq::traits::MessageChannel; use runtime::BlockNumber; use serde::{Deserialize, Serialize}; -use super::pink::group::GroupKeeper; +use super::pink::cluster::ClusterKeeper; use super::*; use crate::secret_channel::SecretReceiver; use crate::types::BlockInfo; @@ -11,21 +11,21 @@ use phala_serde_more as more; pub struct ExecuteEnv<'a, 'b> { pub block: &'a mut BlockInfo<'b>, - pub contract_groups: &'a mut GroupKeeper, + pub contract_clusters: &'a mut ClusterKeeper, } pub struct NativeContext<'a, 'b> { pub block: &'a mut BlockInfo<'b>, pub mq: &'a SignedMessageChannel, pub secret_mq: SecretMessageChannel<'a, SignedMessageChannel>, - pub contract_groups: &'a mut GroupKeeper, + pub contract_clusters: &'a mut ClusterKeeper, pub self_id: ContractId, } pub struct QueryContext<'a> { pub block_number: BlockNumber, pub now_ms: u64, - pub contract_groups: &'a mut GroupKeeper, + pub contract_clusters: &'a mut ClusterKeeper, } impl NativeContext<'_, '_> { @@ -42,7 +42,7 @@ pub trait Contract { req: OpaqueQuery, context: &mut QueryContext, ) -> Result; - fn group_id(&self) -> phala_mq::ContractGroupId; + fn cluster_id(&self) -> phala_mq::ContractClusterId; fn process_next_message(&mut self, env: &mut ExecuteEnv) -> Option; fn on_block_end(&mut self, env: &mut ExecuteEnv) -> TransactionResult; fn push_message(&self, payload: Vec, topic: Vec); @@ -55,23 +55,8 @@ pub trait Contract { fn set_on_block_end_selector(&mut self, selector: u32); } -#[derive(Encode, Decode, Clone, Debug, Copy, derive_more::From)] -pub struct NativeContractId(sp_core::H256); - -impl From<&[u8; 32]> for NativeContractId { - fn from(bytes: &[u8; 32]) -> Self { - NativeContractId(bytes.into()) - } -} - -impl NativeContractId { - pub fn to_contract_id(&self, group_id: &phala_mq::ContractGroupId) -> phala_mq::ContractId { - sp_core::blake2_256(&(group_id, &self.0).encode()).into() - } -} - pub trait NativeContractMore { - fn id(&self) -> NativeContractId; + fn id(&self) -> phala_mq::ContractId; fn set_on_block_end_selector(&mut self, _selector: u32) {} } @@ -106,8 +91,14 @@ pub struct NativeContractWrapper { } impl NativeContractWrapper { - pub fn new(inner: Con, deployer: sp_core::H256, salt: &[u8], id: u32) -> Self { - let encoded = (deployer, id, salt).encode(); + pub fn new( + inner: Con, + cluster_id: &phala_mq::ContractClusterId, + deployer: sp_core::H256, + salt: &[u8], + id: u32, + ) -> Self { + let encoded = (deployer, id, cluster_id, salt).encode(); let id = sp_core::blake2_256(&encoded).into(); NativeContractWrapper { inner, id } } @@ -142,8 +133,8 @@ impl NativeContract for NativeContractWrapper { } impl NativeContractMore for NativeContractWrapper { - fn id(&self) -> NativeContractId { - self.id.into() + fn id(&self) -> phala_mq::ContractId { + self.id } } @@ -156,7 +147,7 @@ pub struct NativeCompatContract { cmd_rcv_mq: SecretReceiver, #[serde(with = "crate::secret_channel::ecdh_serde")] ecdh_key: KeyPair, - group_id: phala_mq::ContractGroupId, + cluster_id: phala_mq::ContractClusterId, contract_id: phala_mq::ContractId, } @@ -166,7 +157,7 @@ impl NativeCompatContract { send_mq: SignedMessageChannel, cmd_rcv_mq: SecretReceiver, ecdh_key: KeyPair, - group_id: phala_mq::ContractGroupId, + cluster_id: phala_mq::ContractClusterId, contract_id: phala_mq::ContractId, ) -> Self { NativeCompatContract { @@ -174,7 +165,7 @@ impl NativeCompatContract { send_mq, cmd_rcv_mq, ecdh_key, - group_id, + cluster_id, contract_id, } } @@ -185,8 +176,8 @@ impl Contract for NativeCompatContract self.contract_id } - fn group_id(&self) -> phala_mq::ContractGroupId { - self.group_id + fn cluster_id(&self) -> phala_mq::ContractClusterId { + self.cluster_id } fn handle_query( @@ -208,7 +199,7 @@ impl Contract for NativeCompatContract block: env.block, mq: &self.send_mq, secret_mq, - contract_groups: &mut env.contract_groups, + contract_clusters: &mut env.contract_clusters, self_id: self.id(), }; @@ -231,7 +222,7 @@ impl Contract for NativeCompatContract block: env.block, mq: &self.send_mq, secret_mq, - contract_groups: &mut env.contract_groups, + contract_clusters: &mut env.contract_clusters, self_id: self.id(), }; self.contract.on_block_end(&mut context) diff --git a/crates/phactory/src/system/mod.rs b/crates/phactory/src/system/mod.rs index 7a3392df74..0a5850be1f 100644 --- a/crates/phactory/src/system/mod.rs +++ b/crates/phactory/src/system/mod.rs @@ -5,9 +5,9 @@ mod side_tasks; use crate::{ benchmark, contracts::{ - pink::group::Group, ContractsKeeper, ExecuteEnv, NativeContract, NativeContractMore, + pink::cluster::Cluster, ContractsKeeper, ExecuteEnv, NativeContract, NativeContractMore, }, - pink::{group::GroupKeeper, Pink}, + pink::{cluster::ClusterKeeper, Pink}, secret_channel::{ecdh_serde, SecretReceiver}, types::{BlockInfo, OpaqueError, OpaqueQuery, OpaqueReply}, }; @@ -410,7 +410,7 @@ pub struct System { pub(crate) gatekeeper: Option>, pub(crate) contracts: ContractsKeeper, - contract_groups: GroupKeeper, + contract_clusters: ClusterKeeper, contract_keys: BTreeMap, // Cached for query @@ -461,7 +461,7 @@ impl System { master_key, gatekeeper: None, contracts, - contract_groups: Default::default(), + contract_clusters: Default::default(), contract_keys: Default::default(), block_number: 0, now_ms: 0, @@ -481,7 +481,7 @@ impl System { let mut context = contracts::QueryContext { block_number: self.block_number, now_ms: self.now_ms, - contract_groups: &mut self.contract_groups, + contract_clusters: &mut self.contract_clusters, }; contract.handle_query(origin, req, &mut context) } @@ -548,10 +548,10 @@ impl System { None => continue 'outer, Some(v) => v, }; - let group_id = contract.group_id(); + let cluster_id = contract.cluster_id(); let mut env = ExecuteEnv { block: block, - contract_groups: &mut self.contract_groups, + contract_clusters: &mut self.contract_clusters, }; let result = match contract.process_next_message(&mut env) { Some(result) => result, @@ -559,28 +559,28 @@ impl System { }; handle_contract_command_result( result, - group_id, + cluster_id, &mut self.contracts, - &mut self.contract_groups, + &mut self.contract_clusters, block, &self.egress, ); } let mut env = ExecuteEnv { block: block, - contract_groups: &mut self.contract_groups, + contract_clusters: &mut self.contract_clusters, }; let contract = match self.contracts.get_mut(&key) { None => continue 'outer, Some(v) => v, }; let result = contract.on_block_end(&mut env); - let group_id = contract.group_id(); + let cluster_id = contract.cluster_id(); handle_contract_command_result( result, - group_id, + cluster_id, &mut self.contracts, - &mut self.contract_groups, + &mut self.contract_clusters, block, &self.egress, ); @@ -849,7 +849,7 @@ impl System { let contract_key = ContractKey(keypair); let contract_pubkey = contract_key.public(); let contract_info = event.contract_info; - let group_id = chain::Hash::from_low_u64_be(contract_info.group_id); + let cluster_id = chain::Hash::from_low_u64_be(contract_info.cluster_id); match contract_info.code_index { CodeIndex::NativeCode(contract_id) => { @@ -868,6 +868,7 @@ impl System { $id => { let contract = NativeContractWrapper::new( $contract, + &cluster_id, deployer, &salt, $id, @@ -878,7 +879,7 @@ impl System { contract_key.0.clone(), ecdh_key, block, - group_id, + cluster_id, )? } )* @@ -905,13 +906,13 @@ impl System { (BTC_PRICE_BOT => btc_price_bot::BtcPriceBot::new()) }; - self.contract_groups - .get_group_or_default_mut(&group_id, &contract_key.0) + self.contract_clusters + .get_cluster_or_default_mut(&cluster_id, &contract_key.0) .add_contract(contract_id); let message = WorkerContractReport::ContractInstantiated { id: contract_id, - group_id, + cluster_id, deployer, pubkey: EcdhPublicKey(ecdh_pubkey), }; @@ -939,9 +940,9 @@ impl System { let code = code.expect("checked; qed."); let deployer = contract_info.deployer; let effects = self - .contract_groups + .contract_clusters .instantiate_contract( - group_id, + cluster_id, deployer.clone(), code, contract_info.instantiate_data, @@ -953,15 +954,15 @@ impl System { .with_context(|| format!("Contract deployer: {:?}", deployer)) .map_err(|_| TransactionError::FailedToExecute)?; - let group = self - .contract_groups - .get_group_mut(&group_id) - .expect("Group must exist after instantiate"); + let cluster = self + .contract_clusters + .get_cluster_mut(&cluster_id) + .expect("Cluster must exist after instantiate"); apply_pink_side_effects( effects, - group_id, + cluster_id, &mut self.contracts, - group, + cluster, block, &self.egress, ); @@ -997,15 +998,15 @@ impl System { } pub fn commit_changes(&mut self) -> anyhow::Result<()> { - self.contract_groups.commit_changes() + self.contract_clusters.commit_changes() } } pub fn handle_contract_command_result( result: TransactionResult, - group_id: phala_mq::ContractGroupId, + cluster_id: phala_mq::ContractClusterId, contracts: &mut ContractsKeeper, - groups: &mut GroupKeeper, + clusters: &mut ClusterKeeper, block: &mut BlockInfo, egress: &SignedMessageChannel, ) { @@ -1016,41 +1017,41 @@ pub fn handle_contract_command_result( } Ok(effects) => effects, }; - let group = match groups.get_group_mut(&group_id) { + let cluster = match clusters.get_cluster_mut(&cluster_id) { None => { error!( - "BUG: contract group not found, it should always exsists, group_id={:?}", - group_id + "BUG: contract cluster not found, it should always exsists, cluster_id={:?}", + cluster_id ); return; } - Some(group) => group, + Some(cluster) => cluster, }; - apply_pink_side_effects(effects, group_id, contracts, group, block, egress); + apply_pink_side_effects(effects, cluster_id, contracts, cluster, block, egress); } pub fn apply_pink_side_effects( effects: ExecSideEffects, - group_id: phala_mq::ContractGroupId, + cluster_id: phala_mq::ContractClusterId, contracts: &mut ContractsKeeper, - group: &mut Group, + cluster: &mut Cluster, block: &mut BlockInfo, egress: &SignedMessageChannel, ) { - let contract_key = group.key().clone(); + let contract_key = cluster.key().clone(); let ecdh_key = contract_key .derive_ecdh_key() .expect("Derive ecdh_key should not fail"); for (deployer, address) in effects.instantiated { - let pink = Pink::from_address(address.clone(), group_id); + let pink = Pink::from_address(address.clone(), cluster_id); let id = install_contract( contracts, pink, contract_key.clone(), ecdh_key.clone(), block, - group_id, + cluster_id, ); let id = match id { @@ -1058,17 +1059,17 @@ pub fn apply_pink_side_effects( Err(err) => { error!("BUG: Install contract failed: {:?}", err); error!(" address: {:?}", address); - error!(" group_id: {:?}", group_id); + error!(" cluster_id: {:?}", cluster_id); error!(" deployer: {:?}", deployer); continue; } }; - group.add_contract(id); + cluster.add_contract(id); let message = WorkerContractReport::ContractInstantiated { id, - group_id, + cluster_id, deployer: phala_types::messaging::AccountId(deployer.into()), pubkey: EcdhPublicKey(ecdh_key.public()), }; @@ -1078,20 +1079,23 @@ pub fn apply_pink_side_effects( } for (address, event) in effects.pink_events { - let id = Pink::address_to_id(&address).to_contract_id(&group_id); + let id = Pink::address_to_id(&address); let contract = match contracts.get_mut(&id) { Some(contract) => contract, None => { panic!( - "BUG: Unknown contract sending pink event, address={:?}, group_id={:?}", - address, group_id + "BUG: Unknown contract sending pink event, address={:?}, cluster_id={:?}", + address, cluster_id ); } }; use pink::runtime::PinkEvent; match event { PinkEvent::Message(message) => { - contract.push_message(message.payload, message.topic); + contract.push_message( + message.payload, + message.topic, + ); } PinkEvent::OspMessage(message) => { contract.push_osp_message( @@ -1114,14 +1118,14 @@ pub fn install_contract( contract_key: sr25519::Pair, ecdh_key: EcdhKey, block: &mut BlockInfo, - group_id: phala_mq::ContractGroupId, + cluster_id: phala_mq::ContractClusterId, ) -> anyhow::Result where Contract: NativeContract + NativeContractMore + Send + 'static, ::Cmd: Send, contracts::AnyContract: From>, { - let contract_id = contract.id().to_contract_id(&group_id); + let contract_id = contract.id(); if contracts.get(&contract_id).is_some() { return Err(anyhow::anyhow!("Contract already exists")); } @@ -1139,7 +1143,7 @@ where mq, cmd_mq, ecdh_key.clone(), - group_id, + cluster_id, contract_id, ); contracts.insert(wrapped); @@ -1213,18 +1217,21 @@ pub mod chain_state { #[cfg(test)] mod tests { use super::*; + use sp_runtime::AccountId32; + + const ALICE: AccountId32 = AccountId32::new([1u8; 32]); #[test] fn test_on_block_end() { let contract_key = sp_core::Pair::from_seed(&Default::default()); let mut contracts = ContractsKeeper::default(); - let mut groupkeeper = GroupKeeper::default(); + let mut keeper = ClusterKeeper::default(); let wasm_bin = pink::load_test_wasm("hooks_test"); - let group_id = phala_mq::ContractGroupId(Default::default()); - let effects = groupkeeper + let cluster_id = phala_mq::ContractClusterId(Default::default()); + let effects = keeper .instantiate_contract( - group_id, - Default::default(), + cluster_id, + ALICE, wasm_bin, vec![0xed, 0x4b, 0x9d, 0x1b], Default::default(), @@ -1235,19 +1242,19 @@ mod tests { .unwrap(); insta::assert_debug_snapshot!(effects); - let group = groupkeeper.get_group_mut(&group_id).unwrap(); + let cluster = keeper.get_cluster_mut(&cluster_id).unwrap(); let mut builder = BlockInfo::builder().block_number(1).now_ms(1); let signer = sr25519::Pair::from_seed(&Default::default()); let egress = builder .send_mq - .channel(MessageOrigin::Worker(Default::default()), signer.into()); + .channel(MessageOrigin::Gatekeeper, signer.into()); let mut block_info = builder.build(); apply_pink_side_effects( effects, - group_id, + cluster_id, &mut contracts, - group, + cluster, &mut block_info, &egress, ); @@ -1256,7 +1263,7 @@ mod tests { let mut env = ExecuteEnv { block: &mut block_info, - contract_groups: &mut &mut groupkeeper, + contract_clusters: &mut &mut keeper, }; for contract in contracts.values_mut() { diff --git a/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end-3.snap b/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end-3.snap index 8c3fa66283..c63c2b0903 100644 --- a/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end-3.snap +++ b/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end-3.snap @@ -6,7 +6,7 @@ expression: effects ExecSideEffects { pink_events: [ ( - e3f30e9fdd495e274a437ebf039139ecfb6ff87b824d6de0282107a6c1494e17 (5HDavttx...), + 6a3692c6cfcbe9cb61fe0ee3649bac291f64d933a084a741900826f55b3960c5 (5ETy9Lid...), Message( Message { payload: [ diff --git a/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end-4.snap b/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end-4.snap index 3bfa7b90ed..864760b371 100644 --- a/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end-4.snap +++ b/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end-4.snap @@ -7,76 +7,42 @@ expression: messages ( 0, Message { - sender: Worker( - 0000000000000000000000000000000000000000000000000000000000000000 (5C4hrfjw...), - ), + sender: Gatekeeper, destination: phala/contract/worker/report, payload: [ 0, - 3, - 74, - 20, + 106, + 54, + 146, + 198, + 207, + 203, 233, - 183, - 189, - 91, - 131, - 39, - 225, - 206, - 214, - 95, - 67, - 128, - 213, - 125, - 7, - 45, - 44, - 126, - 199, - 39, - 67, - 6, - 241, - 228, - 93, + 203, + 97, + 254, + 14, + 227, + 100, + 155, + 172, + 41, + 31, + 100, + 217, 51, - 138, - 202, - 117, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 160, + 132, + 167, + 65, + 144, + 8, + 38, + 245, + 91, + 57, + 96, + 197, 0, 0, 0, @@ -109,6 +75,38 @@ expression: messages 0, 0, 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, 222, 241, 46, diff --git a/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end.snap b/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end.snap index 6130fb00d4..08c954213b 100644 --- a/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end.snap +++ b/crates/phactory/src/system/snapshots/phactory__system__tests__on_block_end.snap @@ -6,7 +6,7 @@ expression: effects ExecSideEffects { pink_events: [ ( - e3f30e9fdd495e274a437ebf039139ecfb6ff87b824d6de0282107a6c1494e17 (5HDavttx...), + 6a3692c6cfcbe9cb61fe0ee3649bac291f64d933a084a741900826f55b3960c5 (5ETy9Lid...), OnBlockEndSelector( 2188995711, ), @@ -14,8 +14,8 @@ ExecSideEffects { ], instantiated: [ ( - 0000000000000000000000000000000000000000000000000000000000000000 (5C4hrfjw...), - e3f30e9fdd495e274a437ebf039139ecfb6ff87b824d6de0282107a6c1494e17 (5HDavttx...), + 0101010101010101010101010101010101010101010101010101010101010101 (5C62Ck4U...), + 6a3692c6cfcbe9cb61fe0ee3649bac291f64d933a084a741900826f55b3960c5 (5ETy9Lid...), ), ], } diff --git a/crates/phala-mq/src/types.rs b/crates/phala-mq/src/types.rs index a65559b86d..705d0dd5bb 100644 --- a/crates/phala-mq/src/types.rs +++ b/crates/phala-mq/src/types.rs @@ -11,7 +11,7 @@ pub type Path = Vec; pub type SenderId = MessageOrigin; pub use sp_core::H256 as ContractId; pub use sp_core::H256 as AccountId; -pub use sp_core::H256 as ContractGroupId; +pub use sp_core::H256 as ContractClusterId; use crate::MessageSigner; use serde::{Serialize, Deserialize}; diff --git a/crates/phala-trie-storage/src/lib.rs b/crates/phala-trie-storage/src/lib.rs index 668d68afc0..c412b6cc1f 100644 --- a/crates/phala-trie-storage/src/lib.rs +++ b/crates/phala-trie-storage/src/lib.rs @@ -14,7 +14,7 @@ use serde::{Serialize, Serializer, Deserializer, Deserialize}; use sp_core::storage::ChildInfo; use sp_core::Hasher; use sp_state_machine::{Backend, TrieBackend}; -use sp_trie::{trie_types::TrieDBMut, MemoryDB, TrieMut, HashDBT}; +use sp_trie::{trie_types::TrieDBMutV0 as TrieDBMut, MemoryDB, TrieMut, HashDBT}; /// Storage key. pub type StorageKey = Vec; @@ -130,6 +130,7 @@ where .map(|(k, v)| (k.as_ref(), v.as_ref().map(|v| v.as_ref()))), ) }), + sp_core::storage::StateVersion::V0, ) } diff --git a/crates/phala-trie-storage/tests/test_state_root.rs b/crates/phala-trie-storage/tests/test_state_root.rs index 7b5ba3d6af..49b3c33aa4 100644 --- a/crates/phala-trie-storage/tests/test_state_root.rs +++ b/crates/phala-trie-storage/tests/test_state_root.rs @@ -1,11 +1,11 @@ +use phala_trie_storage::*; use serde::{Deserialize, Serialize}; use sp_core::Hasher; -use sp_runtime::traits::Hash; -use sp_trie::trie_types::Layout; +use sp_runtime::{traits::Hash, StateVersion}; +use sp_trie::LayoutV0 as Layout; use sp_trie::TrieConfiguration as _; use std::collections::HashMap; use std::path::PathBuf; -use phala_trie_storage::*; #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] pub struct NativeBlakeTwo256; @@ -23,11 +23,11 @@ impl Hasher for NativeBlakeTwo256 { impl Hash for NativeBlakeTwo256 { type Output = sp_core::H256; - fn trie_root(input: Vec<(Vec, Vec)>) -> Self::Output { + fn trie_root(input: Vec<(Vec, Vec)>, _: StateVersion) -> Self::Output { Layout::::trie_root(input) } - fn ordered_trie_root(input: Vec>) -> Self::Output { + fn ordered_trie_root(input: Vec>, _: StateVersion) -> Self::Output { Layout::::ordered_trie_root(input) } } @@ -119,7 +119,8 @@ fn test_apply_main_changes() { .map(|(k, v)| (k.0, map_storage_collection(v))) .collect(); - let (root, trans) = trie.calc_root_if_changes(&main_storage_changes, &child_storage_changes); + let (root, trans) = + trie.calc_root_if_changes(&main_storage_changes, &child_storage_changes); trie.apply_changes(root, trans); assert_eq!(format!("{:?}", trie.root()), roots[number + 1]); } diff --git a/crates/phala-types/src/contract.rs b/crates/phala-types/src/contract.rs index f6043f4eb1..0f78d1c85d 100644 --- a/crates/phala-types/src/contract.rs +++ b/crates/phala-types/src/contract.rs @@ -60,8 +60,8 @@ pub mod messaging { #[derive(Encode, Decode, Clone, PartialEq, Eq, Debug, TypeInfo)] pub struct ContractInfo { pub deployer: AccountId, - /// Contract group counter of the contract - pub group_id: u64, + /// Contract cluster counter of the contract + pub cluster_id: u64, pub salt: Vec, pub code_index: CodeIndex, pub instantiate_data: Vec, diff --git a/crates/phala-types/src/lib.rs b/crates/phala-types/src/lib.rs index f304b54cfb..2f0af8444b 100644 --- a/crates/phala-types/src/lib.rs +++ b/crates/phala-types/src/lib.rs @@ -567,7 +567,7 @@ pub mod messaging { pub enum WorkerContractReport { ContractInstantiated { id: ContractId, - group_id: ContractGroupId, + cluster_id: ContractClusterId, deployer: AccountId, pubkey: EcdhPublicKey, }, diff --git a/crates/phaxt/src/extra.rs b/crates/phaxt/src/extra.rs index 2ebf8b4314..c872039821 100644 --- a/crates/phaxt/src/extra.rs +++ b/crates/phaxt/src/extra.rs @@ -5,10 +5,10 @@ use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use subxt::extrinsic::*; -use subxt::Config; use subxt::sp_runtime::generic::Era; use subxt::sp_runtime::traits::SignedExtension; use subxt::sp_runtime::transaction_validity::TransactionValidityError; +use subxt::Config; #[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] pub struct EraInfo { @@ -43,7 +43,7 @@ impl SignedEx CheckNonce, CheckWeight, // NOTE: skipped the ZST CheckMqSequence here. - ChargeTransactionPayment, + ChargeAssetTxPayment, ); type Parameters = ExtraConfig; @@ -81,7 +81,10 @@ impl SignedEx CheckNonce(self.nonce), CheckWeight(PhantomData), // NOTE: skipped the ZST CheckMqSequence here. - ChargeTransactionPayment(self.additional_params.tip.into()), + ChargeAssetTxPayment { + tip: self.additional_params.tip.into(), + asset_id: None, + }, ) } } @@ -98,4 +101,14 @@ impl SignedEx fn additional_signed(&self) -> Result { self.extra().additional_signed() } + + fn pre_dispatch( + self, + _who: &Self::AccountId, + _call: &Self::Call, + _info: &subxt::sp_runtime::traits::DispatchInfoOf, + _len: usize, + ) -> Result { + Ok(()) + } } diff --git a/crates/pink/src/contract.rs b/crates/pink/src/contract.rs index d7d4ba8723..a6577dbe96 100644 --- a/crates/pink/src/contract.rs +++ b/crates/pink/src/contract.rs @@ -1,3 +1,4 @@ +use pallet_contracts_primitives::StorageDeposit; use scale::{Decode, Encode}; use sp_core::Hasher as _; use sp_runtime::DispatchError; @@ -8,7 +9,7 @@ use crate::{ types::{AccountId, BlockNumber, Hashing, ENOUGH, GAS_LIMIT}, }; -use pallet_contracts_primitives::ContractExecResult; +type ContractExecResult = pallet_contracts_primitives::ContractExecResult; pub type Storage = storage::Storage; @@ -75,6 +76,7 @@ impl Contract { origin.clone(), ENOUGH, GAS_LIMIT, + None, pallet_contracts_primitives::Code::Upload(code.into()), input_data, salt.clone(), @@ -132,6 +134,7 @@ impl Contract { gas_required: 0, debug_message: b"Default account is not allowed to call contracts".to_vec(), result: Err(DispatchError::BadOrigin), + storage_deposit: StorageDeposit::Charge(0), }, ExecSideEffects::default(), ); @@ -152,7 +155,7 @@ impl Contract { storage.execute_with(rollback, move || { System::set_block_number(block_number); Timestamp::set_timestamp(now); - Contracts::bare_call(origin, addr, 0, GAS_LIMIT, input_data, true) + Contracts::bare_call(origin, addr, 0, GAS_LIMIT, None, input_data, true) }) } diff --git a/crates/pink/src/runtime.rs b/crates/pink/src/runtime.rs index cdcae8a99c..d9eb0d4c95 100644 --- a/crates/pink/src/runtime.rs +++ b/crates/pink/src/runtime.rs @@ -1,9 +1,13 @@ mod extension; mod mock_types; +mod pallet_pink; use crate::types::{AccountId, Balance, BlockNumber, Hash, Hashing, Index}; -use frame_support::weights::Weight; -use frame_support::{parameter_types, weights::constants::WEIGHT_PER_SECOND}; +use frame_support::{ + parameter_types, + traits::ConstU128, + weights::{constants::WEIGHT_PER_SECOND, Weight}, +}; use pallet_contracts::{Config, Frame, Schedule}; use sp_runtime::{ generic::Header, @@ -27,6 +31,7 @@ frame_support::construct_runtime! { Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Randomness: pallet_randomness_collective_flip::{Pallet, Storage}, Contracts: pallet_contracts::{Pallet, Call, Storage, Event}, + Pink: pallet_pink::{Pallet, Storage}, } } @@ -37,6 +42,8 @@ parameter_types! { pub static ExistentialDeposit: u64 = 0; } +impl pallet_pink::Config for PinkRuntime {} + impl frame_system::Config for PinkRuntime { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = BlockWeights; @@ -61,6 +68,7 @@ impl frame_system::Config for PinkRuntime { type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } impl pallet_randomness_collective_flip::Config for PinkRuntime {} @@ -112,7 +120,9 @@ impl Config for PinkRuntime { type DeletionQueueDepth = DeletionQueueDepth; type DeletionWeightLimit = DeletionWeightLimit; type Schedule = DefaultSchedule; - type ContractDeposit = (); + type DepositPerByte = ConstU128<0>; + type DepositPerItem = ConstU128<0>; + type AddressGenerator = Pink; } #[cfg(test)] @@ -148,6 +158,7 @@ mod tests { Origin::signed(ALICE), ENOUGH, GAS_LIMIT, + None, wasm, vec![], vec![], @@ -160,6 +171,7 @@ mod tests { addr.clone(), 0, GAS_LIMIT * 2, + None, ::Schedule::get() .limits .payload_len @@ -185,6 +197,7 @@ mod tests { Origin::signed(ALICE), 1_000_000_000_000_000, GAS_LIMIT, + None, wasm, vec![], vec![], @@ -212,11 +225,10 @@ mod tests { // We offset data in the contract tables by 1. let mut params = vec![(n + 1) as u8]; params.extend_from_slice(input); - let result = - Contracts::bare_call(ALICE, addr.clone(), 0, GAS_LIMIT, params, false) - .result - .unwrap(); - assert!(result.is_success()); + let result = Contracts::bare_call(ALICE, addr.clone(), 0, GAS_LIMIT, None, params, false) + .result + .unwrap(); + assert!(!result.did_revert()); let expected = hash_fn(input.as_ref()); assert_eq!(&result.data[..*expected_size], &*expected); } @@ -225,9 +237,7 @@ mod tests { pub mod exec { use sp_runtime::traits::BlakeTwo256; - use sp_state_machine::{ - Backend, Ext, OverlayedChanges, StorageTransactionCache, - }; + use sp_state_machine::{Backend, Ext, OverlayedChanges, StorageTransactionCache}; pub type InMemoryBackend = sp_state_machine::InMemoryBackend; pub fn execute_with(f: impl FnOnce() -> R) -> R { diff --git a/crates/pink/src/runtime/mock_types.rs b/crates/pink/src/runtime/mock_types.rs index 72d76a194a..0dc45522e7 100644 --- a/crates/pink/src/runtime/mock_types.rs +++ b/crates/pink/src/runtime/mock_types.rs @@ -1,9 +1,9 @@ use super::Balance; -use frame_support::traits; +use frame_support::{traits::{self, BalanceStatus}, dispatch::DispatchResult}; use call_trace::{trace_with, CallContext, Trace}; -use sp_runtime::AccountId32; +use sp_runtime::DispatchError; const ENOUGH: Balance = Balance::MAX / 2; @@ -71,19 +71,19 @@ impl traits::Imbalance for NoImbalance { pub struct NoCurrency; -impl traits::Currency for NoCurrency { +impl traits::Currency for NoCurrency { type Balance = Balance; type PositiveImbalance = NoImbalance; type NegativeImbalance = NoImbalance; #[trace_with(Null)] - fn total_balance(_who: &AccountId32) -> Self::Balance { + fn total_balance(_who: &AccountId) -> Self::Balance { ENOUGH } #[trace_with(Null)] - fn can_slash(_who: &AccountId32, _value: Self::Balance) -> bool { + fn can_slash(_who: &AccountId, _value: Self::Balance) -> bool { false } @@ -108,13 +108,13 @@ impl traits::Currency for NoCurrency { } #[trace_with(Null)] - fn free_balance(_who: &AccountId32) -> Self::Balance { + fn free_balance(_who: &AccountId) -> Self::Balance { ENOUGH } #[trace_with(Null)] fn ensure_can_withdraw( - _who: &AccountId32, + _who: &AccountId, _amount: Self::Balance, _reasons: frame_support::traits::WithdrawReasons, _new_balance: Self::Balance, @@ -124,8 +124,8 @@ impl traits::Currency for NoCurrency { #[trace_with(Null)] fn transfer( - _source: &AccountId32, - _dest: &AccountId32, + _source: &AccountId, + _dest: &AccountId, _value: Self::Balance, _existence_requirement: frame_support::traits::ExistenceRequirement, ) -> frame_support::dispatch::DispatchResult { @@ -134,7 +134,7 @@ impl traits::Currency for NoCurrency { #[trace_with(Null)] fn slash( - _who: &AccountId32, + _who: &AccountId, _value: Self::Balance, ) -> (Self::NegativeImbalance, Self::Balance) { (traits::Imbalance::zero(), 0) @@ -142,20 +142,20 @@ impl traits::Currency for NoCurrency { #[trace_with(Null)] fn deposit_into_existing( - _who: &AccountId32, + _who: &AccountId, _value: Self::Balance, ) -> Result { Ok(traits::Imbalance::zero()) } #[trace_with(Null)] - fn deposit_creating(_who: &AccountId32, _value: Self::Balance) -> Self::PositiveImbalance { + fn deposit_creating(_who: &AccountId, _value: Self::Balance) -> Self::PositiveImbalance { traits::Imbalance::zero() } #[trace_with(Null)] fn withdraw( - _who: &AccountId32, + _who: &AccountId, _value: Self::Balance, _reasons: frame_support::traits::WithdrawReasons, _liveness: frame_support::traits::ExistenceRequirement, @@ -165,18 +165,44 @@ impl traits::Currency for NoCurrency { #[trace_with(Null)] fn make_free_balance_be( - _who: &AccountId32, + _who: &AccountId, _balance: Self::Balance, ) -> frame_support::traits::SignedImbalance { frame_support::traits::SignedImbalance::zero() } } +impl traits::ReservableCurrency for NoCurrency { + fn can_reserve(_: &AccountId, _: Self::Balance) -> bool { + true + } + fn slash_reserved(_: &AccountId, _: Self::Balance) -> (Self::NegativeImbalance, Self::Balance) { + (Default::default(), 0) + } + fn reserved_balance(_: &AccountId) -> Self::Balance { + 0 + } + fn reserve(_: &AccountId, _: Self::Balance) -> DispatchResult { + Ok(()) + } + fn unreserve(_: &AccountId, _: Self::Balance) -> Self::Balance { + 0 + } + fn repatriate_reserved( + _: &AccountId, + _: &AccountId, + _: Self::Balance, + _: BalanceStatus, + ) -> Result { + Ok(0) + } +} + pub struct NoAccountStore; -impl traits::StoredMap> for NoAccountStore { - fn get(_: &AccountId32) -> pallet_balances::AccountData { +impl traits::StoredMap> for NoAccountStore { + fn get(_: &AccountId) -> pallet_balances::AccountData { pallet_balances::AccountData { free: ENOUGH, reserved: ENOUGH, @@ -186,7 +212,7 @@ impl traits::StoredMap> for N } fn try_mutate_exists>( - _k: &AccountId32, + _k: &AccountId, f: impl FnOnce(&mut Option>) -> Result, ) -> Result { f(&mut None) diff --git a/crates/pink/src/runtime/pallet_pink.rs b/crates/pink/src/runtime/pallet_pink.rs new file mode 100644 index 0000000000..1ec6c6b219 --- /dev/null +++ b/crates/pink/src/runtime/pallet_pink.rs @@ -0,0 +1,50 @@ +pub use pallet::*; + +#[frame_support::pallet] +pub mod pallet { + use frame_support::pallet_prelude::*; + use pallet_contracts::AddressGenerator; + use sp_core::crypto::UncheckedFrom; + use sp_runtime::traits::Hash as _; + + type CodeHash = ::Hash; + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::storage] + pub(crate) type ClusterId = StorageValue<_, Vec, ValueQuery>; + + #[pallet::pallet] + pub struct Pallet(PhantomData); + + impl AddressGenerator for Pallet + where + T::AccountId: UncheckedFrom + AsRef<[u8]>, + { + fn generate_address( + deploying_address: &T::AccountId, + code_hash: &CodeHash, + salt: &[u8], + ) -> T::AccountId { + let cluster_id = >::get(); + let buf: Vec<_> = deploying_address + .as_ref() + .iter() + .chain(code_hash.as_ref()) + .chain(&cluster_id) + .chain(salt) + .cloned() + .collect(); + UncheckedFrom::unchecked_from(::Hashing::hash( + &buf, + )) + } + } + + impl Pallet { + pub fn set_cluster_id(cluster_id: &[u8]) { + >::put(cluster_id.to_vec()); + } + } +} diff --git a/crates/pink/src/storage.rs b/crates/pink/src/storage.rs index 62cdd855a8..c1f0192d10 100644 --- a/crates/pink/src/storage.rs +++ b/crates/pink/src/storage.rs @@ -71,7 +71,8 @@ where ) }); - self.backend.full_storage_root(delta, child_delta) + self.backend + .full_storage_root(delta, child_delta, sp_core::storage::StateVersion::V0) } pub fn commit_transaction(&mut self, root: Hash, transaction: Backend::Transaction) { @@ -87,6 +88,12 @@ where self.commit_transaction(root, transaction); self.clear_changes(); } + + pub fn set_cluster_id(&mut self, cluster_id: &[u8]) { + self.execute_with(false, || { + crate::runtime::Pink::set_cluster_id(cluster_id); + }); + } } impl Serialize for Storage { diff --git a/pallets/bridge/src/mock.rs b/pallets/bridge/src/mock.rs index c66772f76a..b947294dd3 100644 --- a/pallets/bridge/src/mock.rs +++ b/pallets/bridge/src/mock.rs @@ -62,6 +62,7 @@ impl frame_system::Config for Test { type BlockLength = (); type SS58Prefix = (); type OnSetCode = (); + type MaxConsumers = ConstU32<2>; } parameter_types! { diff --git a/pallets/bridge_transfer/src/mock.rs b/pallets/bridge_transfer/src/mock.rs index 1d409fb1d6..32442a1b6a 100644 --- a/pallets/bridge_transfer/src/mock.rs +++ b/pallets/bridge_transfer/src/mock.rs @@ -1,6 +1,8 @@ #![cfg(test)] -use frame_support::{ord_parameter_types, parameter_types, weights::Weight, PalletId}; +use frame_support::{ + ord_parameter_types, pallet_prelude::ConstU32, parameter_types, weights::Weight, PalletId, +}; use frame_system::{self as system}; use hex_literal::hex; use sp_core::H256; @@ -67,6 +69,7 @@ impl frame_system::Config for Test { type BlockLength = (); type SS58Prefix = (); type OnSetCode = (); + type MaxConsumers = ConstU32<2>; } parameter_types! { diff --git a/pallets/phala/src/mock.rs b/pallets/phala/src/mock.rs index 556bf3bd63..1fff3438be 100644 --- a/pallets/phala/src/mock.rs +++ b/pallets/phala/src/mock.rs @@ -4,6 +4,7 @@ use crate::{ }; use frame_support::{ + pallet_prelude::ConstU32, parameter_types, traits::{GenesisBuild, OnFinalize, OnInitialize}, }; @@ -80,6 +81,7 @@ impl system::Config for Test { type SystemWeightInfo = (); type SS58Prefix = SS58Prefix; type OnSetCode = (); + type MaxConsumers = ConstU32<2>; } impl pallet_balances::Config for Test { diff --git a/pallets/phala/src/registry.rs b/pallets/phala/src/registry.rs index 87707c33dd..75e7328de4 100644 --- a/pallets/phala/src/registry.rs +++ b/pallets/phala/src/registry.rs @@ -103,7 +103,7 @@ pub mod pallet { /// The contract counter. #[pallet::storage] - pub type ContractGroupCounter = StorageValue<_, u64, ValueQuery>; + pub type ContractClusterCounter = StorageValue<_, u64, ValueQuery>; #[pallet::storage] pub type Contracts = @@ -405,14 +405,14 @@ pub mod pallet { let worker_info = Workers::::try_get(&deploy_worker).or(Err(Error::::WorkerNotFound))?; - let group_id = ContractGroupCounter::::mutate(|group_counter| { - *group_counter += 1; - *group_counter + let cluster_id = ContractClusterCounter::::mutate(|counter| { + *counter += 1; + *counter }); // we send hash instead of raw code here to reduce message size let contract_info = ContractInfo { deployer, - group_id, + cluster_id, salt, code_index, instantiate_data: data, @@ -635,7 +635,7 @@ pub mod pallet { match message.payload { WorkerContractReport::ContractInstantiated { id, - group_id: _, + cluster_id: _, deployer: _, pubkey, } => { @@ -766,7 +766,7 @@ pub mod pallet { type Config = T; } - #[derive(Encode, Decode, TypeInfo, Default, Debug, Clone)] + #[derive(Encode, Decode, TypeInfo, Debug, Clone)] pub struct WorkerInfo { // identity pubkey: WorkerPublicKey, diff --git a/pallets/phala/src/stakepool.rs b/pallets/phala/src/stakepool.rs index a823ff4385..65b17fe57f 100644 --- a/pallets/phala/src/stakepool.rs +++ b/pallets/phala/src/stakepool.rs @@ -1114,17 +1114,17 @@ pub mod pallet { fn pool_sub_account(pid: u64, pubkey: &WorkerPublicKey) -> T where - T: Encode + Decode + Default, + T: Encode + Decode, { let hash = crate::hashing::blake2_256(&(pid, pubkey).encode()); // stake pool miner (b"spm/", hash) .using_encoded(|b| T::decode(&mut TrailingZeroInput::new(b))) - .unwrap_or_default() + .expect("Decoding zero-padded account id should always succeed; qed") } #[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Default, RuntimeDebug)] - pub struct PoolInfo { + pub struct PoolInfo { /// Pool ID pub pid: u64, /// The owner of the pool @@ -1153,7 +1153,6 @@ pub mod pallet { impl PoolInfo where - AccountId: Default, Balance: sp_runtime::traits::AtLeast32BitUnsigned + Copy + FixedPointConvert + Display, { /// Adds some stake to a user. @@ -1398,7 +1397,7 @@ pub mod pallet { } #[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, RuntimeDebug)] - pub struct UserStakeInfo { + pub struct UserStakeInfo { /// User account pub user: AccountId, /// The actual locked stake @@ -1415,7 +1414,7 @@ pub mod pallet { } #[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, RuntimeDebug)] - pub struct WithdrawInfo { + pub struct WithdrawInfo { /// The withdrawal requester pub user: AccountId, /// The shares to withdraw. Cannot be dust. diff --git a/pallets/utility/src/lib.rs b/pallets/utility/src/lib.rs index b899a6c476..3eee164a9b 100644 --- a/pallets/utility/src/lib.rs +++ b/pallets/utility/src/lib.rs @@ -477,6 +477,6 @@ impl Pallet { /// Derive a derivative account ID from the owner account and the sub-account index. pub fn derivative_account_id(who: T::AccountId, index: u16) -> T::AccountId { let entropy = (b"modlpy/utilisuba", who, index).using_encoded(blake2_256); - T::AccountId::decode(&mut &entropy[..]).unwrap_or_default() + T::AccountId::decode(&mut &entropy[..]).expect("Should always be able to decode the derived account ID.") } } diff --git a/pallets/utility/src/tests.rs b/pallets/utility/src/tests.rs index 7a8a204a57..5df6d15aac 100644 --- a/pallets/utility/src/tests.rs +++ b/pallets/utility/src/tests.rs @@ -28,6 +28,7 @@ use frame_support::{ parameter_types, storage, traits::Contains, weights::{Pays, Weight}, + pallet_prelude::ConstU32, }; use sp_core::H256; use sp_runtime::{ @@ -127,6 +128,7 @@ impl frame_system::Config for Test { type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); + type MaxConsumers = ConstU32<2>; } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/standalone/node/src/chain_spec.rs b/standalone/node/src/chain_spec.rs index 289fc6b09b..e295c5e487 100644 --- a/standalone/node/src/chain_spec.rs +++ b/standalone/node/src/chain_spec.rs @@ -360,7 +360,7 @@ pub fn testnet_genesis( }, technical_membership: Default::default(), sudo: SudoConfig { - key: root_key, + key: Some(root_key), }, babe: BabeConfig { authorities: vec![], @@ -387,6 +387,8 @@ pub fn testnet_genesis( vesting: Default::default(), phala_registry, phala_mining: Default::default(), + scheduler: Default::default(), + transaction_payment: Default::default(), } } diff --git a/standalone/node/src/service.rs b/standalone/node/src/service.rs index ee20d7faf2..33424a3808 100644 --- a/standalone/node/src/service.rs +++ b/standalone/node/src/service.rs @@ -161,6 +161,7 @@ pub fn new_partial( config.wasm_method, config.default_heap_pages, config.max_runtime_instances, + config.runtime_cache_size, ); let (client, backend, keystore_container, task_manager) = @@ -195,7 +196,7 @@ pub fn new_partial( let justification_import = grandpa_block_import.clone(); let (block_import, babe_link) = sc_consensus_babe::block_import( - sc_consensus_babe::Config::get_or_compute(&*client)?, + sc_consensus_babe::Config::get(&*client)?, grandpa_block_import, client.clone(), )?; diff --git a/standalone/pherry/Cargo.toml b/standalone/pherry/Cargo.toml index 9bfd3bbc3f..0531ee238a 100644 --- a/standalone/pherry/Cargo.toml +++ b/standalone/pherry/Cargo.toml @@ -19,7 +19,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" rand = "0.8.4" structopt = { version = "0.3" } -jsonrpsee-types = "0.4.1" +jsonrpsee-types = "0.5.1" async-trait = "0.1.49" system = { path = "../../substrate/frame/system", package = "frame-system" } diff --git a/standalone/pruntime/app/Cargo.lock b/standalone/pruntime/app/Cargo.lock index 6888160da2..84f7d3719a 100644 --- a/standalone/pruntime/app/Cargo.lock +++ b/standalone/pruntime/app/Cargo.lock @@ -893,6 +893,7 @@ dependencies = [ "paste", "scale-info", "sp-api", + "sp-application-crypto", "sp-io", "sp-runtime", "sp-runtime-interface", @@ -1732,9 +1733,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memory-db" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de006e09d04fc301a5f7e817b75aa49801c4479a8af753764416b085337ddcc5" +checksum = "d505169b746dacf02f7d14d8c80b34edfd8212159c63d23c977739a0d960c626" dependencies = [ "hash-db", "hashbrown", @@ -2169,6 +2170,23 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-child-bounties" +version = "4.0.0-dev" +dependencies = [ + "frame-support", + "frame-system", + "log 0.4.14", + "pallet-bounties", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-collective" version = "4.0.0-dev" @@ -2370,6 +2388,21 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-preimage" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-proxy" version = "4.0.0-dev" @@ -2879,6 +2912,7 @@ dependencies = [ "pallet-bounties", "pallet-bridge", "pallet-bridge-transfer", + "pallet-child-bounties", "pallet-collective", "pallet-democracy", "pallet-election-provider-multi-phase", @@ -2892,6 +2926,7 @@ dependencies = [ "pallet-mq-runtime-api", "pallet-multisig", "pallet-offences", + "pallet-preimage", "pallet-proxy", "pallet-randomness-collective-flip", "pallet-recovery", @@ -3712,18 +3747,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.131" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ad69dfbd3e45369132cc64e6748c2d65cdfb001a2b1c232d128b4ad60561c1" +checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.131" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b710a83c4e0dff6a3d511946b95274ad9ca9e5d3ae497b63fda866ac955358d2" +checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276" dependencies = [ "proc-macro2 1.0.33", "quote 1.0.10", @@ -3873,7 +3908,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "parity-scale-codec", "scale-info", @@ -3885,7 +3920,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "integer-sqrt", "num-traits", @@ -3995,7 +4030,7 @@ dependencies = [ [[package]] name = "sp-core" -version = "4.0.0-dev" +version = "4.1.0-dev" dependencies = [ "base58", "bitflags", @@ -4042,7 +4077,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "blake2-rfc", "byteorder", @@ -4064,7 +4099,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "proc-macro2 1.0.33", "quote 1.0.10", @@ -4073,7 +4108,7 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "environmental", "parity-scale-codec", @@ -4113,7 +4148,7 @@ dependencies = [ [[package]] name = "sp-io" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "futures", "hash-db", @@ -4146,7 +4181,7 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "async-trait", "derive_more", @@ -4194,7 +4229,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "backtrace", "lazy_static", @@ -4203,7 +4238,7 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "either", "hash256-std-hasher", @@ -4224,7 +4259,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "4.0.0-dev" +version = "4.1.0-dev" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -4240,7 +4275,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "Inflector", "proc-macro-crate", @@ -4274,7 +4309,7 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "hash-db", "log 0.4.14", @@ -4296,11 +4331,11 @@ dependencies = [ [[package]] name = "sp-std" -version = "4.0.0-dev" +version = "4.0.0" [[package]] name = "sp-storage" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "impl-serde", "parity-scale-codec", @@ -4327,7 +4362,7 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "parity-scale-codec", "sp-std", @@ -4346,7 +4381,7 @@ dependencies = [ [[package]] name = "sp-trie" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "hash-db", "memory-db", @@ -4367,6 +4402,7 @@ dependencies = [ "parity-wasm", "scale-info", "serde", + "sp-core-hashing-proc-macro", "sp-runtime", "sp-std", "sp-version-proc-macro", @@ -4385,9 +4421,10 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "4.0.0-dev" +version = "4.1.0-dev" dependencies = [ "impl-trait-for-tuples", + "log 0.4.14", "parity-scale-codec", "sp-std", "wasmi", @@ -4407,9 +4444,9 @@ checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" [[package]] name = "ss58-registry" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827441708a5dd8ca54e6b79690dc06d1bede78e61961e667f683c23c16ef964c" +checksum = "c83f0afe7e571565ef9aae7b0e4fb30fcaec4ebb9aea2f00489b772782aa03a4" dependencies = [ "Inflector", "proc-macro2 1.0.33", @@ -4801,9 +4838,9 @@ checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" [[package]] name = "trie-db" -version = "0.22.6" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eac131e334e81b6b3be07399482042838adcd7957aa0010231d0813e39e02fa" +checksum = "e3ddae50680c12ef75bfbf58416ca6622fa43d879553f6cb2ed1a817346e1ffe" dependencies = [ "hash-db", "hashbrown", @@ -4814,9 +4851,9 @@ dependencies = [ [[package]] name = "trie-root" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "652931506d2c1244d7217a70b99f56718a7b4161b37f04e7cd868072a99f68cd" +checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" dependencies = [ "hash-db", ] diff --git a/standalone/pruntime/enclave/Cargo.lock b/standalone/pruntime/enclave/Cargo.lock index 94f08d0acf..c33ca52630 100644 --- a/standalone/pruntime/enclave/Cargo.lock +++ b/standalone/pruntime/enclave/Cargo.lock @@ -1333,6 +1333,7 @@ dependencies = [ "paste", "scale-info", "sp-api", + "sp-application-crypto", "sp-io", "sp-runtime", "sp-runtime-interface", @@ -2401,9 +2402,9 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de006e09d04fc301a5f7e817b75aa49801c4479a8af753764416b085337ddcc5" +checksum = "d505169b746dacf02f7d14d8c80b34edfd8212159c63d23c977739a0d960c626" dependencies = [ "hash-db", "hashbrown", @@ -2782,6 +2783,23 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-child-bounties" +version = "4.0.0-dev" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-bounties", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-collective" version = "4.0.0-dev" @@ -2833,6 +2851,7 @@ dependencies = [ "scale-info", "serde", "sp-core", + "sp-rpc", "sp-runtime", "sp-std", ] @@ -3031,6 +3050,21 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-preimage" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-proxy" version = "4.0.0-dev" @@ -3623,6 +3657,7 @@ dependencies = [ "pallet-bounties", "pallet-bridge", "pallet-bridge-transfer", + "pallet-child-bounties", "pallet-collective", "pallet-democracy", "pallet-election-provider-multi-phase", @@ -3636,6 +3671,7 @@ dependencies = [ "pallet-mq-runtime-api", "pallet-multisig", "pallet-offences", + "pallet-preimage", "pallet-proxy", "pallet-randomness-collective-flip", "pallet-recovery", @@ -4743,7 +4779,7 @@ dependencies = [ [[package]] name = "sgx_libc" version = "1.1.4" -source = "git+https://github.com/Phala-Network/incubator-teaclave-sgx-sdk.git?branch=phala#9ff43370d2c8f8c9cace6b3c2638855ea57032d3" +source = "git+https://github.com/Phala-Network/incubator-teaclave-sgx-sdk.git?branch=phala#c6fce0c60547fd1b31e84a2b8963f948c82867d6" dependencies = [ "sgx_types 1.1.4 (git+https://github.com/Phala-Network/incubator-teaclave-sgx-sdk.git?branch=phala)", ] @@ -4774,7 +4810,7 @@ dependencies = [ [[package]] name = "sgx_trts" version = "1.1.4" -source = "git+https://github.com/Phala-Network/incubator-teaclave-sgx-sdk.git?branch=phala#9ff43370d2c8f8c9cace6b3c2638855ea57032d3" +source = "git+https://github.com/Phala-Network/incubator-teaclave-sgx-sdk.git?branch=phala#c6fce0c60547fd1b31e84a2b8963f948c82867d6" dependencies = [ "sgx_libc 1.1.4 (git+https://github.com/Phala-Network/incubator-teaclave-sgx-sdk.git?branch=phala)", "sgx_types 1.1.4 (git+https://github.com/Phala-Network/incubator-teaclave-sgx-sdk.git?branch=phala)", @@ -4819,7 +4855,7 @@ version = "1.1.4" [[package]] name = "sgx_types" version = "1.1.4" -source = "git+https://github.com/Phala-Network/incubator-teaclave-sgx-sdk.git?branch=phala#9ff43370d2c8f8c9cace6b3c2638855ea57032d3" +source = "git+https://github.com/Phala-Network/incubator-teaclave-sgx-sdk.git?branch=phala#c6fce0c60547fd1b31e84a2b8963f948c82867d6" [[package]] name = "sgx_unwind" @@ -4985,7 +5021,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "parity-scale-codec", "scale-info", @@ -4997,7 +5033,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "integer-sqrt", "num-traits", @@ -5107,7 +5143,7 @@ dependencies = [ [[package]] name = "sp-core" -version = "4.0.0-dev" +version = "4.1.0-dev" dependencies = [ "base58", "bitflags", @@ -5154,7 +5190,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "blake2-rfc", "byteorder", @@ -5176,7 +5212,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "proc-macro2 1.0.34", "quote 1.0.10", @@ -5185,7 +5221,7 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "environmental", "parity-scale-codec", @@ -5225,7 +5261,7 @@ dependencies = [ [[package]] name = "sp-io" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "futures", "hash-db", @@ -5258,7 +5294,7 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "async-trait", "derive_more", @@ -5313,7 +5349,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "backtrace", "lazy_static", @@ -5321,8 +5357,17 @@ dependencies = [ ] [[package]] -name = "sp-runtime" +name = "sp-rpc" version = "4.0.0-dev" +dependencies = [ + "rustc-hash", + "serde", + "sp-core", +] + +[[package]] +name = "sp-runtime" +version = "4.0.0" dependencies = [ "either", "hash256-std-hasher", @@ -5343,7 +5388,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "4.0.0-dev" +version = "4.1.0-dev" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5359,7 +5404,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "Inflector", "proc-macro-crate", @@ -5406,7 +5451,7 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "hash-db", "log", @@ -5428,11 +5473,11 @@ dependencies = [ [[package]] name = "sp-std" -version = "4.0.0-dev" +version = "4.0.0" [[package]] name = "sp-storage" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "impl-serde", "parity-scale-codec", @@ -5459,7 +5504,7 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "parity-scale-codec", "sp-std", @@ -5478,7 +5523,7 @@ dependencies = [ [[package]] name = "sp-trie" -version = "4.0.0-dev" +version = "4.0.0" dependencies = [ "hash-db", "memory-db", @@ -5499,6 +5544,7 @@ dependencies = [ "parity-wasm 0.42.2", "scale-info", "serde", + "sp-core-hashing-proc-macro", "sp-runtime", "sp-std", "sp-version-proc-macro", @@ -5517,9 +5563,10 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "4.0.0-dev" +version = "4.1.0-dev" dependencies = [ "impl-trait-for-tuples", + "log", "parity-scale-codec", "sp-std", "wasmi", @@ -6034,9 +6081,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.22.6" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eac131e334e81b6b3be07399482042838adcd7957aa0010231d0813e39e02fa" +checksum = "e3ddae50680c12ef75bfbf58416ca6622fa43d879553f6cb2ed1a817346e1ffe" dependencies = [ "hash-db", "hashbrown", @@ -6047,9 +6094,9 @@ dependencies = [ [[package]] name = "trie-root" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "652931506d2c1244d7217a70b99f56718a7b4161b37f04e7cd868072a99f68cd" +checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" dependencies = [ "hash-db", ] diff --git a/standalone/runtime/Cargo.toml b/standalone/runtime/Cargo.toml index baebb8366d..20fca0b00c 100644 --- a/standalone/runtime/Cargo.toml +++ b/standalone/runtime/Cargo.toml @@ -86,6 +86,8 @@ pallet-utility = { default-features = false, path = "../../pallets/utility" } pallet-transaction-payment = { default-features = false, path = "../../substrate/frame/transaction-payment" } pallet-transaction-payment-rpc-runtime-api = { default-features = false, path = "../../substrate/frame/transaction-payment/rpc/runtime-api/" } pallet-vesting = { default-features = false, path = "../../substrate/frame/vesting" } +pallet-preimage = { version = "4.0.0-dev", default-features = false, path = "../../substrate/frame/preimage" } +pallet-child-bounties = { version = "4.0.0-dev", default-features = false, path = "../../substrate/frame/child-bounties" } phala-pallets = { default-features = false, path = "../../pallets/phala", package = "phala-pallets" } pallet-bridge = { default-features = false, path = "../../pallets/bridge", package = "pallet-bridge" } @@ -157,6 +159,8 @@ std = [ "pallet-society/std", "pallet-recovery/std", "pallet-vesting/std", + "pallet-preimage/std", + "pallet-child-bounties/std", "log/std", "frame-try-runtime/std", "sp-npos-elections/std", @@ -195,6 +199,8 @@ runtime-benchmarks = [ "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-child-bounties/runtime-benchmarks", "pallet-offences-benchmarking", "pallet-session-benchmarking", "frame-system-benchmarking", @@ -235,6 +241,8 @@ try-runtime = [ "pallet-society/try-runtime", "pallet-recovery/try-runtime", "pallet-vesting/try-runtime", + "pallet-preimage/try-runtime", + "pallet-child-bounties/try-runtime", "phala-pallets/try-runtime", ] diff --git a/standalone/runtime/src/impls.rs b/standalone/runtime/src/impls.rs index e315a45e69..907c6332ef 100644 --- a/standalone/runtime/src/impls.rs +++ b/standalone/runtime/src/impls.rs @@ -23,7 +23,9 @@ use frame_support::traits::{Currency, OnUnbalanced}; pub struct Author; impl OnUnbalanced for Author { fn on_nonzero_unbalanced(amount: NegativeImbalance) { - Balances::resolve_creating(&Authorship::author(), amount); + if let Some(author) = Authorship::author() { + Balances::resolve_creating(&author, amount); + } } } diff --git a/standalone/runtime/src/lib.rs b/standalone/runtime/src/lib.rs index e6465c04d7..9981097890 100644 --- a/standalone/runtime/src/lib.rs +++ b/standalone/runtime/src/lib.rs @@ -31,7 +31,7 @@ use frame_support::{ construct_runtime, parameter_types, traits::{ Currency, EqualPrivilegeOnly, Everything, Imbalance, InstanceFilter, KeyOwnerProofSystem, - LockIdentifier, OnUnbalanced, U128CurrencyToVote, + LockIdentifier, OnUnbalanced, U128CurrencyToVote, EnsureOneOf, ConstU32 }, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, @@ -41,7 +41,7 @@ use frame_support::{ }; use frame_system::{ limits::{BlockLength, BlockWeights}, - EnsureOneOf, EnsureRoot, + EnsureRoot, }; pub use node_primitives::{AccountId, Signature, AccountIndex, Balance, BlockNumber, Hash, Index, Moment}; use pallet_grandpa::{ @@ -141,6 +141,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, + state_version: 0, }; /// The BABE epoch configuration at genesis. @@ -235,6 +236,7 @@ impl frame_system::Config for Runtime { type SystemWeightInfo = frame_system::weights::SubstrateWeight; type SS58Prefix = SS58Prefix; type OnSetCode = (); + type MaxConsumers = ConstU32<16>; } impl pallet_randomness_collective_flip::Config for Runtime {} @@ -350,6 +352,8 @@ parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * RuntimeBlockWeights::get().max_block; pub const MaxScheduledPerBlock: u32 = 50; + // Retry a scheduled item every 10 blocks (1 minute) until the preimage exists. + pub const NoPreimagePostponement: Option = Some(10); } impl pallet_scheduler::Config for Runtime { @@ -362,6 +366,25 @@ impl pallet_scheduler::Config for Runtime { type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = pallet_scheduler::weights::SubstrateWeight; type OriginPrivilegeCmp = EqualPrivilegeOnly; + type PreimageProvider = Preimage; + type NoPreimagePostponement = NoPreimagePostponement; +} + +parameter_types! { + pub const PreimageMaxSize: u32 = 4096 * 1024; + pub const PreimageBaseDeposit: Balance = 1 * DOLLARS; + // One cent: $10,000 / MB + pub const PreimageByteDeposit: Balance = 1 * CENTS; +} + +impl pallet_preimage::Config for Runtime { + type WeightInfo = pallet_preimage::weights::SubstrateWeight; + type Event = Event; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type MaxSize = PreimageMaxSize; + type BaseDeposit = PreimageBaseDeposit; + type ByteDeposit = PreimageByteDeposit; } parameter_types! { @@ -522,6 +545,12 @@ impl onchain::Config for Runtime { type DataProvider = Staking; } +pub struct StakingBenchmarkingConfig; +impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig { + type MaxNominators = ConstU32<1000>; + type MaxValidators = ConstU32<1000>; +} + impl pallet_staking::Config for Runtime { const MAX_NOMINATIONS: u32 = MAX_NOMINATIONS; type Currency = Balances; @@ -536,7 +565,6 @@ impl pallet_staking::Config for Runtime { type SlashDeferDuration = SlashDeferDuration; /// A super-majority of the council can cancel the slash. type SlashCancelOrigin = EnsureOneOf< - AccountId, EnsureRoot, pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>, >; @@ -551,6 +579,7 @@ impl pallet_staking::Config for Runtime { // Note that the aforementioned does not scale to a very large number of nominators. type SortedListProvider = BagsList; type WeightInfo = pallet_staking::weights::SubstrateWeight; + type BenchmarkingConfig = StakingBenchmarkingConfig; } parameter_types! { @@ -598,8 +627,8 @@ pub const MAX_NOMINATIONS: u32 = ; type WeightInfo = pallet_election_provider_multi_phase::weights::SubstrateWeight; type ForceOrigin = EnsureRootOrHalfCouncil; - type BenchmarkingConfig = BenchmarkConfig; + type BenchmarkingConfig = ElectionProviderBenchmarkConfig; type VoterSnapshotPerBlock = VoterSnapshotPerBlock; } @@ -687,8 +716,6 @@ parameter_types! { pub const MinimumDeposit: Balance = 100 * DOLLARS; pub EnactmentPeriod: BlockNumber = 30 * 24 * 60 * Minutes::get(); pub CooloffPeriod: BlockNumber = 28 * 24 * 60 * Minutes::get(); - // One cent: $10,000 / MB - pub const PreimageByteDeposit: Balance = 1 * CENTS; pub const MaxVotes: u32 = 100; pub const MaxProposals: u32 = 100; } @@ -726,7 +753,6 @@ impl pallet_democracy::Config for Runtime { // To cancel a proposal before it has been passed, the technical committee must be unanimous or // Root must agree. type CancelProposalOrigin = EnsureOneOf< - AccountId, EnsureRoot, pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, TechnicalCollective>, >; @@ -817,7 +843,6 @@ impl pallet_collective::Config for Runtime { } type EnsureRootOrHalfCouncil = EnsureOneOf< - AccountId, EnsureRoot, pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>, >; @@ -851,18 +876,19 @@ parameter_types! { pub const BountyCuratorDeposit: Permill = Permill::from_percent(50); pub const BountyValueMinimum: Balance = 5 * DOLLARS; pub const MaxApprovals: u32 = 100; + pub const MaxActiveChildBountyCount: u32 = 5; + pub const ChildBountyValueMinimum: Balance = 1 * DOLLARS; + pub const ChildBountyCuratorDepositBase: Permill = Permill::from_percent(10); } impl pallet_treasury::Config for Runtime { type PalletId = TreasuryPalletId; type Currency = Balances; type ApproveOrigin = EnsureOneOf< - AccountId, EnsureRoot, pallet_collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective>, >; type RejectOrigin = EnsureOneOf< - AccountId, EnsureRoot, pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>, >; @@ -888,6 +914,15 @@ impl pallet_bounties::Config for Runtime { type DataDepositPerByte = DataDepositPerByte; type MaximumReasonLength = MaximumReasonLength; type WeightInfo = pallet_bounties::weights::SubstrateWeight; + type ChildBountyManager = ChildBounties; +} + +impl pallet_child_bounties::Config for Runtime { + type Event = Event; + type MaxActiveChildBountyCount = MaxActiveChildBountyCount; + type ChildBountyValueMinimum = ChildBountyValueMinimum; + type ChildBountyCuratorDepositBase = ChildBountyCuratorDepositBase; + type WeightInfo = pallet_child_bounties::weights::SubstrateWeight; } impl pallet_tips::Config for Runtime { @@ -1205,49 +1240,51 @@ construct_runtime!( NodeBlock = node_primitives::Block, UncheckedExtrinsic = UncheckedExtrinsic { - System: frame_system::{Pallet, Call, Config, Storage, Event}, - Utility: pallet_utility::{Pallet, Call, Event}, - Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, - Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent}, - Indices: pallet_indices::{Pallet, Call, Storage, Config, Event}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, - ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event, ValidateUnsigned}, - Staking: pallet_staking::{Pallet, Call, Config, Storage, Event}, - Session: pallet_session::{Pallet, Call, Storage, Event, Config}, - Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event}, - Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config}, - TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config}, - Elections: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config}, - TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config}, - Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned}, - Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event}, - Sudo: pallet_sudo::{Pallet, Call, Config, Storage, Event}, - ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config}, - AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config}, - Offences: pallet_offences::{Pallet, Storage, Event}, + System: frame_system, + Utility: pallet_utility, + Babe: pallet_babe, + Timestamp: pallet_timestamp, + Authorship: pallet_authorship, + Indices: pallet_indices, + Balances: pallet_balances, + TransactionPayment: pallet_transaction_payment, + ElectionProviderMultiPhase: pallet_election_provider_multi_phase, + Staking: pallet_staking, + Session: pallet_session, + Democracy: pallet_democracy, + Council: pallet_collective::, + TechnicalCommittee: pallet_collective::, + Elections: pallet_elections_phragmen, + TechnicalMembership: pallet_membership::, + Grandpa: pallet_grandpa, + Treasury: pallet_treasury, + Sudo: pallet_sudo, + ImOnline: pallet_im_online, + AuthorityDiscovery: pallet_authority_discovery, + Offences: pallet_offences, Historical: pallet_session_historical::{Pallet}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, - Identity: pallet_identity::{Pallet, Call, Storage, Event}, - Society: pallet_society::{Pallet, Call, Storage, Event, Config}, - Recovery: pallet_recovery::{Pallet, Call, Storage, Event}, - Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config}, - Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event}, - Proxy: pallet_proxy::{Pallet, Call, Storage, Event}, - Multisig: pallet_multisig::{Pallet, Call, Storage, Event}, - Bounties: pallet_bounties::{Pallet, Call, Storage, Event}, - Tips: pallet_tips::{Pallet, Call, Storage, Event}, - Lottery: pallet_lottery::{Pallet, Call, Storage, Event}, - BagsList: pallet_bags_list::{Pallet, Call, Storage, Event}, + RandomnessCollectiveFlip: pallet_randomness_collective_flip, + Identity: pallet_identity, + Society: pallet_society, + Recovery: pallet_recovery, + Vesting: pallet_vesting, + Scheduler: pallet_scheduler, + Preimage: pallet_preimage, + Proxy: pallet_proxy, + Multisig: pallet_multisig, + Bounties: pallet_bounties, + Tips: pallet_tips, + Lottery: pallet_lottery, + BagsList: pallet_bags_list, + ChildBounties: pallet_child_bounties, // ChainBridge - ChainBridge: pallet_bridge::{Pallet, Call, Storage, Event}, - BridgeTransfer: pallet_bridge_transfer::{Pallet, Call, Event, Storage}, + ChainBridge: pallet_bridge, + BridgeTransfer: pallet_bridge_transfer, // Phala - PhalaMq: pallet_mq::{Pallet, Call, Storage}, - PhalaRegistry: pallet_registry::{Pallet, Call, Event, Storage, Config}, - PhalaMining: pallet_mining::{Pallet, Call, Event, Storage, Config}, - PhalaStakePool: pallet_stakepool::{Pallet, Call, Event, Storage}, + PhalaMq: pallet_mq, + PhalaRegistry: pallet_registry, + PhalaMining: pallet_mining, + PhalaStakePool: pallet_stakepool, } ); @@ -1288,7 +1325,7 @@ pub type Executive = frame_executive::Executive< Block, frame_system::ChainContext, Runtime, - AllPallets, + AllPalletsWithSystem, (), >; @@ -1527,6 +1564,7 @@ impl_runtime_apis! { list_benchmark!(list, extra, pallet_bags_list, BagsList); list_benchmark!(list, extra, pallet_balances, Balances); list_benchmark!(list, extra, pallet_bounties, Bounties); + list_benchmark!(list, extra, pallet_child_bounties, ChildBounties); list_benchmark!(list, extra, pallet_collective, Council); list_benchmark!(list, extra, pallet_democracy, Democracy); list_benchmark!(list, extra, pallet_election_provider_multi_phase, ElectionProviderMultiPhase); @@ -1539,6 +1577,7 @@ impl_runtime_apis! { list_benchmark!(list, extra, pallet_membership, TechnicalMembership); list_benchmark!(list, extra, pallet_multisig, Multisig); list_benchmark!(list, extra, pallet_offences, OffencesBench::); + list_benchmark!(list, extra, pallet_preimage, Preimage); list_benchmark!(list, extra, pallet_proxy, Proxy); list_benchmark!(list, extra, pallet_scheduler, Scheduler); list_benchmark!(list, extra, pallet_session, SessionBench::); @@ -1598,6 +1637,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_balances, Balances); add_benchmark!(params, batches, pallet_bags_list, BagsList); add_benchmark!(params, batches, pallet_bounties, Bounties); + add_benchmark!(params, batches, pallet_child_bounties, ChildBounties); add_benchmark!(params, batches, pallet_collective, Council); add_benchmark!(params, batches, pallet_democracy, Democracy); add_benchmark!(params, batches, pallet_election_provider_multi_phase, ElectionProviderMultiPhase); @@ -1610,6 +1650,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_membership, TechnicalMembership); add_benchmark!(params, batches, pallet_multisig, Multisig); add_benchmark!(params, batches, pallet_offences, OffencesBench::); + add_benchmark!(params, batches, pallet_preimage, Preimage); add_benchmark!(params, batches, pallet_proxy, Proxy); add_benchmark!(params, batches, pallet_scheduler, Scheduler); add_benchmark!(params, batches, pallet_session, SessionBench::); diff --git a/substrate b/substrate index fcc54a7297..f57c6447af 160000 --- a/substrate +++ b/substrate @@ -1 +1 @@ -Subproject commit fcc54a72973d03afe7bf9e3ef2736050b3f33465 +Subproject commit f57c6447af83a1706041d462ca290b4f2a1bac4f diff --git a/subxt b/subxt index ea9f6e34e4..131a2cc286 160000 --- a/subxt +++ b/subxt @@ -1 +1 @@ -Subproject commit ea9f6e34e45766d07a30535546451955e5f0a6e4 +Subproject commit 131a2cc286fc8d258571474de5795bf90c8fbe4b