From c0790d47c51a0d88db9f732bf8207a5753a996ab Mon Sep 17 00:00:00 2001 From: Chua Zheng Leong Date: Sat, 22 Aug 2020 11:27:13 +0800 Subject: [PATCH] Feature payment (#8) * Update client package dependencies * Update enclave package dependencies * Update substrate-api dependencies * Add complete task api * Add get_balance api support * Modify advanca-sgx-helper to latest ver * Add support for balance printing * Update Cargo.toml and lock files * Cargo fmt * refactor client to use subxt * format code * substrate-api v0.3.0: use subxt internally * Update to use advanca-node-primitives * address multiple issues in substrate-api - fix `TypeSizeUnavailable` issue on `TaskId` when `transfer_balance` -fix `TypeSizeUnavailable` issue on `Status` when `complete_task` - fix function `wait_all_task_aborted` * update Cargo.lock and format code * format code * cleanup * Swap to serde_json from serde_cbor * Add sr25519 key support + refactor worker->enclave * Update sr25519 support for enclave * Add TaskCompletedEvent listening api * Add sr25519 support, add TaskCompleted event check * Update sr25519 support * Cargo fmt * Update Cargo.toml and Cargo.lock * Update sgx-helper, substrate-subxt, node => tag * Update Cargo.lock Co-authored-by: Gong Deli --- Cargo.lock | 2692 ++++++++++++++++-------------- Cargo.toml | 4 +- app/Cargo.toml | 30 +- app/src/enclave/mod.rs | 14 +- app/src/main.rs | 110 +- app/src/watchdog.rs | 32 +- app/src/worker_teaclave_ecall.rs | 18 +- client/Cargo.toml | 39 +- client/src/grpc.rs | 4 +- client/src/main.rs | 270 ++- enclave/Cargo.lock | 450 +++-- enclave/Cargo.toml | 18 +- enclave/Enclave.edl | 16 +- enclave/src/lib.rs | 180 +- substrate-api/Cargo.toml | 20 +- substrate-api/src/events.rs | 99 -- substrate-api/src/lib.rs | 456 +++-- 17 files changed, 2396 insertions(+), 2056 deletions(-) delete mode 100644 substrate-api/src/events.rs diff --git a/Cargo.lock b/Cargo.lock index 137b360..19e3e20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,7 +13,7 @@ dependencies = [ [[package]] name = "aas-protos-std" version = "0.2.0" -source = "git+https://github.com/advanca/advanca-attestation-service?tag=v0.2.0#015e301e04c0ce66af0e450abe6caade799d3357" +source = "git+https://github.com/advanca/advanca-attestation-service?tag=v0.3.0#c92f23d2eba2d3074e03533bc32056b6a1d23af6" dependencies = [ "clang-sys", "futures 0.3.5", @@ -42,10 +42,10 @@ checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" name = "advanca-client" version = "0.4.0" dependencies = [ - "advanca-core", "advanca-crypto", "advanca-crypto-types", - "advanca-runtime", + "advanca-node-primitives", + "async-std", "clang-sys", "env_logger", "error-chain", @@ -54,14 +54,13 @@ dependencies = [ "hex", "hyper 0.12.35", "jsonrpc-core-client", - "log 0.4.8", + "log 0.4.11", "node-primitives", "node-runtime", "parity-scale-codec", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "sc-rpc", "serde", - "serde_cbor", "serde_json", "sgx_crypto_helper", "sgx_types", @@ -70,96 +69,61 @@ dependencies = [ "sp-keyring", "sp-runtime", "structopt", - "substrate-api", - "substrate-api-client", + "substrate-subxt", "worker-protos-std", ] -[[package]] -name = "advanca-core" -version = "0.2.0" -source = "git+https://github.com/advanca/advanca-node/?tag=v0.2.0#c674ee015ee6e917456fd23b446353130ec05c50" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "safe-mix", - "smart-default", - "sp-api", - "sp-runtime", - "sp-std", -] - [[package]] name = "advanca-crypto" -version = "0.3.0" -source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.3.0#54b3227e8ad0f83699c8c843bf525ea9b7d23d64" +version = "0.4.0" +source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.4.0#cfdbd0601cdeb4bfac7524eab575ec600acdf8fa" dependencies = [ "advanca-crypto-types", "advanca-macros", "aes", "cmac", + "curve25519-dalek 2.1.0", "rand 0.7.3", "ring", + "schnorrkel", "sgx_types", "sgx_ucrypto", ] [[package]] name = "advanca-crypto-types" -version = "0.3.0" -source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.3.0#54b3227e8ad0f83699c8c843bf525ea9b7d23d64" +version = "0.4.0" +source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.4.0#cfdbd0601cdeb4bfac7524eab575ec600acdf8fa" dependencies = [ "aes", "cmac", + "curve25519-dalek 2.1.0", "openssl", + "schnorrkel", "serde", "serde-big-array 0.3.0", - "serde_json", "sgx_types", ] [[package]] name = "advanca-macros" -version = "0.3.0" -source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.3.0#54b3227e8ad0f83699c8c843bf525ea9b7d23d64" +version = "0.4.0" +source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.4.0#cfdbd0601cdeb4bfac7524eab575ec600acdf8fa" dependencies = [ "advanca-crypto-types", "sgx_types", ] [[package]] -name = "advanca-runtime" -version = "0.2.0" -source = "git+https://github.com/advanca/advanca-node/?tag=v0.2.0#c674ee015ee6e917456fd23b446353130ec05c50" +name = "advanca-node-primitives" +version = "0.4.0" +source = "git+https://github.com/advanca/advanca-node/?tag=v0.4.0#1f6c8e981a5a53b8d74d656956702fea9fade95e" dependencies = [ - "advanca-core", - "frame-executive", - "frame-support", - "frame-system", - "pallet-aura", - "pallet-balances", - "pallet-grandpa", - "pallet-indices", - "pallet-randomness-collective-flip", - "pallet-sudo", - "pallet-timestamp", - "pallet-transaction-payment", "parity-scale-codec", - "serde", - "sp-api", - "sp-block-builder", - "sp-consensus-aura", - "sp-core", - "sp-inherents", - "sp-io", - "sp-offchain", + "primitive-types", + "smart-default", "sp-runtime", - "sp-session", "sp-std", - "sp-transaction-pool", - "sp-version", - "substrate-wasm-builder-runner", ] [[package]] @@ -167,11 +131,10 @@ name = "advanca-worker" version = "0.4.0" dependencies = [ "aas-protos-std", - "advanca-core", "advanca-crypto", "advanca-crypto-types", "advanca-macros", - "advanca-runtime", + "advanca-node-primitives", "async-std", "clang-sys", "env_logger", @@ -179,11 +142,10 @@ dependencies = [ "grpcio", "hex", "jsonrpsee", - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", "primitive-types", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_cbor", "serde_json", "sgx-ra", "sgx_crypto_helper", @@ -209,18 +171,6 @@ dependencies = [ "block-cipher-trait", ] -[[package]] -name = "aes-ctr" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" -dependencies = [ - "aes-soft", - "aesni", - "ctr", - "stream-cipher", -] - [[package]] name = "aes-soft" version = "0.3.3" @@ -228,8 +178,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" dependencies = [ "block-cipher-trait", - "byteorder 1.3.4", - "opaque-debug", + "byteorder", + "opaque-debug 0.2.3", ] [[package]] @@ -239,8 +189,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" dependencies = [ "block-cipher-trait", - "opaque-debug", - "stream-cipher", + "opaque-debug 0.2.3", ] [[package]] @@ -267,6 +216,17 @@ dependencies = [ "memchr", ] +[[package]] +name = "alga" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f823d037a7ec6ea2197046bafd4ae150e6bc36f9ca347404f46a46823fa84f2" +dependencies = [ + "approx", + "num-complex", + "num-traits", +] + [[package]] name = "ansi_term" version = "0.11.0" @@ -278,9 +238,18 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.31" +version = "1.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" + +[[package]] +name = "approx" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f" +checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" +dependencies = [ + "num-traits", +] [[package]] name = "arc-swap" @@ -328,26 +297,95 @@ dependencies = [ "syn", ] +[[package]] +name = "async-attributes" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd3d156917d94862e779f356c5acae312b08fd3121e792c857d7928c8088423" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "async-channel" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43de69555a39d52918e2bc33a408d3c0a86c829b212d898f4ca25d21a6387478" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f47c78ea98277cb1f5e6f60ba4fc762f5eafe9f6511bc2f7dfd8b75c225650" +dependencies = [ + "async-io", + "futures-lite", + "multitask", + "parking 1.0.6", + "scoped-tls", + "waker-fn", +] + +[[package]] +name = "async-io" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae22a338d28c75b53702b66f77979062cb29675db376d99e451af4fa79dedb3" +dependencies = [ + "cfg-if", + "concurrent-queue", + "futures-lite", + "libc", + "once_cell", + "parking 2.0.0", + "polling", + "socket2", + "vec-arena", + "wepoll-sys-stjepang", + "winapi 0.3.9", +] + +[[package]] +name = "async-mutex" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e85981fc34e84cdff3fc2c9219189752633fdc538a06df8b5ac45b68a4f3a9" +dependencies = [ + "event-listener", +] + [[package]] name = "async-std" -version = "1.6.2" +version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d68a33ebc8b57800847d00787307f84a562224a14db069b0acefe4c2abbf5d" +checksum = "46c8da367da62b8ff2313c406c9ac091c1b31d67a165becdd2de380d846260f7" dependencies = [ + "async-attributes", + "async-executor", + "async-io", + "async-mutex", "async-task", + "blocking", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", + "futures-lite", + "futures-timer 3.0.2", "kv-log-macro", - "log 0.4.8", + "log 0.4.11", "memchr", "num_cpus", - "once_cell 1.4.0", + "once_cell", "pin-project-lite", "pin-utils", "slab", - "smol", "wasm-bindgen-futures", ] @@ -364,11 +402,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce6977f57fa68da77ffe5542950d47e9c23d65f5bc7cb0a9f8700996913eec7" dependencies = [ "futures 0.3.5", - "rustls", + "rustls 0.16.0", "webpki", "webpki-roots 0.17.0", ] +[[package]] +name = "async-tls" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df097e3f506bec0e1a24f06bb3c962c228f36671de841ff579cb99f371772634" +dependencies = [ + "futures 0.3.5", + "rustls 0.18.1", + "webpki", + "webpki-roots 0.19.0", +] + +[[package]] +name = "atomic-waker" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + [[package]] name = "atty" version = "0.2.14" @@ -388,9 +444,9 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" @@ -424,7 +480,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" dependencies = [ - "byteorder 1.3.4", + "byteorder", "safemem", ] @@ -434,7 +490,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" dependencies = [ - "byteorder 1.3.4", + "byteorder", ] [[package]] @@ -491,25 +547,50 @@ dependencies = [ ] [[package]] -name = "blake2" -version = "0.8.1" +name = "blake2-rfc" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "byte-tools", - "crypto-mac", - "digest", - "opaque-debug", + "arrayvec 0.4.12", + "constant_time_eq", ] [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2b_simd" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" dependencies = [ - "arrayvec 0.4.12", + "arrayref", + "arrayvec 0.5.1", + "constant_time_eq", +] + +[[package]] +name = "blake2s_simd" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab9e07352b829279624ceb7c64adb4f585dacdb81d35cafae81139ccd617cf44" +dependencies = [ + "arrayref", + "arrayvec 0.5.1", + "constant_time_eq", +] + +[[package]] +name = "blake3" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce4f9586c9a3151c4b49b19e82ba163dd073614dd057e53c969e1a4db5b52720" +dependencies = [ + "arrayref", + "arrayvec 0.5.1", + "cc", + "cfg-if", "constant_time_eq", + "crypto-mac 0.8.0", + "digest 0.9.0", ] [[package]] @@ -518,10 +599,20 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding", + "block-padding 0.1.5", "byte-tools", - "byteorder 1.3.4", - "generic-array", + "byteorder", + "generic-array 0.12.3", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding 0.2.1", + "generic-array 0.14.4", ] [[package]] @@ -530,7 +621,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" dependencies = [ - "generic-array", + "generic-array 0.12.3", ] [[package]] @@ -542,16 +633,22 @@ dependencies = [ "byte-tools", ] +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + [[package]] name = "blocking" -version = "0.4.6" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d17efb70ce4421e351d61aafd90c16a20fb5bfe339fcdc32a86816280e62ce0" +checksum = "ea5800d29218fea137b0880387e5948694a23c93fcdde157006966693a865c7c" dependencies = [ - "futures-channel", - "futures-util", - "once_cell 1.4.0", - "parking", + "async-channel", + "atomic-waker", + "futures-lite", + "once_cell", "waker-fn", ] @@ -588,12 +685,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" -[[package]] -name = "byteorder" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" - [[package]] name = "byteorder" version = "1.3.4" @@ -606,7 +697,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" dependencies = [ - "byteorder 1.3.4", + "byteorder", "either", "iovec", ] @@ -631,9 +722,9 @@ checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" [[package]] name = "cc" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" +checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381" [[package]] name = "cexpr" @@ -652,9 +743,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chrono" -version = "0.4.13" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" +checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b" dependencies = [ "num-integer", "num-traits", @@ -674,9 +765,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.1" +version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ "ansi_term", "atty", @@ -688,19 +779,19 @@ dependencies = [ ] [[package]] -name = "clear_on_drop" -version = "0.2.4" +name = "cloudabi" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9cc5db465b294c3fa986d5bbb0f3017cd850bff6dd6c52f9ccff8b4d21b7b08" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "cc", + "bitflags", ] [[package]] name = "cloudabi" -version = "0.0.3" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" dependencies = [ "bitflags", ] @@ -712,7 +803,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f4a435124bcc292eba031f1f725d7abacdaf13cbf9f935450e8c45aa9e96cad" dependencies = [ "block-cipher-trait", - "crypto-mac", + "crypto-mac 0.7.0", "dbl", ] @@ -727,9 +818,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "1.1.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83c06aff61f2d899eb87c379df3cbf7876f14471dcab474e0b6dc90ab96c080" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" dependencies = [ "cache-padded", ] @@ -776,6 +867,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + [[package]] name = "crc32fast" version = "1.2.0" @@ -802,13 +899,13 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "cfg-if", "crossbeam-utils", "lazy_static", "maybe-uninit", "memoffset", - "scopeguard 1.1.0", + "scopeguard", ] [[package]] @@ -828,7 +925,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "cfg-if", "lazy_static", ] @@ -845,61 +942,51 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" dependencies = [ - "generic-array", + "generic-array 0.12.3", "subtle 1.0.0", ] [[package]] -name = "ctr" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022cd691704491df67d25d006fe8eca083098253c4d43516c2206479c58c6736" -dependencies = [ - "block-cipher-trait", - "stream-cipher", -] - -[[package]] -name = "cuckoofilter" -version = "0.3.2" +name = "crypto-mac" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd43f7cfaffe0a386636a10baea2ee05cc50df3b77bea4a456c9572a939bf1f" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "byteorder 0.5.3", - "rand 0.3.23", + "generic-array 0.14.4", + "subtle 2.2.3", ] [[package]] name = "curve25519-dalek" -version = "1.2.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "405681bfe2b7b25ad8660dfd90b6e8be9e470e224ff49e36b587d43f29a22601" +checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" dependencies = [ - "byteorder 1.3.4", - "clear_on_drop", - "digest", - "rand_core 0.3.1", + "byteorder", + "digest 0.8.1", + "rand_core 0.5.1", "subtle 2.2.3", + "zeroize", ] [[package]] name = "curve25519-dalek" -version = "2.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" +checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307" dependencies = [ - "byteorder 1.3.4", - "digest", + "byteorder", + "digest 0.9.0", "rand_core 0.5.1", "subtle 2.2.3", - "zeroize 1.1.0", + "zeroize", ] [[package]] name = "data-encoding" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72aa14c04dfae8dd7d8a2b1cb7ca2152618cd01336dbfe704b8dcbf8d41dbd69" +checksum = "d4d0e2d24e5ee3b23a01de38eefdcd978907890701f08ffffd4cb457ca4ee8d6" [[package]] name = "dbl" @@ -907,7 +994,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dc203b75decc900220c4d9838e738d08413e663c26826ba92b669bed1d0795" dependencies = [ - "generic-array", + "generic-array 0.12.3", ] [[package]] @@ -927,17 +1014,16 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array", + "generic-array 0.12.3", ] [[package]] -name = "dns-parser" -version = "0.8.0" +name = "digest" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "byteorder 1.3.4", - "quick-error", + "generic-array 0.14.4", ] [[package]] @@ -946,23 +1032,34 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" +[[package]] +name = "ed25519" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf038a7b6fd7ef78ad3348b63f3a17550877b0e28f8d68bcc94894d1412158bc" +dependencies = [ + "signature", +] + [[package]] name = "ed25519-dalek" -version = "1.0.0-pre.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978710b352437433c97b2bff193f2fb1dfd58a093f863dd95e225a19baa599a2" +checksum = "53d2e93f837d749c16d118e7ddf7a4dfd0ac8f452cf51e46e9348824e5ef6851" dependencies = [ - "clear_on_drop", - "curve25519-dalek 2.1.0", + "curve25519-dalek 3.0.0", + "ed25519", "rand 0.7.3", - "sha2", + "serde", + "sha2 0.9.1", + "zeroize", ] [[package]] name = "either" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f" [[package]] name = "encoding_rs" @@ -1001,7 +1098,7 @@ checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", "humantime", - "log 0.4.8", + "log 0.4.11", "regex", "termcolor", ] @@ -1023,14 +1120,20 @@ dependencies = [ [[package]] name = "error-chain" -version = "0.12.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" dependencies = [ "backtrace", "version_check 0.9.2", ] +[[package]] +name = "event-listener" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cd41440ae7e4734bbd42302f63eaba892afc93a3912dad84006247f0dedb0e" + [[package]] name = "failure" version = "0.1.8" @@ -1061,18 +1164,32 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fastrand" -version = "1.3.3" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd3bdaaf0a72155260a1c098989b60db1cbb22d6a628e64f16237aa4da93cc7" + +[[package]] +name = "finality-grandpa" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36a9cb09840f81cd211e435d00a4e487edd263dc3c8ff815c32dd76ad668ebed" +checksum = "8feb87a63249689640ac9c011742c33139204e3c134293d3054022276869133b" +dependencies = [ + "either", + "futures 0.3.5", + "futures-timer 2.0.2", + "log 0.4.11", + "num-traits", + "parity-scale-codec", + "parking_lot 0.9.0", +] [[package]] name = "fixed-hash" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3367952ceb191f4ab95dd5685dc163ac539e36202f9fcfd0cb22f9f9c542fefc" +checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" dependencies = [ - "byteorder 1.3.4", - "libc", + "byteorder", "rand 0.7.3", "rustc-hex", "static_assertions", @@ -1086,9 +1203,9 @@ checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" [[package]] name = "flate2" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e" +checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" dependencies = [ "cfg-if", "crc32fast", @@ -1119,23 +1236,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] -name = "frame-executive" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +name = "frame-benchmarking" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", + "linregress", "parity-scale-codec", - "serde", + "paste", + "sp-api", "sp-io", "sp-runtime", + "sp-runtime-interface", "sp-std", ] +[[package]] +name = "frame-executive" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "serde", + "sp-io", + "sp-runtime", + "sp-std", + "sp-tracing", +] + [[package]] name = "frame-metadata" -version = "11.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "11.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "serde", @@ -1145,18 +1280,19 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "bitmask", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", - "log 0.4.8", - "once_cell 0.2.4", + "log 0.4.11", + "once_cell", "parity-scale-codec", "paste", "serde", + "smallvec 1.4.2", "sp-arithmetic", "sp-core", "sp-inherents", @@ -1164,13 +1300,13 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", - "tracing", + "sp-tracing", ] [[package]] name = "frame-support-procedural" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support-procedural-tools", "proc-macro2", @@ -1180,8 +1316,8 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1192,8 +1328,8 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "proc-macro2", "quote", @@ -1202,8 +1338,8 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1218,8 +1354,8 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "sp-api", @@ -1294,22 +1430,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "futures-diagnose" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9" -dependencies = [ - "futures 0.1.29", - "futures 0.3.5", - "lazy_static", - "log 0.4.8", - "parking_lot 0.9.0", - "pin-project", - "serde", - "serde_json", -] - [[package]] name = "futures-executor" version = "0.3.5" @@ -1328,6 +1448,21 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" +[[package]] +name = "futures-lite" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97999970129b808f0ccba93211201d431fcc12d7e1ffae03a61b5cedd1a7ced2" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking 2.0.0", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.5" @@ -1352,7 +1487,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" dependencies = [ - "once_cell 1.4.0", + "once_cell", ] [[package]] @@ -1366,6 +1501,10 @@ name = "futures-timer" version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +dependencies = [ + "gloo-timers", + "send_wrapper 0.4.0", +] [[package]] name = "futures-util" @@ -1386,19 +1525,6 @@ dependencies = [ "proc-macro-hack", "proc-macro-nested", "slab", - "tokio-io", -] - -[[package]] -name = "futures_codec" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0a73299e4718f5452e45980fc1d6957a070abe308d3700b63b8673f47e1c2b3" -dependencies = [ - "bytes 0.5.6", - "futures 0.3.5", - "memchr", - "pin-project", ] [[package]] @@ -1416,6 +1542,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check 0.9.2", +] + [[package]] name = "get_if_addrs" version = "0.5.3" @@ -1470,10 +1606,23 @@ dependencies = [ "aho-corasick", "bstr", "fnv", - "log 0.4.8", + "log 0.4.11", "regex", ] +[[package]] +name = "gloo-timers" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "grpcio" version = "0.5.1" @@ -1482,7 +1631,7 @@ dependencies = [ "futures 0.3.5", "grpcio-sys", "libc", - "log 0.4.8", + "log 0.4.11", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1515,13 +1664,13 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" dependencies = [ - "byteorder 1.3.4", + "byteorder", "bytes 0.4.12", "fnv", "futures 0.1.29", "http 0.1.21", "indexmap", - "log 0.4.8", + "log 0.4.11", "slab", "string", "tokio-io", @@ -1541,17 +1690,11 @@ dependencies = [ "http 0.2.1", "indexmap", "slab", - "tokio 0.2.21", + "tokio 0.2.22", "tokio-util", "tracing", ] -[[package]] -name = "half" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" - [[package]] name = "hash-db" version = "0.15.2" @@ -1567,16 +1710,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "hashbrown" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" -dependencies = [ - "byteorder 1.3.4", - "scopeguard 0.3.3", -] - [[package]] name = "hashbrown" version = "0.6.3" @@ -1594,14 +1727,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96282e96bfcd3da0d3aa9938bedf1e50df3269b6db08b4876d2da0bb1a0841cf" dependencies = [ "ahash 0.3.8", - "autocfg 1.0.0", + "autocfg 1.0.1", +] + +[[package]] +name = "hashbrown" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" +dependencies = [ + "ahash 0.3.8", + "autocfg 1.0.1", ] [[package]] name = "hashbrown_tstd" version = "0.7.1" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", ] [[package]] @@ -1653,8 +1796,8 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" dependencies = [ - "crypto-mac", - "digest", + "crypto-mac 0.7.0", + "digest 0.8.1", ] [[package]] @@ -1663,8 +1806,8 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" dependencies = [ - "digest", - "generic-array", + "digest 0.8.1", + "generic-array 0.12.3", "hmac", ] @@ -1761,7 +1904,7 @@ dependencies = [ "httparse", "iovec", "itoa", - "log 0.4.8", + "log 0.4.11", "net2", "rustc_version", "time", @@ -1794,7 +1937,7 @@ dependencies = [ "pin-project", "socket2", "time", - "tokio 0.2.21", + "tokio 0.2.22", "tower-service", "tracing", "want 0.3.0", @@ -1809,7 +1952,7 @@ dependencies = [ "bytes 0.5.6", "hyper 0.13.7", "native-tls", - "tokio 0.2.21", + "tokio 0.2.22", "tokio-tls 0.3.1", ] @@ -1875,13 +2018,20 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.4.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" +checksum = "86b45e59b16c76b11bf9738fd5d38879d3bd28ad292d7b313608becb17ae2df9" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", + "hashbrown 0.8.2", ] +[[package]] +name = "instant" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485" + [[package]] name = "integer-sqrt" version = "0.1.3" @@ -1929,25 +2079,25 @@ checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" [[package]] name = "js-sys" -version = "0.3.41" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4b9172132a62451e56142bff9afc91c8e4a4500aa5b847da36815b63bfda916" +checksum = "85a7e2c92a4804dd459b86c339278d0fe87cf93757fae222c3fa3ae75458bc73" dependencies = [ "wasm-bindgen", ] [[package]] name = "jsonrpc-client-transports" -version = "14.2.0" +version = "14.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecbdaacc17243168d9d1fa6b2bd7556a27e1e60a621d8a2a6e590ae2b145d158" +checksum = "2773fa94a2a1fd51efb89a8f45b8861023dbb415d18d3c9235ae9388d780f9ec" dependencies = [ "failure", "futures 0.1.29", "hyper 0.12.35", "jsonrpc-core", "jsonrpc-pubsub", - "log 0.4.8", + "log 0.4.11", "serde", "serde_json", "tokio 0.1.22", @@ -1962,7 +2112,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0747307121ffb9703afd93afbd0fb4f854c38fb873f2c8b90e0e902f27c7b62" dependencies = [ "futures 0.1.29", - "log 0.4.8", + "log 0.4.11", "serde", "serde_derive", "serde_json", @@ -1996,7 +2146,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d44f5602a11d657946aac09357956d2841299ed422035edf140c552cb057986" dependencies = [ "jsonrpc-core", - "log 0.4.8", + "log 0.4.11", "parking_lot 0.10.2", "rand 0.7.3", "serde", @@ -2009,7 +2159,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cc8a1da5a54b417cfb7edb9f932024d833dc333de50c21c0e1b28d0e8b4f853" dependencies = [ "async-std", - "async-tls", + "async-tls 0.6.0", "bs58", "bytes 0.5.6", "fnv", @@ -2020,16 +2170,16 @@ dependencies = [ "hyper 0.13.7", "jsonrpsee-proc-macros", "lazy_static", - "log 0.4.8", + "log 0.4.11", "parking_lot 0.10.2", "pin-project", "rand 0.7.3", "serde", "serde_json", - "smallvec 1.4.1", - "soketto", + "smallvec 1.4.2", + "soketto 0.3.2", "thiserror", - "tokio 0.2.21", + "tokio 0.2.22", "unicase 2.6.0", "url 2.1.1", "webpki", @@ -2069,18 +2219,17 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" dependencies = [ - "log 0.4.8", + "log 0.4.11", ] [[package]] name = "kvdb" -version = "0.4.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03080afe6f42cd996da9f568d6add5d7fb5ee2ea7fb7802d2d2cbd836958fd87" +checksum = "0315ef2f688e33844400b31f11c263f2b3dc21d8b9355c6891c5f185fae43f9a" dependencies = [ - "parity-bytes", "parity-util-mem", - "smallvec 1.4.1", + "smallvec 1.4.2", ] [[package]] @@ -2095,17 +2244,11 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" - [[package]] name = "libc" -version = "0.2.72" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" +checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3" [[package]] name = "libloading" @@ -2117,61 +2260,55 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "libm" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" + [[package]] name = "libp2p" -version = "0.15.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84847789ab24b3fc5971a68656ac85886df640986d9ce3264c0327694eae471" +checksum = "0306a49ee6a89468f96089906f36b0eef82c988dcfc8acf3e2dcd6ad1c859f85" dependencies = [ "bytes 0.5.6", "futures 0.3.5", "lazy_static", "libp2p-core", "libp2p-core-derive", - "libp2p-deflate", "libp2p-dns", - "libp2p-floodsub", - "libp2p-gossipsub", - "libp2p-identify", - "libp2p-kad", - "libp2p-mdns", - "libp2p-mplex", - "libp2p-noise", - "libp2p-ping", - "libp2p-plaintext", - "libp2p-secio", "libp2p-swarm", "libp2p-tcp", - "libp2p-uds", "libp2p-wasm-ext", "libp2p-websocket", - "libp2p-yamux", + "multihash", "parity-multiaddr", - "parity-multihash", "parking_lot 0.10.2", "pin-project", - "smallvec 1.4.1", + "smallvec 1.4.2", "wasm-timer", ] [[package]] name = "libp2p-core" -version = "0.15.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbafb2706b8082233f66dc13e196f9cf9b4c229f2cd7c96b2b16617ad6ee330b" +checksum = "6a694fd76d7c33a45a0e6e1525e9b9b5d11127c9c94e560ac0f8abba54ed80af" dependencies = [ "asn1_der", "bs58", "ed25519-dalek", + "either", "fnv", "futures 0.3.5", - "futures-timer 2.0.2", + "futures-timer 3.0.2", "lazy_static", "libsecp256k1", - "log 0.4.8", + "log 0.4.11", + "multihash", "multistream-select", "parity-multiaddr", - "parity-multihash", "parking_lot 0.10.2", "pin-project", "prost", @@ -2179,301 +2316,71 @@ dependencies = [ "rand 0.7.3", "ring", "rw-stream-sink", - "sha2", - "smallvec 1.4.1", + "sha2 0.8.2", + "smallvec 1.4.2", "thiserror", - "unsigned-varint", - "untrusted", + "unsigned-varint 0.4.0", "void", - "zeroize 1.1.0", + "zeroize", ] [[package]] name = "libp2p-core-derive" -version = "0.15.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c320266be0a7760e23484d635acdb83844b2d74d3612d93b41c393c9bcf004e" +checksum = "f753d9324cd3ec14bf04b8a8cd0d269c87f294153d6bf2a84497a63a5ad22213" dependencies = [ "quote", "syn", ] -[[package]] -name = "libp2p-deflate" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be32697b42d040b325c3737f827ea04ede569ec956b7807700dd8d89d8210f9" -dependencies = [ - "flate2", - "futures 0.3.5", - "libp2p-core", -] - [[package]] name = "libp2p-dns" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11c979b882f25d85726b15637d5bbc722dfa1be576605c54e99b8cf56906be3" -dependencies = [ - "futures 0.3.5", - "libp2p-core", - "log 0.4.8", -] - -[[package]] -name = "libp2p-floodsub" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bdf6fba9272ad47dde94bade89540fdb16e24ae9ff7fb714c1c80a035165f28" -dependencies = [ - "bs58", - "cuckoofilter", - "fnv", - "futures 0.3.5", - "libp2p-core", - "libp2p-swarm", - "prost", - "prost-build", - "rand 0.7.3", - "smallvec 1.4.1", -] - -[[package]] -name = "libp2p-gossipsub" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e6ecd058bf769d27ebec530544b081e08b0a1088e3186da8cc58d59915784d0" -dependencies = [ - "base64 0.11.0", - "bs58", - "byteorder 1.3.4", - "bytes 0.5.6", - "fnv", - "futures 0.3.5", - "futures_codec", - "libp2p-core", - "libp2p-swarm", - "log 0.4.8", - "lru", - "prost", - "prost-build", - "rand 0.7.3", - "sha2", - "smallvec 1.4.1", - "unsigned-varint", - "wasm-timer", -] - -[[package]] -name = "libp2p-identify" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1a6261b804111c2dbf53f8ca03f66edc5ad1c29b78a61cf0cc5354052e28e9" -dependencies = [ - "futures 0.3.5", - "libp2p-core", - "libp2p-swarm", - "log 0.4.8", - "prost", - "prost-build", - "smallvec 1.4.1", - "wasm-timer", -] - -[[package]] -name = "libp2p-kad" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6ea6fece0d99599afb1b2082ca8937944cdd6b0946a88d54cb3ae7a38d1253" -dependencies = [ - "arrayvec 0.5.1", - "bytes 0.5.6", - "either", - "fnv", - "futures 0.3.5", - "futures_codec", - "libp2p-core", - "libp2p-swarm", - "log 0.4.8", - "parity-multihash", - "prost", - "prost-build", - "rand 0.7.3", - "sha2", - "smallvec 1.4.1", - "uint", - "unsigned-varint", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-mdns" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074312353355df310affa105ec71b16fd7e52f5c6ae61d3dcbb3e79e8fdc9e5f" -dependencies = [ - "async-std", - "data-encoding", - "dns-parser", - "either", - "futures 0.3.5", - "lazy_static", - "libp2p-core", - "libp2p-swarm", - "log 0.4.8", - "net2", - "rand 0.7.3", - "smallvec 1.4.1", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-mplex" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d0b44dfdef80cc2be4b42d127de1c793905eca2459415a5c57d6b4fbd8ec30" -dependencies = [ - "bytes 0.5.6", - "fnv", - "futures 0.3.5", - "futures_codec", - "libp2p-core", - "log 0.4.8", - "parking_lot 0.10.2", - "unsigned-varint", -] - -[[package]] -name = "libp2p-noise" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0845e8208d814cd41c26c90a6a2f2b720c31b588209cecc49a44c881a09f417f" -dependencies = [ - "curve25519-dalek 1.2.4", - "futures 0.3.5", - "lazy_static", - "libp2p-core", - "log 0.4.8", - "prost", - "prost-build", - "rand 0.7.3", - "ring", - "snow", - "x25519-dalek", - "zeroize 1.1.0", -] - -[[package]] -name = "libp2p-ping" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ecced2949ae93b6ff29565303ecd1bef15c4e4efb689033ee744922561a36b" -dependencies = [ - "futures 0.3.5", - "libp2p-core", - "libp2p-swarm", - "log 0.4.8", - "rand 0.7.3", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-plaintext" -version = "0.15.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "195fda6b6a948a242fd30570e0e3418ae8e0a20055ea75d45458e1079a8efb05" +checksum = "f751924b6b98e350005e0b87a822beb246792a3fb878c684e088f866158120ac" dependencies = [ - "bytes 0.5.6", "futures 0.3.5", - "futures_codec", "libp2p-core", - "log 0.4.8", - "prost", - "prost-build", - "rw-stream-sink", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-secio" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceef68ca377b264f84d64c88739a8fa118b5db1e8f18297351dff75314504a5f" -dependencies = [ - "aes-ctr", - "ctr", - "futures 0.3.5", - "hmac", - "js-sys", - "lazy_static", - "libp2p-core", - "log 0.4.8", - "parity-send-wrapper", - "pin-project", - "prost", - "prost-build", - "quicksink", - "rand 0.7.3", - "ring", - "rw-stream-sink", - "sha2", - "static_assertions", - "twofish", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", + "log 0.4.11", ] [[package]] name = "libp2p-swarm" -version = "0.5.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ea00be81bc3985e36abad263ce2ad1b6aeb862aa743563eb70ad42880c05ae" +checksum = "f88d5e2a090a2aadf042cd33484e2f015c6dab212567406a59deece5dedbd133" dependencies = [ "futures 0.3.5", "libp2p-core", - "log 0.4.8", - "smallvec 1.4.1", + "log 0.4.11", + "rand 0.7.3", + "smallvec 1.4.2", "void", "wasm-timer", ] [[package]] name = "libp2p-tcp" -version = "0.15.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e65ef381570df31cb047dfbc11483ab0fe7e6abbdcf2bdc2c60b5d11133d241" +checksum = "9b1fa2bbad054020cb875546a577a66a65a5bf42eff55ed5265f92ffee3cc052" dependencies = [ "async-std", "futures 0.3.5", - "futures-timer 2.0.2", + "futures-timer 3.0.2", "get_if_addrs", "ipnet", "libp2p-core", - "log 0.4.8", -] - -[[package]] -name = "libp2p-uds" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4f4f7989b35f33d4b9738aab2f031310eb20fec513cab44d12b1bc985a8074" -dependencies = [ - "async-std", - "futures 0.3.5", - "libp2p-core", - "log 0.4.8", + "log 0.4.11", + "socket2", ] [[package]] name = "libp2p-wasm-ext" -version = "0.8.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b4d457adb91a5e2212343218a554394cd8ced64a79fb8e36e7aed2a16d49495" +checksum = "0feb99e32fea20ffb1bbf56a6fb2614bff7325ff44a515728385170b3420d2c3" dependencies = [ "futures 0.3.5", "js-sys", @@ -2485,37 +2392,22 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.15.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bba425f2af1fdb7dece88b9ae05ca9430dfb0b72b2c078e73ded6f1556084509" +checksum = "046a5201f6e471f22b22b394e4d084269ed1e28cf7300f7b49874385db84c7bd" dependencies = [ - "async-tls", - "bytes 0.5.6", + "async-tls 0.8.0", "either", "futures 0.3.5", "libp2p-core", - "log 0.4.8", + "log 0.4.11", "quicksink", - "rustls", - "rw-stream-sink", - "soketto", - "url 2.1.1", - "webpki", - "webpki-roots 0.18.0", -] - -[[package]] -name = "libp2p-yamux" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca25b3aac78a3c93c2a567622abd3cfc16f96f26ae1bf6134f0056203d62d86" -dependencies = [ - "futures 0.3.5", - "libp2p-core", - "log 0.4.8", - "parking_lot 0.10.2", - "thiserror", - "yamux", + "rustls 0.18.1", + "rw-stream-sink", + "soketto 0.4.1", + "url 2.1.1", + "webpki", + "webpki-roots 0.18.0", ] [[package]] @@ -2526,19 +2418,19 @@ checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" dependencies = [ "arrayref", "crunchy", - "digest", + "digest 0.8.1", "hmac-drbg", "rand 0.7.3", - "sha2", + "sha2 0.8.2", "subtle 2.2.3", "typenum", ] [[package]] name = "libz-sys" -version = "1.0.25" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" +checksum = "af67924b8dd885cccea261866c8ce5b74d239d272e154053ff927dae839f5ae9" dependencies = [ "cc", "libc", @@ -2547,12 +2439,14 @@ dependencies = [ ] [[package]] -name = "lock_api" -version = "0.1.5" +name = "linregress" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +checksum = "9290cf6f928576eeb9c096c6fad9d8d452a0a1a70a2bbffa6e36064eedc0aac9" dependencies = [ - "scopeguard 0.3.3", + "failure", + "nalgebra", + "statrs", ] [[package]] @@ -2561,7 +2455,16 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ - "scopeguard 1.1.0", + "scopeguard", +] + +[[package]] +name = "lock_api" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" +dependencies = [ + "scopeguard", ] [[package]] @@ -2570,14 +2473,14 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" dependencies = [ - "log 0.4.8", + "log 0.4.11", ] [[package]] name = "log" -version = "0.4.8" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ "cfg-if", ] @@ -2597,6 +2500,15 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +[[package]] +name = "matrixmultiply" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f" +dependencies = [ + "rawpointer", +] + [[package]] name = "maybe-uninit" version = "2.0.0" @@ -2615,18 +2527,17 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", ] [[package]] name = "memory-db" -version = "0.19.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "198831fe8722331a395bc199a5d08efbc197497ef354cb4c77b969c02ffc0fc4" +checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a" dependencies = [ - "ahash 0.2.18", "hash-db", - "hashbrown 0.6.3", + "hashbrown 0.8.2", "parity-util-mem", ] @@ -2638,14 +2549,14 @@ checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" [[package]] name = "merlin" -version = "1.3.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b0942b357c1b4d0dc43ba724674ec89c3218e6ca2b3e8269e7cb53bcecd2f6e" +checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78" dependencies = [ - "byteorder 1.3.4", + "byteorder", "keccak", - "rand_core 0.4.2", - "zeroize 1.1.0", + "rand_core 0.5.1", + "zeroize", ] [[package]] @@ -2694,25 +2605,13 @@ dependencies = [ "iovec", "kernel32-sys", "libc", - "log 0.4.8", + "log 0.4.11", "miow", "net2", "slab", "winapi 0.2.8", ] -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log 0.4.8", - "mio", - "slab", -] - [[package]] name = "mio-uds" version = "0.6.8" @@ -2736,6 +2635,22 @@ dependencies = [ "ws2_32-sys", ] +[[package]] +name = "multihash" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51cc1552a982658478dbc22eefb72bb1d4fd1161eb9818f7bbf4347443f07569" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "blake3", + "digest 0.9.0", + "sha-1 0.9.1", + "sha2 0.9.1", + "sha3", + "unsigned-varint 0.5.0", +] + [[package]] name = "multimap" version = "0.8.1" @@ -2744,16 +2659,44 @@ checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" [[package]] name = "multistream-select" -version = "0.7.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f938ffe420493e77c8b6cbcc3f282283f68fc889c5dcbc8e51668d5f3a01ad94" +checksum = "c9157e87afbc2ef0d84cc0345423d715f445edde00141c93721c162de35a05e5" dependencies = [ "bytes 0.5.6", - "futures 0.1.29", - "log 0.4.8", - "smallvec 1.4.1", - "tokio-io", - "unsigned-varint", + "futures 0.3.5", + "log 0.4.11", + "pin-project", + "smallvec 1.4.2", + "unsigned-varint 0.4.0", +] + +[[package]] +name = "multitask" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c09c35271e7dcdb5f709779111f2c8e8ab8e06c1b587c1c6a9e179d865aaa5b4" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", +] + +[[package]] +name = "nalgebra" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaa9fddbc34c8c35dd2108515587b8ce0cab396f17977b8c738568e4edb521a2" +dependencies = [ + "alga", + "approx", + "generic-array 0.12.3", + "matrixmultiply", + "num-complex", + "num-rational", + "num-traits", + "rand 0.6.5", + "typenum", ] [[package]] @@ -2764,7 +2707,7 @@ checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" dependencies = [ "lazy_static", "libc", - "log 0.4.8", + "log 0.4.11", "openssl", "openssl-probe", "openssl-sys", @@ -2787,18 +2730,22 @@ dependencies = [ [[package]] name = "node-primitives" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "frame-system", + "parity-scale-codec", + "sp-application-crypto", "sp-core", "sp-runtime", ] [[package]] name = "node-runtime" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "frame-benchmarking", "frame-executive", "frame-support", "frame-system", @@ -2821,9 +2768,12 @@ dependencies = [ "pallet-im-online", "pallet-indices", "pallet-membership", + "pallet-multisig", "pallet-offences", + "pallet-proxy", "pallet-randomness-collective-flip", "pallet-recovery", + "pallet-scheduler", "pallet-session", "pallet-society", "pallet-staking", @@ -2836,7 +2786,6 @@ dependencies = [ "pallet-utility", "pallet-vesting", "parity-scale-codec", - "rustc-hex", "serde", "sp-api", "sp-authority-discovery", @@ -2852,6 +2801,7 @@ dependencies = [ "sp-std", "sp-transaction-pool", "sp-version", + "static_assertions", "substrate-wasm-builder-runner", ] @@ -2861,12 +2811,6 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - [[package]] name = "nom" version = "4.2.3" @@ -2883,18 +2827,28 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-integer", "num-traits", ] +[[package]] +name = "num-complex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +dependencies = [ + "autocfg 1.0.1", + "num-traits", +] + [[package]] name = "num-integer" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-traits", ] @@ -2904,7 +2858,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-bigint", "num-integer", "num-traits", @@ -2916,7 +2870,8 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", + "libm", ] [[package]] @@ -2937,30 +2892,24 @@ checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" [[package]] name = "once_cell" -version = "0.1.8" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532c29a261168a45ce28948f9537ddd7a5dd272cc513b3017b1e82a88f962c37" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" dependencies = [ - "parking_lot 0.7.1", + "parking_lot 0.11.0", ] [[package]] -name = "once_cell" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d584f08c2d717d5c23a6414fc2822b71c651560713e54fa7eace675f758a355e" - -[[package]] -name = "once_cell" -version = "1.4.0" +name = "opaque-debug" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "opaque-debug" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" @@ -2988,38 +2937,17 @@ version = "0.9.58" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "cc", "libc", "pkg-config", "vcpkg", ] -[[package]] -name = "pallet-aura" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" -dependencies = [ - "frame-support", - "frame-system", - "pallet-session", - "pallet-timestamp", - "parity-scale-codec", - "serde", - "sp-application-crypto", - "sp-consensus-aura", - "sp-core", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-timestamp", -] - [[package]] name = "pallet-authority-discovery" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3028,45 +2956,45 @@ dependencies = [ "serde", "sp-application-crypto", "sp-authority-discovery", - "sp-core", - "sp-io", "sp-runtime", "sp-std", ] [[package]] name = "pallet-authorship" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "sp-authorship", - "sp-core", "sp-inherents", - "sp-io", "sp-runtime", "sp-std", ] [[package]] name = "pallet-babe" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", - "hex-literal", + "pallet-authorship", "pallet-session", "pallet-timestamp", "parity-scale-codec", "serde", + "sp-application-crypto", "sp-consensus-babe", + "sp-consensus-vrf", "sp-inherents", "sp-io", "sp-runtime", + "sp-session", "sp-staking", "sp-std", "sp-timestamp", @@ -3074,22 +3002,22 @@ dependencies = [ [[package]] name = "pallet-balances" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "parity-scale-codec", "serde", - "sp-io", "sp-runtime", "sp-std", ] [[package]] name = "pallet-collective" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3103,9 +3031,10 @@ dependencies = [ [[package]] name = "pallet-contracts" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "bitflags", "frame-support", "frame-system", "pallet-contracts-primitives", @@ -3123,8 +3052,8 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -3133,8 +3062,8 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc-runtime-api" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -3145,9 +3074,10 @@ dependencies = [ [[package]] name = "pallet-democracy" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "parity-scale-codec", @@ -3159,21 +3089,22 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", "parity-scale-codec", - "sp-phragmen", + "serde", + "sp-npos-elections", "sp-runtime", "sp-std", ] [[package]] name = "pallet-finality-tracker" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3188,28 +3119,33 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", + "pallet-authorship", "pallet-finality-tracker", "pallet-session", "parity-scale-codec", "serde", + "sp-application-crypto", "sp-core", "sp-finality-grandpa", "sp-runtime", + "sp-session", "sp-staking", "sp-std", ] [[package]] name = "pallet-identity" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "enumflags2", + "frame-benchmarking", "frame-support", "frame-system", "parity-scale-codec", @@ -3221,8 +3157,8 @@ dependencies = [ [[package]] name = "pallet-im-online" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3240,8 +3176,8 @@ dependencies = [ [[package]] name = "pallet-indices" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3256,13 +3192,28 @@ dependencies = [ [[package]] name = "pallet-membership" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "serde", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-multisig" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", "parity-scale-codec", "serde", + "sp-core", "sp-io", "sp-runtime", "sp-std", @@ -3270,8 +3221,8 @@ dependencies = [ [[package]] name = "pallet-offences" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3283,10 +3234,25 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-proxy" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-randomness-collective-flip" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3298,8 +3264,8 @@ dependencies = [ [[package]] name = "pallet-recovery" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "enumflags2", "frame-support", @@ -3311,10 +3277,25 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-scheduler" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "serde", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-session" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3322,8 +3303,10 @@ dependencies = [ "pallet-timestamp", "parity-scale-codec", "serde", + "sp-core", "sp-io", "sp-runtime", + "sp-session", "sp-staking", "sp-std", "sp-trie", @@ -3331,23 +3314,22 @@ dependencies = [ [[package]] name = "pallet-society" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", "parity-scale-codec", "rand_chacha 0.2.2", "serde", - "sp-io", "sp-runtime", "sp-std", ] [[package]] name = "pallet-staking" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3355,18 +3337,19 @@ dependencies = [ "pallet-session", "parity-scale-codec", "serde", + "sp-application-crypto", "sp-io", - "sp-keyring", - "sp-phragmen", + "sp-npos-elections", "sp-runtime", "sp-staking", "sp-std", + "static_assertions", ] [[package]] name = "pallet-staking-reward-curve" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3376,8 +3359,8 @@ dependencies = [ [[package]] name = "pallet-sudo" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3390,9 +3373,10 @@ dependencies = [ [[package]] name = "pallet-timestamp" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "impl-trait-for-tuples", @@ -3406,21 +3390,25 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", + "serde", + "smallvec 1.4.2", + "sp-core", + "sp-io", "sp-runtime", "sp-std", ] [[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "parity-scale-codec", @@ -3432,8 +3420,8 @@ dependencies = [ [[package]] name = "pallet-treasury" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3446,8 +3434,8 @@ dependencies = [ [[package]] name = "pallet-utility" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "frame-support", "frame-system", @@ -3461,63 +3449,41 @@ dependencies = [ [[package]] name = "pallet-vesting" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "enumflags2", "frame-support", "frame-system", "parity-scale-codec", "serde", - "sp-io", "sp-runtime", "sp-std", ] -[[package]] -name = "parity-bytes" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b56e3a2420138bdb970f84dfb9c774aea80fa0e7371549eedec0d80c209c67" - [[package]] name = "parity-multiaddr" -version = "0.7.3" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f77055f9e81921a8cc7bebeb6cded3d128931d51f1e3dd6251f0770a6d431477" +checksum = "cc20af3143a62c16e7c9e92ea5c6ae49f7d271d97d4d8fe73afc28f0514a3d0f" dependencies = [ "arrayref", "bs58", - "byteorder 1.3.4", + "byteorder", "data-encoding", - "parity-multihash", + "multihash", "percent-encoding 2.1.0", "serde", "static_assertions", - "unsigned-varint", + "unsigned-varint 0.4.0", "url 2.1.1", ] -[[package]] -name = "parity-multihash" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a1cd2ba02391b81367bec529fb209019d718684fdc8ad6a712c2b536e46f775" -dependencies = [ - "blake2", - "bytes 0.5.6", - "rand 0.7.3", - "sha-1", - "sha2", - "sha3", - "unsigned-varint", -] - [[package]] name = "parity-scale-codec" -version = "1.3.1" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74f02beb35d47e0706155c9eac554b50c671e0d868fe8296bcdf44a9a4847bf" +checksum = "34d38aeaffc032ec69faa476b3caaca8d4dd7f3f798137ff30359e5c7869ceb6" dependencies = [ "arrayvec 0.5.1", "bitvec", @@ -3528,9 +3494,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" +checksum = "cd20ff7e0399b274a5f5bb37b712fccb5b3a64b9128200d1c3cc40fe709cb073" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3546,11 +3512,12 @@ checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" [[package]] name = "parity-util-mem" -version = "0.5.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9344bc978467339b9ae688f9dcf279d1aaa0ccfc88e9a780c729b765a82d57d5" +checksum = "297ff91fa36aec49ce183484b102f6b75b46776822bd81525bfc4cc9b0dd0f5c" dependencies = [ "cfg-if", + "hashbrown 0.8.2", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot 0.10.2", @@ -3577,19 +3544,15 @@ checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" [[package]] name = "parking" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efcee3c6d23b94012e240525f131c6abaa9e5eeb8f211002d93beec3b7be350" +checksum = "6cb300f271742d4a2a66c01b6b2fa0c83dfebd2e0bf11addb879a3547b4ed87c" [[package]] -name = "parking_lot" -version = "0.7.1" +name = "parking" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" -dependencies = [ - "lock_api 0.1.5", - "parking_lot_core 0.4.0", -] +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" [[package]] name = "parking_lot" @@ -3613,16 +3576,14 @@ dependencies = [ ] [[package]] -name = "parking_lot_core" -version = "0.4.0" +name = "parking_lot" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" dependencies = [ - "libc", - "rand 0.6.5", - "rustc_version", - "smallvec 0.6.13", - "winapi 0.3.9", + "instant", + "lock_api 0.4.1", + "parking_lot_core 0.8.0", ] [[package]] @@ -3632,7 +3593,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" dependencies = [ "cfg-if", - "cloudabi", + "cloudabi 0.0.3", "libc", "redox_syscall", "rustc_version", @@ -3647,10 +3608,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ "cfg-if", - "cloudabi", + "cloudabi 0.0.3", + "libc", + "redox_syscall", + "smallvec 1.4.2", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +dependencies = [ + "cfg-if", + "cloudabi 0.1.0", + "instant", "libc", "redox_syscall", - "smallvec 1.4.1", + "smallvec 1.4.2", "winapi 0.3.9", ] @@ -3679,8 +3655,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" dependencies = [ - "byteorder 1.3.4", - "crypto-mac", + "byteorder", + "crypto-mac 0.7.0", ] [[package]] @@ -3713,18 +3689,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "0.4.20" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75373ff9037d112bb19bc61333a06a159eaeb217660dcfbea7d88e1db823919" +checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.20" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b4b44893d3c370407a1d6a5cfde7c41ae0478e31c516c85f67eb3adc51be6d" +checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" dependencies = [ "proc-macro2", "quote", @@ -3747,19 +3723,31 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" name = "pkg-config" version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" +checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" + +[[package]] +name = "polling" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e09dffb745feffca5be3dea51c02b7b368c4597ab0219a82acaf9799ab3e0d1" +dependencies = [ + "cfg-if", + "libc", + "wepoll-sys-stjepang", + "winapi 0.3.9", +] [[package]] name = "ppv-lite86" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" +checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" [[package]] name = "primitive-types" -version = "0.6.2" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4336f4f5d5524fa60bcbd6fe626f9223d8142a50e7053e979acdf0da41ab975" +checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" dependencies = [ "fixed-hash", "impl-codec", @@ -3778,9 +3766,9 @@ dependencies = [ [[package]] name = "proc-macro-error" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", "proc-macro2", @@ -3791,38 +3779,50 @@ dependencies = [ [[package]] name = "proc-macro-error-attr" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2", "quote", - "syn", - "syn-mid", "version_check 0.9.2", ] [[package]] name = "proc-macro-hack" -version = "0.5.16" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" +checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" [[package]] name = "proc-macro-nested" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0afe1bd463b9e9ed51d0e0f0b50b6b146aec855c56fd182bb242388710a9b6de" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" dependencies = [ "unicode-xid", ] +[[package]] +name = "prometheus" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0575e258dab62268e7236d7307caa38848acbda7ec7ab87bd9093791e999d20" +dependencies = [ + "cfg-if", + "fnv", + "lazy_static", + "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "spin", + "thiserror", +] + [[package]] name = "prost" version = "0.6.1" @@ -3842,7 +3842,7 @@ dependencies = [ "bytes 0.5.6", "heck", "itertools 0.8.2", - "log 0.4.8", + "log 0.4.11", "multimap", "petgraph", "prost", @@ -3915,8 +3915,8 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" dependencies = [ - "byteorder 1.3.4", - "log 0.4.8", + "byteorder", + "log 0.4.11", "parity-wasm", ] @@ -3954,24 +3954,14 @@ checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" [[package]] name = "rand" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" -dependencies = [ - "libc", - "rand 0.4.6", -] - -[[package]] -name = "rand" -version = "0.4.6" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ + "cloudabi 0.0.3", "fuchsia-cprng", "libc", "rand_core 0.3.1", - "rdrand 0.4.0", "winapi 0.3.9", ] @@ -3989,7 +3979,7 @@ dependencies = [ "rand_isaac", "rand_jitter", "rand_os", - "rand_pcg", + "rand_pcg 0.1.2", "rand_xorshift", "winapi 0.3.9", ] @@ -4005,6 +3995,7 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", + "rand_pcg 0.2.1", ] [[package]] @@ -4095,7 +4086,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" dependencies = [ - "cloudabi", + "cloudabi 0.0.3", "fuchsia-cprng", "libc", "rand_core 0.4.2", @@ -4113,6 +4104,15 @@ dependencies = [ "rand_core 0.4.2", ] +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "rand_xorshift" version = "0.1.1" @@ -4122,6 +4122,12 @@ dependencies = [ "rand_core 0.3.1", ] +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + [[package]] name = "rdrand" version = "0.4.0" @@ -4146,6 +4152,26 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +[[package]] +name = "ref-cast" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "745c1787167ddae5569661d5ffb8b25ae5fedbf46717eaa92d652221cec72623" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "regex" version = "1.3.9" @@ -4166,18 +4192,39 @@ checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" [[package]] name = "remove_dir_all" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "rental" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8545debe98b2b139fb04cad8618b530e9b07c152d99a5de83c860b877d67847f" +dependencies = [ + "rental-impl", + "stable_deref_trait", +] + +[[package]] +name = "rental-impl" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "reqwest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b82c9238b305f26f53443e3a4bc8528d64b8d0bee408ec949eb7bf5635ec680" +checksum = "12427a5577082c24419c9c417db35cfeb65962efc7675bb6b0d5f1f9d315bfe6" dependencies = [ "base64 0.12.3", "bytes 0.5.6", @@ -4188,9 +4235,10 @@ dependencies = [ "http-body 0.3.1", "hyper 0.13.7", "hyper-tls", + "ipnet", "js-sys", "lazy_static", - "log 0.4.8", + "log 0.4.11", "mime 0.3.16", "mime_guess", "native-tls", @@ -4198,7 +4246,7 @@ dependencies = [ "pin-project-lite", "serde", "serde_urlencoded", - "tokio 0.2.21", + "tokio 0.2.22", "tokio-tls 0.3.1", "url 2.1.1", "wasm-bindgen", @@ -4215,7 +4263,7 @@ checksum = "952cd6b98c85bbc30efa1ba5783b8abf12fec8b3287ffa52605b9432313e34e4" dependencies = [ "cc", "libc", - "once_cell 1.4.0", + "once_cell", "spin", "untrusted", "web-sys", @@ -4256,7 +4304,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" dependencies = [ "base64 0.10.1", - "log 0.4.8", + "log 0.4.11", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +dependencies = [ + "base64 0.12.3", + "log 0.4.11", "ring", "sct", "webpki", @@ -4305,8 +4366,8 @@ dependencies = [ [[package]] name = "sc-block-builder" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -4315,47 +4376,15 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-core", - "sp-runtime", - "sp-state-machine", -] - -[[package]] -name = "sc-client" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" -dependencies = [ - "derive_more", - "fnv", - "futures 0.3.5", - "hash-db", - "hex-literal", - "kvdb", - "log 0.4.8", - "parity-scale-codec", - "parking_lot 0.10.2", - "sc-block-builder", - "sc-client-api", - "sc-executor", - "sc-telemetry", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-externalities", "sp-inherents", - "sp-keyring", "sp-runtime", "sp-state-machine", - "sp-std", - "sp-trie", - "sp-version", - "tracing", ] [[package]] name = "sc-client-api" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", "fnv", @@ -4363,7 +4392,8 @@ dependencies = [ "hash-db", "hex-literal", "kvdb", - "log 0.4.8", + "lazy_static", + "log 0.4.11", "parity-scale-codec", "parking_lot 0.10.2", "sc-executor", @@ -4372,31 +4402,36 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-core", + "sp-database", "sp-externalities", "sp-inherents", "sp-keyring", "sp-runtime", "sp-state-machine", "sp-std", + "sp-storage", "sp-transaction-pool", "sp-trie", + "sp-utils", "sp-version", + "substrate-prometheus-endpoint", ] [[package]] name = "sc-executor" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", "lazy_static", "libsecp256k1", - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", "parity-wasm", "parking_lot 0.10.2", "sc-executor-common", "sc-executor-wasmi", + "sp-api", "sp-core", "sp-externalities", "sp-io", @@ -4411,12 +4446,13 @@ dependencies = [ [[package]] name = "sc-executor-common" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", + "parity-wasm", "sp-allocator", "sp-core", "sp-runtime-interface", @@ -4427,12 +4463,11 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", - "parity-wasm", "sc-executor-common", "sp-allocator", "sp-core", @@ -4443,11 +4478,12 @@ dependencies = [ [[package]] name = "sc-keystore" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", "hex", + "merlin", "parking_lot 0.10.2", "rand 0.7.3", "serde_json", @@ -4458,17 +4494,17 @@ dependencies = [ [[package]] name = "sc-rpc" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "futures 0.3.5", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", "parking_lot 0.10.2", - "sc-client", + "sc-block-builder", "sc-client-api", "sc-executor", "sc-keystore", @@ -4476,6 +4512,7 @@ dependencies = [ "serde_json", "sp-api", "sp-blockchain", + "sp-chain-spec", "sp-core", "sp-offchain", "sp-rpc", @@ -4483,13 +4520,14 @@ dependencies = [ "sp-session", "sp-state-machine", "sp-transaction-pool", + "sp-utils", "sp-version", ] [[package]] name = "sc-rpc-api" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", "futures 0.3.5", @@ -4497,27 +4535,28 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "jsonrpc-pubsub", - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", "parking_lot 0.10.2", "serde", "serde_json", + "sp-chain-spec", "sp-core", "sp-rpc", + "sp-runtime", "sp-transaction-pool", "sp-version", ] [[package]] name = "sc-telemetry" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ - "bytes 0.5.6", "futures 0.3.5", "futures-timer 3.0.2", "libp2p", - "log 0.4.8", + "log 0.4.11", "parking_lot 0.10.2", "pin-project", "rand 0.7.3", @@ -4542,19 +4581,20 @@ dependencies = [ [[package]] name = "schnorrkel" -version = "0.8.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eacd8381b3c37840c9c9f40472af529e49975bdcbc24f83c31059fd6539023d3" +checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" dependencies = [ - "curve25519-dalek 1.2.4", - "failure", + "arrayref", + "arrayvec 0.5.1", + "curve25519-dalek 2.1.0", + "getrandom", "merlin", - "rand 0.6.5", - "rand_core 0.4.2", - "rand_os", - "sha2", + "rand 0.7.3", + "rand_core 0.5.1", + "sha2 0.8.2", "subtle 2.2.3", - "zeroize 0.9.3", + "zeroize", ] [[package]] @@ -4563,12 +4603,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" -[[package]] -name = "scopeguard" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" - [[package]] name = "scopeguard" version = "1.1.0" @@ -4585,6 +4619,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "secrecy" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9182278ed645df3477a9c27bfee0621c621aa16f6972635f7f795dae3d81070f" +dependencies = [ + "zeroize", +] + [[package]] name = "security-framework" version = "0.4.4" @@ -4629,11 +4672,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0eddf2e8f50ced781f288c19f18621fa72a3779e3cb58dbf23b07469b0abeb4" +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + [[package]] name = "serde" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" +checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5" dependencies = [ "serde_derive", ] @@ -4658,21 +4707,11 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_cbor" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -dependencies = [ - "half", - "serde", -] - [[package]] name = "serde_derive" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" +checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48" dependencies = [ "proc-macro2", "quote", @@ -4681,9 +4720,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" +checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" dependencies = [ "itoa", "ryu", @@ -4704,8 +4743,8 @@ dependencies = [ [[package]] name = "sgx-ra" -version = "0.3.0" -source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.3.0#54b3227e8ad0f83699c8c843bf525ea9b7d23d64" +version = "0.4.0" +source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.4.0#cfdbd0601cdeb4bfac7524eab575ec600acdf8fa" dependencies = [ "advanca-crypto", "advanca-crypto-types", @@ -4713,9 +4752,9 @@ dependencies = [ "base16", "base64 0.12.3", "cmac", - "generic-array", + "generic-array 0.12.3", "hex", - "log 0.4.8", + "log 0.4.11", "memoffset", "rand 0.7.3", "reqwest", @@ -4860,10 +4899,23 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.7.3", + "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha-1" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -4878,23 +4930,35 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.7.3", + "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] name = "sha3" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" dependencies = [ - "block-buffer", - "byte-tools", - "digest", + "block-buffer 0.9.0", + "digest 0.9.0", "keccak", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -4903,6 +4967,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +[[package]] +name = "signature" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" + [[package]] name = "slab" version = "0.4.2" @@ -4953,9 +5023,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" +checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "smart-default" @@ -4968,40 +5038,6 @@ dependencies = [ "syn", ] -[[package]] -name = "smol" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620cbb3c6e34da57d3a248cda0cd01cd5848164dc062e764e65d06fe3ea7aed5" -dependencies = [ - "async-task", - "blocking", - "concurrent-queue", - "fastrand", - "futures-io", - "futures-util", - "libc", - "once_cell 1.4.0", - "scoped-tls", - "slab", - "socket2", - "wepoll-sys-stjepang", - "winapi 0.3.9", -] - -[[package]] -name = "snow" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb767eee7d257ba202f0b9b08673bc13b22281632ef45267b19f13100accd2f" -dependencies = [ - "arrayref", - "rand_core 0.5.1", - "ring", - "rustc_version", - "subtle 2.2.3", -] - [[package]] name = "socket2" version = "0.3.12" @@ -5022,25 +5058,40 @@ checksum = "1c9dab3f95c9ebdf3a88268c19af668f637a3c5039c2c56ff2d40b1b2d64a25b" dependencies = [ "base64 0.11.0", "bytes 0.5.6", - "flate2", "futures 0.3.5", "http 0.2.1", "httparse", - "log 0.4.8", + "log 0.4.11", "rand 0.7.3", "sha1", - "smallvec 1.4.1", + "smallvec 1.4.2", "static_assertions", "thiserror", ] +[[package]] +name = "soketto" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85457366ae0c6ce56bf05a958aef14cd38513c236568618edbcd9a8c52cb80b0" +dependencies = [ + "base64 0.12.3", + "bytes 0.5.6", + "flate2", + "futures 0.3.5", + "httparse", + "log 0.4.11", + "rand 0.7.3", + "sha-1 0.8.2", +] + [[package]] name = "sp-allocator" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", - "log 0.4.8", + "log 0.4.11", "sp-core", "sp-std", "sp-wasm-interface", @@ -5048,8 +5099,8 @@ dependencies = [ [[package]] name = "sp-api" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "hash-db", "parity-scale-codec", @@ -5063,8 +5114,8 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -5075,8 +5126,8 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "serde", @@ -5087,8 +5138,8 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "integer-sqrt", "num-traits", @@ -5100,8 +5151,8 @@ dependencies = [ [[package]] name = "sp-authority-discovery" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "sp-api", @@ -5112,8 +5163,8 @@ dependencies = [ [[package]] name = "sp-authorship" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -5123,8 +5174,8 @@ dependencies = [ [[package]] name = "sp-block-builder" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "sp-api", @@ -5135,31 +5186,40 @@ dependencies = [ [[package]] name = "sp-blockchain" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", - "log 0.4.8", + "log 0.4.11", "lru", "parity-scale-codec", "parking_lot 0.10.2", "sp-block-builder", "sp-consensus", + "sp-database", "sp-runtime", "sp-state-machine", ] +[[package]] +name = "sp-chain-spec" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "sp-consensus" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", "futures 0.3.5", - "futures-diagnose", "futures-timer 3.0.2", "libp2p", - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", "parking_lot 0.10.2", "serde", @@ -5168,17 +5228,26 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", + "sp-trie", + "sp-utils", "sp-version", + "substrate-prometheus-endpoint", + "wasm-timer", ] [[package]] -name = "sp-consensus-aura" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +name = "sp-consensus-babe" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "merlin", "parity-scale-codec", "sp-api", "sp-application-crypto", + "sp-consensus", + "sp-consensus-slots", + "sp-consensus-vrf", + "sp-core", "sp-inherents", "sp-runtime", "sp-std", @@ -5186,37 +5255,45 @@ dependencies = [ ] [[package]] -name = "sp-consensus-babe" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +name = "sp-consensus-slots" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "parity-scale-codec", + "sp-runtime", +] + +[[package]] +name = "sp-consensus-vrf" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "schnorrkel", - "sp-api", - "sp-application-crypto", - "sp-consensus", - "sp-inherents", + "sp-core", "sp-runtime", "sp-std", - "sp-timestamp", ] [[package]] name = "sp-core" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "base58", "blake2-rfc", - "byteorder 1.3.4", + "byteorder", + "derive_more", "ed25519-dalek", + "futures 0.3.5", "hash-db", "hash256-std-hasher", "hex", - "impl-serde 0.2.3", + "impl-serde 0.3.1", "lazy_static", "libsecp256k1", - "log 0.4.8", + "log 0.4.11", + "merlin", "num-traits", "parity-scale-codec", "parity-util-mem", @@ -5224,10 +5301,10 @@ dependencies = [ "primitive-types", "rand 0.7.3", "regex", - "rustc-hex", "schnorrkel", + "secrecy", "serde", - "sha2", + "sha2 0.8.2", "sp-debug-derive", "sp-externalities", "sp-runtime-interface", @@ -5238,13 +5315,22 @@ dependencies = [ "tiny-keccak", "twox-hash", "wasmi", - "zeroize 1.1.0", + "zeroize", +] + +[[package]] +name = "sp-database" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "kvdb", + "parking_lot 0.10.2", ] [[package]] name = "sp-debug-derive" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "proc-macro2", "quote", @@ -5253,31 +5339,35 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "environmental", + "parity-scale-codec", "sp-std", "sp-storage", ] [[package]] name = "sp-finality-grandpa" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "finality-grandpa", + "log 0.4.11", "parity-scale-codec", "serde", "sp-api", "sp-application-crypto", + "sp-core", "sp-runtime", "sp-std", ] [[package]] name = "sp-finality-tracker" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -5286,8 +5376,8 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", "parity-scale-codec", @@ -5298,26 +5388,29 @@ dependencies = [ [[package]] name = "sp-io" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "futures 0.3.5", "hash-db", "libsecp256k1", - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", + "parking_lot 0.10.2", "sp-core", "sp-externalities", "sp-runtime-interface", "sp-state-machine", "sp-std", + "sp-tracing", "sp-trie", "sp-wasm-interface", ] [[package]] name = "sp-keyring" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "lazy_static", "sp-core", @@ -5326,37 +5419,51 @@ dependencies = [ ] [[package]] -name = "sp-offchain" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +name = "sp-npos-elections" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ - "sp-api", - "sp-runtime", + "parity-scale-codec", + "serde", + "sp-arithmetic", + "sp-npos-elections-compact", + "sp-std", ] [[package]] -name = "sp-panic-handler" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +name = "sp-npos-elections-compact" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ - "backtrace", - "log 0.4.8", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "sp-phragmen" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +name = "sp-offchain" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ - "serde", + "sp-api", + "sp-core", "sp-runtime", - "sp-std", +] + +[[package]] +name = "sp-panic-handler" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "backtrace", + "log 0.4.11", ] [[package]] name = "sp-rpc" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "serde", "sp-core", @@ -5364,11 +5471,13 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "either", + "hash256-std-hasher", "impl-trait-for-tuples", - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", "parity-util-mem", "paste", @@ -5384,22 +5493,23 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "primitive-types", "sp-externalities", "sp-runtime-interface-proc-macro", "sp-std", + "sp-tracing", "sp-wasm-interface", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "Inflector", "proc-macro-crate", @@ -5410,8 +5520,8 @@ dependencies = [ [[package]] name = "sp-sandbox" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "sp-core", @@ -5423,8 +5533,8 @@ dependencies = [ [[package]] name = "sp-serializer" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "serde", "serde_json", @@ -5432,19 +5542,21 @@ dependencies = [ [[package]] name = "sp-session" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ + "parity-scale-codec", "sp-api", "sp-core", "sp-runtime", + "sp-staking", "sp-std", ] [[package]] name = "sp-staking" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -5453,15 +5565,17 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "hash-db", - "log 0.4.8", + "itertools 0.9.0", + "log 0.4.11", "num-traits", "parity-scale-codec", "parking_lot 0.10.2", "rand 0.7.3", + "smallvec 1.4.2", "sp-core", "sp-externalities", "sp-panic-handler", @@ -5472,15 +5586,16 @@ dependencies = [ [[package]] name = "sp-std" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" [[package]] name = "sp-storage" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "impl-serde 0.2.3", + "ref-cast", "serde", "sp-debug-derive", "sp-std", @@ -5488,8 +5603,8 @@ dependencies = [ [[package]] name = "sp-timestamp" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5500,24 +5615,35 @@ dependencies = [ "wasm-timer", ] +[[package]] +name = "sp-tracing" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "log 0.4.11", + "rental", + "tracing", +] + [[package]] name = "sp-transaction-pool" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "derive_more", "futures 0.3.5", - "log 0.4.8", + "log 0.4.11", "parity-scale-codec", "serde", "sp-api", + "sp-blockchain", "sp-runtime", ] [[package]] name = "sp-trie" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "hash-db", "memory-db", @@ -5528,10 +5654,22 @@ dependencies = [ "trie-root", ] +[[package]] +name = "sp-utils" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "futures 0.3.5", + "futures-core", + "futures-timer 3.0.2", + "lazy_static", + "prometheus", +] + [[package]] name = "sp-version" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -5542,8 +5680,8 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "2.0.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5557,6 +5695,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -5564,12 +5708,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "stream-cipher" -version = "0.3.2" +name = "statrs" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" +checksum = "10102ac8d55e35db2b3fafc26f81ba8647da2e15879ab686a67e6d19af2685e8" dependencies = [ - "generic-array", + "rand 0.5.6", ] [[package]] @@ -5589,9 +5733,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de2f5e239ee807089b62adce73e48c625e0ed80df02c7ab3f068f5db5281065c" +checksum = "de5472fb24d7e80ae84a7801b7978f95a19ec32cb1876faea59ab711eb901976" dependencies = [ "clap", "lazy_static", @@ -5600,9 +5744,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "510413f9de616762a4fbeab62509bf15c729603b72d7cd71280fbca431b1c118" +checksum = "1e0eb37335aeeebe51be42e2dc07f031163fbabfa6ac67d7ea68b5c2f68d5f99" dependencies = [ "heck", "proc-macro-error", @@ -5652,62 +5796,95 @@ dependencies = [ [[package]] name = "substrate-api" -version = "0.2.0" +version = "0.3.0" dependencies = [ - "advanca-core", - "advanca-runtime", + "advanca-node-primitives", + "async-std", "env_logger", "hex", - "log 0.4.8", + "log 0.4.11", + "pallet-balances", "parity-scale-codec", "sp-core", "sp-keyring", - "substrate-api-client", + "sp-runtime", + "substrate-subxt", ] [[package]] -name = "substrate-api-client" -version = "2.0.0" -source = "git+https://github.com/advanca/substrate-api-client?rev=1231a987dcfe5610ddbd32ada6f95aecc4f90ec9#1231a987dcfe5610ddbd32ada6f95aecc4f90ec9" +name = "substrate-bip39" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c004e8166d6e0aa3a9d5fa673e5b7098ff25f930de1013a21341988151e681bb" dependencies = [ - "env_logger", + "hmac", + "pbkdf2", + "schnorrkel", + "sha2 0.8.2", +] + +[[package]] +name = "substrate-prometheus-endpoint" +version = "0.8.0-rc5" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" +dependencies = [ + "async-std", + "derive_more", + "futures-util", + "hyper 0.13.7", + "log 0.4.11", + "prometheus", + "tokio 0.2.22", +] + +[[package]] +name = "substrate-subxt" +version = "0.11.0" +source = "git+https://github.com/advanca/substrate-subxt/?rev=d86bad44a3281c9eb0630d8b166885200f1fa150#d86bad44a3281c9eb0630d8b166885200f1fa150" +dependencies = [ + "advanca-node-primitives", "frame-metadata", "frame-support", - "frame-system", + "futures 0.3.5", "hex", - "log 0.4.8", - "node-primitives", + "jsonrpsee", + "log 0.4.11", + "num-traits", "pallet-balances", "pallet-indices", "parity-scale-codec", - "primitive-types", + "sc-rpc-api", "serde", "serde_json", "sp-core", - "sp-io", + "sp-rpc", "sp-runtime", - "sp-std", + "sp-transaction-pool", "sp-version", + "substrate-subxt-proc-macro", "thiserror", - "ws", + "url 2.1.1", ] [[package]] -name = "substrate-bip39" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be511be555a3633e71739a79e4ddff6a6aaa6579fa6114182a51d72c3eb93c5" +name = "substrate-subxt-proc-macro" +version = "0.11.0" +source = "git+https://github.com/advanca/substrate-subxt/?rev=d86bad44a3281c9eb0630d8b166885200f1fa150#d86bad44a3281c9eb0630d8b166885200f1fa150" dependencies = [ - "hmac", - "pbkdf2", - "schnorrkel", - "sha2", + "heck", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "sp-keyring", + "syn", + "synstructure", ] [[package]] name = "substrate-wasm-builder-runner" -version = "1.0.5" -source = "git+https://github.com/paritytech/substrate?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f82539e2f78e8ddbcd98aea512c87c5f3c" +version = "1.0.6" +source = "git+https://github.com/paritytech/substrate?tag=v2.0.0-rc5+2#1502626e45a704d1e2852e38ad669687ef02f68b" [[package]] name = "subtle" @@ -5723,26 +5900,15 @@ checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" [[package]] name = "syn" -version = "1.0.34" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b" +checksum = "e69abc24912995b3038597a7a593be5053eb0fb44f3cc5beec0deb421790c1f4" dependencies = [ "proc-macro2", "quote", "unicode-xid", ] -[[package]] -name = "syn-mid" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "synstructure" version = "0.12.4" @@ -5795,18 +5961,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13f926965ad00595dd129fa12823b04bbf866e9085ab0a5f2b05b850fbfc344" +checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "893582086c2f98cde18f906265a65b5030a074b1046c674ae898be6519a7f479" +checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" dependencies = [ "proc-macro2", "quote", @@ -5834,17 +6000,18 @@ dependencies = [ [[package]] name = "tiny-bip39" -version = "0.6.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1c5676413eaeb1ea35300a0224416f57abc3bd251657e0fafc12c47ff98c060" +checksum = "b0165e045cc2ae1660270ca65e1676dbaab60feb0f91b10f7d0665e9b47e31f2" dependencies = [ "failure", - "hashbrown 0.1.8", "hmac", - "once_cell 0.1.8", + "once_cell", "pbkdf2", - "rand 0.6.5", - "sha2", + "rand 0.7.3", + "rustc-hash", + "sha2 0.8.2", + "unicode-normalization", ] [[package]] @@ -5858,9 +6025,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" +checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" [[package]] name = "tokio" @@ -5888,9 +6055,9 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" dependencies = [ "bytes 0.5.6", "fnv", @@ -5965,7 +6132,7 @@ checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" dependencies = [ "bytes 0.4.12", "futures 0.1.29", - "log 0.4.8", + "log 0.4.11", ] [[package]] @@ -5977,7 +6144,7 @@ dependencies = [ "crossbeam-utils", "futures 0.1.29", "lazy_static", - "log 0.4.8", + "log 0.4.11", "mio", "num_cpus", "parking_lot 0.9.0", @@ -6022,7 +6189,7 @@ dependencies = [ "crossbeam-utils", "futures 0.1.29", "lazy_static", - "log 0.4.8", + "log 0.4.11", "num_cpus", "slab", "tokio-executor", @@ -6058,7 +6225,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" dependencies = [ "native-tls", - "tokio 0.2.21", + "tokio 0.2.22", ] [[package]] @@ -6069,7 +6236,7 @@ checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" dependencies = [ "bytes 0.4.12", "futures 0.1.29", - "log 0.4.8", + "log 0.4.11", "mio", "tokio-codec", "tokio-io", @@ -6086,7 +6253,7 @@ dependencies = [ "futures 0.1.29", "iovec", "libc", - "log 0.4.8", + "log 0.4.11", "mio", "mio-uds", "tokio-codec", @@ -6103,9 +6270,9 @@ dependencies = [ "bytes 0.5.6", "futures-core", "futures-sink", - "log 0.4.8", + "log 0.4.11", "pin-project-lite", - "tokio 0.2.21", + "tokio 0.2.22", ] [[package]] @@ -6125,21 +6292,21 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.16" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" +checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" dependencies = [ "cfg-if", - "log 0.4.8", + "log 0.4.11", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" +checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada" dependencies = [ "proc-macro2", "quote", @@ -6148,9 +6315,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.11" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f" +checksum = "db63662723c316b43ca36d833707cc93dff82a02ba3d7e354f342682cc8b3545" dependencies = [ "lazy_static", ] @@ -6163,15 +6330,15 @@ checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" [[package]] name = "trie-db" -version = "0.20.1" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc309f34008563989045a4c4dbcc5770467f3a3785ee80a9b5cc0d83362475f" +checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0" dependencies = [ "hash-db", - "hashbrown 0.6.3", - "log 0.4.8", + "hashbrown 0.8.2", + "log 0.4.11", "rustc-hex", - "smallvec 1.4.1", + "smallvec 1.4.2", ] [[package]] @@ -6189,17 +6356,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "twofish" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712d261e83e727c8e2dbb75dacac67c36e35db36a958ee504f2164fc052434e1" -dependencies = [ - "block-cipher-trait", - "byteorder 1.3.4", - "opaque-debug", -] - [[package]] name = "twox-hash" version = "1.5.0" @@ -6223,11 +6379,11 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" +checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" dependencies = [ - "byteorder 1.3.4", + "byteorder", "crunchy", "rustc-hex", "static_assertions", @@ -6289,13 +6445,15 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unsigned-varint" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f67332660eb59a6f1eb24ff1220c9e8d01738a8503c6002e30bcfe4bd9f2b4a9" -dependencies = [ - "bytes 0.5.6", - "futures_codec", -] +checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5" + +[[package]] +name = "unsigned-varint" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a98e44fc6af1e18c3a06666d829b4fd8d2714fb2dbffe8ab99d5dc7ea6baa628" [[package]] name = "untrusted" @@ -6331,6 +6489,12 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" +[[package]] +name = "vec-arena" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cb18268690309760d59ee1a9b21132c126ba384f374c59a94db4bc03adeb561" + [[package]] name = "vec_map" version = "0.8.2" @@ -6379,7 +6543,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" dependencies = [ "futures 0.1.29", - "log 0.4.8", + "log 0.4.11", "try-lock", ] @@ -6389,7 +6553,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "log 0.4.8", + "log 0.4.11", "try-lock", ] @@ -6401,9 +6565,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.64" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a634620115e4a229108b71bde263bb4220c483b3f07f5ba514ee8d15064c4c2" +checksum = "f0563a9a4b071746dd5aedbc3a28c6fe9be4586fb3fbadb67c400d4f53c6b16c" dependencies = [ "cfg-if", "serde", @@ -6413,13 +6577,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.64" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e53963b583d18a5aa3aaae4b4c1cb535218246131ba22a71f05b518098571df" +checksum = "bc71e4c5efa60fb9e74160e89b93353bc24059999c0ae0fb03affc39770310b0" dependencies = [ "bumpalo", "lazy_static", - "log 0.4.8", + "log 0.4.11", "proc-macro2", "quote", "syn", @@ -6428,9 +6592,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba48d66049d2a6cc8488702e7259ab7afc9043ad0dc5448444f46f2a453b362" +checksum = "95f8d235a77f880bcef268d379810ea6c0af2eacfa90b1ad5af731776e0c4699" dependencies = [ "cfg-if", "js-sys", @@ -6440,9 +6604,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.64" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fcfd5ef6eec85623b4c6e844293d4516470d8f19cd72d0d12246017eb9060b8" +checksum = "97c57cefa5fa80e2ba15641578b44d36e7a64279bc5ed43c6dbaf329457a2ed2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6450,9 +6614,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.64" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9adff9ee0e94b926ca81b57f57f86d5545cdcb1d259e21ec9bdd95b901754c75" +checksum = "841a6d1c35c6f596ccea1f82504a192a60378f64b3bb0261904ad8f2f5657556" dependencies = [ "proc-macro2", "quote", @@ -6463,9 +6627,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.64" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7b90ea6c632dd06fd765d44542e234d5e63d9bb917ecd64d79778a13bd79ae" +checksum = "93b162580e34310e5931c4b792560108b10fd14d64915d7fff8ff00180e70092" [[package]] name = "wasm-timer" @@ -6477,7 +6641,7 @@ dependencies = [ "js-sys", "parking_lot 0.9.0", "pin-utils", - "send_wrapper", + "send_wrapper 0.2.0", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -6508,9 +6672,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.41" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863539788676619aac1a23e2df3655e96b32b0e05eb72ca34ba045ad573c625d" +checksum = "dda38f4e5ca63eda02c059d243aa25b5f35ab98451e518c51612cd0f1bd19a47" dependencies = [ "js-sys", "wasm-bindgen", @@ -6544,6 +6708,15 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739" +dependencies = [ + "webpki", +] + [[package]] name = "websocket" version = "0.24.0" @@ -6573,7 +6746,7 @@ checksum = "5e3810f0d00c4dccb54c30a4eee815e703232819dec7b007db115791c42aa374" dependencies = [ "base64 0.10.1", "bitflags", - "byteorder 1.3.4", + "byteorder", "bytes 0.4.12", "futures 0.1.29", "native-tls", @@ -6679,24 +6852,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "ws" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329d3e6dd450a9c5c73024e1047f0be7e24121a68484eb0b5368977bee3cf8c3" -dependencies = [ - "byteorder 1.3.4", - "bytes 0.4.12", - "httparse", - "log 0.4.8", - "mio", - "mio-extras", - "rand 0.4.6", - "sha1", - "slab", - "url 1.7.2", -] - [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -6707,37 +6862,6 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "x25519-dalek" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee1585dc1484373cbc1cee7aafda26634665cf449436fd6e24bfd1fad230538" -dependencies = [ - "clear_on_drop", - "curve25519-dalek 1.2.4", - "rand_core 0.3.1", -] - -[[package]] -name = "yamux" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd37e58a1256a0b328ce9c67d8b62ecdd02f4803ba443df478835cb1a41a637c" -dependencies = [ - "futures 0.3.5", - "log 0.4.8", - "nohash-hasher", - "parking_lot 0.10.2", - "rand 0.7.3", - "static_assertions", -] - -[[package]] -name = "zeroize" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" - [[package]] name = "zeroize" version = "1.1.0" diff --git a/Cargo.toml b/Cargo.toml index 222c759..213474b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,9 @@ exclude = [ #substrate-api-client = { path = "../substrate-api-client" } #[patch.'https://github.com/advanca/advanca-sgx-helper'] -#advanca-crypto-types = { path = "../advanca-sgx-helper/advanca-crypto-types" } +#advanca-crypto = { path = "../../advanca-sgx-helper/advanca-crypto" } +#advanca-crypto-types = { path = "../../advanca-sgx-helper/advanca-crypto-types" } +#advanca-macros = { path = "../../advanca-sgx-helper/advanca-macros" } [patch.crates-io] protobuf-build = { rev = "1c76baf642c9abc6428c94c66f4f16304c77950e", git = "https://github.com/advanca/protobuf-build.git" } diff --git a/app/Cargo.toml b/app/Cargo.toml index 301653e..ceaa8a0 100644 --- a/app/Cargo.toml +++ b/app/Cargo.toml @@ -10,7 +10,6 @@ version = "0.4.0" log = "0.4" env_logger = "0.7.1" serde_json = "1.0" -serde_cbor = { version = "0.11.1"} hex = "0.4.2" futures = "0.3" grpcio = { rev = "249e21b3593a8bdd58429d2552b9ab72d6d46526", git = "https://github.com/tikv/grpc-rs.git", default-features = false, features = ["openssl", "protobuf-codec"] } @@ -21,30 +20,35 @@ structopt = "0.3" jsonrpsee = { version = "0.1", features = ["ws"] } async-std = { version = "1" } -sp-core = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} -sp-keyring = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} -sp-runtime = {rev = '00a400f82539e2f78e8ddbcd98aea512c87c5f3c', git = 'https://github.com/paritytech/substrate.git'} +sp-core = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate"} +sp-keyring = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate"} +sp-runtime = { tag = "v2.0.0-rc5+2", git = 'https://github.com/paritytech/substrate.git'} # use the pinned substrate revision's primitive type version -primitive-types = "0.6.2" +primitive-types = "0.7.2" sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" } sgx_urts = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" } sgx_tseal = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" } sgx_crypto_helper = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" } -advanca-macros = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-sgx-helper" } -advanca-crypto = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-sgx-helper" } -advanca-crypto-types = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-sgx-helper" } -sgx-ra = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-sgx-helper" } -advanca-runtime = { tag = "v0.2.0", git = "https://github.com/advanca/advanca-node/" } -advanca-core = { tag = "v0.2.0", git = "https://github.com/advanca/advanca-node/" } +advanca-macros = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-sgx-helper" } +advanca-crypto = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-sgx-helper", features = ["std_env"] } +advanca-crypto-types = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-sgx-helper", features = ["std_env"] } +sgx-ra = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-sgx-helper" } +advanca-node-primitives = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-node/" } -aas-protos-std = { tag = "v0.2.0", git = "https://github.com/advanca/advanca-attestation-service" } +#advanca-macros = { path = "../../../advanca-sgx-helper/advanca-macros/" } +#advanca-crypto = { path = "../../../advanca-sgx-helper/advanca-crypto/", features = ["std_env"] } +#advanca-crypto-types = { path = "../../../advanca-sgx-helper/advanca-crypto-types/", features = ["std_env"] } +#sgx-ra = { path = "../../../advanca-sgx-helper/sgx-ra" } +#advanca-node-primitives = { path = "../../advanca-node/advanca-node-primitives/" } + +aas-protos-std = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-attestation-service" } worker-protos-std = { path = "../worker-protos/worker-protos-std" } [dependencies.codec] package = "parity-scale-codec" -version = "1.0.0" +version = "1.3.0" [dependencies.substrate-api] path = "../substrate-api" diff --git a/app/src/enclave/mod.rs b/app/src/enclave/mod.rs index fd3fae5..3610c0b 100644 --- a/app/src/enclave/mod.rs +++ b/app/src/enclave/mod.rs @@ -112,23 +112,25 @@ pub fn init() -> SgxResult { Ok(enclave) } -pub fn sr25519_public_key(eid: sgx_enclave_id_t) -> SgxResult> { - let public_key_size = 32; - let mut public_key = vec![0u8; public_key_size as usize]; +pub fn enclave_sr25519_public_key(eid: sgx_enclave_id_t) -> SgxResult { + let mut buf_size = 1024; + let mut buf = vec![0_u8; buf_size]; let _ = unsafe { handle_ecall!( eid, - get_sr25519_public_key(public_key.as_mut_ptr(), public_key_size) + get_worker_sr25519_pubkey(buf.as_mut_ptr(), &mut buf_size) ) .unwrap() }; - Ok(public_key) + let publickey: Sr25519PublicKey = serde_json::from_slice(&buf[..buf_size]).unwrap(); + + Ok(publickey) } pub fn create_storage(eid: sgx_enclave_id_t, owner: Secp256r1PublicKey) -> SgxError { - let public_key_bytes = serde_cbor::to_vec(&owner).unwrap(); + let public_key_bytes = serde_json::to_vec(&owner).unwrap(); // we'll keep the current interface let mut status = sgx_status_t::SGX_SUCCESS; diff --git a/app/src/main.rs b/app/src/main.rs index de1d690..f006169 100644 --- a/app/src/main.rs +++ b/app/src/main.rs @@ -13,7 +13,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::convert::TryFrom; use std::str; use std::sync::mpsc; use std::thread; @@ -29,8 +28,7 @@ use sp_keyring::AccountKeyring; use substrate_api::SubstrateApi; -use advanca_core::Enclave; -use advanca_runtime::AccountId; +use advanca_node_primitives::{AccountId, Enclave}; mod enclave; mod grpc; @@ -96,6 +94,16 @@ struct Opt { aas_url: String, } +fn display_balance(account_id: AccountId, api: &SubstrateApi) { + let accountdata = api.get_balance(account_id); + info!("{:=^80}", "Worker Balance Information"); + info!("Free : {:?}", accountdata.free); + info!("Reserved : {:?}", accountdata.reserved); + info!("Misc Frozen : {:?}", accountdata.misc_frozen); + info!("Fee Frozen : {:?}", accountdata.fee_frozen); + info!("{:=^80}", ""); +} + async fn aas_remote_attest( client: Arc>, eid: sgx_enclave_id_t, @@ -185,7 +193,7 @@ async fn aas_remote_attest( // aas accepted our attestation, we'll prepare the request let mut buf = [0_u8; 4096]; let mut buf_size: usize = buf.len(); - let _ = unsafe { handle_ecall!(eid, gen_worker_ec256_pubkey()).unwrap() }; + let _ = unsafe { handle_ecall!(eid, gen_worker_key()).unwrap() }; let _ = unsafe { handle_ecall!( eid, @@ -205,7 +213,7 @@ async fn aas_remote_attest( assert_eq!(msg_aas_report.get_msg_type(), MsgType::AAS_RA_REG_REPORT); let aas_report_bytes = msg_aas_report.get_msg_bytes(); - let aas_report: AasRegReport = serde_cbor::from_slice(aas_report_bytes).unwrap(); + let aas_report: AasRegReport = serde_json::from_slice(aas_report_bytes).unwrap(); // 04:1a:4f:ea:0d:04:bd:ed:7d:c1:43:ee:74:cb:8e: // 56:9e:6e:49:1c:89:bc:d6:5c:34:8f:8a:5b:40:5f: // 79:53:e3:89:7d:0f:0c:bc:cf:f0:45:ce:c9:a9:1d: @@ -306,12 +314,31 @@ fn main() { ) .unwrap() }; - let worker_pubkey: Secp256r1PublicKey = serde_cbor::from_slice(&buf[..buf_size]).unwrap(); - info!("ec256 pubkey generated {:?}", worker_pubkey); + let enclave_sec256p1_pubkey: Secp256r1PublicKey = + serde_json::from_slice(&buf[..buf_size]).unwrap(); + info!("ec256 pubkey generated {:?}", enclave_sec256p1_pubkey); + + buf_size = buf.len(); + let _ = unsafe { + handle_ecall!( + eid, + get_worker_sr25519_pubkey(buf.as_mut_ptr(), &mut buf_size) + ) + .unwrap() + }; + let enclave_sr25519_pubkey: Sr25519PublicKey = + serde_json::from_slice(&buf[..buf_size]).unwrap(); + info!( + "enclave sr25519 pubkey generated {:?}", + enclave_sr25519_pubkey + ); let (worker_keypair, _) = sr25519::Pair::generate(); let worker_account: AccountId = worker_keypair.public().as_array_ref().to_owned().into(); - info!("sr25519 keypair generated {:?}", worker_keypair.public()); + info!( + "worker sr25519 keypair generated {:?}", + worker_keypair.public() + ); // inject funds into worker account fund_account(&opt.ws_url, &worker_account); @@ -320,22 +347,30 @@ fn main() { let mut api = SubstrateApi::new(&opt.ws_url); api.set_signer(worker_keypair.clone()); + display_balance(worker_account.clone(), &api); + // get the keys from enclave - let sr25519_public_key = sr25519::Public::try_from( - &enclave::sr25519_public_key(e.geteid()).expect("enclave sr25519 public key")[..], - ) - .unwrap(); //.try_into().unwrap(); + let sr25519_public_key = enclave::enclave_sr25519_public_key(e.geteid()) + .expect("enclave sr25519 public key") + .to_schnorrkel_public(); + + let enclave_pubkeys = advanca_node_primitives::PublicKeys { + secp256r1_public_key: serde_json::to_vec(&enclave_sec256p1_pubkey).unwrap(), + sr25519_public_key: serde_json::to_vec(&enclave_sr25519_pubkey).unwrap(), + }; let enclave = Enclave:: { - account_id: sr25519_public_key.as_array_ref().to_owned().into(), - public_key: serde_cbor::to_vec(&worker_pubkey).unwrap(), - attestation: serde_cbor::to_vec(&aas_report).unwrap(), + account_id: sr25519_public_key.to_bytes().to_owned().into(), + public_keys: enclave_pubkeys, + attestation: serde_json::to_vec(&aas_report).unwrap(), }; info!("registering worker ..."); let hash = api.register_worker(10, enclave); info!("registered worker (extrinsic={:?})", hash); + display_balance(worker_account.clone(), &api); + // listen for new task info!("listening for new task ..."); let task_id = api.listen_for_task_submitted(); @@ -360,10 +395,11 @@ fn main() { let user = api.get_user(owner.clone()); info!("received user information (id={})", owner.clone()); - let user_pubkey: Secp256r1PublicKey = serde_cbor::from_slice(&user.public_key).unwrap(); + let user_pubkey: Secp256r1PublicKey = + serde_json::from_slice(&user.public_keys.secp256r1_public_key).unwrap(); info!("user public_key: {:?}", user_pubkey); let signed_owner_task_pubkey: Secp256r1SignedMsg = - serde_cbor::from_slice(&task.signed_owner_task_pubkey).unwrap(); + serde_json::from_slice(&task.signed_owner_task_secp256r1_pubkey).unwrap(); let verified = secp256r1_verify_msg(&user_pubkey, &signed_owner_task_pubkey).unwrap(); info!("verifying owner task pubkey ... {:?}", verified); assert_eq!(verified, true); @@ -387,10 +423,32 @@ fn main() { get_task_ec256_pubkey(buf.as_mut_ptr(), &mut buf_size, task_id.as_ptr()) ) }; - let signed_task_pubkey: Secp256r1SignedMsg = serde_cbor::from_slice(&buf[..buf_size]).unwrap(); - let signed_task_pubkey_bytes = serde_cbor::to_vec(&signed_task_pubkey).unwrap(); + let signed_enclave_task_secp256r1_pubkey: Secp256r1SignedMsg = + serde_json::from_slice(&buf[..buf_size]).unwrap(); + let signed_enclave_task_secp256r1_pubkey_bytes = + serde_json::to_vec(&signed_enclave_task_secp256r1_pubkey).unwrap(); debug!("user public key is {:?}", user_pubkey); - debug!("signed task public key is {:?}", signed_task_pubkey); + debug!( + "signed task public key is {:?}", + signed_enclave_task_secp256r1_pubkey + ); + + buf_size = buf.len(); + let _ = unsafe { + handle_ecall!( + eid, + get_task_sr25519_pubkey(buf.as_mut_ptr(), &mut buf_size, task_id.as_ptr()) + ) + }; + let signed_enclave_task_sr25519_pubkey: Sr25519SignedMsg = + serde_json::from_slice(&buf[..buf_size]).unwrap(); + let signed_enclave_task_sr25519_pubkey_bytes = + serde_json::to_vec(&signed_enclave_task_sr25519_pubkey).unwrap(); + debug!("user public key is {:?}", user_pubkey); + debug!( + "signed task public key is {:?}", + signed_enclave_task_sr25519_pubkey + ); let msg = opt.grpc_url.as_bytes(); debug!("url: {:?}", opt.grpc_url); @@ -410,7 +468,7 @@ fn main() { ) .unwrap() }; - let url_encrypted: Aes128EncryptedMsg = serde_cbor::from_slice(&buf[..buf_size]).unwrap(); + let url_encrypted: Aes128EncryptedMsg = serde_json::from_slice(&buf[..buf_size]).unwrap(); debug!("msg len: {:?}", msg.len()); debug!("ivcipher len: {:?}", buf_size); debug!("url_encrypted: {:?}", url_encrypted); @@ -449,8 +507,9 @@ fn main() { ); let hash = api_wrapper.lock().unwrap().accept_task( task_id, - signed_task_pubkey_bytes, - serde_cbor::to_vec(&url_encrypted).unwrap(), + signed_enclave_task_secp256r1_pubkey_bytes, + signed_enclave_task_sr25519_pubkey_bytes, + serde_json::to_vec(&url_encrypted).unwrap(), ); info!("accepted task (extrinsic={:?})", hash); @@ -469,6 +528,11 @@ fn main() { .expect("Couldn't join on the watchdog"); info!("watchdong killed"); + api_wrapper.lock().unwrap().complete_task(task_id); + info!("complete task: {:?}", task_id); + + display_balance(worker_account.clone(), &api_wrapper.lock().unwrap()); + let sgx_return = unsafe { enclave_ra_close(eid, &mut retval, ra_context) }; info!("enclave_ra_close: {}", sgx_return); info!("freeing ra_context: {}", ra_context); diff --git a/app/src/watchdog.rs b/app/src/watchdog.rs index 6c4f3eb..48c7b8c 100644 --- a/app/src/watchdog.rs +++ b/app/src/watchdog.rs @@ -48,22 +48,22 @@ pub fn print_task_stats(task_id: H256, api: Arc>) { trace!("{:?}", worker_info); debug!("verifying worker's attestation report"); let worker_attestation_report = - serde_cbor::from_slice(&worker_info.enclave.attestation).unwrap(); + serde_json::from_slice(&worker_info.enclave.attestation).unwrap(); assert_eq!( true, aas_verify_reg_report(&AAS_PUB_KEY, &worker_attestation_report).unwrap() ); - debug!("get worker's attested pubkey"); - let worker_pubkey: Secp256r1PublicKey = worker_attestation_report.worker_pubkey; - debug!("verifying worker's task pubkey"); - let signed_worker_task_pubkey = - serde_cbor::from_slice(&task.signed_worker_task_pubkey.unwrap()).unwrap(); + debug!("get enclave's attested pubkey"); + let enclave_sr25519_pubkey: Sr25519PublicKey = worker_attestation_report.enclave_sr25519_pubkey; + debug!("verifying enclave's task secp256r1 pubkey"); + let signed_enclave_task_sr25519_pubkey = + serde_json::from_slice(&task.signed_enclave_task_sr25519_pubkey.unwrap()).unwrap(); assert_eq!( true, - secp256r1_verify_msg(&worker_pubkey, &signed_worker_task_pubkey).unwrap() + sr25519_verify_msg(&enclave_sr25519_pubkey, &signed_enclave_task_sr25519_pubkey).unwrap() ); - let worker_task_pubkey: Secp256r1PublicKey = - serde_cbor::from_slice(&signed_worker_task_pubkey.msg).unwrap(); + let enclave_task_sr25519_pubkey: Sr25519PublicKey = + serde_json::from_slice(&signed_enclave_task_sr25519_pubkey.msg).unwrap(); debug!("iterating over the evidences ..."); let mut verified_evidence = 0; let mut alive_blocks = HashSet::new(); @@ -73,20 +73,20 @@ pub fn print_task_stats(task_id: H256, api: Arc>) { let mut data_in = 0; let mut data_out = 0; for evidence_bytes in task.worker_heartbeat_evidence { - let signed_timestamp: Secp256r1SignedMsg = serde_cbor::from_slice(&evidence_bytes).unwrap(); + let signed_timestamp: Secp256r1SignedMsg = serde_json::from_slice(&evidence_bytes).unwrap(); trace!("verifying aas timestamp..."); assert_eq!( true, secp256r1_verify_msg(&AAS_PUB_KEY, &signed_timestamp).unwrap() ); - let timestamp: AasTimestamp = serde_cbor::from_slice(&signed_timestamp.msg).unwrap(); + let timestamp: AasTimestamp = serde_json::from_slice(&signed_timestamp.msg).unwrap(); trace!("verifying signed evidence ..."); - let signed_evidence: Secp256r1SignedMsg = serde_cbor::from_slice(×tamp.data).unwrap(); + let signed_evidence: Sr25519SignedMsg = serde_json::from_slice(×tamp.data).unwrap(); assert_eq!( true, - secp256r1_verify_msg(&worker_task_pubkey, &signed_evidence).unwrap() + sr25519_verify_msg(&enclave_task_sr25519_pubkey, &signed_evidence).unwrap() ); - let evidence: AliveEvidence = serde_cbor::from_slice(&signed_evidence.msg).unwrap(); + let evidence: AliveEvidence = serde_json::from_slice(&signed_evidence.msg).unwrap(); trace!("Evidence: {:?}", evidence); alive_blocks.insert(evidence.block_hash.clone()); storage_in = evidence.storage_in; @@ -155,10 +155,10 @@ pub fn watchdog_loop( .timestamp(×tamp_request) .unwrap(); let timestamp: Secp256r1SignedMsg = - serde_cbor::from_slice(×tamp_response.signed_data).unwrap(); + serde_json::from_slice(×tamp_response.signed_data).unwrap(); trace!("timestamp response: {:?}", timestamp); // save to vec, prepare to post to chain when watching ends - alive_evidence.push(serde_cbor::to_vec(×tamp).unwrap()); + alive_evidence.push(serde_json::to_vec(×tamp).unwrap()); if *is_done.lock().unwrap() { break; } diff --git a/app/src/worker_teaclave_ecall.rs b/app/src/worker_teaclave_ecall.rs index 65f3f54..583d10e 100644 --- a/app/src/worker_teaclave_ecall.rs +++ b/app/src/worker_teaclave_ecall.rs @@ -16,12 +16,6 @@ extern "C" { response_capacity: u32, response_size: *mut u32, ) -> sgx_status_t; - pub fn get_sr25519_public_key( - eid: sgx_enclave_id_t, - retval: *mut sgx_status_t, - public_key: *mut u8, - public_key_size: u32, - ) -> sgx_status_t; pub fn enclave_init_ra( eid: sgx_enclave_id_t, retval: *mut sgx_status_t, @@ -41,9 +35,19 @@ extern "C" { msg: *const u8, msg_len: usize, ) -> sgx_status_t; - pub fn gen_worker_ec256_pubkey( + pub fn gen_worker_key(eid: sgx_enclave_id_t, retval: *mut sgx_status_t) -> sgx_status_t; + pub fn get_worker_sr25519_pubkey( + eid: sgx_enclave_id_t, + retval: *mut sgx_status_t, + ubuf: *mut u8, + ubuf_size: *mut usize, + ) -> sgx_status_t; + pub fn get_task_sr25519_pubkey( eid: sgx_enclave_id_t, retval: *mut sgx_status_t, + ubuf: *mut u8, + ubuf_size: *mut usize, + task_id: *const u8, ) -> sgx_status_t; pub fn get_worker_ec256_pubkey( eid: sgx_enclave_id_t, diff --git a/client/Cargo.toml b/client/Cargo.toml index c3a220e..db8b6c3 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -18,36 +18,39 @@ log = "0.4.8" hex = "0.4.2" error-chain = "0.12" serde = { version = "1.0", features = ["derive"]} -serde_cbor = "0.11.1" serde_json = "1" protobuf = "=2.8.1" structopt = "0.3" -node-primitives = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} -sc-rpc = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} -sp-core = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} -sp-runtime = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} -sp-keyring = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} -node-runtime = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} +node-primitives = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate"} +sc-rpc = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate"} +sp-core = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate"} +sp-runtime = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate"} +sp-keyring = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate"} +node-runtime = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate"} sgx_crypto_helper = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" } sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" } sgx_ucrypto = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" } -advanca-crypto-types = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-sgx-helper" } -advanca-crypto = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-sgx-helper", features=["std_env"] } -advanca-core = { tag = "v0.2.0", git = "https://github.com/advanca/advanca-node/" } -advanca-runtime = { tag = "v0.2.0", git = "https://github.com/advanca/advanca-node/" } +advanca-crypto = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-sgx-helper/", features = ["std_env"] } +advanca-crypto-types = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-sgx-helper/", features = ["std_env"] } +advanca-node-primitives = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-node/" } +substrate-subxt = { rev = "d86bad44a3281c9eb0630d8b166885200f1fa150", git = "https://github.com/advanca/substrate-subxt/" } + +#advanca-crypto = { path = "../../../advanca-sgx-helper/advanca-crypto/", features = ["std_env"] } +#advanca-crypto-types = { path = "../../../advanca-sgx-helper/advanca-crypto-types/", features = ["std_env"] } +#advanca-node-primitives = { path = "../../advanca-node/advanca-node-primitives/" } +#substrate-subxt = { path = "../../../substrate-subxt" } worker-protos-std = { path = "../worker-protos/worker-protos-std" } -[dependencies.substrate-api-client] -git = "https://github.com/advanca/substrate-api-client" -rev = "1231a987dcfe5610ddbd32ada6f95aecc4f90ec9" +async-std = { version = "1.6.2", features = ["attributes"] } + +#[dependencies.substrate-subxt] +#git = 'https://github.com/advanca/substrate-subxt' +#rev = '41ef6db2f46ef9df64a627e3efc04a942def5d89' [dependencies.codec] package = "parity-scale-codec" -version = "1.0.0" - -[dependencies.substrate-api] -path = "../substrate-api" +version = "1.3.0" diff --git a/client/src/grpc.rs b/client/src/grpc.rs index 5688c16..4c73cdc 100644 --- a/client/src/grpc.rs +++ b/client/src/grpc.rs @@ -61,14 +61,14 @@ impl Client { { let plaintext = plain_req.write_to_bytes().unwrap(); let encrypted_msg = aes128gcm_encrypt(&key, &plaintext).unwrap(); - req.set_payload(serde_cbor::to_vec(&encrypted_msg).unwrap()); + req.set_payload(serde_json::to_vec(&encrypted_msg).unwrap()); } trace!("encrypted req {:?}", req); let res = self.storage_client.send(&req).unwrap(); { let ciphertext = res.get_payload(); let encrypted_msg_bytes = ciphertext.to_vec(); - let encrypted_msg = serde_cbor::from_slice(&encrypted_msg_bytes).unwrap(); + let encrypted_msg = serde_json::from_slice(&encrypted_msg_bytes).unwrap(); trace!("response payload {:?}", ciphertext); trace!("decryption key {:?}", key); let plaintext = aes128gcm_decrypt(&key, &encrypted_msg).unwrap(); diff --git a/client/src/main.rs b/client/src/main.rs index 01d08cf..6541fc3 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -12,37 +12,52 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - -use std::str; -use std::sync::mpsc::channel; -use std::thread; - use env_logger; -use env_logger::Builder; use hex; -use log::LevelFilter; use log::{debug, info, trace}; use structopt::StructOpt; use sp_core::{crypto::Pair, sr25519}; use sp_keyring::AccountKeyring; -use advanca_core::{Privacy, TaskSpec}; -use advanca_runtime::AccountId; -use substrate_api::SubstrateApi; - -use serde_cbor; +use advanca_node_primitives::{AccountId, Privacy, PublicKeys, TaskSpec}; use advanca_crypto::*; use advanca_crypto_types::*; +use substrate_subxt::{ + advanca::advanca_core::*, + advanca::AdvancaRuntime, + balances::{TransferCallExt, TransferEvent, TransferEventExt}, + system::AccountStoreExt, + Client, ClientBuilder, EventSubscription, EventsDecoder, PairSigner, +}; + mod grpc; /// helper function to fund the account -fn fund_account(ws_url: &str, account: &AccountId) { - let mut alice_api = SubstrateApi::new(ws_url); - alice_api.set_signer(AccountKeyring::Alice.pair()); - alice_api.transfer_balance(account.to_owned(), 1_000_000_000); +async fn fund_account(api: &Client, account: &AccountId) { + // Alice has initial balances so using it to fund 'account' + let alice = PairSigner::new(AccountKeyring::Alice.pair()); + trace!("funding account {:?}", account); + let result = api + .transfer_and_watch(&alice, &account, 1_000_000_000_000 as u128) + .await + .expect("extrinsic success"); + + trace!( + "confirmed extrinsic '{:?}' at block '{:?}'", + result.extrinsic, + result.block + ); + let event = result.transfer().expect("decode event").expect("has event"); + let expected_event = TransferEvent { + from: alice.signer().public().as_array_ref().to_owned().into(), + to: account.clone(), + amount: 1_000_000_000_000, + }; + assert_eq!(expected_event, event, "got expected event"); + trace!("fund_account done"); } #[derive(Debug, StructOpt)] @@ -57,17 +72,60 @@ struct Opt { ws_url: String, } -fn main() { +async fn display_balance( + account_id: AccountId, + api: &Client, +) -> Result<(), Box> { + let accountdata = api.account(&account_id, None).await?.data; + info!("{:=^80}", "Client Balance Information"); + info!("Free : {:?}", accountdata.free); + info!("Reserved : {:?}", accountdata.reserved); + info!("Misc Frozen : {:?}", accountdata.misc_frozen); + info!("Fee Frozen : {:?}", accountdata.fee_frozen); + info!("{:=^80}", ""); + Ok(()) +} + +async fn wait_for_event( + api: &Client, + predicate: P, +) -> Result<(), Box> +where + P: Fn(&E) -> bool, + R: AdvancaCore + substrate_subxt::Runtime, + E: substrate_subxt::Event + std::fmt::Debug, +{ + let sub = api.subscribe_events().await?; + let mut decoder = EventsDecoder::::new(api.metadata().clone()); + decoder.with_advanca_core(); + + let mut event_sub = EventSubscription::new(sub, decoder); + event_sub.filter_event::(); + + while let Some(result) = event_sub.next().await { + let event = E::decode(&mut &result?.data[..])?; + trace!("Received event {:?}", event); + if predicate(&event) { + trace!("Found the matched event"); + return Ok(()); + } + } + Err("Cannot find the matching event".into()) +} + +#[async_std::main] +async fn main() -> Result<(), Box> { let opt = Opt::from_args(); - let mut builder = Builder::from_default_env(); - builder - .default_format() - .format_level(true) - .format_module_path(false) - .format_timestamp(None) - .filter(Some("advanca_client"), LevelFilter::Debug) + env_logger::from_env(env_logger::Env::default().default_filter_or("advanca_client=debug")) .init(); + let api = ClientBuilder::::new() + .set_url(&opt.ws_url) + .build() + .await?; + info!("connected to advanca-node API"); + trace!("API Metadata:\n{}", api.metadata().pretty()); + // generate sr25519 keypair let (client_sr25519_keypair, _) = sr25519::Pair::generate(); let client_account: AccountId = client_sr25519_keypair @@ -81,85 +139,139 @@ fn main() { ); // fund the user account - fund_account(&opt.ws_url, &client_account); + fund_account(&api, &client_account).await; info!("funded account {:?}", client_account); // generate secp256r1 keypair for communication with worker let (prvkey, pubkey) = secp256r1_gen_keypair().unwrap(); + let (sr25519_prvkey, sr25519_pubkey) = sr25519_gen_keypair().unwrap(); info!("generated client ec256 keypair"); trace!("generated client ec256 keypair {:?}", prvkey.r); - let mut api = SubstrateApi::new(&opt.ws_url); - api.set_signer(client_sr25519_keypair.clone()); - info!("connected to advanca-node API"); + let public_keys = PublicKeys { + secp256r1_public_key: serde_json::to_vec(&pubkey).unwrap(), + sr25519_public_key: serde_json::to_vec(&sr25519_pubkey).unwrap(), + }; + + info!("generated client sr25519 keypair"); + trace!( + "generated client sr25519 keypair {:?}", + sr25519_prvkey.secret + ); + + let client_signer = PairSigner::new(client_sr25519_keypair.clone()); // register user info!("registering user ..."); - let public_key = serde_cbor::to_vec(&pubkey).unwrap(); + let public_key = serde_json::to_vec(&pubkey).unwrap(); info!("public_key bytes: {:?}", public_key); - let hash = api.register_user(1 as u128, public_key); - info!("registered user (extrinsic={:?})", hash); - let (task_in, task_out) = channel(); - let handle: thread::JoinHandle<_> = thread::spawn(move || { - let listener_api = SubstrateApi::new(&opt.ws_url); + let result = api + .register_user_and_watch(&client_signer, 1, public_keys) + .await + .expect("extrinsic success"); + info!("registered user (extrinsic={:?})", result.extrinsic); + display_balance(client_account.clone(), &api).await?; - task_in - .send(listener_api.listen_for_task_submitted()) - .unwrap(); - }); + info!("sleeping for 12 seconds..."); + async_std::task::sleep(std::time::Duration::from_secs(18)).await; // submit task - info!("generating ephemeral task key ..."); - let (owner_task_prvkey, owner_task_pubkey) = secp256r1_gen_keypair().unwrap(); - debug!("owner task prvkey: {:?}", owner_task_prvkey); - debug!("owner task pubkey: {:?}", owner_task_pubkey); - let signed_task_pubkey = - secp256r1_sign_msg(&prvkey, &serde_cbor::to_vec(&owner_task_pubkey).unwrap()).unwrap(); - info!("signed task pubkey ... {:?}", signed_task_pubkey); + info!("generating ephemeral task secp256r1 key ..."); + let (owner_task_secp256r1_prvkey, owner_task_secp256r1_pubkey) = + secp256r1_gen_keypair().unwrap(); + debug!( + "owner task secp256r1 prvkey: {:?}", + owner_task_secp256r1_prvkey + ); + debug!( + "owner task secp256r1 pubkey: {:?}", + owner_task_secp256r1_pubkey + ); + + info!("generating ephemeral task sr25519 key ..."); + let (owner_task_sr25519_prvkey, owner_task_sr25519_pubkey) = sr25519_gen_keypair().unwrap(); + debug!("owner task sr25519 prvkey: {:?}", owner_task_sr25519_prvkey); + debug!("owner task sr25519 pubkey: {:?}", owner_task_sr25519_pubkey); + + let signed_task_secp256r1_pubkey = secp256r1_sign_msg( + &prvkey, + &serde_json::to_vec(&owner_task_secp256r1_pubkey).unwrap(), + ) + .unwrap(); + info!( + "signed task secp256r1 pubkey ... {:?}", + signed_task_secp256r1_pubkey + ); + + let signed_task_sr25519_pubkey = sr25519_sign_msg( + &sr25519_prvkey, + &serde_json::to_vec(&owner_task_sr25519_pubkey).unwrap(), + ) + .unwrap(); + info!( + "signed task sr25519 pubkey ... {:?}", + signed_task_sr25519_pubkey + ); + info!("submitting task ..."); let mut task_spec: TaskSpec = Default::default(); task_spec.privacy = Privacy::Encryption; - let hash = api.submit_task( - serde_cbor::to_vec(&signed_task_pubkey).unwrap(), - 0, - task_spec, - ); - info!("task submitted (extrinsic={:?})", hash); + let result = api + .submit_task_and_watch( + &client_signer, + serde_json::to_vec(&signed_task_secp256r1_pubkey).unwrap(), + serde_json::to_vec(&signed_task_sr25519_pubkey).unwrap(), + 0, + task_spec, + ) + .await + .expect("extrinsic success"); + info!("task submitted (extrinsic={:?})", result.extrinsic); + display_balance(client_account.clone(), &api).await?; - let task_id = task_out.recv().unwrap(); - handle.join().unwrap(); + let task_id = result + .task_submitted() + .expect("decode event") + .expect("has event") + .task_id; + info!("task_id is {:?}", task_id); - // wait for the task to be accepted info!("waiting for the task to be accepted ..."); - api.wait_all_task_accepted(vec![task_id]); + wait_for_event(&api, |e: &TaskAcceptedEvent| { + e.task_id == task_id.clone() + }) + .await?; info!("task accepted, moving forward"); - let task = api.get_task(task_id); + let task = api.tasks(task_id, None).await?; let worker_id = task.worker.expect("There should be a worker ID"); info!("got a new worker (id={})", worker_id); info!("querying worker information ..."); - let worker = api.get_worker(worker_id); + let worker = api.workers(worker_id, None).await?; info!("received worker information"); - let enclave_public_key = serde_cbor::from_slice(&worker.enclave.public_key).unwrap(); - debug!("enclave public key is {:?}", enclave_public_key); + let enclave_secp256r1_public_key = + serde_json::from_slice(&worker.enclave.public_keys.secp256r1_public_key).unwrap(); + debug!("enclave public key is {:?}", enclave_secp256r1_public_key); - let signed_task_pubkey_bytes = task - .signed_worker_task_pubkey + let signed_task_secp256r1_pubkey_bytes = task + .signed_enclave_task_secp256r1_pubkey .expect("signed task pubkey should exist"); - let signed_task_pubkey: Secp256r1SignedMsg = - serde_cbor::from_slice(&signed_task_pubkey_bytes).unwrap(); + let signed_task_secp256r1_pubkey: Secp256r1SignedMsg = + serde_json::from_slice(&signed_task_secp256r1_pubkey_bytes).unwrap(); // verify that the task_pubkey is untampered - let verified = secp256r1_verify_msg(&enclave_public_key, &signed_task_pubkey).unwrap(); + let verified = + secp256r1_verify_msg(&enclave_secp256r1_public_key, &signed_task_secp256r1_pubkey).unwrap(); assert_eq!(verified, true); - let worker_task_pubkey: Secp256r1PublicKey = - serde_cbor::from_slice(&signed_task_pubkey.msg).unwrap(); - let kdk: Aes128Key = derive_kdk(&owner_task_prvkey, &worker_task_pubkey).unwrap(); + let enclave_task_secp256r1_pubkey: Secp256r1PublicKey = + serde_json::from_slice(&signed_task_secp256r1_pubkey.msg).unwrap(); + let kdk: Aes128Key = + derive_kdk(&owner_task_secp256r1_prvkey, &enclave_task_secp256r1_pubkey).unwrap(); let encrypted_worker_url = task.worker_url.expect("encrypted url should exist"); - let url_encrypted: Aes128EncryptedMsg = serde_cbor::from_slice(&encrypted_worker_url).unwrap(); + let url_encrypted: Aes128EncryptedMsg = serde_json::from_slice(&encrypted_worker_url).unwrap(); debug!("encrypted_url: {:?}", url_encrypted); debug!("key: {:?}", kdk); @@ -168,12 +280,26 @@ fn main() { info!("worker url is {:?}", url); // talk to worker directly - grpc::start_demo(&url, worker_task_pubkey, owner_task_prvkey); + grpc::start_demo( + &url, + enclave_task_secp256r1_pubkey, + owner_task_secp256r1_prvkey, + ); // abort the task info!("sleeping for 12 seconds..."); - std::thread::sleep(std::time::Duration::from_secs(12)); + async_std::task::sleep(std::time::Duration::from_secs(18)).await; + info!("aborting task ..."); - let hash = api.abort_task(task_id); - info!("task aborted (extrinsic={:?})", hash); + let result = api + .abort_task_and_watch(&client_signer, task_id) + .await + .expect("extrinsic success"); + info!("task aborted (extrinsic={:?})", result.extrinsic); + + let _event = async_std::task::block_on(wait_for_event(&api, |_: &TaskCompletedEvent<_>| true)) + .expect("retrieve an event"); + display_balance(client_account.clone(), &api).await?; + + Ok(()) } diff --git a/enclave/Cargo.lock b/enclave/Cargo.lock index 3ac3250..d604d90 100644 --- a/enclave/Cargo.lock +++ b/enclave/Cargo.lock @@ -2,11 +2,14 @@ # It is not intended for manual editing. [[package]] name = "advanca-crypto" -version = "0.3.0" -source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.3.0#54b3227e8ad0f83699c8c843bf525ea9b7d23d64" +version = "0.4.0" +source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.4.0#cfdbd0601cdeb4bfac7524eab575ec600acdf8fa" dependencies = [ "advanca-crypto-types", "advanca-macros", + "curve25519-dalek", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "schnorrkel", "sgx_tcrypto", "sgx_tkey_exchange", "sgx_tstd", @@ -15,20 +18,21 @@ dependencies = [ [[package]] name = "advanca-crypto-types" -version = "0.3.0" -source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.3.0#54b3227e8ad0f83699c8c843bf525ea9b7d23d64" +version = "0.4.0" +source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.4.0#cfdbd0601cdeb4bfac7524eab575ec600acdf8fa" dependencies = [ + "curve25519-dalek", + "schnorrkel", "serde 1.0.106", "serde-big-array", - "serde_json", "sgx_tstd", "sgx_types", ] [[package]] name = "advanca-macros" -version = "0.3.0" -source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.3.0#54b3227e8ad0f83699c8c843bf525ea9b7d23d64" +version = "0.4.0" +source = "git+https://github.com/advanca/advanca-sgx-helper?tag=v0.4.0#cfdbd0601cdeb4bfac7524eab575ec600acdf8fa" dependencies = [ "advanca-crypto-types", "sgx_types", @@ -86,6 +90,12 @@ dependencies = [ "memchr 2.3.3", ] +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + [[package]] name = "arrayvec" version = "0.5.1" @@ -94,9 +104,9 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "base64" @@ -116,16 +126,6 @@ dependencies = [ "sgx_tstd", ] -[[package]] -name = "bincode" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" -dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.114", -] - [[package]] name = "bitflags" version = "1.2.1" @@ -138,29 +138,32 @@ version = "0.8.1" source = "git+https://github.com/mesalock-linux/rustcrypto-hashes-sgx?tag=sgx_1.1.2#68505ef594009188aa74f01bcd7250cdef7e08d5" dependencies = [ "byte-tools 0.3.1 (git+https://github.com/mesalock-linux/rustcrypto-utils-sgx)", - "crypto-mac 0.8.0", + "crypto-mac", "digest 0.8.1 (git+https://github.com/mesalock-linux/rustcrypto-traits-sgx)", "opaque-debug", "sgx_tstd", ] [[package]] -name = "blake2" -version = "0.8.1" +name = "block-buffer" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ + "block-padding", "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crypto-mac 0.7.0", - "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] [[package]] -name = "build_const" -version = "0.2.1" +name = "block-padding" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "byte-slice-cast" @@ -193,11 +196,26 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +[[package]] +name = "c2-chacha" +version = "0.2.3" +source = "git+https://github.com/mesalock-linux/cryptocorrosion-sgx#b31e8668ee0d09678a239a01e6dbcad033e1197f" +dependencies = [ + "byteorder 1.3.4 (git+https://github.com/mesalock-linux/byteorder-sgx.git)", + "ppv-lite86 0.2.6", + "stream-cipher", +] + [[package]] name = "cc" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" +checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "git+https://github.com/mesalock-linux/cfg-if-for-sysroot#9aea09f448fa12ab508c3c77c87fdf7431a9d304" [[package]] name = "cfg-if" @@ -207,12 +225,8 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "crc" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" -dependencies = [ - "build_const", -] +version = "2.0.0" +source = "git+https://github.com/mesalock-linux/crc-rs-sgx#86696be09b7605d27327bbe659ac6c0e990c267f" [[package]] name = "crunchy" @@ -220,16 +234,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-mac" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" -dependencies = [ - "generic-array", - "subtle 1.0.0", -] - [[package]] name = "crypto-mac" version = "0.8.0" @@ -240,6 +244,19 @@ dependencies = [ "subtle 2.2.2", ] +[[package]] +name = "curve25519-dalek" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" +dependencies = [ + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.2.3", + "zeroize", +] + [[package]] name = "digest" version = "0.8.1" @@ -260,9 +277,9 @@ dependencies = [ [[package]] name = "either" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f" [[package]] name = "env_logger" @@ -277,51 +294,20 @@ dependencies = [ ] [[package]] -name = "errno" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b480f641ccf0faf324e20c1d3e53d81b7484c698b42ea677f6907ae4db195371" -dependencies = [ - "errno-dragonfly", - "libc 0.2.72", - "winapi", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.1" +name = "fake-simd" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" -dependencies = [ - "gcc", - "libc 0.2.72", -] +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fixed-hash" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3367952ceb191f4ab95dd5685dc163ac539e36202f9fcfd0cb22f9f9c542fefc" +checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" dependencies = [ "static_assertions", ] -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc 0.2.72", - "winapi", -] - -[[package]] -name = "gcc" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" - [[package]] name = "generic-array" version = "0.12.3" @@ -334,12 +320,12 @@ dependencies = [ [[package]] name = "getrandom" version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +source = "git+https://github.com/mesalock-linux/getrandom-sgx.git#66a998d6a06ef0a91a14921a322fe7fa621c6a6e" dependencies = [ - "cfg-if", - "libc 0.2.72", - "wasi", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "sgx_libc", + "sgx_trts", + "sgx_tstd", ] [[package]] @@ -383,9 +369,11 @@ dependencies = [ [[package]] name = "integer-encoding" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4ebd0bd29be0f11973e9b3e219005661042a019fd757798c36a47c87852625" +version = "1.0.7" +source = "git+https://github.com/mesalock-linux/integer-encoding-rs-sgx#67cfe42758cf8fa9e116a5599bff8926d9aa22ae" +dependencies = [ + "sgx_tstd", +] [[package]] name = "itertools" @@ -404,6 +392,12 @@ dependencies = [ "sgx_tstd", ] +[[package]] +name = "keccak" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" + [[package]] name = "lazy_static" version = "1.4.0" @@ -418,18 +412,12 @@ name = "libc" version = "0.2.66" source = "git+https://github.com/mesalock-linux/libc-sgx#b718c0bdf0cf197645595867e06915811fcda207" -[[package]] -name = "libc" -version = "0.2.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" - [[package]] name = "log" version = "0.4.8" source = "git+https://github.com/mesalock-linux/log-sgx?tag=sgx_1.1.2#d08c18ff0585d2d4948e658e55c516b404ebdecf" dependencies = [ - "cfg-if", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "sgx_tstd", ] @@ -438,19 +426,10 @@ name = "log" version = "0.4.8" source = "git+https://github.com/mesalock-linux/log-sgx#d08c18ff0585d2d4948e658e55c516b404ebdecf" dependencies = [ - "cfg-if", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "sgx_tstd", ] -[[package]] -name = "log" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -dependencies = [ - "cfg-if", -] - [[package]] name = "memchr" version = "2.2.1" @@ -467,6 +446,18 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +[[package]] +name = "merlin" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78" +dependencies = [ + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize", +] + [[package]] name = "opaque-debug" version = "0.2.3" @@ -476,22 +467,18 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "oram" version = "0.1.2" -source = "git+https://github.com/advanca/oram.git?tag=v0.1.2#a9424d596b383aeec9a95b92988488bb996f939c" +source = "git+https://github.com/advanca/oram.git?rev=2dd7044a688294d6754d4deb03518045f0b19864#2dd7044a688294d6754d4deb03518045f0b19864" dependencies = [ - "bincode 1.2.1", - "bincode 1.3.1", - "blake2 0.8.1 (git+https://github.com/mesalock-linux/rustcrypto-hashes-sgx?tag=sgx_1.1.2)", - "blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if", + "bincode", + "blake2", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "hex", "log 0.4.8 (git+https://github.com/mesalock-linux/log-sgx?tag=sgx_1.1.2)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "protected_fs_rs", - "rand", - "rand_core 0.5.1", + "protected_fs_rs 0.0.1 (git+https://github.com/mesalock-linux/protected_fs_rs.git?tag=sgx_1.1.2)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rusty-leveldb", "serde 1.0.106", - "serde 1.0.114", "serde_derive 1.0.106 (git+https://github.com/mesalock-linux/serde-sgx?tag=sgx_1.1.2)", "sgx_rand", "sgx_tstd", @@ -499,9 +486,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "1.3.1" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74f02beb35d47e0706155c9eac554b50c671e0d868fe8296bcdf44a9a4847bf" +checksum = "34d38aeaffc032ec69faa476b3caaca8d4dd7f3f798137ff30359e5c7869ceb6" dependencies = [ "arrayvec", "byte-slice-cast", @@ -510,9 +497,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" +checksum = "cd20ff7e0399b274a5f5bb37b712fccb5b3a64b9128200d1c3cc40fe709cb073" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -522,15 +509,20 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.8" +version = "0.2.6" +source = "git+https://github.com/mesalock-linux/cryptocorrosion-sgx#b31e8668ee0d09678a239a01e6dbcad033e1197f" + +[[package]] +name = "ppv-lite86" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" +checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" [[package]] name = "primitive-types" -version = "0.6.2" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4336f4f5d5524fa60bcbd6fe626f9223d8142a50e7053e979acdf0da41ab975" +checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" dependencies = [ "fixed-hash", "impl-codec", @@ -548,9 +540,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" dependencies = [ "unicode-xid", ] @@ -560,8 +552,21 @@ name = "protected_fs_rs" version = "0.0.1" source = "git+https://github.com/mesalock-linux/protected_fs_rs.git?tag=sgx_1.1.2#6c3aecf2aa9795c533d4c5caf94d3f3ce19a3b2b" dependencies = [ - "cfg-if", - "libc 0.2.66", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2", + "rdrand", + "sgx_trts", + "sgx_tstd", + "sgx_types", +] + +[[package]] +name = "protected_fs_rs" +version = "0.0.1" +source = "git+https://github.com/mesalock-linux/protected_fs_rs.git#6c3aecf2aa9795c533d4c5caf94d3f3ce19a3b2b" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", "rand_core 0.4.2", "rdrand", "sgx_trts", @@ -617,27 +622,46 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.7.3" +source = "git+https://github.com/mesalock-linux/rand-sgx?tag=v0.7.3_sgx1.1.2#a6a7eccfd4f574b9dc87fec88ca779a12cae1ab0" +dependencies = [ + "getrandom", + "rand_chacha 0.2.1", + "rand_core 0.5.1 (git+https://github.com/mesalock-linux/rand-sgx?tag=v0.7.3_sgx1.1.2)", + "sgx_tstd", +] + [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", - "libc 0.2.72", - "rand_chacha", - "rand_core 0.5.1", + "rand_chacha 0.2.2", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc", ] +[[package]] +name = "rand_chacha" +version = "0.2.1" +source = "git+https://github.com/mesalock-linux/rand-sgx?tag=v0.7.3_sgx1.1.2#a6a7eccfd4f574b9dc87fec88ca779a12cae1ab0" +dependencies = [ + "c2-chacha", + "rand_core 0.5.1 (git+https://github.com/mesalock-linux/rand-sgx?tag=v0.7.3_sgx1.1.2)", + "sgx_tstd", +] + [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "ppv-lite86 0.2.9", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -649,19 +673,25 @@ checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +source = "git+https://github.com/mesalock-linux/rand-sgx?tag=v0.7.3_sgx1.1.2#a6a7eccfd4f574b9dc87fec88ca779a12cae1ab0" dependencies = [ "getrandom", + "sgx_tstd", ] +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" + [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -718,15 +748,18 @@ checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] name = "rusty-leveldb" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b620ddbe36ca024309bd1ae4d99c43c2241744afa8035f75adcc8817103564c5" +version = "0.3.0" +source = "git+https://github.com/mesalock-linux/rusty_leveldb_sgx?tag=sgx_1.1.2#a4676b23018398baa7033e32f1f7d89ab9a94227" dependencies = [ + "cfg-if 0.1.10 (git+https://github.com/mesalock-linux/cfg-if-for-sysroot)", "crc", - "errno", - "fs2", "integer-encoding", - "rand", + "protected_fs_rs 0.0.1 (git+https://github.com/mesalock-linux/protected_fs_rs.git)", + "rand 0.7.3 (git+https://github.com/mesalock-linux/rand-sgx?tag=v0.7.3_sgx1.1.2)", + "sgx_libc", + "sgx_trts", + "sgx_tstd", + "sgx_types", "snap", ] @@ -745,6 +778,22 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schnorrkel" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" +dependencies = [ + "arrayref", + "arrayvec", + "curve25519-dalek", + "merlin", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2", + "subtle 2.2.3", + "zeroize", +] + [[package]] name = "serde" version = "1.0.106" @@ -756,12 +805,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" -dependencies = [ - "serde_derive 1.0.114", -] +checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5" [[package]] name = "serde-big-array" @@ -802,17 +848,6 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_derive" -version = "1.0.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "serde_json" version = "1.0.51" @@ -970,10 +1005,26 @@ dependencies = [ ] [[package]] -name = "snap" -version = "1.0.1" +name = "sha2" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da73c8f77aebc0e40c300b93f0a5f1bece7a248a36eee287d4e095f35c7b7d6e" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +dependencies = [ + "block-buffer", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd", + "opaque-debug", +] + +[[package]] +name = "snap" +version = "0.2.5" +source = "git+https://github.com/mesalock-linux/rust-snappy-sgx#44758d7e1333f54354384e68ca825c58981f37e2" +dependencies = [ + "byteorder 1.3.4 (git+https://github.com/mesalock-linux/byteorder-sgx.git)", + "lazy_static", + "sgx_tstd", +] [[package]] name = "spin" @@ -988,10 +1039,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "subtle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" +name = "stream-cipher" +version = "0.3.2" +source = "git+https://github.com/mesalock-linux/rustcrypto-traits-sgx#1046ef3f5d20e6dc8030cca5e60faa37884c3814" +dependencies = [ + "generic-array", +] [[package]] name = "subtle" @@ -1001,14 +1054,32 @@ dependencies = [ "sgx_tstd", ] +[[package]] +name = "subtle" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" + [[package]] name = "syn" -version = "1.0.34" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e69abc24912995b3038597a7a593be5053eb0fb44f3cc5beec0deb421790c1f4" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "synstructure" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ "proc-macro2", "quote", + "syn", "unicode-xid", ] @@ -1044,7 +1115,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" dependencies = [ - "serde 1.0.114", + "serde 1.0.115", ] [[package]] @@ -1055,9 +1126,9 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" +checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "crunchy", @@ -1082,12 +1153,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "winapi" version = "0.3.9" @@ -1130,3 +1195,24 @@ dependencies = [ "sgx_types", "walkdir", ] + +[[package]] +name = "zeroize" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/enclave/Cargo.toml b/enclave/Cargo.toml index 380a1b6..9328b43 100644 --- a/enclave/Cargo.toml +++ b/enclave/Cargo.toml @@ -26,8 +26,8 @@ sgx_tunittest = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx- [dependencies] # unmodified crates -codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } -primitive-types = { version = "0.6", default-features = false, features = ["codec"] } +codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +primitive-types = { version = "0.7.2", default-features = false, features = ["codec"] } # mesalock-modified crates # NOTE: Have to ensure all the git repos have the same Cargo version @@ -43,10 +43,16 @@ serde-big-array = { git = "https://github.com/mesalock-linux/serde-big-array-s serde_cbor = { git = "https://github.com/mesalock-linux/cbor-sgx" } # customized crates -advanca-macros = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-sgx-helper" } -advanca-crypto = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-sgx-helper", features = ["sgx_enclave"] } -advanca-crypto-types = { tag = "v0.3.0", git = "https://github.com/advanca/advanca-sgx-helper", features = ["sgx_enclave"] } -oram = { tag = "v0.1.2", git = "https://github.com/advanca/oram.git", default-features = false, features = ["sgx"] } +advanca-macros = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-sgx-helper" } +advanca-crypto = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-sgx-helper", default-features = false, features = ["sgx_enclave"] } +advanca-crypto-types = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-sgx-helper", default-features = false, features = ["sgx_enclave"] } +oram = { rev = "2dd7044a688294d6754d4deb03518045f0b19864", git = "https://github.com/advanca/oram.git", default-features = false, features = ["sgx"] } + +#advanca-macros = { path = "../../../advanca-sgx-helper/advanca-macros"} +#advanca-crypto = { path = "../../../advanca-sgx-helper/advanca-crypto", default-features = false, features = ["sgx_enclave"] } +#advanca-crypto-types = { path = "../../../advanca-sgx-helper/advanca-crypto-types", default-features = false, features = ["sgx_enclave"] } +#oram = { path = "../../../oram/", default-features = false, features = ["sgx"] } + worker-protos-enclave = { path = "../worker-protos/worker-protos-enclave" } # rust-sgx-sdk crates diff --git a/enclave/Enclave.edl b/enclave/Enclave.edl index 397778e..aacace4 100644 --- a/enclave/Enclave.edl +++ b/enclave/Enclave.edl @@ -39,9 +39,6 @@ enclave { [out] uint32_t* response_size ); - public sgx_status_t get_sr25519_public_key( - [out, size=public_key_size] uint8_t* public_key, uint32_t public_key_size); - public sgx_status_t enclave_init_ra ( int b_pse, [out] sgx_ra_context_t *p_context @@ -58,7 +55,18 @@ enclave { size_t msg_len ); - public sgx_status_t gen_worker_ec256_pubkey ( + public sgx_status_t gen_worker_key ( + ); + + public sgx_status_t get_worker_sr25519_pubkey ( + [user_check] uint8_t *ubuf, + [in,out] size_t *ubuf_size + ); + + public sgx_status_t get_task_sr25519_pubkey ( + [user_check] uint8_t *ubuf, + [in,out] size_t *ubuf_size, + [in, count=32] uint8_t *task_id ); public sgx_status_t get_worker_ec256_pubkey ( diff --git a/enclave/src/lib.rs b/enclave/src/lib.rs index 4c8eaf4..87e779f 100644 --- a/enclave/src/lib.rs +++ b/enclave/src/lib.rs @@ -50,18 +50,14 @@ use sgx_types::*; use advanca_crypto::*; use advanca_crypto_types::*; -use serde::Serialize; -use serde_cbor; -use serde_cbor::de::from_slice_with_scratch; -use serde_cbor::ser::SliceWrite; -use serde_cbor::Serializer; - use advanca_macros::{enclave_cryptoerr, enclave_ret, enclave_ret_protobuf}; #[derive(Default, Clone, Copy)] struct AttestedSession { - worker_prvkey: Secp256r1PrivateKey, - worker_pubkey: Secp256r1PublicKey, + enclave_secp256r1_prvkey: Secp256r1PrivateKey, + enclave_secp256r1_pubkey: Secp256r1PublicKey, + enclave_sr25519_prvkey: Sr25519PrivateKey, + enclave_sr25519_pubkey: Sr25519PublicKey, // shared_dhkey : sgx_ec256_dh_shared_t, // kdk : sgx_key_128bit_t, } @@ -83,19 +79,29 @@ const G_SP_PUB_KEY: sgx_ec256_public_t = sgx_ec256_public_t { // TODO: change this to a mutable attested_session data object // and use once_only init to set the value. static mut ATTESTED_SESSION: AttestedSession = AttestedSession { - worker_prvkey: Secp256r1PrivateKey { r: [0; 32] }, - worker_pubkey: Secp256r1PublicKey { + enclave_secp256r1_prvkey: Secp256r1PrivateKey { r: [0; 32] }, + enclave_secp256r1_pubkey: Secp256r1PublicKey { gx: [0; 32], gy: [0; 32], }, + enclave_sr25519_prvkey: Sr25519PrivateKey { + secret: [0; 32], + nonce: [0; 32], + }, + enclave_sr25519_pubkey: Sr25519PublicKey { + compressed_point: [0; 32], + }, }; // static mut ATTESTED_SESSION: Once = Once::new(); #[derive(Default, Clone, Copy)] struct TaskInfo { - task_prvkey: Secp256r1PrivateKey, - task_pubkey: Secp256r1PublicKey, - user_pubkey: Secp256r1PublicKey, + task_secp256r1_prvkey: Secp256r1PrivateKey, + task_secp256r1_pubkey: Secp256r1PublicKey, + task_sr25519_prvkey: Sr25519PrivateKey, + task_sr25519_pubkey: Sr25519PublicKey, + user_secp256r1_pubkey: Secp256r1PublicKey, + user_sr25519_pubkey: Sr25519PublicKey, kdk: Aes128Key, enclave_total_in: usize, enclave_total_out: usize, @@ -103,15 +109,25 @@ struct TaskInfo { static mut TASKS: *mut HashMap<[u8; 32], TaskInfo> = 0 as *mut HashMap<[u8; 32], TaskInfo>; static mut SINGLE_TASK: TaskInfo = TaskInfo { - task_prvkey: Secp256r1PrivateKey { r: [0; 32] }, - task_pubkey: Secp256r1PublicKey { + task_secp256r1_prvkey: Secp256r1PrivateKey { r: [0; 32] }, + task_secp256r1_pubkey: Secp256r1PublicKey { gx: [0; 32], gy: [0; 32], }, - user_pubkey: Secp256r1PublicKey { + task_sr25519_prvkey: Sr25519PrivateKey { + secret: [0; 32], + nonce: [0; 32], + }, + task_sr25519_pubkey: Sr25519PublicKey { + compressed_point: [0; 32], + }, + user_secp256r1_pubkey: Secp256r1PublicKey { gx: [0; 32], gy: [0; 32], }, + user_sr25519_pubkey: Sr25519PublicKey { + compressed_point: [0; 32], + }, kdk: Aes128Key { key: [0; 16] }, enclave_total_in: 0, enclave_total_out: 0, @@ -163,18 +179,58 @@ pub unsafe extern "C" fn enclave_ra_close(context: sgx_ra_context_t) -> sgx_stat } #[no_mangle] -pub unsafe extern "C" fn gen_worker_ec256_pubkey() -> sgx_status_t { +pub unsafe extern "C" fn gen_worker_key() -> sgx_status_t { match secp256r1_gen_keypair() { Ok((prvkey, pubkey)) => { - ATTESTED_SESSION.worker_prvkey = prvkey; - ATTESTED_SESSION.worker_pubkey = pubkey; - return sgx_status_t::SGX_SUCCESS; + ATTESTED_SESSION.enclave_secp256r1_prvkey = prvkey; + ATTESTED_SESSION.enclave_secp256r1_pubkey = pubkey; } Err(CryptoError::SgxError(i, _)) => { return sgx_status_t::from_repr(i).unwrap(); } _ => unreachable!(), } + match sr25519_gen_keypair() { + Ok((prvkey, pubkey)) => { + ATTESTED_SESSION.enclave_sr25519_prvkey = prvkey; + ATTESTED_SESSION.enclave_sr25519_pubkey = pubkey; + } + Err(CryptoError::SgxError(i, _)) => { + return sgx_status_t::from_repr(i).unwrap(); + } + _ => unreachable!(), + } + return sgx_status_t::SGX_SUCCESS; +} + +#[no_mangle] +pub unsafe extern "C" fn get_worker_sr25519_pubkey( + ubuf: *mut u8, + ubuf_size: &mut usize, +) -> sgx_status_t { + enclave_ret!(ATTESTED_SESSION.enclave_sr25519_pubkey, ubuf, ubuf_size); + sgx_status_t::SGX_SUCCESS +} + +#[no_mangle] +pub unsafe extern "C" fn get_task_sr25519_pubkey( + ubuf: *mut u8, + ubuf_size: &mut usize, + p_task_id: *const u8, +) -> sgx_status_t { + let mut task_id = [0_u8; 32]; + let task_id_slice = core::slice::from_raw_parts(p_task_id, 32); + task_id.copy_from_slice(&task_id_slice); + let task_info = (*TASKS).get(&task_id).unwrap(); + let task_sr25519_pubkey: Sr25519PublicKey = task_info.task_sr25519_pubkey; + let enclave_sr25519_prvkey = ATTESTED_SESSION.enclave_sr25519_prvkey; + let signed_pubkey: Sr25519SignedMsg = sr25519_sign_msg( + &enclave_sr25519_prvkey, + &serde_json::to_vec(&task_sr25519_pubkey).unwrap(), + ) + .unwrap(); + enclave_ret!(signed_pubkey, ubuf, ubuf_size); + sgx_status_t::SGX_SUCCESS } #[no_mangle] @@ -182,7 +238,7 @@ pub unsafe extern "C" fn get_worker_ec256_pubkey( ubuf: *mut u8, ubuf_size: &mut usize, ) -> sgx_status_t { - enclave_ret!(ATTESTED_SESSION.worker_pubkey, ubuf, ubuf_size); + enclave_ret!(ATTESTED_SESSION.enclave_secp256r1_pubkey, ubuf, ubuf_size); sgx_status_t::SGX_SUCCESS } @@ -196,10 +252,13 @@ pub unsafe extern "C" fn get_task_ec256_pubkey( let task_id_slice = core::slice::from_raw_parts(p_task_id, 32); task_id.copy_from_slice(&task_id_slice); let task_info = (*TASKS).get(&task_id).unwrap(); - let task_pubkey = task_info.task_pubkey; - let worker_prvkey = ATTESTED_SESSION.worker_prvkey; - let signed_pubkey: Secp256r1SignedMsg = - secp256r1_sign_msg(&worker_prvkey, &serde_cbor::to_vec(&task_pubkey).unwrap()).unwrap(); + let task_pubkey = task_info.task_secp256r1_pubkey; + let enclave_secp256r1_prvkey = ATTESTED_SESSION.enclave_secp256r1_prvkey; + let signed_pubkey: Secp256r1SignedMsg = secp256r1_sign_msg( + &enclave_secp256r1_prvkey, + &serde_json::to_vec(&task_pubkey).unwrap(), + ) + .unwrap(); enclave_ret!(signed_pubkey, ubuf, ubuf_size); sgx_status_t::SGX_SUCCESS } @@ -210,14 +269,16 @@ pub unsafe extern "C" fn gen_worker_reg_request( ubuf_size: &mut usize, context: sgx_ra_context_t, ) -> sgx_status_t { - let pubkey = ATTESTED_SESSION.worker_pubkey; - let sk_key = enclave_cryptoerr!(enclave_get_sk_key(context)); - let data = pubkey.to_raw_bytes(); - let mac = enclave_cryptoerr!(aes128cmac_mac(&sk_key, &data)); - let req = AasRegRequest { - worker_pubkey: pubkey, - mac: mac, + let secp256r1_pubkey = ATTESTED_SESSION.enclave_secp256r1_pubkey; + let sr25519_pubkey = ATTESTED_SESSION.enclave_sr25519_pubkey; + let mut req = AasRegRequest { + enclave_secp256r1_pubkey: secp256r1_pubkey, + enclave_sr25519_pubkey: sr25519_pubkey, + mac: Aes128Mac::default(), }; + let sk_key = enclave_cryptoerr!(enclave_get_sk_key(context)); + let mac = enclave_cryptoerr!(aes128cmac_mac(&sk_key, &req.to_check_bytes())); + req.mac = mac; enclave_ret!(req, ubuf, ubuf_size); sgx_status_t::SGX_SUCCESS } @@ -228,29 +289,34 @@ pub unsafe extern "C" fn accept_task( p_user_pubkey_buf: *const u8, user_pubkey_buf_size: usize, ) -> sgx_status_t { - let mut scratch = [0_u8; 8196]; let mut task_id = [0_u8; 32]; let task_id_slice = core::slice::from_raw_parts(p_task_id, 32); task_id.copy_from_slice(&task_id_slice); let pubkey_buf_slice = core::slice::from_raw_parts(p_user_pubkey_buf, user_pubkey_buf_size); - let user_pubkey: Secp256r1PublicKey = - from_slice_with_scratch(&pubkey_buf_slice, &mut scratch).unwrap(); - let (task_prvkey, task_pubkey) = secp256r1_gen_keypair().unwrap(); + let user_secp256r1_pubkey: Secp256r1PublicKey = + serde_json::from_slice(pubkey_buf_slice).unwrap(); + let (task_secp256r1_prvkey, task_secp256r1_pubkey) = secp256r1_gen_keypair().unwrap(); + let (task_sr25519_prvkey, task_sr25519_pubkey) = sr25519_gen_keypair().unwrap(); - let kdk = enclave_cryptoerr!(derive_kdk(&task_prvkey, &user_pubkey)); + let kdk = enclave_cryptoerr!(derive_kdk(&task_secp256r1_prvkey, &user_secp256r1_pubkey)); let task_info = TaskInfo { - task_prvkey: task_prvkey, - task_pubkey: task_pubkey, - user_pubkey: user_pubkey, + task_secp256r1_prvkey: task_secp256r1_prvkey, + task_secp256r1_pubkey: task_secp256r1_pubkey, + task_sr25519_prvkey: task_sr25519_prvkey, + task_sr25519_pubkey: task_sr25519_pubkey, + user_secp256r1_pubkey: user_secp256r1_pubkey, + user_sr25519_pubkey: Sr25519PublicKey::default(), kdk: kdk, enclave_total_in: 0, enclave_total_out: 0, }; (*TASKS).insert(task_id, task_info); // TODO! hack for single task demo - SINGLE_TASK.task_prvkey = task_prvkey; - SINGLE_TASK.task_pubkey = task_pubkey; - SINGLE_TASK.user_pubkey = user_pubkey; + SINGLE_TASK.task_secp256r1_prvkey = task_secp256r1_prvkey; + SINGLE_TASK.task_secp256r1_pubkey = task_secp256r1_pubkey; + SINGLE_TASK.task_sr25519_prvkey = task_sr25519_prvkey; + SINGLE_TASK.task_sr25519_pubkey = task_sr25519_pubkey; + SINGLE_TASK.user_secp256r1_pubkey = user_secp256r1_pubkey; SINGLE_TASK.kdk = kdk; sgx_status_t::SGX_SUCCESS } @@ -275,18 +341,6 @@ pub unsafe extern "C" fn encrypt_msg( sgx_status_t::SGX_SUCCESS } -#[no_mangle] -pub unsafe extern "C" fn get_sr25519_public_key( - public_key: *mut u8, - public_key_size: u32, -) -> sgx_status_t { - let key_slice = slice::from_raw_parts_mut(public_key, public_key_size as usize); - - //FIXME: a dummy public key is used - key_slice.clone_from_slice(&[111 as u8; 32]); - sgx_status_t::SGX_SUCCESS -} - #[no_mangle] pub unsafe extern "C" fn create_storage( public_key: *const u8, @@ -294,7 +348,7 @@ pub unsafe extern "C" fn create_storage( ) -> sgx_status_t { println!("[ENCLAVE INFO] creating storage ..."); let key_bytes_slice = slice::from_raw_parts(public_key, public_key_size as usize); - let pubkey: Secp256r1PublicKey = serde_cbor::from_slice(&key_bytes_slice).unwrap(); + let pubkey: Secp256r1PublicKey = serde_json::from_slice(&key_bytes_slice).unwrap(); let mut key_bytes = [0_u8; 64]; key_bytes.copy_from_slice(&pubkey.to_raw_bytes()); if let Err(status) = storage::create_sealed_storage(key_bytes) { @@ -324,7 +378,8 @@ pub unsafe extern "C" fn proc_heartbeat( let mut task_id = [0_u8; 32]; task_id.copy_from_slice(&heartbeat_req.task_id); let task_info = (*TASKS).get(&task_id).unwrap(); - let worker_task_prvkey = task_info.task_prvkey; + // let worker_task_prvkey = task_info.task_prvkey; + let worker_task_sr25519_prvkey = task_info.task_sr25519_prvkey; let mut heartbeat_response = HeartbeatResponse::new(); // obtain the storage info // current owner is not used for storage, set it to 0 @@ -340,10 +395,11 @@ pub unsafe extern "C" fn proc_heartbeat( storage_out: storage_out, storage_size: storage_size, }; - let data = serde_cbor::to_vec(&alive_evidence).unwrap(); + let data = serde_json::to_vec(&alive_evidence).unwrap(); - let block_hash_mac = enclave_cryptoerr!(secp256r1_sign_msg(&worker_task_prvkey, &data)); - heartbeat_response.heartbeat_sig = serde_cbor::to_vec(&block_hash_mac).unwrap(); + // let block_hash_mac = enclave_cryptoerr!(secp256r1_sign_msg(&worker_task_prvkey, &data)); + let block_hash_mac = enclave_cryptoerr!(sr25519_sign_msg(&worker_task_sr25519_prvkey, &data)); + heartbeat_response.heartbeat_sig = serde_json::to_vec(&block_hash_mac).unwrap(); enclave_ret_protobuf!(heartbeat_response, p_ubuf, p_ubuf_size); sgx_status_t::SGX_SUCCESS } @@ -364,7 +420,7 @@ pub unsafe extern "C" fn storage_request( let _ = backtrace::enable_backtrace("enclave.signed.so", PrintFormat::Full); - let encrypted_msg = serde_cbor::from_slice(&encrypted_msg_slice).unwrap(); + let encrypted_msg = serde_json::from_slice(&encrypted_msg_slice).unwrap(); let decrypted_msg = enclave_cryptoerr!(aes128gcm_decrypt(&kdk, &encrypted_msg)); let request_decrypted = decrypted_msg; @@ -379,7 +435,7 @@ pub unsafe extern "C" fn storage_request( let response_encoded = response.write_to_bytes().unwrap(); let response_encrypted = enclave_cryptoerr!(aes128gcm_encrypt(&kdk, &response_encoded)); - let response_encrypted_bytes = serde_cbor::to_vec(&response_encrypted).unwrap(); + let response_encrypted_bytes = serde_json::to_vec(&response_encrypted).unwrap(); let (first, _) = response_payload.split_at_mut(response_encrypted_bytes.len()); first.clone_from_slice(&response_encrypted_bytes); diff --git a/substrate-api/Cargo.toml b/substrate-api/Cargo.toml index a8c210f..2af80f6 100644 --- a/substrate-api/Cargo.toml +++ b/substrate-api/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Advanca Authors"] edition = "2018" license = "GPL-3.0" name = "substrate-api" -version = "0.2.0" +version = "0.3.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -11,19 +11,21 @@ version = "0.2.0" env_logger = "0.7.0" log = "0.4.8" hex = "0.4.2" +async-std = { version = "1.6.2", features = ["attributes"] } -sp-core = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} +sp-core = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate" } +sp-runtime = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate" } +pallet-balances = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate" } -advanca-runtime = { tag = "v0.2.0", git = "https://github.com/advanca/advanca-node" } -advanca-core = { tag = "v0.2.0", git = "https://github.com/advanca/advanca-node" } +advanca-node-primitives = { tag = "v0.4.0", git = "https://github.com/advanca/advanca-node/" } +substrate-subxt = { rev = "d86bad44a3281c9eb0630d8b166885200f1fa150", git = "https://github.com/advanca/substrate-subxt/" } -[dependencies.substrate-api-client] -git = "https://github.com/advanca/substrate-api-client" -rev = "1231a987dcfe5610ddbd32ada6f95aecc4f90ec9" +#advanca-node-primitives = { path = "../../advanca-node/advanca-node-primitives/" } +#substrate-subxt = { path = "../../../substrate-subxt" } [dependencies.codec] package = "parity-scale-codec" -version = "1.0.0" +version = "1.3.0" [dev-dependencies] -sp-keyring = { git = "https://github.com/paritytech/substrate", rev = "00a400f82539e2f78e8ddbcd98aea512c87c5f3c"} +sp-keyring = { tag = "v2.0.0-rc5+2", git = "https://github.com/paritytech/substrate" } diff --git a/substrate-api/src/events.rs b/substrate-api/src/events.rs deleted file mode 100644 index 75b8af3..0000000 --- a/substrate-api/src/events.rs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (C) 2020 ADVANCA PTE. LTD. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Contains mirrored struct definition of advanca-core pallet events -//! -//! TODO: try to use the enums defined in advanca-core, i.e.: -//! ```rust -//! decl_event!( -//! pub enum Event -//! where -//! AccountId = ::AccountId, -//! TaskId = TaskId, -//! { -//! UserAdded(AccountId), -//! UserRemoved(AccountId), -//! TaskSubmitted(TaskId), -//! TaskUpdated(TaskId), -//! TaskAccepted(TaskId), -//! TaskCompleted(TaskId), -//! TaskAborted(TaskId), -//! WorkerAdded(AccountId), -//! WorkerRemoved(AccountId), -//! } -//! ); -//! ``` -use crate::{AccountId, TaskId}; -use codec::Decode; - -#[derive(Decode, Debug)] -pub struct UserAdded { - pub account_id: AccountId, -} - -#[derive(Decode, Debug)] -pub struct UserRemoved { - pub account_id: AccountId, -} - -#[derive(Decode, Debug)] -pub struct WorkerAdded { - pub account_id: AccountId, -} - -#[derive(Decode, Debug)] -pub struct WorkerRemoved { - pub account_id: AccountId, -} - -#[derive(Decode, Debug)] -pub struct TaskSubmitted { - pub task_id: TaskId, -} - -#[derive(Decode, Debug)] -pub struct TaskUpdated { - pub task_id: TaskId, -} - -#[derive(Decode, Debug)] -pub struct TaskAccepted { - pub task_id: TaskId, -} - -#[derive(Decode, Debug)] -pub struct TaskCompleted { - pub task_id: TaskId, -} - -#[derive(Decode, Debug)] -pub struct TaskAborted { - pub task_id: TaskId, -} - -pub trait Event: Decode { - fn task_id(&self) -> TaskId; -} - -impl Event for TaskAccepted { - fn task_id(&self) -> TaskId { - self.task_id - } -} -impl Event for TaskAborted { - fn task_id(&self) -> TaskId { - self.task_id - } -} diff --git a/substrate-api/src/lib.rs b/substrate-api/src/lib.rs index 62589d4..e41e1c2 100644 --- a/substrate-api/src/lib.rs +++ b/substrate-api/src/lib.rs @@ -12,354 +12,343 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - -mod events; - use std::collections::{HashMap, HashSet}; -use std::convert::TryFrom; use std::iter::FromIterator; -use std::sync::mpsc::channel; -use codec::{Decode, Encode}; -use log::{error, info, trace}; +use log::{error, trace}; -use advanca_core::{ - self, Ciphertext, Duration, Enclave, Privacy, Task, TaskSpec, TaskStatus, User, Worker, -}; -use advanca_runtime::{AccountId, Balance, Hash}; -use sp_core::{sr25519, Pair}; -use substrate_api_client::{ - node_metadata::Metadata, - utils::{hexstr_to_u256, hexstr_to_vec}, - Api, +use pallet_balances::AccountData; + +use advanca_node_primitives::{ + self, Ciphertext, Duration, Enclave, Privacy, PublicKeys, Task, TaskSpec, TaskStatus, User, + Worker, }; +use advanca_node_primitives::{AccountId, Balance, Hash}; +use sp_core::sr25519; -pub use substrate_api_client::compose_extrinsic; +use substrate_subxt::{ + advanca::advanca_core::*, advanca::AdvancaRuntime, balances::TransferCall, + system::AccountStoreExt, Client, ClientBuilder, EventSubscription, EventsDecoder, PairSigner, +}; //TODO: use TaskId from advanca_core pub type TaskId = Hash; -/// The wrapper of substrate-api-client -pub struct SubstrateApi(Api); +pub struct SubstrateApi { + pub client: Client, + signer: Option>, +} impl SubstrateApi { /// Create an API without signer pub fn new(ws_url: &str) -> SubstrateApi { - SubstrateApi(Api::new(ws_url.into())) - } - - /// Make a copy of the inner API type - pub fn clone_api(&self) -> Api { - self.0.clone() + let client = async_std::task::block_on( + ClientBuilder::::new() + .set_url(ws_url) + .build(), + ) + .expect("spawn client"); + // let client = ClientBuilder::::new().set_url(ws_url).build().await.expect("substrate client creation works"); + SubstrateApi { + client, + signer: None, + } } /// Set signer pub fn set_signer(&mut self, signer: sr25519::Pair) { - let api = self.0.clone(); - self.0 = api.set_signer(signer); + self.signer = Some(PairSigner::<_, _>::new(signer)); } - /// Return genesis hash - pub fn genesis_hash(&self) -> Hash { - self.0.get_genesis_hash() + pub fn signer(&self) -> &PairSigner { + self.signer.as_ref().unwrap() } - /// Return runtime spec version - pub fn spec_version(&self) -> u32 { - self.0.get_spec_version() + pub fn signer_mut(&mut self) -> &mut PairSigner { + self.signer.as_mut().unwrap() } - /// Helper function to get the runtime metadata - pub fn print_metadata(&self) { - let meta = Metadata::try_from(self.0.get_metadata()).unwrap(); - - meta.print_overview(); - meta.print_modules_with_calls(); - meta.print_modules_with_events(); - - println!( - "Metadata:\n {}", - Metadata::pretty_format(&self.0.get_metadata()).unwrap() - ); - } - - fn get_storage(&self, prefix: &str, key: &str, param_encoded: Option>) -> String { - trace!( - "calling get_storage(prefix={}, key={}, param={:?})", - prefix, - key, - param_encoded - ); - let result = self.0.get_storage(prefix, key, param_encoded).unwrap(); - trace!("received encoded storage value {}", result); - result + /// Return genesis hash + pub fn genesis_hash(&self) -> Hash { + *self.client.genesis() } - /// send the encoded extrinsic out - /// - /// the `extrinsic_encoded` is an encoded string with prefix "0x" - pub fn send_extrinsic(&self, extrinsic_encoded: String) -> Hash { - trace!( - "sending composed extrinsic: {:64?} (len={})", - extrinsic_encoded, - &extrinsic_encoded.len() - ); + /// Helper function to get the runtime metadata + pub fn print_metadata(&self) { + let meta = self.client.metadata(); - let hash = self.0.send_extrinsic(extrinsic_encoded).unwrap(); - trace!("received extrinsic hash {:?}", hash); - hash + println!("Metadata:\n {}", meta.pretty()); } /// Get the nonce of the spcecified account pub fn get_nonce(&self, account: &AccountId) -> u32 { - let hex_str = self.get_storage("System", "AccountNonce", Some(account.encode())); - let nonce = hexstr_to_u256(hex_str).unwrap(); - trace!("received nonce {:?}", &nonce.low_u32()); - nonce.low_u32() + async_std::task::block_on(self.client.account(account, None)) + .expect("retrieve account nonce") + .nonce + // self.client.account(account, None).await.expect("retrieve account nonce").nonce } pub fn get_worker(&self, id: AccountId) -> Worker { - let hex_str = self.get_storage("AdvancaCore", "Workers", Some(id.encode())); - let worker_encoded = hexstr_to_vec(hex_str).unwrap(); - trace!("worker encoded {:?}", hex::encode(&worker_encoded)); - let worker = Decode::decode(&mut worker_encoded.as_slice()).unwrap(); - trace!("worker {:?}", worker); - worker + async_std::task::block_on(self.client.workers(id, None)).expect("retrieve worker") } pub fn get_task( &self, id: TaskId, ) -> Task, TaskStatus, Ciphertext> { - let hex_str = self.get_storage("AdvancaCore", "Tasks", Some(id.encode())); - let task_encoded = hexstr_to_vec(hex_str).unwrap(); - trace!("task encoded {:?}", hex::encode(&task_encoded)); - let task = Decode::decode(&mut task_encoded.as_slice()).unwrap(); - trace!("task {:?}", task); - task + async_std::task::block_on(self.client.tasks(id, None)).expect("retrieve task") + } + + pub fn get_balance(&self, id: AccountId) -> AccountData { + async_std::task::block_on(self.client.account(&id, None)) + .expect("retrieve account balance") + .data } pub fn get_user(&self, id: AccountId) -> User { - let hex_str = self.get_storage("AdvancaCore", "Users", Some(id.encode())); - let user_encoded = hexstr_to_vec(hex_str).unwrap(); - trace!("user encoded {:?}", hex::encode(&user_encoded)); - let user = Decode::decode(&mut user_encoded.as_slice()).unwrap(); - trace!("user {:?}", user); - user + async_std::task::block_on(self.client.users(id, None)).expect("retrieve user") } pub fn get_unscheduled_tasks(&self) -> Vec { - let hex_str = self.get_storage("AdvancaCore", "UnscheduledTasks", None); - let unscheduled_encoded = hexstr_to_vec(hex_str).unwrap(); - trace!( - "unscheduled_tasks encoded {:?}", - hex::encode(&unscheduled_encoded) - ); - let unscheduled_tasks: Vec = - Decode::decode(&mut unscheduled_encoded.as_slice()).unwrap(); - trace!("unscheduled_task {:?}", unscheduled_tasks); - unscheduled_tasks + async_std::task::block_on(self.client.unscheduled_tasks(None)) + .expect("retrieve unscheduled tasks") + } + + // an enhanced version of substrate_subxt::transfer_and_watch + async fn transfer_and_watch( + &self, + to: &AccountId, + amount: Balance, + ) -> Result, substrate_subxt::Error> { + let extrinsic = self + .client + .create_signed(TransferCall { to, amount }, self.signer()) + .await?; + let mut decoder = self.client.events_decoder::>(); + decoder.with_advanca_core(); + self.client + .submit_and_watch_extrinsic(extrinsic, decoder) + .await } pub fn transfer_balance(&self, to: AccountId, amount: Balance) -> Hash { - let xt = self.0.balance_transfer(to.into(), amount); - trace!("composed extrinsic: {:?}", xt); - self.send_extrinsic(xt.hex_encode()) + async_std::task::block_on(self.transfer_and_watch(&to, amount)) + .expect("get transfer hash") + .extrinsic } - pub fn register_user(&self, deposit: Balance, public_key: Vec) -> Hash { - let extrinsic = compose_extrinsic!( - self.0.clone(), - "AdvancaCore", - "register_user", + pub fn register_user(&self, deposit: Balance, public_key: PublicKeys) -> Hash { + async_std::task::block_on(self.client.register_user_and_watch( + self.signer(), deposit, - public_key - ); - trace!("composed extrinsic {:?}", &extrinsic); - self.send_extrinsic(extrinsic.hex_encode()) + public_key, + )) + .expect("get register_user hash") + .extrinsic } pub fn register_worker(&self, deposit: Balance, enclave: Enclave) -> Hash { - let extrinsic = compose_extrinsic!( - self.0.clone(), - "AdvancaCore", - "register_worker", + async_std::task::block_on(self.client.register_worker_and_watch( + self.signer(), deposit, - enclave - ); - trace!("composed extrinsic {:?}", &extrinsic); - self.send_extrinsic(extrinsic.hex_encode()) + enclave, + )) + .expect("get register_worker hash") + .extrinsic } pub fn submit_task( &self, - signed_user_task_pubkey: Vec, + signed_user_task_secp256r1_pubkey: Vec, + signed_user_task_sr25519_pubkey: Vec, lease: Duration, task_spec: TaskSpec, ) -> Hash { - let extrinsic = compose_extrinsic!( - self.0.clone(), - "AdvancaCore", - "submit_task", - signed_user_task_pubkey, + async_std::task::block_on(self.client.submit_task_and_watch( + self.signer(), + signed_user_task_secp256r1_pubkey, + signed_user_task_sr25519_pubkey, lease, - task_spec - ); - trace!("composed extrinsic {:?}", &extrinsic); - self.send_extrinsic(extrinsic.hex_encode()) + task_spec, + )) + .expect("get submit_task hash") + .extrinsic } pub fn submit_task_evidence(&self, task_id: TaskId, evidence: Vec>) -> Hash { - let extrinsic = compose_extrinsic!( - self.0.clone(), - "AdvancaCore", - "submit_task_evidence", + async_std::task::block_on(self.client.submit_task_evidence_and_watch( + self.signer(), task_id, - evidence - ); - trace!("submit_task_evidence: composed extrinsic {:?}", &extrinsic); - self.send_extrinsic(extrinsic.hex_encode()) + evidence, + )) + .expect("get submit_task_evidence hash") + .extrinsic } pub fn accept_task( &self, task_id: TaskId, - signed_eph_pubkey: Vec, + signed_secp256r1_pubkey: Vec, + signed_sr25519_pubkey: Vec, url: Ciphertext, ) -> Hash { - let extrinsic = compose_extrinsic!( - self.0.clone(), - "AdvancaCore", - "accept_task", + async_std::task::block_on(self.client.accept_task_and_watch( + self.signer(), task_id, - signed_eph_pubkey, - url - ); - trace!("composed extrinsic {:?}", extrinsic); - self.send_extrinsic(extrinsic.hex_encode()) + signed_secp256r1_pubkey, + signed_sr25519_pubkey, + url, + )) + .expect("get accept_task hash") + .extrinsic } pub fn update_task(&self, task_id: TaskId, task_spec: TaskSpec) -> Hash { - let extrinsic = compose_extrinsic!( - self.0.clone(), - "AdvancaCore", - "update_task", + async_std::task::block_on(self.client.update_task_and_watch( + self.signer(), task_id, - task_spec - ); - trace!("composed extrinsic {:?}", extrinsic); - self.send_extrinsic(extrinsic.hex_encode()) + task_spec, + )) + .expect("get update_task hash") + .extrinsic } pub fn abort_task(&self, task_id: TaskId) -> Hash { - let extrinsic = compose_extrinsic!(self.0.clone(), "AdvancaCore", "abort_task", task_id); - trace!("composed extrinsic: {:?}", extrinsic); - self.send_extrinsic(extrinsic.hex_encode()) + async_std::task::block_on(self.client.abort_task_and_watch(self.signer(), task_id)) + .expect("get abort_task hash") + .extrinsic + } + + pub fn complete_task(&self, task_id: TaskId) -> Hash { + async_std::task::block_on(self.client.complete_task_and_watch(self.signer(), task_id)) + .expect("get complete_task hash") + .extrinsic + } + + /// Listen for event TaskCompleted once + /// + /// Block the current thread till TaskCompleted return and task id is returned + pub fn listen_for_task_completed(&self) -> TaskId { + let event = + async_std::task::block_on(wait_for_event(&self.client, |_: &TaskCompletedEvent<_>| { + true + })) + .expect("retrieve an event"); + event.task_id } /// Listen for event WorkerAdded once /// /// Block the current thread and return the worker acount received pub fn listen_for_worker_added(&self) -> AccountId { - let (events_in, events_out) = channel(); - self.0.subscribe_events(events_in.clone()); - trace!("waiting for WorkedAdded"); - let args: events::WorkerAdded = self - .0 - .wait_for_event("AdvancaCore", "WorkerAdded", &events_out) - .unwrap() - .unwrap(); - - let id = args.account_id.clone(); - trace!("received WorkerAdded: {:?}", args); - id + let event = + async_std::task::block_on(wait_for_event(&self.client, |_: &WorkerAddedEvent<_>| true)) + .expect("retrieve an event"); + event.worker } /// Listen for event TaskSubmitted once /// /// Block the current thread and return the task id received pub fn listen_for_task_submitted(&self) -> TaskId { - let api = &self.0; - let (events_in, events_out) = channel(); - api.subscribe_events(events_in.clone()); - trace!("waiting for TaskSubmitted"); - let args: events::TaskSubmitted = api - .wait_for_event("AdvancaCore", "TaskSubmitted", &events_out) - .unwrap() - .unwrap(); - - let id = args.task_id.clone(); - trace!("received TaskSubmitted: {:?}", args); - return id; + let event = + async_std::task::block_on(wait_for_event(&self.client, |_: &TaskSubmittedEvent<_>| { + true + })) + .expect("retrieve an event"); + event.task_id } /// Wait until all the specified tasks are accepted /// /// Block the current thread pub fn wait_all_task_accepted(&self, task_ids: Vec) { - self.wait_all_task_on_condition::(task_ids); + self.wait_all_task_on_condition(task_ids, |e: &TaskAcceptedEvent| { + e.task_id + }); } /// Wait until all the specified tasks are aborted /// /// Block the current thread pub fn wait_all_task_aborted(&self, task_ids: Vec) { - self.wait_all_task_on_condition::(task_ids); + self.wait_all_task_on_condition(task_ids, |e: &TaskAbortedEvent| e.task_id); } /// Internal helper function for all wait_all_task_* functions - fn wait_all_task_on_condition(&self, task_ids: Vec) + fn wait_all_task_on_condition(&self, task_ids: Vec, task_id_accessor: F) where - T: events::Event, + F: Fn(&E) -> TaskId, + // R: AdvancaCore + substrate_subxt::Runtime, + E: substrate_subxt::Event + std::fmt::Debug, { let mut received: HashMap = task_ids.iter().map(|i| (i.clone(), false)).collect(); let expected_ids: HashSet = HashSet::from_iter(task_ids); let mut count = 0; - // get the event name (e.g., TaskAccepted) from struct type name (e.g., struct TaskAccepted) - let variant = std::any::type_name::().split("::").last().unwrap(); - - let (events_in, events_out) = channel(); - - let api = &self.0; - - api.subscribe_events(events_in.clone()); - - loop { - let args: T = api - .wait_for_event("AdvancaCore", variant, &events_out) - .unwrap() - .unwrap(); - if expected_ids.contains(&args.task_id()) { - if let Some(seen) = received.get_mut(&args.task_id()) { + async_std::task::block_on(wait_for_event(&self.client, |e: &E| { + let task_id = task_id_accessor(e); + if expected_ids.contains(&task_id) { + if let Some(seen) = received.get_mut(&task_id) { if !*seen { - trace!("hit one task with id {:?}", &args.task_id()); + trace!("hit one task with id {:?}", task_id); *seen = true; count += 1; if count == expected_ids.len() { trace!("all task received, returning"); - return; } } else { error!( - "received event {} with same id(={}) twice, something is wrong", - variant, - &args.task_id() + "received event '{:?}' with same task id(={}) twice, something is wrong", + e, + task_id ); } + return true; } } + false + })).expect("retrieve an event"); + } +} + +pub async fn wait_for_event( + api: &Client, + mut predicate: P, +) -> Result> +where + P: FnMut(&E) -> bool, + R: AdvancaCore + substrate_subxt::Runtime, + E: substrate_subxt::Event + std::fmt::Debug, +{ + let sub = api.subscribe_events().await?; + let mut decoder = EventsDecoder::::new(api.metadata().clone()); + decoder.with_advanca_core(); + + let mut event_sub = EventSubscription::new(sub, decoder); + event_sub.filter_event::(); + + while let Some(result) = event_sub.next().await { + let event = E::decode(&mut &result?.data[..])?; + trace!("Received event {:?}", event); + if predicate(&event) { + trace!("Found the matched event"); + return Ok(event); } } + Err("Cannot find the matching event".into()) } #[cfg(test)] mod tests { use super::*; use env_logger; + use log::info; + use sp_core::crypto::Pair; use sp_core::crypto::Ss58Codec; use sp_keyring::AccountKeyring; + use std::sync::mpsc::channel; use std::{thread, time}; /// Make sure env_logger is initialized only once and every test function calls this @@ -368,7 +357,7 @@ mod tests { } fn default_api() -> SubstrateApi { - SubstrateApi(Api::new("ws://127.0.0.1:9944".into())) + SubstrateApi::new("ws://127.0.0.1:9998".into()) } /// Create a dummy registered user @@ -380,7 +369,7 @@ mod tests { let (user, _, _) = sr25519::Pair::generate_with_phrase(None); trace!("randomly generated user {:?}", user.public()); - let amount = 1_000_000_000; + let amount = 1_000_000_000_000; let user_account_id: AccountId = user.public().as_array_ref().to_owned().into(); trace!("user account id is {:?}", user_account_id.to_ss58check()); alice_api.transfer_balance(user_account_id.clone(), amount); @@ -408,7 +397,7 @@ mod tests { let (worker, _, _) = sr25519::Pair::generate_with_phrase(None); trace!("randomly generated worker {:?}", worker.public()); - let amount = 1_000_000_000; + let amount = 1_000_000_000_000; let worker_account_id: AccountId = worker.public().as_array_ref().to_owned().into(); trace!( "worker account id is {:?}", @@ -462,43 +451,6 @@ mod tests { } } - #[test] - #[ignore] // Ignore since it's relying on a running substrate-node - fn transfer_balance() { - init(); - - let from = AccountKeyring::Alice.pair(); - let mut api = default_api(); - api.set_signer(from); - info!("Alice's Account Nonce is {}\n", api.0.get_nonce().unwrap()); - - // define the recipient - let to = AccountKeyring::Bob.to_account_id(); - trace!("to account id {:?}", to.to_ss58check()); - let xt = api.0.balance_transfer(to.into(), 42); - info!("composed Extrinsic:\n {:?}\n", xt); - - // send and watch extrinsic until finalized - let tx_hash = api.0.send_extrinsic(xt.hex_encode()).unwrap(); - info!("transaction got finalized. Hash: {:?}", tx_hash); - - let (random_receiver, _, _) = sr25519::Pair::generate_with_phrase(None); - trace!("random receiver public key {:?}", random_receiver.public()); - - let random_receiver_account_id: AccountId = - random_receiver.public().as_array_ref().to_owned().into(); - trace!( - "random receiver address {:?}", - random_receiver_account_id.to_ss58check() - ); - let xt = api - .0 - .balance_transfer(random_receiver_account_id.into(), 1234); - trace!("composed extrinsinc\n{:?}\n", xt); - let tx_hash = api.0.send_extrinsic(xt.hex_encode()).unwrap(); - trace!("transaction got finalized with hash {:?}", tx_hash); - } - #[test] #[ignore] // Ignore since it's relying on a running substrate-node fn add_user() { @@ -608,7 +560,7 @@ mod tests { thread::sleep(time::Duration::from_secs(1)); // submit task - user_api.submit_task(0, Default::default()); + user_api.submit_task(vec![], Default::default(), Default::default()); let task_id = task_out .recv_timeout(time::Duration::from_secs(30)) @@ -628,7 +580,7 @@ mod tests { let user_api = new_registered_user(); - user_api.submit_task(0, Default::default()); + user_api.submit_task(vec![], Default::default(), Default::default()); let handle: thread::JoinHandle<_> = thread::spawn(move || { let listener_api = default_api(); @@ -653,7 +605,7 @@ mod tests { info!("got the task {:?}", &task_id); }); - let hash = worker_api.accept_task(task_id, vec![1, 2, 3]); + let hash = worker_api.accept_task(task_id, Default::default(), vec![1, 2, 3]); info!("extrinsic confirmed {:?}", hash); handle.join().unwrap(); }