diff --git a/Cargo.lock b/Cargo.lock index 422adf2818..6ebd4e301c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -94,6 +94,12 @@ dependencies = [ "const-random", ] +[[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" + [[package]] name = "aho-corasick" version = "0.7.13" @@ -199,47 +205,52 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" +[[package]] +name = "async-channel" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958a8af017616083a7c739a9c4da4b757a6816593734b4b6145adbe1421526a5" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + [[package]] name = "async-std" -version = "1.5.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "538ecb01eb64eecd772087e5b6f7540cbc917f047727339a472dafed2185b267" +checksum = "00d68a33ebc8b57800847d00787307f84a562224a14db069b0acefe4c2abbf5d" dependencies = [ "async-task", - "broadcaster", - "crossbeam-channel", - "crossbeam-deque", "crossbeam-utils", + "futures-channel", "futures-core", "futures-io", - "futures-timer 2.0.2", + "futures-timer 3.0.2", "kv-log-macro", "log", "memchr", - "mio", - "mio-uds", "num_cpus", "once_cell", "pin-project-lite", "pin-utils", "slab", + "smol", + "wasm-bindgen-futures", ] [[package]] name = "async-task" -version = "1.3.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ac2c016b079e771204030951c366db398864f5026f84a44dafb0ff20f02085d" -dependencies = [ - "libc", - "winapi 0.3.9", -] +checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" [[package]] name = "async-tls" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fd83426b89b034bf4e9ceb9c533c2f2386b813fd3dcae0a425ec6f1837d78a" +checksum = "df097e3f506bec0e1a24f06bb3c962c228f36671de841ff579cb99f371772634" dependencies = [ "futures 0.3.5", "rustls", @@ -247,6 +258,12 @@ dependencies = [ "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" @@ -296,6 +313,12 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + [[package]] name = "bindgen" version = "0.53.3" @@ -342,18 +365,6 @@ dependencies = [ "radium", ] -[[package]] -name = "blake2" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" -dependencies = [ - "byte-tools", - "crypto-mac 0.7.0", - "digest 0.8.1", - "opaque-debug 0.2.3", -] - [[package]] name = "blake2" version = "0.9.0" @@ -439,17 +450,17 @@ dependencies = [ ] [[package]] -name = "broadcaster" -version = "1.0.0" +name = "blocking" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c972e21e0d055a36cf73e4daae870941fe7a8abcd5ac3396aab9e4c126bd87" +checksum = "d2468ff7bf85066b4a3678fede6fe66db31846d753ff0adfbfab2c6a6e81612b" dependencies = [ - "futures-channel", - "futures-core", - "futures-sink", - "futures-util", - "parking_lot 0.10.2", - "slab", + "async-channel", + "atomic-waker", + "futures-lite", + "once_cell", + "parking", + "waker-fn", ] [[package]] @@ -517,6 +528,12 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + [[package]] name = "cc" version = "1.0.57" @@ -602,21 +619,21 @@ 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" +name = "concurrent-queue" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "1582139bb74d97ef232c30bc236646017db06f13ee7cc01fa24c9e55640f86d4" dependencies = [ - "bitflags", + "cache-padded", ] [[package]] @@ -676,16 +693,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-channel" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061" -dependencies = [ - "crossbeam-utils", - "maybe-uninit", -] - [[package]] name = "crossbeam-deque" version = "0.7.3" @@ -762,9 +769,9 @@ dependencies = [ [[package]] name = "ct-logs" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3686f5fa27dbc1d76c751300376e167c5a43387f44bb451fd1c24776e49113" +checksum = "8c8e13110a84b6315df212c045be706af261fd364791cad863285439ebba672e" dependencies = [ "sct", ] @@ -854,16 +861,27 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +[[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-pre.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978710b352437433c97b2bff193f2fb1dfd58a093f863dd95e225a19baa599a2" +checksum = "21a8a37f4e8b35af971e6db5e3897e7a6344caa3f92f6544f88125a1f5f0035a" dependencies = [ - "clear_on_drop", "curve25519-dalek", + "ed25519", "rand 0.7.3", + "serde", "sha2 0.8.2", + "zeroize", ] [[package]] @@ -951,6 +969,12 @@ dependencies = [ "uint", ] +[[package]] +name = "event-listener" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829694371bd7bbc6aee17c4ff624aad8bf9f4dc06c6f9f6071eaa08c89530d10" + [[package]] name = "evm" version = "0.17.0" @@ -1034,6 +1058,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fastrand" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36a9cb09840f81cd211e435d00a4e487edd263dc3c8ff815c32dd76ad668ebed" + [[package]] name = "fdlimit" version = "0.1.4" @@ -1097,14 +1127,14 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "parity-scale-codec", ] [[package]] name = "frame-benchmarking" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "frame-system", @@ -1120,7 +1150,7 @@ dependencies = [ [[package]] name = "frame-executive" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "frame-system", @@ -1134,7 +1164,7 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "11.0.0-rc3" +version = "11.0.0-rc5" dependencies = [ "parity-scale-codec", "serde", @@ -1144,7 +1174,7 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "bitmask", "frame-metadata", @@ -1168,7 +1198,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support-procedural-tools", "proc-macro2", @@ -1178,7 +1208,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1189,7 +1219,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "proc-macro2", "quote 1.0.7", @@ -1198,7 +1228,7 @@ dependencies = [ [[package]] name = "frame-system" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1213,7 +1243,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "parity-scale-codec", "sp-api", @@ -1402,6 +1432,21 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" +[[package]] +name = "futures-lite" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbe71459749b2e8e66fb95df721b22fa08661ad384a0c5b519e11d3893b4692a" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.5" @@ -1440,6 +1485,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" @@ -1474,18 +1523,6 @@ dependencies = [ "slab", ] -[[package]] -name = "futures_codec" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0a73299e4718f5452e45980fc1d6957a070abe308d3700b63b8673f47e1c2b3" -dependencies = [ - "bytes 0.5.5", - "futures 0.3.5", - "memchr", - "pin-project", -] - [[package]] name = "futures_codec" version = "0.4.1" @@ -1603,6 +1640,19 @@ dependencies = [ "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 = "h2" version = "0.1.26" @@ -1661,10 +1711,20 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead" dependencies = [ - "ahash", + "ahash 0.2.18", "autocfg 0.1.7", ] +[[package]] +name = "hashbrown" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb" +dependencies = [ + "ahash 0.3.8", + "autocfg 1.0.0", +] + [[package]] name = "heck" version = "0.3.1" @@ -1844,9 +1904,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac965ea399ec3a25ac7d13b8affd4b8f39325cca00858ddf5eb29b79e6b14b08" +checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6" dependencies = [ "bytes 0.5.5", "ct-logs", @@ -2166,9 +2226,9 @@ dependencies = [ [[package]] name = "kvdb" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e763b2a9b500ba47948061d1e8bc3b5f03a8a1f067dbcf822a4d2c84d2b54a3a" +checksum = "0315ef2f688e33844400b31f11c263f2b3dc21d8b9355c6891c5f185fae43f9a" dependencies = [ "parity-util-mem", "smallvec 1.4.1", @@ -2176,9 +2236,9 @@ dependencies = [ [[package]] name = "kvdb-memorydb" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73027d5e228de6f503b5b7335d530404fc26230a6ae3e09b33ec6e45408509a4" +checksum = "73de822b260a3bdfb889dbbb65bb2d473eee2253973d6fa4a5d149a2a4a7c66e" dependencies = [ "kvdb", "parity-util-mem", @@ -2187,9 +2247,9 @@ dependencies = [ [[package]] name = "kvdb-rocksdb" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84384eca250c7ff67877eda5336f28a86586aaee24acb945643590671f6bfce1" +checksum = "7c341ef15cfb1f923fa3b5138bfbd2d4813a2c1640b473727a53351c7f0b0fa2" dependencies = [ "fs-swap", "kvdb", @@ -2257,9 +2317,9 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" [[package]] name = "libp2p" -version = "0.19.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057eba5432d3e740e313c6e13c9153d0cb76b4f71bfc2e5242ae5bdb7d41af67" +checksum = "0306a49ee6a89468f96089906f36b0eef82c988dcfc8acf3e2dcd6ad1c859f85" dependencies = [ "bytes 0.5.5", "futures 0.3.5", @@ -2279,7 +2339,7 @@ dependencies = [ "libp2p-websocket", "libp2p-yamux", "multihash", - "parity-multiaddr 0.9.1", + "parity-multiaddr", "parking_lot 0.10.2", "pin-project", "smallvec 1.4.1", @@ -2288,9 +2348,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.19.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a0387b930c3d4c2533dc4893c1e0394185ddcc019846121b1b27491e45a2c08" +checksum = "6a694fd76d7c33a45a0e6e1525e9b9b5d11127c9c94e560ac0f8abba54ed80af" dependencies = [ "asn1_der", "bs58", @@ -2304,7 +2364,7 @@ dependencies = [ "log", "multihash", "multistream-select", - "parity-multiaddr 0.9.1", + "parity-multiaddr", "parking_lot 0.10.2", "pin-project", "prost", @@ -2322,9 +2382,9 @@ dependencies = [ [[package]] name = "libp2p-core-derive" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f09548626b737ed64080fde595e06ce1117795b8b9fc4d2629fa36561c583171" +checksum = "f753d9324cd3ec14bf04b8a8cd0d269c87f294153d6bf2a84497a63a5ad22213" dependencies = [ "quote 1.0.7", "syn 1.0.33", @@ -2332,9 +2392,9 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc186d9a941fd0207cf8f08ef225a735e2d7296258f570155e525f6ee732f87" +checksum = "f751924b6b98e350005e0b87a822beb246792a3fb878c684e088f866158120ac" dependencies = [ "futures 0.3.5", "libp2p-core", @@ -2343,9 +2403,9 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f76075b170d908bae616f550ade410d9d27c013fa69042551dbfc757c7c094" +checksum = "912c00a7bf67e0e765daf0cc37e08f675ea26aba3d6d1fbfaee81f19a4c23049" dependencies = [ "futures 0.3.5", "libp2p-core", @@ -2359,16 +2419,16 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.19.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d6c1d5100973527ae70d82687465b17049c1b717a7964de38b8e65000878ff" +checksum = "44ed3a4c8111c570ab2bffb30c6353178d7603ce3787e3c5f2493c8d3d16d1f0" dependencies = [ "arrayvec 0.5.1", "bytes 0.5.5", "either", "fnv", "futures 0.3.5", - "futures_codec 0.3.4", + "futures_codec", "libp2p-core", "libp2p-swarm", "log", @@ -2379,16 +2439,16 @@ dependencies = [ "sha2 0.8.2", "smallvec 1.4.1", "uint", - "unsigned-varint 0.3.3", + "unsigned-varint 0.4.0", "void", "wasm-timer", ] [[package]] name = "libp2p-mdns" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f55b2d4b80986e5bf158270ab23268ec0e7f644ece5436fbaabc5155472f357" +checksum = "cd004c668160fd922f7268b2cd1e4550ff69165d9c744e9eb5770086eb753d02" dependencies = [ "async-std", "data-encoding", @@ -2408,14 +2468,14 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be7d913a4cd57de2013257ec73f07d77bfce390b370023e2d59083e5ca079864" +checksum = "14ae0ffacd30f073f96cd518b2c9cd2cb18ac27c3d136a4b23cf1af99f33e541" dependencies = [ "bytes 0.5.5", "fnv", "futures 0.3.5", - "futures_codec 0.4.1", + "futures_codec", "libp2p-core", "log", "parking_lot 0.10.2", @@ -2424,10 +2484,11 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.19.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a03db664653369f46ee03fcec483a378c20195089bb43a26cb9fb0058009ac88" +checksum = "8f353f8966bbaaf7456535fffd3f366f153148773a0cf04b2ec3860955cb720e" dependencies = [ + "bytes 0.5.5", "curve25519-dalek", "futures 0.3.5", "lazy_static", @@ -2445,9 +2506,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.19.3" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dedd34e35a9728d52d59ef36a218e411359a353f9011b2574b86ee790978f6" +checksum = "70130cf130e4ba6dc177366e72dd9f86f9e3588fa1a0c4145247e676f16affad" dependencies = [ "futures 0.3.5", "libp2p-core", @@ -2460,9 +2521,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce53ff4d127cf8b39adf84dbd381ca32d49bd85788cee08e6669da2495993930" +checksum = "f88d5e2a090a2aadf042cd33484e2f015c6dab212567406a59deece5dedbd133" dependencies = [ "futures 0.3.5", "libp2p-core", @@ -2475,9 +2536,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481500c5774c62e8c413e9535b3f33a0e3dbacf2da63b8d3056c686a9df4146" +checksum = "9b1fa2bbad054020cb875546a577a66a65a5bf42eff55ed5265f92ffee3cc052" dependencies = [ "async-std", "futures 0.3.5", @@ -2491,9 +2552,9 @@ dependencies = [ [[package]] name = "libp2p-wasm-ext" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f59fdbb5706f2723ca108c088b1c7a37f735a8c328021f0508007162627e9885" +checksum = "0feb99e32fea20ffb1bbf56a6fb2614bff7325ff44a515728385170b3420d2c3" dependencies = [ "futures 0.3.5", "js-sys", @@ -2505,12 +2566,11 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.19.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "085fbe4c05c4116c2164ab4d5a521eb6e00516c444f61b3ee9f68c7b1e53580b" +checksum = "046a5201f6e471f22b22b394e4d084269ed1e28cf7300f7b49874385db84c7bd" dependencies = [ "async-tls", - "bytes 0.5.5", "either", "futures 0.3.5", "libp2p-core", @@ -2526,9 +2586,9 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da33e7b5f49c75c6a8afb0b8d1e229f5fa48be9f39bd14cdbc21459a02ac6fc" +checksum = "46ae9bf2f7d8a4be9c7e9b61df9de9dc1bd66419d669098f22f81f8d9571029a" dependencies = [ "futures 0.3.5", "libp2p-core", @@ -2629,7 +2689,7 @@ checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" dependencies = [ "cfg-if", "generator", - "scoped-tls", + "scoped-tls 0.1.2", ] [[package]] @@ -2638,7 +2698,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0609345ddee5badacf857d4f547e0e5a2e987db77085c24cd887f73573a04237" dependencies = [ - "hashbrown", + "hashbrown 0.6.3", ] [[package]] @@ -2689,13 +2749,12 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.21.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2999ff7a65d5a1d72172f6d51fa2ea03024b51aee709ba5ff81c3c629a2410" +checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a" dependencies = [ - "ahash", "hash-db", - "hashbrown", + "hashbrown 0.8.1", "parity-util-mem", ] @@ -2956,6 +3015,7 @@ dependencies = [ "jsonrpc-core", "log", "moonbeam-runtime", + "pallet-ethereum 0.1.0", "pallet-evm", "pallet-transaction-payment-rpc", "parking_lot 0.10.2", @@ -2964,9 +3024,11 @@ dependencies = [ "sc-client-api", "sc-consensus", "sc-consensus-aura", + "sc-consensus-manual-seal", "sc-executor", "sc-finality-grandpa", "sc-network", + "sc-rpc", "sc-rpc-api", "sc-service", "sc-transaction-pool", @@ -2979,6 +3041,7 @@ dependencies = [ "sp-finality-grandpa", "sp-inherents", "sp-runtime", + "sp-timestamp", "sp-transaction-pool", "structopt", "substrate-build-script-utils", @@ -3132,7 +3195,7 @@ dependencies = [ [[package]] name = "pallet-aura" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "frame-system", @@ -3148,9 +3211,23 @@ dependencies = [ "sp-timestamp", ] +[[package]] +name = "pallet-authorship" +version = "2.0.0-rc5" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-authorship", + "sp-inherents", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-balances" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3192,7 +3269,7 @@ checksum = "bd4556fb64842e71bb6e2f98b7541c0d310069eb607d432c6ac9bdaecbfd3118" [[package]] name = "pallet-evm" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "evm", "frame-support", @@ -3212,7 +3289,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "frame-system", @@ -3227,10 +3304,12 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", + "pallet-authorship", "pallet-finality-tracker", "pallet-session", "parity-scale-codec", @@ -3246,7 +3325,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "frame-system", @@ -3258,7 +3337,7 @@ dependencies = [ [[package]] name = "pallet-session" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "frame-system", @@ -3277,7 +3356,7 @@ dependencies = [ [[package]] name = "pallet-sudo" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "frame-system", @@ -3290,7 +3369,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3306,7 +3385,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "frame-system", @@ -3314,13 +3393,15 @@ dependencies = [ "parity-scale-codec", "serde", "smallvec 1.4.1", + "sp-core", + "sp-io", "sp-runtime", "sp-std", ] [[package]] name = "pallet-transaction-payment-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -3337,7 +3418,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-support", "parity-scale-codec", @@ -3361,24 +3442,6 @@ dependencies = [ "parking_lot 0.10.2", ] -[[package]] -name = "parity-multiaddr" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f77055f9e81921a8cc7bebeb6cded3d128931d51f1e3dd6251f0770a6d431477" -dependencies = [ - "arrayref", - "bs58", - "byteorder", - "data-encoding", - "parity-multihash", - "percent-encoding 2.1.0", - "serde", - "static_assertions", - "unsigned-varint 0.3.3", - "url 2.1.1", -] - [[package]] name = "parity-multiaddr" version = "0.9.1" @@ -3397,21 +3460,6 @@ dependencies = [ "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 0.8.1", - "bytes 0.5.5", - "rand 0.7.3", - "sha-1", - "sha2 0.8.2", - "sha3", - "unsigned-varint 0.3.3", -] - [[package]] name = "parity-scale-codec" version = "1.3.1" @@ -3464,11 +3512,12 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6e2583649a3ca84894d1d71da249abcfda54d5aca24733d72ca10d0f02361c" +checksum = "297ff91fa36aec49ce183484b102f6b75b46776822bd81525bfc4cc9b0dd0f5c" dependencies = [ "cfg-if", + "hashbrown 0.8.1", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot 0.10.2", @@ -3494,6 +3543,12 @@ version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" +[[package]] +name = "parking" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb300f271742d4a2a66c01b6b2fa0c83dfebd2e0bf11addb879a3547b4ed87c" + [[package]] name = "parking_lot" version = "0.9.0" @@ -4181,6 +4236,12 @@ dependencies = [ "syn 1.0.33", ] +[[package]] +name = "retain_mut" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e005d658ad26eacc2b6c506dfde519f4e277e328d0eb3379ca61647d70a8f531" + [[package]] name = "ring" version = "0.16.15" @@ -4248,7 +4309,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" dependencies = [ - "base64", + "base64 0.11.0", "blake2b_simd", "constant_time_eq", "crossbeam-utils", @@ -4283,11 +4344,11 @@ dependencies = [ [[package]] name = "rustls" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1" +checksum = "cac94b333ee2aac3284c5b8a1b7fb4dd11cba88c244e3fe33cdbd047af0eb693" dependencies = [ - "base64", + "base64 0.12.3", "log", "ring", "sct", @@ -4296,9 +4357,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75ffeb84a6bd9d014713119542ce415db3a3e4748f0bfce1e1416cd224a23a5" +checksum = "629d439a7672da82dd955498445e496ee2096fe2117b9f796558a43fdb9e59b8" dependencies = [ "openssl-probe", "rustls", @@ -4334,7 +4395,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -4357,7 +4418,7 @@ dependencies = [ [[package]] name = "sc-block-builder" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -4366,13 +4427,14 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-core", + "sp-inherents", "sp-runtime", "sp-state-machine", ] [[package]] name = "sc-chain-spec" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -4387,7 +4449,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4397,7 +4459,7 @@ dependencies = [ [[package]] name = "sc-cli" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "ansi_term 0.12.1", "atty", @@ -4419,6 +4481,7 @@ dependencies = [ "sc-service", "sc-telemetry", "sc-tracing", + "serde", "serde_json", "sp-blockchain", "sp-core", @@ -4436,7 +4499,7 @@ dependencies = [ [[package]] name = "sc-client-api" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "derive_more", "fnv", @@ -4471,7 +4534,7 @@ dependencies = [ [[package]] name = "sc-client-db" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "blake2-rfc", "hash-db", @@ -4499,7 +4562,7 @@ dependencies = [ [[package]] name = "sc-consensus" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "sc-client-api", "sp-blockchain", @@ -4509,7 +4572,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "derive_more", "futures 0.3.5", @@ -4537,9 +4600,33 @@ dependencies = [ "substrate-prometheus-endpoint", ] +[[package]] +name = "sc-consensus-manual-seal" +version = "0.8.0-rc5" +dependencies = [ + "assert_matches", + "derive_more", + "futures 0.3.5", + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", + "log", + "parking_lot 0.10.2", + "sc-client-api", + "sc-transaction-pool", + "serde", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-transaction-pool", + "substrate-prometheus-endpoint", +] + [[package]] name = "sc-consensus-slots" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -4552,6 +4639,7 @@ dependencies = [ "sp-application-crypto", "sp-blockchain", "sp-consensus", + "sp-consensus-slots", "sp-core", "sp-inherents", "sp-runtime", @@ -4560,7 +4648,7 @@ dependencies = [ [[package]] name = "sc-executor" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "derive_more", "lazy_static", @@ -4586,7 +4674,7 @@ dependencies = [ [[package]] name = "sc-executor-common" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "derive_more", "log", @@ -4602,7 +4690,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "log", "parity-scale-codec", @@ -4616,7 +4704,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "assert_matches", "derive_more", @@ -4653,13 +4741,12 @@ dependencies = [ [[package]] name = "sc-informant" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "ansi_term 0.12.1", "futures 0.3.5", "log", "parity-util-mem", - "parking_lot 0.10.2", "sc-client-api", "sc-network", "sp-blockchain", @@ -4671,7 +4758,7 @@ dependencies = [ [[package]] name = "sc-keystore" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "derive_more", "hex", @@ -4686,7 +4773,7 @@ dependencies = [ [[package]] name = "sc-light" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "hash-db", "lazy_static", @@ -4704,7 +4791,7 @@ dependencies = [ [[package]] name = "sc-network" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "bitflags", "bs58", @@ -4716,7 +4803,7 @@ dependencies = [ "fork-tree", "futures 0.3.5", "futures-timer 3.0.2", - "futures_codec 0.3.4", + "futures_codec", "hex", "ip_network", "libp2p", @@ -4747,7 +4834,7 @@ dependencies = [ "sp-utils", "substrate-prometheus-endpoint", "thiserror", - "unsigned-varint 0.3.3", + "unsigned-varint 0.4.0", "void", "wasm-timer", "zeroize", @@ -4755,7 +4842,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -4769,7 +4856,7 @@ dependencies = [ [[package]] name = "sc-offchain" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "bytes 0.5.5", "fnv", @@ -4795,7 +4882,7 @@ dependencies = [ [[package]] name = "sc-peerset" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "futures 0.3.5", "libp2p", @@ -4807,7 +4894,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -4815,7 +4902,7 @@ dependencies = [ [[package]] name = "sc-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "futures 0.3.5", "hash-db", @@ -4846,7 +4933,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "derive_more", "futures 0.3.5", @@ -4869,7 +4956,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -4884,7 +4971,7 @@ dependencies = [ [[package]] name = "sc-service" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "derive_more", "directories", @@ -4897,7 +4984,6 @@ dependencies = [ "lazy_static", "log", "netstat2", - "parity-multiaddr 0.7.3", "parity-scale-codec", "parity-util-mem", "parking_lot 0.10.2", @@ -4946,7 +5032,7 @@ dependencies = [ [[package]] name = "sc-state-db" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "log", "parity-scale-codec", @@ -4959,9 +5045,8 @@ dependencies = [ [[package]] name = "sc-telemetry" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ - "bytes 0.5.5", "futures 0.3.5", "futures-timer 3.0.2", "libp2p", @@ -4980,7 +5065,7 @@ dependencies = [ [[package]] name = "sc-tracing" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "erased-serde", "log", @@ -4996,7 +5081,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "derive_more", "futures 0.3.5", @@ -5004,6 +5089,7 @@ dependencies = [ "log", "parity-util-mem", "parking_lot 0.10.2", + "retain_mut", "serde", "sp-blockchain", "sp-core", @@ -5015,7 +5101,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "derive_more", "futures 0.3.5", @@ -5072,6 +5158,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + [[package]] name = "scopeguard" version = "1.1.0" @@ -5088,11 +5180,20 @@ 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" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" +checksum = "ad502866817f0575705bd7be36e2b2535cc33262d493aa733a2ec862baa2bc2b" dependencies = [ "bitflags", "core-foundation", @@ -5103,9 +5204,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "0.4.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" +checksum = "51ceb04988b17b6d1dcd555390fa822ca5637b4a14e1f5099f13d351bed4d6c7" dependencies = [ "core-foundation-sys", "libc", @@ -5132,6 +5233,12 @@ 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" @@ -5175,12 +5282,6 @@ dependencies = [ "opaque-debug 0.2.3", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - [[package]] name = "sha2" version = "0.8.2" @@ -5235,6 +5336,12 @@ dependencies = [ "libc", ] +[[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" @@ -5300,6 +5407,27 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" +[[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", + "scoped-tls 1.0.0", + "slab", + "socket2", + "wepoll-sys-stjepang", + "winapi 0.3.9", +] + [[package]] name = "snow" version = "0.7.1" @@ -5307,7 +5435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32bf8474159a95551661246cda4976e89356999e3cbfef36f493dacc3fae1e8e" dependencies = [ "aes-gcm", - "blake2 0.9.0", + "blake2", "chacha20poly1305", "rand 0.7.3", "rand_core 0.5.1", @@ -5332,27 +5460,23 @@ dependencies = [ [[package]] name = "soketto" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9dab3f95c9ebdf3a88268c19af668f637a3c5039c2c56ff2d40b1b2d64a25b" +checksum = "85457366ae0c6ce56bf05a958aef14cd38513c236568618edbcd9a8c52cb80b0" dependencies = [ - "base64", + "base64 0.12.3", "bytes 0.5.5", "flate2", "futures 0.3.5", - "http 0.2.1", "httparse", "log", "rand 0.7.3", - "sha1", - "smallvec 1.4.1", - "static_assertions", - "thiserror", + "sha-1", ] [[package]] name = "sp-allocator" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "derive_more", "log", @@ -5363,7 +5487,7 @@ dependencies = [ [[package]] name = "sp-api" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "hash-db", "parity-scale-codec", @@ -5377,7 +5501,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -5388,7 +5512,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "parity-scale-codec", "serde", @@ -5399,7 +5523,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "integer-sqrt", "num-traits 0.2.12", @@ -5409,9 +5533,19 @@ dependencies = [ "sp-std", ] +[[package]] +name = "sp-authorship" +version = "2.0.0-rc5" +dependencies = [ + "parity-scale-codec", + "sp-inherents", + "sp-runtime", + "sp-std", +] + [[package]] name = "sp-block-builder" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "parity-scale-codec", "sp-api", @@ -5422,7 +5556,7 @@ dependencies = [ [[package]] name = "sp-blockchain" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "derive_more", "log", @@ -5431,13 +5565,14 @@ dependencies = [ "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-rc3" +version = "2.0.0-rc5" dependencies = [ "serde", "serde_json", @@ -5445,7 +5580,7 @@ dependencies = [ [[package]] name = "sp-consensus" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "derive_more", "futures 0.3.5", @@ -5460,6 +5595,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", + "sp-trie", "sp-utils", "sp-version", "substrate-prometheus-endpoint", @@ -5468,7 +5604,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "parity-scale-codec", "sp-api", @@ -5479,9 +5615,17 @@ dependencies = [ "sp-timestamp", ] +[[package]] +name = "sp-consensus-slots" +version = "0.8.0-rc5" +dependencies = [ + "parity-scale-codec", + "sp-runtime", +] + [[package]] name = "sp-core" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "base58", "blake2-rfc", @@ -5505,6 +5649,7 @@ dependencies = [ "rand 0.7.3", "regex", "schnorrkel", + "secrecy", "serde", "sha2 0.8.2", "sp-debug-derive", @@ -5522,7 +5667,7 @@ dependencies = [ [[package]] name = "sp-database" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -5530,7 +5675,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "proc-macro2", "quote 1.0.7", @@ -5539,7 +5684,7 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "environmental", "parity-scale-codec", @@ -5549,7 +5694,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "finality-grandpa", "log", @@ -5564,7 +5709,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -5573,7 +5718,7 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "derive_more", "parity-scale-codec", @@ -5584,7 +5729,7 @@ dependencies = [ [[package]] name = "sp-io" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "futures 0.3.5", "hash-db", @@ -5604,7 +5749,7 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "lazy_static", "sp-core", @@ -5614,7 +5759,7 @@ dependencies = [ [[package]] name = "sp-offchain" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "sp-api", "sp-core", @@ -5623,7 +5768,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "backtrace", "log", @@ -5631,7 +5776,7 @@ dependencies = [ [[package]] name = "sp-rpc" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "serde", "sp-core", @@ -5639,7 +5784,7 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "either", "hash256-std-hasher", @@ -5660,7 +5805,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "parity-scale-codec", "primitive-types", @@ -5674,7 +5819,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "Inflector", "proc-macro-crate", @@ -5685,7 +5830,7 @@ dependencies = [ [[package]] name = "sp-serializer" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "serde", "serde_json", @@ -5693,7 +5838,7 @@ dependencies = [ [[package]] name = "sp-session" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "parity-scale-codec", "sp-api", @@ -5705,7 +5850,7 @@ dependencies = [ [[package]] name = "sp-staking" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -5714,7 +5859,7 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "hash-db", "itertools 0.9.0", @@ -5734,11 +5879,11 @@ dependencies = [ [[package]] name = "sp-std" -version = "2.0.0-rc3" +version = "2.0.0-rc5" [[package]] name = "sp-storage" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -5749,7 +5894,7 @@ dependencies = [ [[package]] name = "sp-timestamp" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5762,7 +5907,7 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "log", "rental", @@ -5771,7 +5916,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "derive_more", "futures 0.3.5", @@ -5781,12 +5926,11 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-runtime", - "sp-utils", ] [[package]] name = "sp-trie" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "hash-db", "memory-db", @@ -5799,7 +5943,7 @@ dependencies = [ [[package]] name = "sp-utils" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "futures 0.3.5", "futures-core", @@ -5810,7 +5954,7 @@ dependencies = [ [[package]] name = "sp-version" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -5821,7 +5965,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5939,14 +6083,14 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "platforms", ] [[package]] name = "substrate-frame-rpc-system" -version = "2.0.0-rc3" +version = "2.0.0-rc5" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.5", @@ -5968,7 +6112,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" -version = "0.8.0-rc3" +version = "0.8.0-rc5" dependencies = [ "async-std", "derive_more", @@ -6051,9 +6195,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.13.4" +version = "0.14.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac193374347e7c263c5f547524f36ff8ec6702d56c8799c8331d26dffe8c1e" +checksum = "2983daff11a197c7c406b130579bc362177aa54cf2cc1f34d6ac88fccaa6a5e1" dependencies = [ "cfg-if", "doc-comment", @@ -6336,9 +6480,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15cb62a0d2770787abc96e99c1cd98fcf17f94959f3af63ca85bdfb203f051b4" +checksum = "228139ddd4fea3fa345a29233009635235833e52807af7ea6448ead03890d6a9" dependencies = [ "futures-core", "rustls", @@ -6514,12 +6658,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.21.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb230c24c741993b04cfccbabb45acff6f6480c5f00d3ed8794ea43db3a9d727" +checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.8.1", "log", "rustc-hex", "smallvec 1.4.1", @@ -6633,12 +6777,6 @@ name = "unsigned-varint" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f67332660eb59a6f1eb24ff1220c9e8d01738a8503c6002e30bcfe4bd9f2b4a9" -dependencies = [ - "bytes 0.5.5", - "futures-io", - "futures-util", - "futures_codec 0.3.4", -] [[package]] name = "unsigned-varint" @@ -6647,7 +6785,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5" dependencies = [ "bytes 0.5.5", - "futures_codec 0.4.1", + "futures-io", + "futures-util", + "futures_codec", ] [[package]] @@ -6702,6 +6842,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "waker-fn" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9571542c2ce85ce642e6b58b3364da2fb53526360dfb7c211add4f5c23105ff7" + [[package]] name = "want" version = "0.2.0" @@ -6805,7 +6951,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", @@ -6872,6 +7018,15 @@ dependencies = [ "webpki", ] +[[package]] +name = "wepoll-sys-stjepang" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fd319e971980166b53e17b1026812ad66c6b54063be879eb182342b55284694" +dependencies = [ + "cc", +] + [[package]] name = "which" version = "3.1.1" @@ -6997,19 +7152,3 @@ dependencies = [ "syn 1.0.33", "synstructure", ] - -[[patch.unused]] -name = "evm" -version = "0.16.1" - -[[patch.unused]] -name = "evm-core" -version = "0.16.1" - -[[patch.unused]] -name = "evm-gasometer" -version = "0.16.1" - -[[patch.unused]] -name = "evm-runtime" -version = "0.16.1" diff --git a/Cargo.toml b/Cargo.toml index 642447362d..3b26bcf979 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,3 @@ panic = 'unwind' [patch.crates-io] ethereum = { path = "vendor/ethereum" } -evm = { path = "vendor/frontier/vendor/evm" } -evm-core = { path = "vendor/frontier/vendor/evm/core" } -evm-gasometer = { path = "vendor/frontier/vendor/evm/gasometer" } -evm-runtime = { path = "vendor/frontier/vendor/evm/runtime" } diff --git a/node/Cargo.toml b/node/Cargo.toml index 0430f74814..10d9c4359a 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -22,6 +22,7 @@ jsonrpc-core = "14.0.3" sp-api = { version = "2.0.0-dev", path = "../vendor/frontier/vendor/substrate/primitives/api" } sp-blockchain = { version = "2.0.0-dev", path = "../vendor/frontier/vendor/substrate/primitives/blockchain" } sc-rpc-api = { version = "0.8.0-dev", path = "../vendor/frontier/vendor/substrate/client/rpc-api" } +sc-rpc = { version = "2.0.0-dev", path = "../vendor/frontier/vendor/substrate/client/rpc" } substrate-frame-rpc-system = { version = "2.0.0-dev", path = "../vendor/frontier/vendor/substrate/utils/frame/rpc/system" } pallet-transaction-payment-rpc = { version = "2.0.0-dev", path = "../vendor/frontier/vendor/substrate/frame/transaction-payment/rpc/" } sc-cli = { version = "0.8.0-dev", path = "../vendor/frontier/vendor/substrate/client/cli" } @@ -34,9 +35,12 @@ sp-transaction-pool = { version = "2.0.0-dev", path = "../vendor/frontier/vendor sc-network = { version = "0.8.0-dev", path = "../vendor/frontier/vendor/substrate/client/network" } sc-consensus-aura = { version = "0.8.0-dev", path = "../vendor/frontier/vendor/substrate/client/consensus/aura" } sp-consensus-aura = { version = "0.8.0-dev", path = "../vendor/frontier/vendor/substrate/primitives/consensus/aura" } +sc-consensus-manual-seal = { path = "../vendor/frontier/vendor/substrate/client/consensus/manual-seal" } sp-consensus = { version = "0.8.0-dev", path = "../vendor/frontier/vendor/substrate/primitives/consensus/common" } sc-consensus = { version = "0.8.0-dev", path = "../vendor/frontier/vendor/substrate/client/consensus/common" } +sp-timestamp = { version = "2.0.0-dev", default-features = false, path = "../vendor/frontier/vendor/substrate/primitives/timestamp" } evm = { version = "2.0.0-dev", package = "pallet-evm", path = "../vendor/frontier/vendor/substrate/frame/evm" } +ethereum = { version = "0.1.0", package = "pallet-ethereum", path = "../vendor/frontier/frame/ethereum" } sc-finality-grandpa = { version = "0.8.0-dev", path = "../vendor/frontier/vendor/substrate/client/finality-grandpa" } sp-finality-grandpa = { version = "2.0.0-dev", path = "../vendor/frontier/vendor/substrate/primitives/finality-grandpa" } sc-client-api = { version = "2.0.0-dev", path = "../vendor/frontier/vendor/substrate/client/api" } diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 28945df82e..cf3e2a985c 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -1,21 +1,39 @@ +// This file is part of Frontier. + +// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use sp_core::{Pair, Public, sr25519, H160, U256}; use moonbeam_runtime::{ - AccountId, AuraConfig, BalancesConfig, EVMConfig, GenesisConfig, GrandpaConfig, Signature, - SudoConfig, SystemConfig, WASM_BINARY, + AccountId, AuraConfig, BalancesConfig, EVMConfig, EthereumConfig, GenesisConfig, GrandpaConfig, + SudoConfig, SystemConfig, WASM_BINARY, Signature }; -use sc_service::ChainType; use sp_consensus_aura::sr25519::AuthorityId as AuraId; -use sp_core::{sr25519, Pair, Public, H160, U256}; use sp_finality_grandpa::AuthorityId as GrandpaId; -use sp_runtime::traits::{IdentifyAccount, Verify}; +use sp_runtime::traits::{Verify, IdentifyAccount}; +use sc_service::ChainType; use std::collections::BTreeMap; use std::str::FromStr; -// Note this is the URL for the telemetry server -//const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; + +// The URL for the telemetry server. +// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. pub type ChainSpec = sc_service::GenericChainSpec; -/// Helper function to generate a crypto pair from seed +/// Generate a crypto pair from seed. pub fn get_from_seed(seed: &str) -> ::Public { TPublic::Pair::from_string(&format!("//{}", seed), None) .expect("static values are valid; qed") @@ -24,83 +42,111 @@ pub fn get_from_seed(seed: &str) -> ::Pu type AccountPublic = ::Signer; -/// Helper function to generate an account ID from seed -pub fn get_account_id_from_seed(seed: &str) -> AccountId -where - AccountPublic: From<::Public>, +/// Generate an account ID from seed. +pub fn get_account_id_from_seed(seed: &str) -> AccountId where + AccountPublic: From<::Public> { AccountPublic::from(get_from_seed::(seed)).into_account() } -/// Helper function to generate an authority key for Aura +/// Generate an Aura authority key. pub fn authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) { - (get_from_seed::(s), get_from_seed::(s)) + ( + get_from_seed::(s), + get_from_seed::(s), + ) } -pub fn development_config() -> ChainSpec { - ChainSpec::from_genesis( +pub fn development_config() -> Result { + let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?; + + Ok(ChainSpec::from_genesis( + // Name "Development", + // ID "dev", ChainType::Development, - || { - testnet_genesis( - vec![authority_keys_from_seed("Alice")], + move || testnet_genesis( + wasm_binary, + // Initial PoA authorities + vec![ + authority_keys_from_seed("Alice"), + ], + // Sudo account + get_account_id_from_seed::("Alice"), + // Pre-funded accounts + vec![ get_account_id_from_seed::("Alice"), - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - ], - true, - ) - }, + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + ], + true, + ), + // Bootnodes vec![], + // Telemetry None, + // Protocol ID None, + // Properties None, + // Extensions None, - ) + )) } -pub fn local_testnet_config() -> ChainSpec { - ChainSpec::from_genesis( +pub fn local_testnet_config() -> Result { + let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?; + + Ok(ChainSpec::from_genesis( + // Name "Local Testnet", + // ID "local_testnet", ChainType::Local, - || { - testnet_genesis( - vec![ - authority_keys_from_seed("Alice"), - authority_keys_from_seed("Bob"), - ], + move || testnet_genesis( + wasm_binary, + // Initial PoA authorities + vec![ + authority_keys_from_seed("Alice"), + authority_keys_from_seed("Bob"), + ], + // Sudo account + get_account_id_from_seed::("Alice"), + // Pre-funded accounts + vec![ get_account_id_from_seed::("Alice"), - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), - ], - true, - ) - }, + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ], + true, + ), + // Bootnodes vec![], + // Telemetry None, + // Protocol ID None, + // Properties None, + // Extensions None, - ) + )) } +/// Configure initial storage state for FRAME modules. fn testnet_genesis( + wasm_binary: &[u8], initial_authorities: Vec<(AuraId, GrandpaId)>, root_key: AccountId, endowed_accounts: Vec, @@ -117,31 +163,29 @@ fn testnet_genesis( code: vec![], }, ); - GenesisConfig { system: Some(SystemConfig { - code: WASM_BINARY.to_vec(), + // Add Wasm runtime to storage. + code: wasm_binary.to_vec(), changes_trie_config: Default::default(), }), balances: Some(BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, 1 << 60)) - .collect(), + // Configure endowed accounts with initial balance of 1 << 60. + balances: endowed_accounts.iter().cloned().map(|k|(k, 1 << 60)).collect(), }), aura: Some(AuraConfig { authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(), }), grandpa: Some(GrandpaConfig { - authorities: initial_authorities - .iter() - .map(|x| (x.1.clone(), 1)) - .collect(), + authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(), + }), + sudo: Some(SudoConfig { + // Assign network admin rights. + key: root_key, }), - sudo: Some(SudoConfig { key: root_key }), evm: Some(EVMConfig { accounts: evm_accounts, }), + ethereum: Some(EthereumConfig {}), } } diff --git a/node/src/cli.rs b/node/src/cli.rs index 0091ef7d75..51eb56b31b 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -1,6 +1,19 @@ -use sc_cli::{RunCmd, Subcommand}; +use sc_cli::{Subcommand}; use structopt::StructOpt; + +#[allow(missing_docs)] +#[derive(Debug, StructOpt)] +pub struct RunCmd { + #[allow(missing_docs)] + #[structopt(flatten)] + pub base: sc_cli::RunCmd, + + /// Force using Kusama native runtime. + #[structopt(long = "manual-seal")] + pub manual_seal: bool, +} + #[derive(Debug, StructOpt)] pub struct Cli { #[structopt(subcommand)] diff --git a/node/src/command.rs b/node/src/command.rs index ed5ba0ba0d..28fef8bb13 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -1,46 +1,48 @@ use crate::chain_spec; use crate::cli::Cli; use crate::service; -use sc_cli::SubstrateCli; +use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec}; +use sc_service::ServiceParams; +use crate::service::new_full_params; impl SubstrateCli for Cli { - fn impl_name() -> &'static str { - "Substrate Node" + fn impl_name() -> String { + "Substrate Node".into() } - fn impl_version() -> &'static str { - env!("SUBSTRATE_CLI_IMPL_VERSION") + fn impl_version() -> String { + env!("SUBSTRATE_CLI_IMPL_VERSION").into() } - fn description() -> &'static str { - env!("CARGO_PKG_DESCRIPTION") + fn description() -> String { + env!("CARGO_PKG_DESCRIPTION").into() } - fn author() -> &'static str { - env!("CARGO_PKG_AUTHORS") + fn author() -> String { + env!("CARGO_PKG_AUTHORS").into() } - fn support_url() -> &'static str { - "support.anonymous.an" + fn support_url() -> String { + "support.anonymous.an".into() } fn copyright_start_year() -> i32 { 2017 } - fn executable_name() -> &'static str { - env!("CARGO_PKG_NAME") - } - fn load_spec(&self, id: &str) -> Result, String> { Ok(match id { - "dev" => Box::new(chain_spec::development_config()), - "" | "local" => Box::new(chain_spec::local_testnet_config()), + "dev" => Box::new(chain_spec::development_config()?), + "" | "local" => Box::new(chain_spec::local_testnet_config()?), path => Box::new(chain_spec::ChainSpec::from_json_file( std::path::PathBuf::from(path), )?), }) } + + fn native_runtime_version(_: &Box) -> &'static RuntimeVersion { + &moonbeam_runtime::VERSION + } } /// Parse and run command line arguments @@ -50,15 +52,18 @@ pub fn run() -> sc_cli::Result<()> { match &cli.subcommand { Some(subcommand) => { let runner = cli.create_runner(subcommand)?; - runner.run_subcommand(subcommand, |config| Ok(new_full_start!(config).0)) + runner.run_subcommand(subcommand, |config| { + let (ServiceParams { client, backend, task_manager, import_queue, .. }, ..) + = new_full_params(config, cli.run.manual_seal)?; + Ok((client, backend, import_queue, task_manager)) + }) } None => { - let runner = cli.create_runner(&cli.run)?; - runner.run_node( - service::new_light, - service::new_full, - moonbeam_runtime::VERSION, - ) + let runner = cli.create_runner(&cli.run.base)?; + runner.run_node_until_exit(|config| match config.role { + Role::Light => service::new_light(config), + _ => service::new_full(config, cli.run.manual_seal), + }) } } } diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 711cbf3388..fee7c61bef 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -1,16 +1,19 @@ //! A collection of node-specific RPC methods. -use std::{fmt, sync::Arc}; +use std::{sync::Arc, fmt}; -use moonbeam_runtime::{opaque::Block, AccountId, Balance, Hash, Index, UncheckedExtrinsic}; -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; -use sc_rpc_api::DenyUnsafe; +use sc_consensus_manual_seal::rpc::{ManualSeal, ManualSealApi}; +use moonbeam_runtime::{Hash, AccountId, Index, opaque::Block, Balance, UncheckedExtrinsic}; use sp_api::ProvideRuntimeApi; -use sp_block_builder::BlockBuilder; -use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; +use sp_transaction_pool::TransactionPool; +use sp_blockchain::{Error as BlockChainError, HeaderMetadata, HeaderBackend}; use sp_consensus::SelectChain; +use sc_rpc_api::DenyUnsafe; +use sc_client_api::backend::{StorageProvider, Backend, StateBackend}; use sp_runtime::traits::BlakeTwo256; -use sp_transaction_pool::TransactionPool; +use sp_block_builder::BlockBuilder; + +pub type IoHandler = jsonrpc_core::IoHandler; /// Light client extra dependencies. pub struct LightDeps { @@ -36,32 +39,31 @@ pub struct FullDeps { pub deny_unsafe: DenyUnsafe, /// The Node authority flag pub is_authority: bool, + /// Manual seal command sink + pub command_sink: Option>>, } /// Instantiate all Full RPC extensions. -pub fn create_full(deps: FullDeps) -> jsonrpc_core::IoHandler -where +pub fn create_full( + deps: FullDeps, +) -> jsonrpc_core::IoHandler where BE: Backend + 'static, BE::State: StateBackend, C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + HeaderMetadata + 'static, + C: HeaderBackend + HeaderMetadata + 'static, C: Send + Sync + 'static, C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: BlockBuilder, - C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi< - Block, - Balance, - UncheckedExtrinsic, - >, + C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: frontier_rpc_primitives::EthereumRuntimeApi, ::Error: fmt::Debug, - P: TransactionPool + 'static, + P: TransactionPool + 'static, M: jsonrpc_core::Metadata + Default, - SC: SelectChain + 'static, + SC: SelectChain +'static, { - use frontier_rpc::{EthApi, EthApiServer}; - use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi}; use substrate_frame_rpc_system::{FullSystem, SystemApi}; + use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi}; + use frontier_rpc::{EthApi, EthApiServer}; let mut io = jsonrpc_core::IoHandler::default(); let FullDeps { @@ -70,30 +72,43 @@ where select_chain, deny_unsafe, is_authority, + command_sink } = deps; - io.extend_with(SystemApi::to_delegate(FullSystem::new( - client.clone(), - pool.clone(), - deny_unsafe, - ))); - io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new( - client.clone(), - ))); - io.extend_with(EthApiServer::to_delegate(EthApi::new( - client.clone(), - select_chain, - pool.clone(), - moonbeam_runtime::TransactionConverter, - is_authority, - ))); + io.extend_with( + SystemApi::to_delegate(FullSystem::new(client.clone(), pool.clone(), deny_unsafe)) + ); + io.extend_with( + TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone())) + ); + io.extend_with( + EthApiServer::to_delegate(EthApi::new( + client.clone(), + select_chain, + pool.clone(), + moonbeam_runtime::TransactionConverter, + is_authority, + )) + ); + + match command_sink { + Some(command_sink) => { + io.extend_with( + // We provide the rpc handler with the sending end of the channel to allow the rpc + // send EngineCommands to the background block authorship task. + ManualSealApi::to_delegate(ManualSeal::new(command_sink)), + ); + } + _ => {} + } io } /// Instantiate all Light RPC extensions. -pub fn create_light(deps: LightDeps) -> jsonrpc_core::IoHandler -where +pub fn create_light( + deps: LightDeps, +) -> jsonrpc_core::IoHandler where C: sp_blockchain::HeaderBackend, C: Send + Sync + 'static, F: sc_client_api::light::Fetcher + 'static, @@ -106,12 +121,14 @@ where client, pool, remote_blockchain, - fetcher, + fetcher } = deps; let mut io = jsonrpc_core::IoHandler::default(); - io.extend_with(SystemApi::::to_delegate( - LightSystem::new(client, remote_blockchain, fetcher, pool), - )); + io.extend_with( + SystemApi::::to_delegate( + LightSystem::new(client, remote_blockchain, fetcher, pool) + ) + ); io } diff --git a/node/src/service.rs b/node/src/service.rs index 3acaae6175..c98ed2f154 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -1,19 +1,18 @@ //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. -use moonbeam_runtime::{self, opaque::Block, RuntimeApi}; -use sc_client_api::ExecutorProvider; -use sc_consensus::LongestChain; +use std::sync::Arc; +use std::time::Duration; +use sc_client_api::{ExecutorProvider, RemoteBackend}; +use sc_consensus_manual_seal::{self as manual_seal}; +use moonbeam_runtime::{self, opaque::Block, RuntimeApi, Hash}; +use sc_service::{error::Error as ServiceError, Configuration, ServiceComponents, TaskManager}; +use sp_inherents::InherentDataProviders; use sc_executor::native_executor_instance; pub use sc_executor::NativeExecutor; +use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair}; use sc_finality_grandpa::{ - FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState, - StorageAndProofProvider, + FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider, SharedVoterState, }; -use sc_service::{error::Error as ServiceError, AbstractService, Configuration, ServiceBuilder}; -use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; -use sp_inherents::InherentDataProviders; -use std::sync::Arc; -use std::time::Duration; // Our native executor instance. native_executor_instance!( @@ -22,280 +21,335 @@ native_executor_instance!( moonbeam_runtime::native_version, ); -/// Starts a `ServiceBuilder` for a full service. -/// -/// Use this macro if you don't actually need the full service, but just the builder in order to -/// be able to perform chain operations. -macro_rules! new_full_start { - ($config:expr) => {{ - use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; - use std::sync::Arc; - - let mut import_setup = None; - let inherent_data_providers = sp_inherents::InherentDataProviders::new(); - - let builder = sc_service::ServiceBuilder::new_full::< - moonbeam_runtime::opaque::Block, - moonbeam_runtime::RuntimeApi, - crate::service::Executor, - >($config)? - .with_select_chain(|_config, backend| Ok(sc_consensus::LongestChain::new(backend.clone())))? - .with_transaction_pool(|builder| { - let pool_api = sc_transaction_pool::FullChainApi::new(builder.client().clone()); - Ok(sc_transaction_pool::BasicPool::new( - builder.config().transaction_pool.clone(), - std::sync::Arc::new(pool_api), - builder.prometheus_registry(), - )) - })? - .with_import_queue( - |_config, client, mut select_chain, _transaction_pool, spawn_task_handle, registry| { - let select_chain = select_chain - .take() - .ok_or_else(|| sc_service::Error::SelectChainRequired)?; - - let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import( - client.clone(), - &(client.clone() as Arc<_>), - select_chain, - )?; +type FullClient = sc_service::TFullClient; +type FullBackend = sc_service::TFullBackend; +type FullSelectChain = sc_consensus::LongestChain; - let aura_block_import = - sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( - grandpa_block_import.clone(), - client.clone(), - ); +pub enum ConsensusResult { + GrandPa(( + sc_finality_grandpa::GrandpaBlockImport, + sc_finality_grandpa::LinkHalf + )), + ManualSeal +} - let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( - sc_consensus_aura::slot_duration(&*client)?, - aura_block_import, - Some(Box::new(grandpa_block_import.clone())), - None, - client, - inherent_data_providers.clone(), - spawn_task_handle, - registry, - )?; +pub fn new_full_params(config: Configuration, manual_seal: bool) -> Result<( + sc_service::ServiceParams< + Block, FullClient, + sp_consensus::import_queue::BasicQueue>, + sc_transaction_pool::FullPool, + crate::rpc::IoHandler, FullBackend, + >, + FullSelectChain, + sp_inherents::InherentDataProviders, + futures::channel::mpsc::Receiver>, + ConsensusResult +), ServiceError> { + let inherent_data_providers = sp_inherents::InherentDataProviders::new(); + + let (client, backend, keystore, task_manager) = + sc_service::new_full_parts::(&config)?; + let client = Arc::new(client); + + let select_chain = sc_consensus::LongestChain::new(backend.clone()); + + let pool_api = sc_transaction_pool::FullChainApi::new( + client.clone(), config.prometheus_registry(), + ); + let transaction_pool = sc_transaction_pool::BasicPool::new_full( + config.transaction_pool.clone(), + std::sync::Arc::new(pool_api), + config.prometheus_registry(), + task_manager.spawn_handle(), + client.clone(), + ); - import_setup = Some((grandpa_block_import, grandpa_link)); - - Ok(import_queue) - }, - )? - .with_rpc_extensions_builder(|builder| { - let client = builder.client().clone(); - let is_authority: bool = builder.config().role.is_authority(); - let pool = builder.pool().clone(); - let select_chain = builder - .select_chain() - .cloned() - .expect("SelectChain is present for full services or set up failed; qed."); - - Ok(move |deny_unsafe| { - let deps = crate::rpc::FullDeps { - client: client.clone(), - pool: pool.clone(), - select_chain: select_chain.clone(), - deny_unsafe, - is_authority, - }; + // Channel for the rpc handler to communicate with the authorship task. + let (command_sink, commands_stream) = futures::channel::mpsc::channel(1000); - crate::rpc::create_full(deps) - }) - })?; + let is_authority = config.role.is_authority(); - (builder, import_setup, inherent_data_providers) - }}; -} + let rpc_extensions_builder = { + let client = client.clone(); + let pool = transaction_pool.clone(); + let select_chain = select_chain.clone(); -/// Builds a new service for a full client. -pub fn new_full(config: Configuration) -> Result { - let role = config.role.clone(); - let force_authoring = config.force_authoring; - let name = config.network.node_name.clone(); - let disable_grandpa = config.disable_grandpa; + Box::new(move |deny_unsafe| { + let deps = crate::rpc::FullDeps { + client: client.clone(), + pool: pool.clone(), + select_chain: select_chain.clone(), + deny_unsafe, + is_authority, + command_sink: Some(command_sink.clone()) + }; - let (builder, mut import_setup, inherent_data_providers) = new_full_start!(config); + crate::rpc::create_full(deps) + }) + }; - let (block_import, grandpa_link) = import_setup.take().expect( - "Link Half and Block Import are present for Full Services or setup failed before. qed", - ); + if manual_seal { + inherent_data_providers + .register_provider(sp_timestamp::InherentDataProvider) + .map_err(Into::into) + .map_err(sp_consensus::error::Error::InherentData)?; - let service = builder - .with_finality_proof_provider(|client, backend| { - // GenesisAuthoritySetProvider is implemented for StorageAndProofProvider - let provider = client as Arc>; - Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) - })? - .build_full()?; - - if role.is_authority() { - let proposer = sc_basic_authorship::ProposerFactory::new( - service.client(), - service.transaction_pool(), - service.prometheus_registry().as_ref(), + let import_queue = sc_consensus_manual_seal::import_queue( + Box::new(client.clone()), + &task_manager.spawn_handle(), + config.prometheus_registry(), ); - let client = service.client(); - let select_chain = service - .select_chain() - .ok_or(ServiceError::SelectChainRequired)?; - - let can_author_with = - sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); - - let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _>( - sc_consensus_aura::slot_duration(&*client)?, - client, - select_chain, - block_import, - proposer, - service.network(), - inherent_data_providers.clone(), - force_authoring, - service.keystore(), - can_author_with, - )?; - - // the AURA authoring task is considered essential, i.e. if it - // fails we take down the service with it. - service.spawn_essential_task("aura", aura); + + let params = sc_service::ServiceParams { + backend, client, import_queue, keystore, task_manager, transaction_pool, rpc_extensions_builder, + config, + block_announce_validator_builder: None, + finality_proof_request_builder: Some(Box::new(sc_network::config::DummyFinalityProofRequestBuilder)), + finality_proof_provider: None, + on_demand: None, + remote_blockchain: None, + }; + + return Ok(( + params, select_chain, inherent_data_providers, commands_stream, + ConsensusResult::ManualSeal + )); } - // if the node isn't actively participating in consensus then it doesn't - // need a keystore, regardless of which protocol we use below. - let keystore = if role.is_authority() { - Some(service.keystore() as sp_core::traits::BareCryptoStorePtr) - } else { - None - }; + let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import( + client.clone(), &(client.clone() as Arc<_>), select_chain.clone(), + )?; + + let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( + grandpa_block_import.clone(), client.clone(), + ); - let grandpa_config = sc_finality_grandpa::Config { - // FIXME #1578 make this available through chainspec - gossip_duration: Duration::from_millis(333), - justification_period: 512, - name: Some(name), - observer_enabled: false, - keystore, - is_authority: role.is_network_authority(), + let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( + sc_consensus_aura::slot_duration(&*client)?, + aura_block_import, + Some(Box::new(grandpa_block_import.clone())), + None, + client.clone(), + inherent_data_providers.clone(), + &task_manager.spawn_handle(), + config.prometheus_registry(), + )?; + + let provider = client.clone() as Arc>; + let finality_proof_provider = + Arc::new(GrandpaFinalityProofProvider::new(backend.clone(), provider)); + + + let params = sc_service::ServiceParams { + backend, client, import_queue, keystore, task_manager, transaction_pool, rpc_extensions_builder, + config, + block_announce_validator_builder: None, + finality_proof_request_builder: None, + finality_proof_provider: Some(finality_proof_provider), + on_demand: None, + remote_blockchain: None, }; - let enable_grandpa = !disable_grandpa; - if enable_grandpa { - // start the full GRANDPA voter - // NOTE: non-authorities could run the GRANDPA observer protocol, but at - // this point the full voter should provide better guarantees of block - // and vote data availability than the observer. The observer has not - // been tested extensively yet and having most nodes in a network run it - // could lead to finality stalls. - let grandpa_config = sc_finality_grandpa::GrandpaParams { - config: grandpa_config, - link: grandpa_link, - network: service.network(), - inherent_data_providers: inherent_data_providers.clone(), - telemetry_on_connect: Some(service.telemetry_on_connect_stream()), - voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(), - prometheus_registry: service.prometheus_registry(), - shared_voter_state: SharedVoterState::empty(), - }; + Ok(( + params, select_chain, inherent_data_providers, commands_stream, + ConsensusResult::GrandPa((grandpa_block_import, grandpa_link)) + )) +} - // the GRANDPA voter task is considered infallible, i.e. - // if it fails we take down the service with it. - service.spawn_essential_task( - "grandpa-voter", - sc_finality_grandpa::run_grandpa_voter(grandpa_config)?, - ); - } else { - sc_finality_grandpa::setup_disabled_grandpa( - service.client(), - &inherent_data_providers, - service.network(), - )?; - } +/// Builds a new service for a full client. +pub fn new_full(config: Configuration, manual_seal: bool) -> Result { + let ( + params, select_chain, inherent_data_providers, + commands_stream, consensus_result + ) = new_full_params(config, manual_seal)?; + + let ( + role, force_authoring, name, enable_grandpa, prometheus_registry, + client, transaction_pool, keystore, + ) = { + let sc_service::ServiceParams { + config, client, transaction_pool, keystore, .. + } = ¶ms; + + ( + config.role.clone(), + config.force_authoring, + config.network.node_name.clone(), + !config.disable_grandpa, + config.prometheus_registry().cloned(), + + client.clone(), transaction_pool.clone(), keystore.clone(), + ) + }; - Ok(service) -} + let ServiceComponents { + task_manager, network, telemetry_on_connect_sinks, .. + } = sc_service::build(params)?; -/// Builds a new service for a light client. -pub fn new_light(config: Configuration) -> Result { - let inherent_data_providers = InherentDataProviders::new(); - - ServiceBuilder::new_light::(config)? - .with_select_chain(|_config, backend| Ok(LongestChain::new(backend.clone())))? - .with_transaction_pool(|builder| { - let fetcher = builder - .fetcher() - .ok_or_else(|| "Trying to start light transaction pool without active fetcher")?; - - let pool_api = - sc_transaction_pool::LightChainApi::new(builder.client().clone(), fetcher.clone()); - let pool = sc_transaction_pool::BasicPool::with_revalidation_type( - builder.config().transaction_pool.clone(), - Arc::new(pool_api), - builder.prometheus_registry(), - sc_transaction_pool::RevalidationType::Light, - ); - Ok(pool) - })? - .with_import_queue_and_fprb( - |_config, - client, - backend, - fetcher, - _select_chain, - _tx_pool, - spawn_task_handle, - prometheus_registry| { - let fetch_checker = fetcher - .map(|fetcher| fetcher.checker().clone()) - .ok_or_else(|| { - "Trying to start light import queue without active fetch checker" - })?; - let grandpa_block_import = sc_finality_grandpa::light_block_import( + match consensus_result { + ConsensusResult::ManualSeal => { + if role.is_authority() { + let proposer = sc_basic_authorship::ProposerFactory::new( client.clone(), - backend, - &(client.clone() as Arc<_>), - Arc::new(fetch_checker), - )?; - let finality_proof_import = grandpa_block_import.clone(); - let finality_proof_request_builder = - finality_proof_import.create_finality_proof_request_builder(); + transaction_pool.clone(), + prometheus_registry.as_ref(), + ); + + // Background authorship future + let authorship_future = manual_seal::run_manual_seal( + Box::new(client.clone()), + proposer, + client.clone(), + transaction_pool.pool().clone(), + commands_stream, + select_chain, + inherent_data_providers, + ); + + // we spawn the future on a background thread managed by service. + task_manager.spawn_essential_handle().spawn_blocking("manual-seal", authorship_future); + } + log::info!("Manual Seal Ready"); + }, + ConsensusResult::GrandPa((grandpa_block_import, grandpa_link)) => { + if role.is_authority() { + let proposer = sc_basic_authorship::ProposerFactory::new( + client.clone(), + transaction_pool.clone(), + prometheus_registry.as_ref(), + ); + - let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( + let can_author_with = + sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); + let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _>( sc_consensus_aura::slot_duration(&*client)?, + client.clone(), + select_chain, grandpa_block_import, - None, - Some(Box::new(finality_proof_import)), - client, + proposer, + network.clone(), inherent_data_providers.clone(), - spawn_task_handle, - prometheus_registry, + force_authoring, + keystore.clone(), + can_author_with, )?; - Ok((import_queue, finality_proof_request_builder)) - }, - )? - .with_finality_proof_provider(|client, backend| { - // GenesisAuthoritySetProvider is implemented for StorageAndProofProvider - let provider = client as Arc>; - Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) - })? - .with_rpc_extensions(|builder| { - let fetcher = builder - .fetcher() - .ok_or_else(|| "Trying to start node RPC without active fetcher")?; - let remote_blockchain = builder - .remote_backend() - .ok_or_else(|| "Trying to start node RPC without active remote blockchain")?; - - let light_deps = crate::rpc::LightDeps { - remote_blockchain, - fetcher, - client: builder.client().clone(), - pool: builder.pool(), - }; + // the AURA authoring task is considered essential, i.e. if it + // fails we take down the service with it. + task_manager.spawn_essential_handle().spawn_blocking("aura", aura); + + + // if the node isn't actively participating in consensus then it doesn't + // need a keystore, regardless of which protocol we use below. + let keystore = if role.is_authority() { + Some(keystore as sp_core::traits::BareCryptoStorePtr) + } else { + None + }; + let grandpa_config = sc_finality_grandpa::Config { + // FIXME #1578 make this available through chainspec + gossip_duration: Duration::from_millis(333), + justification_period: 512, + name: Some(name), + observer_enabled: false, + keystore, + is_authority: role.is_network_authority(), + }; + + if enable_grandpa { + // start the full GRANDPA voter + // NOTE: non-authorities could run the GRANDPA observer protocol, but at + // this point the full voter should provide better guarantees of block + // and vote data availability than the observer. The observer has not + // been tested extensively yet and having most nodes in a network run it + // could lead to finality stalls. + let grandpa_config = sc_finality_grandpa::GrandpaParams { + config: grandpa_config, + link: grandpa_link, + network, + inherent_data_providers, + telemetry_on_connect: Some(telemetry_on_connect_sinks.on_connect_stream()), + voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(), + prometheus_registry, + shared_voter_state: SharedVoterState::empty(), + }; + + // the GRANDPA voter task is considered infallible, i.e. + // if it fails we take down the service with it. + task_manager.spawn_essential_handle().spawn_blocking( + "grandpa-voter", + sc_finality_grandpa::run_grandpa_voter(grandpa_config)? + ); + } else { + sc_finality_grandpa::setup_disabled_grandpa( + client, + &inherent_data_providers, + network, + )?; + } + } + } + } + + Ok(task_manager) +} + +/// Builds a new service for a light client. +pub fn new_light(config: Configuration) -> Result { + let (client, backend, keystore, task_manager, on_demand) = + sc_service::new_light_parts::(&config)?; + + let transaction_pool_api = Arc::new(sc_transaction_pool::LightChainApi::new( + client.clone(), on_demand.clone(), + )); + let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light( + config.transaction_pool.clone(), + transaction_pool_api, + config.prometheus_registry(), + task_manager.spawn_handle(), + )); + + let grandpa_block_import = sc_finality_grandpa::light_block_import( + client.clone(), backend.clone(), &(client.clone() as Arc<_>), + Arc::new(on_demand.checker().clone()) as Arc<_>, + )?; + let finality_proof_import = grandpa_block_import.clone(); + let finality_proof_request_builder = + finality_proof_import.create_finality_proof_request_builder(); + + let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( + sc_consensus_aura::slot_duration(&*client)?, + grandpa_block_import, + None, + Some(Box::new(finality_proof_import)), + client.clone(), + InherentDataProviders::new(), + &task_manager.spawn_handle(), + config.prometheus_registry(), + )?; + + let light_deps = crate::rpc::LightDeps { + remote_blockchain: backend.remote_blockchain(), + fetcher: on_demand.clone(), + client: client.clone(), + pool: transaction_pool.clone(), + }; - Ok(crate::rpc::create_light(light_deps)) - })? - .build_light() + let rpc_extensions = crate::rpc::create_light(light_deps); + + let finality_proof_provider = + Arc::new(GrandpaFinalityProofProvider::new(backend.clone(), client.clone() as Arc<_>)); + + sc_service::build(sc_service::ServiceParams { + block_announce_validator_builder: None, + finality_proof_request_builder: Some(finality_proof_request_builder), + finality_proof_provider: Some(finality_proof_provider), + on_demand: Some(on_demand), + remote_blockchain: Some(backend.remote_blockchain()), + rpc_extensions_builder: Box::new(sc_service::NoopRpcExtensionBuilder(rpc_extensions)), + transaction_pool: transaction_pool, + config, client, import_queue, keystore, backend, task_manager + }).map(|ServiceComponents { task_manager, .. }| task_manager) } diff --git a/runtime/build.rs b/runtime/build.rs index 39f7f56feb..52705043a2 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -3,7 +3,7 @@ use wasm_builder_runner::WasmBuilder; fn main() { WasmBuilder::new() .with_current_project() - .with_wasm_builder_from_crates("1.0.9") + .with_wasm_builder_from_crates("2.0.0") .export_heap_base() .import_memory() .build() diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index c0926b4fa5..05ec8f4837 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -8,47 +8,43 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -use codec::{Decode, Encode}; -use grandpa::fg_primitives; -use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; -use sp_api::impl_runtime_apis; -use sp_consensus_aura::sr25519::AuthorityId as AuraId; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; -use sp_runtime::traits::{ - BlakeTwo256, Block as BlockT, IdentifyAccount, IdentityLookup, NumberFor, Saturating, Verify, -}; +use sp_std::{prelude::*, marker::PhantomData}; +use codec::{Encode, Decode}; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata, U256, H160, H256}; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, ModuleId, MultiSignature, + ApplyExtrinsicResult, generic, create_runtime_str, impl_opaque_keys, MultiSignature, + transaction_validity::{TransactionValidity, TransactionSource}, }; -use sp_std::prelude::*; +use sp_runtime::traits::{ + BlakeTwo256, Block as BlockT, IdentityLookup, Verify, IdentifyAccount, NumberFor, Saturating, +}; +use sp_api::impl_runtime_apis; +use sp_consensus_aura::sr25519::AuthorityId as AuraId; +use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; +use grandpa::fg_primitives; +use sp_version::RuntimeVersion; #[cfg(feature = "std")] use sp_version::NativeVersion; -use sp_version::RuntimeVersion; +use sp_core::crypto::Public; -use evm::{ConvertAccountId, FeeCalculator, HashTruncateConvertAccountId}; // A few exports that help ease life for downstream crates. +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; +pub use timestamp::Call as TimestampCall; pub use balances::Call as BalancesCall; -use ethereum::{ - Block as EthereumBlock, Receipt as EthereumReceipt, Transaction as EthereumTransaction, -}; -pub use evm::Account as EVMAccount; +pub use sp_runtime::{Permill, Perbill}; pub use frame_support::{ - construct_runtime, parameter_types, - traits::{FindAuthor, KeyOwnerProofSystem, Randomness}, + construct_runtime, parameter_types, StorageValue, + traits::{KeyOwnerProofSystem, Randomness, FindAuthor}, weights::{ + Weight, IdentityFee, constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, - IdentityFee, Weight, }, - StorageValue, + ConsensusEngineId, }; -use frontier_rpc_primitives::TransactionStatus; - -#[cfg(any(feature = "std", test))] -pub use sp_runtime::BuildStorage; -pub use sp_runtime::{Perbill, Permill}; -pub use timestamp::Call as TimestampCall; +use ethereum::{Block as EthereumBlock, Transaction as EthereumTransaction, Receipt as EthereumReceipt}; +use evm::{Account as EVMAccount, FeeCalculator, HashedAddressMapping, EnsureAddressTruncated}; +use frontier_rpc_primitives::{TransactionStatus}; pub mod constants; @@ -78,8 +74,6 @@ pub type Hash = sp_core::H256; /// Digest item type. pub type DigestItem = generic::DigestItem; -// EVM structs -pub struct FixedGasPrice; /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats /// of data like extrinsics, allowing for them to continue syncing the network through upgrades @@ -104,7 +98,6 @@ pub mod opaque { } } -/// This runtime version. pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("node-moonbeam"), impl_name: create_runtime_str!("node-moonbeam"), @@ -115,6 +108,15 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { transaction_version: 1, }; +pub const MILLISECS_PER_BLOCK: u64 = 6000; + +pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; + +// Time is measured by number of blocks. +pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); +pub const HOURS: BlockNumber = MINUTES * 60; +pub const DAYS: BlockNumber = HOURS * 24; + /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { @@ -124,22 +126,22 @@ pub fn native_version() -> NativeVersion { } } -const AVERAGE_ON_INITIALIZE_WEIGHT: Perbill = Perbill::from_percent(10); parameter_types! { pub const BlockHashCount: BlockNumber = 2400; /// We allow for 2 seconds of compute with a 6 second average block time. pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); /// Assume 10% of weight for average on_initialize calls. - pub MaximumExtrinsicWeight: Weight = - AvailableBlockRatio::get().saturating_sub(AVERAGE_ON_INITIALIZE_WEIGHT) - * MaximumBlockWeight::get(); + pub MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get() + .saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get(); pub const MaximumBlockLength: u32 = 5 * 1024 * 1024; pub const Version: RuntimeVersion = VERSION; } +// Configure FRAME pallets to include in runtime. + impl system::Trait for Runtime { - /// The basic call filter to use in Origin + /// The basic call filter to use in dispatchable. type BaseCallFilter = (); /// The identifier used to distinguish between accounts. type AccountId = AccountId; @@ -193,6 +195,8 @@ impl system::Trait for Runtime { type OnKilledAccount = (); /// The data to be stored in an account. type AccountData = balances::AccountData; + /// Weight information for the extrinsics of this pallet. + type SystemWeightInfo = (); } impl aura::Trait for Runtime { @@ -225,6 +229,7 @@ impl timestamp::Trait for Runtime { type Moment = constants::time::Moment; type OnTimestampSet = Aura; type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); } parameter_types! { @@ -239,12 +244,11 @@ impl balances::Trait for Runtime { type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; + type WeightInfo = (); } parameter_types! { pub const TransactionByteFee: Balance = 1; - pub const ChainId: u64 = 43; - pub const EVMModuleId: ModuleId = ModuleId(*b"py/evmpa"); } impl transaction_payment::Trait for Runtime { @@ -260,6 +264,9 @@ impl sudo::Trait for Runtime { type Call = Call; } +/// Fixed gas price of `1`. +pub struct FixedGasPrice; + impl FeeCalculator for FixedGasPrice { fn min_gas_price() -> U256 { // Gas price is always one token per gas. @@ -267,22 +274,41 @@ impl FeeCalculator for FixedGasPrice { } } +parameter_types! { + pub const ChainId: u64 = 43; +} + impl evm::Trait for Runtime { - type ModuleId = EVMModuleId; type FeeCalculator = FixedGasPrice; - type ConvertAccountId = HashTruncateConvertAccountId; + type CallOrigin = EnsureAddressTruncated; + type WithdrawOrigin = EnsureAddressTruncated; + type AddressMapping = HashedAddressMapping; type Currency = Balances; type Event = Event; - type Precompiles = (); // We can use () here because paint_evm provides an - // `impl Precompiles for ()`` - // block that always returns none (line 75) + type Precompiles = (); + type ChainId = ChainId; +} + +pub struct EthereumFindAuthor(PhantomData); +impl> FindAuthor for EthereumFindAuthor +{ + fn find_author<'a, I>(digests: I) -> Option where + I: 'a + IntoIterator + { + if let Some(author_index) = F::find_author(digests) { + let authority_id = Aura::authorities()[author_index as usize].clone(); + return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24])); + } + None + } } impl ethereum::Trait for Runtime { type Event = Event; - type ChainId = ChainId; + type FindAuthor = EthereumFindAuthor; } +// Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where Block = Block, @@ -292,12 +318,12 @@ construct_runtime!( System: system::{Module, Call, Config, Storage, Event}, RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage}, Timestamp: timestamp::{Module, Call, Storage, Inherent}, - Aura: aura::{Module, Config, Inherent(Timestamp)}, + Aura: aura::{Module, Config, Inherent}, Grandpa: grandpa::{Module, Call, Storage, Config, Event}, Balances: balances::{Module, Call, Storage, Config, Event}, TransactionPayment: transaction_payment::{Module, Storage}, Sudo: sudo::{Module, Call, Config, Storage, Event}, - Ethereum: ethereum::{Module, Call, Storage, Event, ValidateUnsigned}, + Ethereum: ethereum::{Module, Call, Storage, Event, Config, ValidateUnsigned}, EVM: evm::{Module, Config, Call, Storage, Event}, } ); @@ -310,19 +336,11 @@ impl frontier_rpc_primitives::ConvertTransaction for Transac } } -impl frontier_rpc_primitives::ConvertTransaction - for TransactionConverter -{ - fn convert_transaction( - &self, - transaction: ethereum::Transaction, - ) -> opaque::UncheckedExtrinsic { - let extrinsic = UncheckedExtrinsic::new_unsigned( - ethereum::Call::::transact(transaction).into(), - ); +impl frontier_rpc_primitives::ConvertTransaction for TransactionConverter { + fn convert_transaction(&self, transaction: ethereum::Transaction) -> opaque::UncheckedExtrinsic { + let extrinsic = UncheckedExtrinsic::new_unsigned(ethereum::Call::::transact(transaction).into()); let encoded = extrinsic.encode(); - opaque::UncheckedExtrinsic::decode(&mut &encoded[..]) - .expect("Encoded extrinsic is always valid") + opaque::UncheckedExtrinsic::decode(&mut &encoded[..]).expect("Encoded extrinsic is always valid") } } @@ -437,7 +455,7 @@ impl_runtime_apis! { } fn account_basic(address: H160) -> EVMAccount { - evm::Module::::accounts(address) + evm::Module::::account_basic(&address) } fn gas_price() -> U256 { @@ -449,14 +467,7 @@ impl_runtime_apis! { } fn author() -> H160 { - let digest = >::digest(); - let pre_runtime_digests = digest.logs.iter().filter_map(|d| d.as_pre_runtime()); - if let Some(index) = >::find_author(pre_runtime_digests) { - let authority_id = &>::authorities()[index as usize]; - >::convert_account_id(&authority_id) - } else { - H160::zero() - } + >::find_author() } fn storage_at(address: H160, index: U256) -> H256 { @@ -465,6 +476,40 @@ impl_runtime_apis! { evm::Module::::account_storages(address, H256::from_slice(&tmp[..])) } + fn call( + from: H160, + data: Vec, + value: U256, + gas_limit: U256, + gas_price: U256, + nonce: Option, + action: ethereum::TransactionAction, + ) -> Option<(Vec, U256)> { + match action { + ethereum::TransactionAction::Call(to) => + evm::Module::::execute_call( + from, + to, + data, + value, + gas_limit.low_u32(), + gas_price, + nonce, + false, + ).ok().map(|(_, ret, gas)| (ret, gas)), + ethereum::TransactionAction::Create => + evm::Module::::execute_create( + from, + data, + value, + gas_limit.low_u32(), + gas_price, + nonce, + false, + ).ok().map(|(_, _, gas)| (vec![], gas)), + } + } + fn block_by_number(number: u32) -> ( Option, Vec> ) { @@ -485,6 +530,17 @@ impl_runtime_apis! { None } + fn block_transaction_count_by_hash(hash: H256) -> Option { + if let Some(block) = >::block_by_hash(hash) { + return Some(U256::from(block.transactions.len())) + } + None + } + + fn block_by_hash(hash: H256) -> Option { + >::block_by_hash(hash) + } + fn block_by_hash_with_statuses(hash: H256) -> ( Option, Vec> ) { @@ -498,22 +554,11 @@ impl_runtime_apis! { (None, vec![]) } - fn block_transaction_count_by_hash(hash: H256) -> Option { - if let Some(block) = >::block_by_hash(hash) { - return Some(U256::from(block.transactions.len())) - } - None - } - - fn block_by_hash(hash: H256) -> Option { - >::block_by_hash(hash) - } - fn transaction_by_hash(hash: H256) -> Option<( EthereumTransaction, EthereumBlock, TransactionStatus, - EthereumReceipt)> { + Vec)> { >::transaction_by_hash(hash) } @@ -534,25 +579,34 @@ impl_runtime_apis! { ) } - fn call( - from: H160, - to: H160, - data: Vec, - value: U256, - gas_limit: U256, - gas_price: U256, - nonce: Option, - ) -> Option<(Vec, U256)> { - evm::Module::::execute_call( - from, - to, - data, - value, - gas_limit.low_u32(), - gas_price, - nonce, - false, - ).ok().map(|(_, ret, gas)| (ret, gas)) + fn logs( + from_block: Option, + to_block: Option, + block_hash: Option, + address: Option, + topic: Option> + ) -> Vec<( + H160, // address + Vec, // topics + Vec, // data + Option, // block_hash + Option, // block_number + Option, // transaction_hash + Option, // transaction_index + Option, // log index in block + Option, // log index in transaction + )> { + let output = >::filtered_logs( + from_block, + to_block, + block_hash, + address, + topic + ); + if let Some(output) = output { + return output; + } + return vec![]; } } @@ -586,7 +640,7 @@ impl_runtime_apis! { Grandpa::grandpa_authorities() } - fn submit_report_equivocation_extrinsic( + fn submit_report_equivocation_unsigned_extrinsic( _equivocation_proof: fg_primitives::EquivocationProof< ::Hash, NumberFor, diff --git a/vendor/frontier b/vendor/frontier index 59399fcf1e..3dfbf2888e 160000 --- a/vendor/frontier +++ b/vendor/frontier @@ -1 +1 @@ -Subproject commit 59399fcf1ec399754cfd27687a95976bada38a5a +Subproject commit 3dfbf2888e3d8688f4b4a3a3b6ba5defa267ef1b