From 64dab9c29437ae8e0621c4024b619b1b61d5fb15 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 16 Dec 2020 04:52:53 -0500 Subject: [PATCH] Update Substrate Dependency (#566) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update `sp-io` dependency * Rename Trait to Config * RustFmt * Bump `sp-io` again * Use new frame_system weight types in Rialto and Millau runtimes * Update test Runtimes to use new weight types * Bump `sp-io` again * Update to not-the latest first. * Update benchmarks. * Another Trai. * Move new weight types into runtime primitive crates This allows us to check limits for extrinsics from other parts of the codebase without pulling in the entire chain runtime. * Remove leftover comments * Move new functions to a better location * Small formatting fixes * Add actual documentation to new weight config types * Decrease maximum block weight of Millau chain * Decreease maximum block length of Millau chain Co-authored-by: Tomasz Drwięga --- Cargo.lock | 496 +++++++++--------- bin/millau/node/src/service.rs | 2 - bin/millau/runtime/src/lib.rs | 61 +-- bin/millau/runtime/src/rialto_messages.rs | 8 +- bin/rialto/node/src/service.rs | 2 - bin/rialto/runtime/src/exchange.rs | 2 +- bin/rialto/runtime/src/lib.rs | 83 ++- bin/rialto/runtime/src/millau_messages.rs | 8 +- bin/runtime-common/src/messages.rs | 18 +- modules/call-dispatch/src/lib.rs | 40 +- modules/currency-exchange/src/benchmarking.rs | 10 +- modules/currency-exchange/src/lib.rs | 38 +- modules/ethereum/src/benchmarking.rs | 2 +- modules/ethereum/src/lib.rs | 18 +- modules/ethereum/src/mock.rs | 16 +- modules/ethereum/src/test_utils.rs | 6 +- modules/message-lane/src/benchmarking.rs | 8 +- modules/message-lane/src/inbound_lane.rs | 4 +- modules/message-lane/src/lib.rs | 48 +- modules/message-lane/src/mock.rs | 16 +- modules/shift-session-manager/src/lib.rs | 28 +- modules/substrate/src/lib.rs | 26 +- modules/substrate/src/mock.rs | 24 +- modules/substrate/src/storage_proof.rs | 2 +- primitives/millau/Cargo.toml | 2 + primitives/millau/src/lib.rs | 69 ++- primitives/millau/src/millau_hash.rs | 2 +- primitives/rialto/Cargo.toml | 2 + primitives/rialto/src/lib.rs | 66 ++- relays/substrate-client/src/chain.rs | 2 +- .../src/millau_messages_to_rialto.rs | 4 +- .../src/rialto_messages_to_millau.rs | 4 +- 32 files changed, 588 insertions(+), 529 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39565e35cea78..9914633081857 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -145,17 +145,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "alga" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f823d037a7ec6ea2197046bafd4ae150e6bc36f9ca347404f46a46823fa84f2" -dependencies = [ - "approx", - "num-complex", - "num-traits", -] - [[package]] name = "ansi_term" version = "0.11.0" @@ -584,17 +573,6 @@ dependencies = [ "constant_time_eq", ] -[[package]] -name = "blake2s_simd" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9e07352b829279624ceb7c64adb4f585dacdb81d35cafae81139ccd617cf44" -dependencies = [ - "arrayref", - "arrayvec 0.5.1", - "constant_time_eq", -] - [[package]] name = "block-buffer" version = "0.7.3" @@ -764,6 +742,7 @@ dependencies = [ "bp-runtime", "fixed-hash 0.6.1", "frame-support", + "frame-system", "hash256-std-hasher", "impl-codec", "impl-serde 0.3.1", @@ -797,6 +776,7 @@ dependencies = [ "bp-message-lane", "bp-runtime", "frame-support", + "frame-system", "sp-api", "sp-core", "sp-runtime", @@ -1254,11 +1234,10 @@ dependencies = [ [[package]] name = "directories" -version = "2.0.2" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c" +checksum = "f8fed639d60b58d0f53498ab13d26f621fd77569cc6edb031f4cc36a2ad9da0f" dependencies = [ - "cfg-if 0.1.10", "dirs-sys", ] @@ -1691,7 +1670,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", ] @@ -1699,7 +1678,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "frame-system", @@ -1717,7 +1696,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "chrono", "frame-benchmarking", @@ -1739,7 +1718,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "frame-system", @@ -1755,7 +1734,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "12.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "serde", @@ -1766,7 +1745,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "bitflags", "frame-metadata", @@ -1791,7 +1770,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support-procedural-tools", "proc-macro2", @@ -1802,7 +1781,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1814,7 +1793,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "proc-macro2", "quote", @@ -1824,7 +1803,7 @@ dependencies = [ [[package]] name = "frame-system" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1840,7 +1819,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "sp-api", @@ -2070,6 +2049,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "generic-array" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed1e761351b56f54eb9dcd0cfaca9fd0daecf93918e1cfc01c8a3d26ee7adcd" +dependencies = [ + "typenum", +] + [[package]] name = "generic-array" version = "0.14.4" @@ -2941,9 +2929,9 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" [[package]] name = "libp2p" -version = "0.30.1" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c2b4c99f8798be90746fc226acf95d3e6cff0655883634cc30dab1f64f438b" +checksum = "724846a3194368fefcac7ebdab12e01b8ac382e3efe399ddbd28851ab34f396f" dependencies = [ "atomic", "bytes 0.5.6", @@ -2970,7 +2958,6 @@ dependencies = [ "libp2p-wasm-ext", "libp2p-websocket", "libp2p-yamux", - "multihash", "parity-multiaddr", "parking_lot 0.11.1", "pin-project 1.0.1", @@ -2980,12 +2967,13 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.24.0" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8186060d6bd415e4e928e6cb44c4fe7e7a7dd53437bd936ce7e5f421e45a51" +checksum = "cc9c96d3a606a696a3a6c0ad3c3352c57bda2082ec9090930f1bd9daf787039f" dependencies = [ "asn1_der", "bs58 0.4.0", + "bytes 0.5.6", "ed25519-dalek", "either", "fnv", @@ -3007,16 +2995,16 @@ dependencies = [ "sha2 0.9.1", "smallvec 1.5.0", "thiserror", - "unsigned-varint 0.5.1", + "unsigned-varint", "void", "zeroize", ] [[package]] name = "libp2p-core-derive" -version = "0.20.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f753d9324cd3ec14bf04b8a8cd0d269c87f294153d6bf2a84497a63a5ad22213" +checksum = "f4bc40943156e42138d22ed3c57ff0e1a147237742715937622a99b10fbe0156" dependencies = [ "quote", "syn", @@ -3024,9 +3012,9 @@ dependencies = [ [[package]] name = "libp2p-deflate" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34aea69349e70a58ef9ecd21ac12c5eaa36255ac6986828079d26393f9e618cb" +checksum = "5a579d7dd506d0620ba88ccc1754436b7de35ed6c884234f9a226bbfce382640" dependencies = [ "flate2", "futures 0.3.8", @@ -3035,9 +3023,9 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0baeff71fb5cb1fe1604f74a712a44b66a8c5900f4022411a1d550f09d6bb776" +checksum = "15dea5933f570844d7b5222b12b58f7bd52e9ca38cd65a1bd4f35341f053f012" dependencies = [ "futures 0.3.8", "libp2p-core", @@ -3046,9 +3034,9 @@ dependencies = [ [[package]] name = "libp2p-floodsub" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0f925a45f310b678e70faf71a10023b829d02eb9cc2628a63de928936f3ade" +checksum = "23070a0838bd9a8adb27e6eba477eeb650c498f9d139383dd0135d20a8170253" dependencies = [ "cuckoofilter", "fnv", @@ -3064,9 +3052,9 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efeb65567174974f551a91f9f5719445b6695cad56f6a7a47a27111f37efb6b8" +checksum = "65e8f3aa0906fbad435dac23c177eef3cdfaaf62609791bd7f54f8553edcfdf9" dependencies = [ "base64 0.13.0", "byteorder", @@ -3084,15 +3072,15 @@ dependencies = [ "rand 0.7.3", "sha2 0.9.1", "smallvec 1.5.0", - "unsigned-varint 0.5.1", + "unsigned-varint", "wasm-timer", ] [[package]] name = "libp2p-identify" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e074124669840484de564901d47f2d0892e73f6d8ee7c37e9c2644af1b217bf4" +checksum = "802fb973a7e0dde3fb9a2113a62bad90338ebe01983b706e1d576d0c2af93cda" dependencies = [ "futures 0.3.8", "libp2p-core", @@ -3106,9 +3094,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78a2653b2e3254a3bbeb66bfc3f0dca7d6cba6aa2a96791db114003dec1b5394" +checksum = "6506b7b7982f7626fc96a91bc61be4b1fe7ae9ac23824f0ecefcce21cb39238c" dependencies = [ "arrayvec 0.5.1", "bytes 0.5.6", @@ -3119,23 +3107,22 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "multihash", "prost", "prost-build", "rand 0.7.3", "sha2 0.9.1", "smallvec 1.5.0", "uint", - "unsigned-varint 0.5.1", + "unsigned-varint", "void", "wasm-timer", ] [[package]] name = "libp2p-mdns" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786b068098794322239f8f04df88a52daeb7863b2e77501c4d85d32e0a8f2d26" +checksum = "4458ec36b5ab2662fb4d5c8bb9b6e1591da0ab6efe8881c7a7670ef033bc8937" dependencies = [ "async-std", "data-encoding", @@ -3155,9 +3142,9 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed764eab613a8fb6b7dcf6c796f55a06fef2270e528329903e25cd3311b99663" +checksum = "ae2132b14045009b0f8e577a06e1459592ef0a89dedc58f3d4baf4eac956837b" dependencies = [ "bytes 0.5.6", "futures 0.3.8", @@ -3168,14 +3155,14 @@ dependencies = [ "parking_lot 0.11.1", "rand 0.7.3", "smallvec 1.5.0", - "unsigned-varint 0.5.1", + "unsigned-varint", ] [[package]] name = "libp2p-noise" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb441fb015ec16690099c5d910fcba271d357763b3dcb784db7b27bbb0b68372" +checksum = "b9610a524bef4db383cd96b4ec3ec4722eafa72c7242fa89990b74166760583d" dependencies = [ "bytes 0.5.6", "curve25519-dalek 3.0.0", @@ -3195,9 +3182,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e5c50936cfdbe96a514e8992f304fa44cd3a681b6f779505f1ae62b3474705" +checksum = "659adf89356e04f65398bb74ee791b269e63da9e41b37f8dc19eaacd12487bfe" dependencies = [ "futures 0.3.8", "libp2p-core", @@ -3210,9 +3197,9 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21026557c335d3639591f247b19b7536195772034ec7e9c463137227f95eaaa1" +checksum = "96dfe26270c91d4ff095030d1fcadd602f3fd84968ebd592829916d0715798a6" dependencies = [ "bytes 0.5.6", "futures 0.3.8", @@ -3221,7 +3208,7 @@ dependencies = [ "log", "prost", "prost-build", - "unsigned-varint 0.5.1", + "unsigned-varint", "void", ] @@ -3241,9 +3228,9 @@ dependencies = [ [[package]] name = "libp2p-request-response" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dd9a1e0e6563dec1c9e702f7e68bdaa43da62a84536aa06372d3fed3e25d4ca" +checksum = "1e952dcc9d2d7e7e45ae8bfcff255723091bd43e3e9a7741a0af8a17fe55b3ed" dependencies = [ "async-trait", "bytes 0.5.6", @@ -3255,15 +3242,15 @@ dependencies = [ "minicbor", "rand 0.7.3", "smallvec 1.5.0", - "unsigned-varint 0.5.1", + "unsigned-varint", "wasm-timer", ] [[package]] name = "libp2p-swarm" -version = "0.24.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "565f0e06674b4033c978471e4083d5aaa8e03cef0719a0ec0905aaeaad39a919" +checksum = "a6ecee54e85513a7301eb4681b3a6aac5b6d11f60d43097cf7624fd4450d7dfe" dependencies = [ "either", "futures 0.3.8", @@ -3277,9 +3264,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.24.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33f3dce259c0d3127af5167f45c275b6c047320efdd0e40fde947482487af0a3" +checksum = "bc28c9ad6dc43f4c3950411cf808639d90307a076330e7996e5e94e70279bde0" dependencies = [ "async-std", "futures 0.3.8", @@ -3293,9 +3280,9 @@ dependencies = [ [[package]] name = "libp2p-uds" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0aba04370a00d8d0236e350bc862926c1b42542a169aa6a481e660e5b990fe" +checksum = "9d821208d4b9af4b293a56dde470edd9f9fac8bb94a51f4f5327cc29a471b3f3" dependencies = [ "async-std", "futures 0.3.8", @@ -3305,9 +3292,9 @@ dependencies = [ [[package]] name = "libp2p-wasm-ext" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c703816f4170477a375b49c56d349e535ce68388f81ba1d9a3c8e2517effa82" +checksum = "1e6ef400b231ba78e866b860445480ca21ee447e03034138c6d57cf2969d6bf4" dependencies = [ "futures 0.3.8", "js-sys", @@ -3319,9 +3306,9 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5e7268a959748040a0cf7456ad655be55b87f0ceda03bdb5b53674726b28f7" +checksum = "a5736e2fccdcea6e728bbaf903bddc113be223313ce2c756ad9fe43b5a2b0f06" dependencies = [ "async-tls 0.10.0", "either", @@ -3334,14 +3321,14 @@ dependencies = [ "soketto 0.4.2", "url 2.1.1", "webpki", - "webpki-roots 0.20.0", + "webpki-roots 0.21.0", ] [[package]] name = "libp2p-yamux" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a0798cbb58535162c40858493d09af06eac42a26e4966e58de0df701f559348" +checksum = "3be7ac000fa3e42ac09a6e658e48de34ac8ef9fff64a4e6e6b08dcc8f4b0e5f6" dependencies = [ "futures 0.3.8", "libp2p-core", @@ -3406,11 +3393,10 @@ dependencies = [ [[package]] name = "linregress" -version = "0.1.7" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9290cf6f928576eeb9c096c6fad9d8d452a0a1a70a2bbffa6e36064eedc0aac9" +checksum = "0d0ad4b5cc8385a881c561fac3501353d63d2a2b7a357b5064d71815c9a92724" dependencies = [ - "failure", "nalgebra", "statrs", ] @@ -3761,17 +3747,29 @@ dependencies = [ [[package]] name = "multihash" -version = "0.11.4" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567122ab6492f49b59def14ecc36e13e64dca4188196dd0cd41f9f3f979f3df6" +checksum = "4dac63698b887d2d929306ea48b63760431ff8a24fac40ddb22f9c7f49fb7cab" dependencies = [ - "blake2b_simd", - "blake2s_simd", "digest 0.9.0", - "sha-1 0.9.1", + "generic-array 0.14.4", + "multihash-derive", "sha2 0.9.1", - "sha3", - "unsigned-varint 0.5.1", + "unsigned-varint", +] + +[[package]] +name = "multihash-derive" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ee3c48cb9d9b275ad967a0e96715badc13c6029adb92f34fa17b9ff28fd81f" +dependencies = [ + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] @@ -3782,32 +3780,33 @@ checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" [[package]] name = "multistream-select" -version = "0.8.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93faf2e41f9ee62fb01680ed48f3cc26652352327aa2e59869070358f6b7dd75" +checksum = "dda822043bba2d6da31c4e14041f9794f8fb130a5959289038d0b809d8888614" dependencies = [ "bytes 0.5.6", "futures 0.3.8", "log", "pin-project 1.0.1", "smallvec 1.5.0", - "unsigned-varint 0.5.1", + "unsigned-varint", ] [[package]] name = "nalgebra" -version = "0.18.1" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa9fddbc34c8c35dd2108515587b8ce0cab396f17977b8c738568e4edb521a2" +checksum = "d6b6147c3d50b4f3cdabfe2ecc94a0191fd3d6ad58aefd9664cf396285883486" dependencies = [ - "alga", "approx", - "generic-array 0.12.3", + "generic-array 0.13.2", "matrixmultiply", "num-complex", "num-rational", "num-traits", - "rand 0.6.5", + "rand 0.7.3", + "rand_distr", + "simba", "typenum", ] @@ -4025,7 +4024,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "frame-system", @@ -4044,7 +4043,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "frame-system", @@ -4059,7 +4058,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-benchmarking", "frame-support", @@ -4122,7 +4121,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-benchmarking", "frame-support", @@ -4181,7 +4180,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "frame-system", @@ -4194,7 +4193,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "frame-system", @@ -4249,7 +4248,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "frame-system", @@ -4263,7 +4262,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-benchmarking", "frame-support", @@ -4280,7 +4279,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "frame-system", @@ -4297,7 +4296,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-support", "parity-scale-codec", @@ -4354,9 +4353,9 @@ dependencies = [ [[package]] name = "parity-multiaddr" -version = "0.9.6" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43244a26dc1ddd3097216bb12eaa6cf8a07b060c72718d9ebd60fd297d6401df" +checksum = "2f51a30667591b14f96068b2d12f1306d07a41ebd98239d194356d4d9707ac16" dependencies = [ "arrayref", "bs58 0.4.0", @@ -4366,7 +4365,7 @@ dependencies = [ "percent-encoding 2.1.0", "serde", "static_assertions", - "unsigned-varint 0.5.1", + "unsigned-varint", "url 2.1.1", ] @@ -4856,9 +4855,9 @@ checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ "unicode-xid", ] @@ -5079,6 +5078,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_distr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2" +dependencies = [ + "rand 0.7.3", +] + [[package]] name = "rand_hc" version = "0.1.0" @@ -5539,9 +5547,9 @@ dependencies = [ [[package]] name = "rpassword" -version = "4.0.5" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99371657d3c8e4d816fb6221db98fa408242b0b53bac08f8676a41f8554fe99f" +checksum = "d755237fc0f99d98641540e66abac8bc46a0652f19148ac9e21de2da06b326c9" dependencies = [ "libc", "winapi 0.3.9", @@ -5668,7 +5676,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.3.8", "futures-timer 3.0.2", @@ -5691,7 +5699,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5708,7 +5716,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5729,7 +5737,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5740,15 +5748,13 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ - "ansi_term 0.12.1", "atty", "chrono", "fdlimit", "futures 0.3.8", "hex", - "lazy_static", "libp2p", "log", "names", @@ -5785,7 +5791,7 @@ dependencies = [ [[package]] name = "sc-cli-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5796,20 +5802,18 @@ dependencies = [ [[package]] name = "sc-client-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", "fnv", "futures 0.3.8", "hash-db", - "hex-literal 0.3.1", "kvdb", "lazy_static", "log", "parity-scale-codec", "parking_lot 0.10.2", "sc-executor", - "sc-telemetry", "sp-api", "sp-blockchain", "sp-consensus", @@ -5817,7 +5821,6 @@ dependencies = [ "sp-database", "sp-externalities", "sp-inherents", - "sp-keyring", "sp-keystore", "sp-runtime", "sp-state-machine", @@ -5833,7 +5836,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "blake2-rfc", "hash-db", @@ -5863,7 +5866,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "sc-client-api", "sp-blockchain", @@ -5874,7 +5877,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", "futures 0.3.8", @@ -5905,7 +5908,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", "fork-tree", @@ -5950,7 +5953,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "fork-tree", "parity-scale-codec", @@ -5963,7 +5966,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.3.8", "futures-timer 3.0.2", @@ -5983,12 +5986,13 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-trie", + "thiserror", ] [[package]] name = "sc-consensus-uncles" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "log", "sc-client-api", @@ -6002,7 +6006,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", "lazy_static", @@ -6030,24 +6034,23 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", - "log", "parity-scale-codec", "parity-wasm", "sp-allocator", "sp-core", - "sp-runtime-interface", "sp-serializer", "sp-wasm-interface", + "thiserror", "wasmi", ] [[package]] name = "sc-executor-wasmi" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "log", "parity-scale-codec", @@ -6062,7 +6065,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", "finality-grandpa", @@ -6099,7 +6102,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", "finality-grandpa", @@ -6123,7 +6126,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "ansi_term 0.12.1", "futures 0.3.8", @@ -6141,7 +6144,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "async-trait", "derive_more", @@ -6161,7 +6164,7 @@ dependencies = [ [[package]] name = "sc-light" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "hash-db", "lazy_static", @@ -6180,12 +6183,12 @@ dependencies = [ [[package]] name = "sc-network" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "async-std", "async-trait", "bitflags", - "bs58 0.3.1", + "bs58 0.4.0", "bytes 0.5.6", "derive_more", "either", @@ -6204,7 +6207,7 @@ dependencies = [ "lru", "nohash-hasher", "parity-scale-codec", - "parking_lot 0.10.2", + "parking_lot 0.11.1", "pin-project 0.4.24", "prost", "prost-build", @@ -6216,7 +6219,7 @@ dependencies = [ "serde_json", "slog", "slog_derive", - "smallvec 0.6.13", + "smallvec 1.5.0", "sp-arithmetic", "sp-blockchain", "sp-consensus", @@ -6225,7 +6228,7 @@ dependencies = [ "sp-utils", "substrate-prometheus-endpoint", "thiserror", - "unsigned-varint 0.4.0", + "unsigned-varint", "void", "wasm-timer", "zeroize", @@ -6234,7 +6237,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.3.8", "futures-timer 3.0.2", @@ -6249,7 +6252,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "bytes 0.5.6", "fnv", @@ -6276,7 +6279,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.3.8", "libp2p", @@ -6289,7 +6292,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6298,7 +6301,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.3.8", "hash-db", @@ -6312,6 +6315,7 @@ dependencies = [ "sc-executor", "sc-keystore", "sc-rpc-api", + "sc-tracing", "serde_json", "sp-api", "sp-blockchain", @@ -6331,7 +6335,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", "futures 0.3.8", @@ -6355,7 +6359,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.1.29", "jsonrpc-core 15.1.0", @@ -6373,9 +6377,8 @@ dependencies = [ [[package]] name = "sc-service" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ - "derive_more", "directories", "exit-future", "futures 0.1.29", @@ -6429,6 +6432,7 @@ dependencies = [ "sp-version", "substrate-prometheus-endpoint", "tempfile", + "thiserror", "tracing", "tracing-futures", "wasm-timer", @@ -6437,7 +6441,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "log", "parity-scale-codec", @@ -6446,12 +6450,13 @@ dependencies = [ "parking_lot 0.10.2", "sc-client-api", "sp-core", + "thiserror", ] [[package]] name = "sc-telemetry" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.3.8", "futures-timer 3.0.2", @@ -6472,11 +6477,15 @@ dependencies = [ [[package]] name = "sc-tracing" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ + "ansi_term 0.12.1", "erased-serde", + "lazy_static", "log", + "once_cell", "parking_lot 0.10.2", + "regex", "rustc-hash", "sc-telemetry", "serde", @@ -6485,13 +6494,14 @@ dependencies = [ "sp-tracing", "tracing", "tracing-core", + "tracing-log", "tracing-subscriber", ] [[package]] name = "sc-transaction-graph" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", "futures 0.3.8", @@ -6506,15 +6516,15 @@ dependencies = [ "sp-runtime", "sp-transaction-pool", "sp-utils", + "thiserror", "wasm-timer", ] [[package]] name = "sc-transaction-pool" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ - "derive_more", "futures 0.3.8", "futures-diagnose", "intervalier", @@ -6532,6 +6542,7 @@ dependencies = [ "sp-transaction-pool", "sp-utils", "substrate-prometheus-endpoint", + "thiserror", "wasm-timer", ] @@ -6558,6 +6569,7 @@ dependencies = [ "merlin", "rand 0.7.3", "rand_core 0.5.1", + "serde", "sha2 0.8.2", "subtle 2.3.0", "zeroize", @@ -6838,6 +6850,18 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" +[[package]] +name = "simba" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb931b1367faadea6b1ab1c306a860ec17aaa5fa39f367d0c744e69d971a1fb2" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste 0.1.18", +] + [[package]] name = "slab" version = "0.4.2" @@ -6971,19 +6995,19 @@ dependencies = [ [[package]] name = "sp-allocator" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ - "derive_more", "log", "sp-core", "sp-std", "sp-wasm-interface", + "thiserror", ] [[package]] name = "sp-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "hash-db", "parity-scale-codec", @@ -6993,12 +7017,13 @@ dependencies = [ "sp-state-machine", "sp-std", "sp-version", + "thiserror", ] [[package]] name = "sp-api-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7010,7 +7035,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "serde", @@ -7022,7 +7047,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "integer-sqrt", "num-traits", @@ -7035,7 +7060,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7046,7 +7071,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "sp-api", @@ -7058,13 +7083,14 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ + "futures 0.3.8", "log", "lru", "parity-scale-codec", "parking_lot 0.10.2", - "sp-block-builder", + "sp-api", "sp-consensus", "sp-database", "sp-runtime", @@ -7075,7 +7101,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "serde", "serde_json", @@ -7084,7 +7110,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.3.8", "futures-timer 3.0.2", @@ -7110,7 +7136,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "sp-api", @@ -7124,7 +7150,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "merlin", "parity-scale-codec", @@ -7144,7 +7170,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7153,7 +7179,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7165,7 +7191,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "base58", "blake2-rfc", @@ -7209,7 +7235,7 @@ dependencies = [ [[package]] name = "sp-database" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7218,7 +7244,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "proc-macro2", "quote", @@ -7228,7 +7254,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "environmental", "parity-scale-codec", @@ -7239,7 +7265,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "finality-grandpa", "log", @@ -7256,7 +7282,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "parking_lot 0.10.2", @@ -7268,7 +7294,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.3.8", "hash-db", @@ -7292,7 +7318,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "lazy_static", "sp-core", @@ -7303,7 +7329,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "async-trait", "derive_more", @@ -7312,6 +7338,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.10.2", "schnorrkel", + "serde", "sp-core", "sp-externalities", ] @@ -7319,7 +7346,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "sp-api", "sp-core", @@ -7329,16 +7356,15 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "backtrace", - "log", ] [[package]] name = "sp-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "serde", "sp-core", @@ -7347,7 +7373,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "either", "hash256-std-hasher", @@ -7361,7 +7387,6 @@ dependencies = [ "sp-application-crypto", "sp-arithmetic", "sp-core", - "sp-inherents", "sp-io", "sp-std", ] @@ -7369,8 +7394,9 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ + "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", "sp-externalities", @@ -7385,7 +7411,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "Inflector", "proc-macro-crate", @@ -7397,7 +7423,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "serde", "serde_json", @@ -7406,7 +7432,7 @@ dependencies = [ [[package]] name = "sp-session" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "sp-api", @@ -7419,7 +7445,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7429,7 +7455,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "hash-db", "log", @@ -7451,12 +7477,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" [[package]] name = "sp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "impl-serde 0.3.1", "parity-scale-codec", @@ -7469,7 +7495,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "log", "sp-core", @@ -7482,7 +7508,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7496,7 +7522,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "log", "parity-scale-codec", @@ -7509,7 +7535,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "derive_more", "futures 0.3.8", @@ -7519,12 +7545,13 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-runtime", + "thiserror", ] [[package]] name = "sp-trie" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "hash-db", "memory-db", @@ -7538,7 +7565,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "futures 0.3.8", "futures-core", @@ -7550,7 +7577,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "impl-serde 0.3.1", "parity-scale-codec", @@ -7562,7 +7589,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7599,11 +7626,11 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "statrs" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10102ac8d55e35db2b3fafc26f81ba8647da2e15879ab686a67e6d19af2685e8" +checksum = "cce16f6de653e88beca7bd13780d08e09d4489dbca1f9210e041bc4852481382" dependencies = [ - "rand 0.5.6", + "rand 0.7.3", ] [[package]] @@ -7768,7 +7795,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.8", @@ -7791,7 +7818,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate.git#0840c58849bc84e7fd72627745bda243741adcd8" +source = "git+https://github.com/paritytech/substrate.git#9d843c3e1b05c0ddfa2469277f5b522f7d57f612" dependencies = [ "async-std", "derive_more", @@ -8481,7 +8508,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bfd5b7557925ce778ff9b9ef90e3ade34c524b5ff10e239c69a42d546d2af56" dependencies = [ - "rand 0.7.3", + "rand 0.3.23", ] [[package]] @@ -8563,18 +8590,6 @@ dependencies = [ "subtle 2.3.0", ] -[[package]] -name = "unsigned-varint" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5" -dependencies = [ - "bytes 0.5.6", - "futures-io", - "futures-util", - "futures_codec", -] - [[package]] name = "unsigned-varint" version = "0.5.1" @@ -8867,6 +8882,15 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376" +dependencies = [ + "webpki", +] + [[package]] name = "wepoll-sys-stjepang" version = "1.0.8" diff --git a/bin/millau/node/src/service.rs b/bin/millau/node/src/service.rs index 10e613f5964aa..a9d866af73a37 100644 --- a/bin/millau/node/src/service.rs +++ b/bin/millau/node/src/service.rs @@ -318,8 +318,6 @@ pub fn new_full(config: Configuration) -> Result { task_manager .spawn_essential_handle() .spawn_blocking("grandpa-voter", sc_finality_grandpa::run_grandpa_voter(grandpa_config)?); - } else { - sc_finality_grandpa::setup_disabled_grandpa(network)?; } network_starter.start_network(); diff --git a/bin/millau/runtime/src/lib.rs b/bin/millau/runtime/src/lib.rs index 1502e3946736b..fcf443e9370f4 100644 --- a/bin/millau/runtime/src/lib.rs +++ b/bin/millau/runtime/src/lib.rs @@ -31,6 +31,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod rialto_messages; use codec::Decode; +use frame_system::limits; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -50,7 +51,7 @@ use sp_version::RuntimeVersion; pub use frame_support::{ construct_runtime, parameter_types, traits::{Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem, Randomness}, - weights::{IdentityFee, RuntimeDbWeight, Weight}, + weights::{constants::WEIGHT_PER_SECOND, DispatchClass, IdentityFee, RuntimeDbWeight, Weight}, StorageValue, }; @@ -149,19 +150,17 @@ pub fn native_version() -> NativeVersion { parameter_types! { pub const BlockHashCount: BlockNumber = 250; - pub const MaximumBlockWeight: Weight = bp_millau::MAXIMUM_BLOCK_WEIGHT; - pub const ExtrinsicBaseWeight: Weight = 10_000_000; - pub const AvailableBlockRatio: Perbill = Perbill::from_percent(bp_millau::AVAILABLE_BLOCK_RATIO); - pub MaximumExtrinsicWeight: Weight = bp_millau::MAXIMUM_EXTRINSIC_WEIGHT; - pub const MaximumBlockLength: u32 = bp_millau::MAXIMUM_BLOCK_SIZE; pub const Version: RuntimeVersion = VERSION; pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 60_000_000, // ~0.06 ms = ~60 µs write: 200_000_000, // ~0.2 ms = 200 µs }; + + pub RuntimeBlockLength: limits::BlockLength = bp_millau::runtime_block_length(); + pub RuntimeBlockWeights: limits::BlockWeights = bp_millau::runtime_block_weights(); } -impl frame_system::Trait for Runtime { +impl frame_system::Config for Runtime { /// The basic call filter to use in dispatchable. type BaseCallFilter = (); /// The identifier used to distinguish between accounts. @@ -186,24 +185,6 @@ impl frame_system::Trait for Runtime { type Origin = Origin; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = BlockHashCount; - /// Maximum weight of each block. - type MaximumBlockWeight = MaximumBlockWeight; - /// The weight of database operations that the runtime can invoke. - type DbWeight = DbWeight; - /// The weight of the overhead invoked on the block import process, independent of the - /// extrinsics included in that block. - type BlockExecutionWeight = (); - /// The base weight of any extrinsic processed by the runtime, independent of the - /// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...) - type ExtrinsicBaseWeight = ExtrinsicBaseWeight; - /// The maximum weight that a single extrinsic of `Normal` dispatch class can have, - /// idependent of the logic of that extrinsics. (Roughly max block weight - average on - /// initialize cost). - type MaximumExtrinsicWeight = MaximumExtrinsicWeight; - /// Maximum size of all encoded transactions (in bytes) that are allowed in one block. - type MaximumBlockLength = MaximumBlockLength; - /// Portion of the block weight that is available to all normal transactions. - type AvailableBlockRatio = AvailableBlockRatio; /// Version of the runtime. type Version = Version; /// Provides information about the pallet setup in the runtime. @@ -217,12 +198,18 @@ impl frame_system::Trait for Runtime { // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = (); + /// Block and extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The maximum length of a block (in bytes). + type BlockLength = RuntimeBlockLength; + /// The weight of database operations that the runtime can invoke. + type DbWeight = DbWeight; } -impl pallet_aura::Trait for Runtime { +impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; } -impl pallet_bridge_call_dispatch::Trait for Runtime { +impl pallet_bridge_call_dispatch::Config for Runtime { type Event = Event; type MessageId = (bp_message_lane::LaneId, bp_message_lane::MessageNonce); type Call = Call; @@ -232,7 +219,7 @@ impl pallet_bridge_call_dispatch::Trait for Runtime { type AccountIdConverter = bp_millau::AccountIdConverter; } -impl pallet_grandpa::Trait for Runtime { +impl pallet_grandpa::Config for Runtime { type Event = Event; type Call = Call; type KeyOwnerProofSystem = (); @@ -248,7 +235,7 @@ parameter_types! { pub const MinimumPeriod: u64 = SLOT_DURATION / 2; } -impl pallet_timestamp::Trait for Runtime { +impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; @@ -264,7 +251,7 @@ parameter_types! { pub const MaxLocks: u32 = 50; } -impl pallet_balances::Trait for Runtime { +impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. @@ -282,14 +269,14 @@ parameter_types! { pub const TransactionByteFee: Balance = 1; } -impl pallet_transaction_payment::Trait for Runtime { +impl pallet_transaction_payment::Config for Runtime { type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; type TransactionByteFee = TransactionByteFee; type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); } -impl pallet_sudo::Trait for Runtime { +impl pallet_sudo::Config for Runtime { type Event = Event; type Call = Call; } @@ -300,9 +287,9 @@ parameter_types! { pub const Offset: BlockNumber = 0; } -impl pallet_session::Trait for Runtime { +impl pallet_session::Config for Runtime { type Event = Event; - type ValidatorId = ::AccountId; + type ValidatorId = ::AccountId; type ValidatorIdOf = (); type ShouldEndSession = pallet_session::PeriodicSessions; type NextSessionRotation = pallet_session::PeriodicSessions; @@ -314,11 +301,11 @@ impl pallet_session::Trait for Runtime { type WeightInfo = (); } -impl pallet_substrate_bridge::Trait for Runtime { +impl pallet_substrate_bridge::Config for Runtime { type BridgedChain = bp_rialto::Rialto; } -impl pallet_shift_session_manager::Trait for Runtime {} +impl pallet_shift_session_manager::Config for Runtime {} parameter_types! { pub const MaxMessagesToPruneAtOnce: bp_message_lane::MessageNonce = 8; @@ -330,7 +317,7 @@ parameter_types! { bp_millau::MAX_MESSAGES_IN_DELIVERY_TRANSACTION; } -impl pallet_message_lane::Trait for Runtime { +impl pallet_message_lane::Config for Runtime { type Event = Event; type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; diff --git a/bin/millau/runtime/src/rialto_messages.rs b/bin/millau/runtime/src/rialto_messages.rs index 061137e2151b9..a2fba5faf270a 100644 --- a/bin/millau/runtime/src/rialto_messages.rs +++ b/bin/millau/runtime/src/rialto_messages.rs @@ -89,12 +89,12 @@ impl MessageBridge for WithRialtoMessageBridge { type BridgedChain = Rialto; fn maximal_extrinsic_size_on_target_chain() -> u32 { - bp_rialto::MAXIMUM_EXTRINSIC_SIZE + bp_rialto::max_extrinsic_size() } fn weight_limits_of_message_on_bridged_chain(message_payload: &[u8]) -> RangeInclusive { // we don't want to relay too large messages + keep reserve for future upgrades - let upper_limit = bp_rialto::MAXIMUM_EXTRINSIC_WEIGHT / 2; + let upper_limit = bp_rialto::max_extrinsic_weight() / 2; // given Rialto chain parameters (`TransactionByteFee`, `WeightToFee`, `FeeMultiplierUpdate`), // the minimal weight of the message may be computed as message.length() @@ -116,12 +116,12 @@ impl MessageBridge for WithRialtoMessageBridge { } fn this_weight_to_this_balance(weight: Weight) -> bp_millau::Balance { - ::WeightToFee::calc(&weight) + ::WeightToFee::calc(&weight) } fn bridged_weight_to_bridged_balance(weight: Weight) -> bp_rialto::Balance { // we're using the same weights in both chains now - ::WeightToFee::calc(&weight) as _ + ::WeightToFee::calc(&weight) as _ } fn this_balance_to_bridged_balance(this_balance: bp_millau::Balance) -> bp_rialto::Balance { diff --git a/bin/rialto/node/src/service.rs b/bin/rialto/node/src/service.rs index bd4c587618eb0..57415b73447f6 100644 --- a/bin/rialto/node/src/service.rs +++ b/bin/rialto/node/src/service.rs @@ -317,8 +317,6 @@ pub fn new_full(config: Configuration) -> Result { task_manager .spawn_essential_handle() .spawn_blocking("grandpa-voter", sc_finality_grandpa::run_grandpa_voter(grandpa_config)?); - } else { - sc_finality_grandpa::setup_disabled_grandpa(network)?; } network_starter.start_network(); diff --git a/bin/rialto/runtime/src/exchange.rs b/bin/rialto/runtime/src/exchange.rs index 1e68ce83f71fe..12fbadf012dd1 100644 --- a/bin/rialto/runtime/src/exchange.rs +++ b/bin/rialto/runtime/src/exchange.rs @@ -128,7 +128,7 @@ impl MaybeLockFundsTransaction for EthTransaction { /// Prepares everything required to bench claim of funds locked by given transaction. #[cfg(feature = "runtime-benchmarks")] -pub(crate) fn prepare_environment_for_claim, I: frame_support::traits::Instance>( +pub(crate) fn prepare_environment_for_claim, I: frame_support::traits::Instance>( transactions: &[(RawTransaction, RawTransactionReceipt)], ) -> bp_eth_poa::H256 { use bp_eth_poa::compute_merkle_root; diff --git a/bin/rialto/runtime/src/lib.rs b/bin/rialto/runtime/src/lib.rs index 57b041f649369..04534d48021bf 100644 --- a/bin/rialto/runtime/src/lib.rs +++ b/bin/rialto/runtime/src/lib.rs @@ -37,6 +37,7 @@ pub mod millau_messages; pub mod rialto_poa; use codec::Decode; +use frame_system::limits; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -56,7 +57,7 @@ use sp_version::RuntimeVersion; pub use frame_support::{ construct_runtime, parameter_types, traits::{Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem, Randomness}, - weights::{IdentityFee, RuntimeDbWeight, Weight}, + weights::{constants::WEIGHT_PER_SECOND, DispatchClass, IdentityFee, RuntimeDbWeight, Weight}, StorageValue, }; @@ -157,19 +158,17 @@ pub fn native_version() -> NativeVersion { parameter_types! { pub const BlockHashCount: BlockNumber = 250; - pub const MaximumBlockWeight: Weight = bp_rialto::MAXIMUM_BLOCK_WEIGHT; - pub const ExtrinsicBaseWeight: Weight = 10_000_000; - pub const AvailableBlockRatio: Perbill = Perbill::from_percent(bp_rialto::AVAILABLE_BLOCK_RATIO); - pub MaximumExtrinsicWeight: Weight = bp_rialto::MAXIMUM_EXTRINSIC_WEIGHT; - pub const MaximumBlockLength: u32 = bp_rialto::MAXIMUM_BLOCK_SIZE; pub const Version: RuntimeVersion = VERSION; pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 60_000_000, // ~0.06 ms = ~60 µs write: 200_000_000, // ~0.2 ms = 200 µs }; + + pub RuntimeBlockLength: limits::BlockLength = bp_rialto::runtime_block_length(); + pub RuntimeBlockWeights: limits::BlockWeights = bp_rialto::runtime_block_weights(); } -impl frame_system::Trait for Runtime { +impl frame_system::Config for Runtime { /// The basic call filter to use in dispatchable. type BaseCallFilter = (); /// The identifier used to distinguish between accounts. @@ -194,24 +193,6 @@ impl frame_system::Trait for Runtime { type Origin = Origin; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = BlockHashCount; - /// Maximum weight of each block. - type MaximumBlockWeight = MaximumBlockWeight; - /// The weight of database operations that the runtime can invoke. - type DbWeight = DbWeight; - /// The weight of the overhead invoked on the block import process, independent of the - /// extrinsics included in that block. - type BlockExecutionWeight = (); - /// The base weight of any extrinsic processed by the runtime, independent of the - /// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...) - type ExtrinsicBaseWeight = ExtrinsicBaseWeight; - /// The maximum weight that a single extrinsic of `Normal` dispatch class can have, - /// idependent of the logic of that extrinsics. (Roughly max block weight - average on - /// initialize cost). - type MaximumExtrinsicWeight = MaximumExtrinsicWeight; - /// Maximum size of all encoded transactions (in bytes) that are allowed in one block. - type MaximumBlockLength = MaximumBlockLength; - /// Portion of the block weight that is available to all normal transactions. - type AvailableBlockRatio = AvailableBlockRatio; /// Version of the runtime. type Version = Version; /// Provides information about the pallet setup in the runtime. @@ -225,14 +206,20 @@ impl frame_system::Trait for Runtime { // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = (); + /// Block and extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The maximum length of a block (in bytes). + type BlockLength = RuntimeBlockLength; + /// The weight of database operations that the runtime can invoke. + type DbWeight = DbWeight; } -impl pallet_aura::Trait for Runtime { +impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; } type RialtoPoA = pallet_bridge_eth_poa::Instance1; -impl pallet_bridge_eth_poa::Trait for Runtime { +impl pallet_bridge_eth_poa::Config for Runtime { type AuraConfiguration = rialto_poa::BridgeAuraConfiguration; type FinalityVotesCachingInterval = rialto_poa::FinalityVotesCachingInterval; type ValidatorsConfiguration = rialto_poa::BridgeValidatorsConfiguration; @@ -242,7 +229,7 @@ impl pallet_bridge_eth_poa::Trait for Runtime { } type Kovan = pallet_bridge_eth_poa::Instance2; -impl pallet_bridge_eth_poa::Trait for Runtime { +impl pallet_bridge_eth_poa::Config for Runtime { type AuraConfiguration = kovan::BridgeAuraConfiguration; type FinalityVotesCachingInterval = kovan::FinalityVotesCachingInterval; type ValidatorsConfiguration = kovan::BridgeValidatorsConfiguration; @@ -252,7 +239,7 @@ impl pallet_bridge_eth_poa::Trait for Runtime { } type RialtoCurrencyExchange = pallet_bridge_currency_exchange::Instance1; -impl pallet_bridge_currency_exchange::Trait for Runtime { +impl pallet_bridge_currency_exchange::Config for Runtime { type OnTransactionSubmitted = (); type PeerBlockchain = rialto_poa::RialtoBlockchain; type PeerMaybeLockFundsTransaction = exchange::EthTransaction; @@ -263,7 +250,7 @@ impl pallet_bridge_currency_exchange::Trait for Runtime } type KovanCurrencyExchange = pallet_bridge_currency_exchange::Instance2; -impl pallet_bridge_currency_exchange::Trait for Runtime { +impl pallet_bridge_currency_exchange::Config for Runtime { type OnTransactionSubmitted = (); type PeerBlockchain = kovan::KovanBlockchain; type PeerMaybeLockFundsTransaction = exchange::EthTransaction; @@ -273,7 +260,7 @@ impl pallet_bridge_currency_exchange::Trait for Runtime { type DepositInto = DepositInto; } -impl pallet_bridge_call_dispatch::Trait for Runtime { +impl pallet_bridge_call_dispatch::Config for Runtime { type Event = Event; type MessageId = (bp_message_lane::LaneId, bp_message_lane::MessageNonce); type Call = Call; @@ -340,7 +327,7 @@ impl bp_currency_exchange::DepositInto for DepositInto { } } -impl pallet_grandpa::Trait for Runtime { +impl pallet_grandpa::Config for Runtime { type Event = Event; type Call = Call; type KeyOwnerProofSystem = (); @@ -356,7 +343,7 @@ parameter_types! { pub const MinimumPeriod: u64 = SLOT_DURATION / 2; } -impl pallet_timestamp::Trait for Runtime { +impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; @@ -372,7 +359,7 @@ parameter_types! { pub const MaxLocks: u32 = 50; } -impl pallet_balances::Trait for Runtime { +impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. @@ -390,14 +377,14 @@ parameter_types! { pub const TransactionByteFee: Balance = 1; } -impl pallet_transaction_payment::Trait for Runtime { +impl pallet_transaction_payment::Config for Runtime { type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; type TransactionByteFee = TransactionByteFee; type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); } -impl pallet_sudo::Trait for Runtime { +impl pallet_sudo::Config for Runtime { type Event = Event; type Call = Call; } @@ -407,9 +394,9 @@ parameter_types! { pub const Offset: BlockNumber = 0; } -impl pallet_session::Trait for Runtime { +impl pallet_session::Config for Runtime { type Event = Event; - type ValidatorId = ::AccountId; + type ValidatorId = ::AccountId; type ValidatorIdOf = (); type ShouldEndSession = pallet_session::PeriodicSessions; type NextSessionRotation = pallet_session::PeriodicSessions; @@ -421,11 +408,11 @@ impl pallet_session::Trait for Runtime { type WeightInfo = (); } -impl pallet_substrate_bridge::Trait for Runtime { +impl pallet_substrate_bridge::Config for Runtime { type BridgedChain = bp_millau::Millau; } -impl pallet_shift_session_manager::Trait for Runtime {} +impl pallet_shift_session_manager::Config for Runtime {} parameter_types! { pub const MaxMessagesToPruneAtOnce: bp_message_lane::MessageNonce = 8; @@ -438,7 +425,7 @@ parameter_types! { } pub(crate) type WithMillauMessageLaneInstance = pallet_message_lane::DefaultInstance; -impl pallet_message_lane::Trait for Runtime { +impl pallet_message_lane::Config for Runtime { type Event = Event; type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; @@ -777,18 +764,18 @@ impl_runtime_apis! { use pallet_bridge_currency_exchange::benchmarking::{ Module as BridgeCurrencyExchangeBench, - Trait as BridgeCurrencyExchangeTrait, + Config as BridgeCurrencyExchangeConfig, ProofParams as BridgeCurrencyExchangeProofParams, }; - impl BridgeCurrencyExchangeTrait for Runtime { + impl BridgeCurrencyExchangeConfig for Runtime { fn make_proof( proof_params: BridgeCurrencyExchangeProofParams, ) -> crate::exchange::EthereumTransactionInclusionProof { use bp_currency_exchange::DepositInto; if proof_params.recipient_exists { - >::DepositInto::deposit_into( + >::DepositInto::deposit_into( proof_params.recipient.clone(), ExistentialDeposit::get(), ).unwrap(); @@ -817,11 +804,11 @@ impl_runtime_apis! { use pallet_message_lane::benchmarking::{ Module as MessageLaneBench, - Trait as MessageLaneTrait, + Config as MessageLaneConfig, MessageParams as MessageLaneMessageParams, }; - impl MessageLaneTrait for Runtime { + impl MessageLaneConfig for Runtime { fn endow_account(account: &Self::AccountId) { pallet_balances::Module::::make_free_balance_be( account, @@ -923,7 +910,7 @@ mod tests { let initial_amount = as Currency>::free_balance(&existing_account); let additional_amount = 10_000; - >::DepositInto::deposit_into( + >::DepositInto::deposit_into( existing_account.clone(), additional_amount, ) @@ -942,7 +929,7 @@ mod tests { let initial_amount = 0; let additional_amount = ExistentialDeposit::get() + 10_000; let new_account: AccountId = [42u8; 32].into(); - >::DepositInto::deposit_into( + >::DepositInto::deposit_into( new_account.clone(), additional_amount, ) diff --git a/bin/rialto/runtime/src/millau_messages.rs b/bin/rialto/runtime/src/millau_messages.rs index 680fcb747f8cd..77139b2bb6ab6 100644 --- a/bin/rialto/runtime/src/millau_messages.rs +++ b/bin/rialto/runtime/src/millau_messages.rs @@ -89,12 +89,12 @@ impl MessageBridge for WithMillauMessageBridge { type BridgedChain = Millau; fn maximal_extrinsic_size_on_target_chain() -> u32 { - bp_millau::MAXIMUM_EXTRINSIC_SIZE + bp_millau::max_extrinsic_size() } fn weight_limits_of_message_on_bridged_chain(message_payload: &[u8]) -> RangeInclusive { // we don't want to relay too large messages + keep reserve for future upgrades - let upper_limit = bp_millau::MAXIMUM_EXTRINSIC_WEIGHT / 2; + let upper_limit = bp_millau::max_extrinsic_weight() / 2; // given Millau chain parameters (`TransactionByteFee`, `WeightToFee`, `FeeMultiplierUpdate`), // the minimal weight of the message may be computed as message.length() @@ -116,12 +116,12 @@ impl MessageBridge for WithMillauMessageBridge { } fn this_weight_to_this_balance(weight: Weight) -> bp_rialto::Balance { - ::WeightToFee::calc(&weight) + ::WeightToFee::calc(&weight) } fn bridged_weight_to_bridged_balance(weight: Weight) -> bp_millau::Balance { // we're using the same weights in both chains now - ::WeightToFee::calc(&weight) as _ + ::WeightToFee::calc(&weight) as _ } fn this_balance_to_bridged_balance(this_balance: bp_rialto::Balance) -> bp_millau::Balance { diff --git a/bin/runtime-common/src/messages.rs b/bin/runtime-common/src/messages.rs index 0c7d4ff4be02b..3ec1fb7284905 100644 --- a/bin/runtime-common/src/messages.rs +++ b/bin/runtime-common/src/messages.rs @@ -202,7 +202,7 @@ pub mod source { } // The maximal size of extrinsic at Substrate-based chain depends on the - // `frame_system::Trait::MaximumBlockLength` and `frame_system::Trait::AvailableBlockRatio` + // `frame_system::Config::MaximumBlockLength` and `frame_system::Config::AvailableBlockRatio` // constants. This check is here to be sure that the lane won't stuck because message is too // large to fit into delivery transaction. // @@ -261,10 +261,10 @@ pub mod source { proof: FromBridgedChainMessagesDeliveryProof, ) -> Result, &'static str> where - ThisRuntime: pallet_substrate_bridge::Trait, - ThisRuntime: pallet_message_lane::Trait>>, + ThisRuntime: pallet_substrate_bridge::Config, + ThisRuntime: pallet_message_lane::Config>>, HashOf>: - Into::BridgedChain>>, + Into::BridgedChain>>, { let (bridged_header_hash, bridged_storage_proof, lane) = proof; pallet_substrate_bridge::Module::::parse_finalized_storage_proof( @@ -359,7 +359,7 @@ pub mod target { for FromBridgedChainMessageDispatch where ThisCallDispatchInstance: frame_support::traits::Instance, - ThisRuntime: pallet_bridge_call_dispatch::Trait, + ThisRuntime: pallet_bridge_call_dispatch::Config, pallet_bridge_call_dispatch::Module: bp_message_dispatch::MessageDispatch< (LaneId, MessageNonce), @@ -396,10 +396,10 @@ pub mod target { max_messages: MessageNonce, ) -> Result>>>, &'static str> where - ThisRuntime: pallet_substrate_bridge::Trait, - ThisRuntime: pallet_message_lane::Trait>>, + ThisRuntime: pallet_substrate_bridge::Config, + ThisRuntime: pallet_message_lane::Config>>, HashOf>: - Into::BridgedChain>>, + Into::BridgedChain>>, { verify_messages_proof_with_parser::( proof, @@ -459,7 +459,7 @@ pub mod target { where H: Hasher, B: MessageBridge, - ThisRuntime: pallet_message_lane::Trait>>, + ThisRuntime: pallet_message_lane::Config>>, { fn read_raw_outbound_lane_data(&self, lane_id: &LaneId) -> Option> { let storage_outbound_lane_data_key = pallet_message_lane::storage_keys::outbound_lane_data_key::< diff --git a/modules/call-dispatch/src/lib.rs b/modules/call-dispatch/src/lib.rs index 19c728162e64c..09e49702656f1 100644 --- a/modules/call-dispatch/src/lib.rs +++ b/modules/call-dispatch/src/lib.rs @@ -95,9 +95,9 @@ pub struct MessagePayload: frame_system::Trait { +pub trait Config: frame_system::Config { /// The overarching event type. - type Event: From> + Into<::Event>; + type Event: From> + Into<::Event>; /// Id of the message. Whenever message is passed to the dispatch module, it emits /// event with this id + dispatch result. Could be e.g. (LaneId, MessageNonce) if /// it comes from message-lane module. @@ -113,7 +113,7 @@ pub trait Trait: frame_system::Trait { type Call: Parameter + GetDispatchInfo + Dispatchable< - Origin = ::Origin, + Origin = ::Origin, PostInfo = frame_support::dispatch::PostDispatchInfo, >; /// A type which can be turned into an AccountId from a 256-bit hash. @@ -123,12 +123,12 @@ pub trait Trait: frame_system::Trait { } decl_storage! { - trait Store for Module, I: Instance = DefaultInstance> as CallDispatch {} + trait Store for Module, I: Instance = DefaultInstance> as CallDispatch {} } decl_event!( pub enum Event where - >::MessageId + >::MessageId { /// Message has been rejected by dispatcher because of spec version mismatch. /// Last two arguments are: expected and passed spec version. @@ -147,18 +147,18 @@ decl_event!( decl_module! { /// Call Dispatch FRAME Pallet. - pub struct Module, I: Instance = DefaultInstance> for enum Call where origin: T::Origin { + pub struct Module, I: Instance = DefaultInstance> for enum Call where origin: T::Origin { /// Deposit one of this module's events by using the default implementation. fn deposit_event() = default; } } -impl, I: Instance> MessageDispatch for Module { +impl, I: Instance> MessageDispatch for Module { type Message = MessagePayload< T::SourceChainAccountId, T::TargetChainAccountPublic, T::TargetChainSignature, - >::Call, + >::Call, >; fn dispatch_weight(message: &Self::Message) -> Weight { @@ -168,7 +168,7 @@ impl, I: Instance> MessageDispatch for Module { fn dispatch(bridge: InstanceId, id: T::MessageId, message: Self::Message) { // verify spec version // (we want it to be the same, because otherwise we may decode Call improperly) - let expected_version = ::Version::get().spec_version; + let expected_version = ::Version::get().spec_version; if message.spec_version != expected_version { frame_support::debug::trace!( "Message {:?}/{:?}: spec_version mismatch. Expected {:?}, got {:?}", @@ -384,7 +384,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } - impl frame_system::Trait for TestRuntime { + impl frame_system::Config for TestRuntime { type Origin = Origin; type Index = u64; type Call = Call; @@ -396,13 +396,6 @@ mod tests { type Header = Header; type Event = TestEvent; type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; - type DbWeight = (); - type BlockExecutionWeight = (); - type ExtrinsicBaseWeight = (); - type MaximumExtrinsicWeight = (); - type AvailableBlockRatio = AvailableBlockRatio; - type MaximumBlockLength = MaximumBlockLength; type Version = (); type PalletInfo = (); type AccountData = (); @@ -410,9 +403,12 @@ mod tests { type OnKilledAccount = (); type BaseCallFilter = (); type SystemWeightInfo = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); } - impl Trait for TestRuntime { + impl Config for TestRuntime { type Event = TestEvent; type MessageId = MessageId; type SourceChainAccountId = AccountId; @@ -435,7 +431,7 @@ mod tests { fn prepare_message( origin: CallOrigin, call: Call, - ) -> as MessageDispatch<::MessageId>>::Message { + ) -> as MessageDispatch<::MessageId>>::Message { MessagePayload { spec_version: TEST_SPEC_VERSION, weight: TEST_WEIGHT, @@ -446,20 +442,20 @@ mod tests { fn prepare_root_message( call: Call, - ) -> as MessageDispatch<::MessageId>>::Message { + ) -> as MessageDispatch<::MessageId>>::Message { prepare_message(CallOrigin::SourceRoot, call) } fn prepare_target_message( call: Call, - ) -> as MessageDispatch<::MessageId>>::Message { + ) -> as MessageDispatch<::MessageId>>::Message { let origin = CallOrigin::TargetAccount(1, TestAccountPublic(1), TestSignature(1)); prepare_message(origin, call) } fn prepare_source_message( call: Call, - ) -> as MessageDispatch<::MessageId>>::Message { + ) -> as MessageDispatch<::MessageId>>::Message { let origin = CallOrigin::SourceAccount(1); prepare_message(origin, call) } diff --git a/modules/currency-exchange/src/benchmarking.rs b/modules/currency-exchange/src/benchmarking.rs index 189dac8407b9d..73304ff40bc38 100644 --- a/modules/currency-exchange/src/benchmarking.rs +++ b/modules/currency-exchange/src/benchmarking.rs @@ -18,7 +18,7 @@ //! So we are giving runtime opportunity to prepare environment and construct proof //! before invoking module calls. -use super::{BaseHeaderChain, Call, Instance, Module as CurrencyExchangeModule, Trait as CurrencyExchangeTrait}; +use super::{BaseHeaderChain, Call, Config as CurrencyExchangeConfig, Instance, Module as CurrencyExchangeModule}; use sp_std::prelude::*; use frame_benchmarking::{account, benchmarks_instance}; @@ -29,7 +29,7 @@ const WORST_TX_SIZE_FACTOR: u32 = 1000; const WORST_PROOF_SIZE_FACTOR: u32 = 1000; /// Module we're benchmarking here. -pub struct Module, I: Instance>(CurrencyExchangeModule); +pub struct Module, I: Instance>(CurrencyExchangeModule); /// Proof benchmarking parameters. pub struct ProofParams { @@ -45,12 +45,12 @@ pub struct ProofParams { pub proof_size_factor: u32, } -/// Trait that must be implemented by runtime. -pub trait Trait: CurrencyExchangeTrait { +/// Config that must be implemented by runtime. +pub trait Config: CurrencyExchangeConfig { /// Prepare proof for importing exchange transaction. fn make_proof( proof_params: ProofParams, - ) -> <>::PeerBlockchain as BaseHeaderChain>::TransactionInclusionProof; + ) -> <>::PeerBlockchain as BaseHeaderChain>::TransactionInclusionProof; } benchmarks_instance! { diff --git a/modules/currency-exchange/src/lib.rs b/modules/currency-exchange/src/lib.rs index 036f3b564c10d..4ff88e7b03ab3 100644 --- a/modules/currency-exchange/src/lib.rs +++ b/modules/currency-exchange/src/lib.rs @@ -35,7 +35,7 @@ pub trait OnTransactionSubmitted { } /// The module configuration trait -pub trait Trait: frame_system::Trait { +pub trait Config: frame_system::Config { /// Handler for transaction submission result. type OnTransactionSubmitted: OnTransactionSubmitted; /// Represents the blockchain that we'll be exchanging currency with. @@ -61,7 +61,7 @@ pub trait Trait: frame_system::Trait { } decl_error! { - pub enum Error for Module, I: Instance> { + pub enum Error for Module, I: Instance> { /// Invalid peer blockchain transaction provided. InvalidTransaction, /// Peer transaction has invalid amount. @@ -84,12 +84,12 @@ decl_error! { } decl_module! { - pub struct Module, I: Instance = DefaultInstance> for enum Call where origin: T::Origin { + pub struct Module, I: Instance = DefaultInstance> for enum Call where origin: T::Origin { /// Imports lock fund transaction of the peer blockchain. #[weight = 0] // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) pub fn import_peer_transaction( origin, - proof: <>::PeerBlockchain as BaseHeaderChain>::TransactionInclusionProof, + proof: <>::PeerBlockchain as BaseHeaderChain>::TransactionInclusionProof, ) -> DispatchResult { let submitter = frame_system::ensure_signed(origin)?; @@ -125,13 +125,13 @@ decl_module! { } decl_storage! { - trait Store for Module, I: Instance = DefaultInstance> as Bridge { + trait Store for Module, I: Instance = DefaultInstance> as Bridge { /// All transfers that have already been claimed. Transfers: map hasher(blake2_128_concat) ::Id => (); } } -impl, I: Instance> Module { +impl, I: Instance> Module { /// Returns true if currency exchange module is able to import given transaction proof in /// its current state. pub fn filter_transaction_proof(proof: &::TransactionInclusionProof) -> bool { @@ -149,7 +149,7 @@ impl, I: Instance> Module { } } -impl, I: Instance> From for Error { +impl, I: Instance> From for Error { fn from(error: ExchangeError) -> Self { match error { ExchangeError::InvalidTransaction => Error::InvalidTransaction, @@ -168,7 +168,7 @@ impl OnTransactionSubmitted for () { } /// Exchange deposit details. -struct DepositDetails, I: Instance> { +struct DepositDetails, I: Instance> { /// Transfer id. pub transfer_id: ::Id, /// Transfer recipient. @@ -179,16 +179,16 @@ struct DepositDetails, I: Instance> { /// Verify and parse transaction proof, preparing everything required for importing /// this transaction proof. -fn prepare_deposit_details, I: Instance>( - proof: &<>::PeerBlockchain as BaseHeaderChain>::TransactionInclusionProof, +fn prepare_deposit_details, I: Instance>( + proof: &<>::PeerBlockchain as BaseHeaderChain>::TransactionInclusionProof, ) -> Result, Error> { // ensure that transaction is included in finalized block that we know of - let transaction = >::PeerBlockchain::verify_transaction_inclusion_proof(proof) + let transaction = >::PeerBlockchain::verify_transaction_inclusion_proof(proof) .ok_or(Error::::UnfinalizedTransaction)?; // parse transaction let transaction = - >::PeerMaybeLockFundsTransaction::parse(&transaction).map_err(Error::::from)?; + >::PeerMaybeLockFundsTransaction::parse(&transaction).map_err(Error::::from)?; let transfer_id = transaction.id; ensure!( !Transfers::::contains_key(&transfer_id), @@ -325,7 +325,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } - impl frame_system::Trait for TestRuntime { + impl frame_system::Config for TestRuntime { type Origin = Origin; type Index = u64; type Call = (); @@ -337,13 +337,6 @@ mod tests { type Header = Header; type Event = (); type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; - type DbWeight = (); - type BlockExecutionWeight = (); - type ExtrinsicBaseWeight = (); - type MaximumExtrinsicWeight = (); - type AvailableBlockRatio = AvailableBlockRatio; - type MaximumBlockLength = MaximumBlockLength; type Version = (); type PalletInfo = (); type AccountData = (); @@ -351,9 +344,12 @@ mod tests { type OnKilledAccount = (); type BaseCallFilter = (); type SystemWeightInfo = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); } - impl Trait for TestRuntime { + impl Config for TestRuntime { type OnTransactionSubmitted = DummyTransactionSubmissionHandler; type PeerBlockchain = DummyBlockchain; type PeerMaybeLockFundsTransaction = DummyTransaction; diff --git a/modules/ethereum/src/benchmarking.rs b/modules/ethereum/src/benchmarking.rs index 2dd58d664822f..35a202f3f2fe7 100644 --- a/modules/ethereum/src/benchmarking.rs +++ b/modules/ethereum/src/benchmarking.rs @@ -218,7 +218,7 @@ benchmarks_instance! { } } -fn initialize_bench, I: Instance>(num_validators: usize) -> AuraHeader { +fn initialize_bench, I: Instance>(num_validators: usize) -> AuraHeader { // Initialize storage with some initial header let initial_header = build_genesis_header(&validator(0)); let initial_difficulty = initial_header.difficulty; diff --git a/modules/ethereum/src/lib.rs b/modules/ethereum/src/lib.rs index 75062f763952a..70ebbe624ce5f 100644 --- a/modules/ethereum/src/lib.rs +++ b/modules/ethereum/src/lib.rs @@ -370,7 +370,7 @@ impl OnHeadersSubmitted for () { } /// The module configuration trait. -pub trait Trait: frame_system::Trait { +pub trait Config: frame_system::Config { /// Aura configuration. type AuraConfiguration: Get; /// Validators configuration. @@ -393,7 +393,7 @@ pub trait Trait: frame_system::Trait { } decl_module! { - pub struct Module, I: Instance = DefaultInstance> for enum Call where origin: T::Origin { + pub struct Module, I: Instance = DefaultInstance> for enum Call where origin: T::Origin { /// Import single Aura header. Requires transaction to be **UNSIGNED**. #[weight = 0] // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) pub fn import_unsigned_header(origin, header: AuraHeader, receipts: Option>) { @@ -457,7 +457,7 @@ decl_module! { } decl_storage! { - trait Store for Module, I: Instance = DefaultInstance> as Bridge { + trait Store for Module, I: Instance = DefaultInstance> as Bridge { /// Best known block. BestBlock: (HeaderId, U256); /// Best finalized block. @@ -505,7 +505,7 @@ decl_storage! { } } -impl, I: Instance> Module { +impl, I: Instance> Module { /// Returns number and hash of the best block known to the bridge module. /// The caller should only submit `import_header` transaction that makes /// (or leads to making) other header the best one. @@ -542,7 +542,7 @@ impl, I: Instance> Module { } } -impl, I: Instance> frame_support::unsigned::ValidateUnsigned for Module { +impl, I: Instance> frame_support::unsigned::ValidateUnsigned for Module { type Call = Call; fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { @@ -584,7 +584,7 @@ impl, I: Instance> frame_support::unsigned::ValidateUnsigned for Mod #[derive(Default)] pub struct BridgeStorage(sp_std::marker::PhantomData<(T, I)>); -impl, I: Instance> BridgeStorage { +impl, I: Instance> BridgeStorage { /// Create new BridgeStorage. pub fn new() -> Self { BridgeStorage(sp_std::marker::PhantomData::<(T, I)>::default()) @@ -683,7 +683,7 @@ impl, I: Instance> BridgeStorage { } } -impl, I: Instance> Storage for BridgeStorage { +impl, I: Instance> Storage for BridgeStorage { type Submitter = T::AccountId; fn best_block(&self) -> (HeaderId, U256) { @@ -863,7 +863,7 @@ impl, I: Instance> Storage for BridgeStorage { /// Initialize storage. #[cfg(any(feature = "std", feature = "runtime-benchmarks"))] -pub(crate) fn initialize_storage, I: Instance>( +pub(crate) fn initialize_storage, I: Instance>( initial_header: &AuraHeader, initial_difficulty: U256, initial_validators: &[Address], @@ -1263,7 +1263,7 @@ pub(crate) mod tests { fn finality_votes_are_cached() { run_test(TOTAL_VALIDATORS, |ctx| { let mut storage = BridgeStorage::::new(); - let interval = ::FinalityVotesCachingInterval::get().unwrap(); + let interval = ::FinalityVotesCachingInterval::get().unwrap(); // for all headers with number < interval, cache entry is not created for i in 1..interval { diff --git a/modules/ethereum/src/mock.rs b/modules/ethereum/src/mock.rs index 1255cc671962b..e6d105070fc32 100644 --- a/modules/ethereum/src/mock.rs +++ b/modules/ethereum/src/mock.rs @@ -18,7 +18,7 @@ pub use crate::test_utils::{insert_header, validator_utils::*, validators_change pub use bp_eth_poa::signatures::secret_to_address; use crate::validators::{ValidatorsConfiguration, ValidatorsSource}; -use crate::{AuraConfiguration, ChainTime, GenesisConfig, PruningStrategy, Trait}; +use crate::{AuraConfiguration, ChainTime, Config, GenesisConfig, PruningStrategy}; use bp_eth_poa::{Address, AuraHeader, H256, U256}; use frame_support::{impl_outer_origin, parameter_types, weights::Weight}; use secp256k1::SecretKey; @@ -44,7 +44,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -impl frame_system::Trait for TestRuntime { +impl frame_system::Config for TestRuntime { type Origin = Origin; type Index = u64; type Call = (); @@ -56,13 +56,6 @@ impl frame_system::Trait for TestRuntime { type Header = SubstrateHeader; type Event = (); type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; - type DbWeight = (); - type BlockExecutionWeight = (); - type ExtrinsicBaseWeight = (); - type MaximumExtrinsicWeight = (); - type AvailableBlockRatio = AvailableBlockRatio; - type MaximumBlockLength = MaximumBlockLength; type Version = (); type PalletInfo = (); type AccountData = (); @@ -70,6 +63,9 @@ impl frame_system::Trait for TestRuntime { type OnKilledAccount = (); type BaseCallFilter = (); type SystemWeightInfo = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); } parameter_types! { @@ -78,7 +74,7 @@ parameter_types! { pub TestValidatorsConfiguration: ValidatorsConfiguration = test_validators_config(); } -impl Trait for TestRuntime { +impl Config for TestRuntime { type AuraConfiguration = TestAuraConfiguration; type ValidatorsConfiguration = TestValidatorsConfiguration; type FinalityVotesCachingInterval = TestFinalityVotesCachingInterval; diff --git a/modules/ethereum/src/test_utils.rs b/modules/ethereum/src/test_utils.rs index b669856fdb445..e1e145f3d1236 100644 --- a/modules/ethereum/src/test_utils.rs +++ b/modules/ethereum/src/test_utils.rs @@ -27,7 +27,7 @@ use crate::finality::FinalityVotes; use crate::validators::CHANGE_EVENT_HASH; use crate::verification::calculate_score; -use crate::{HeaderToImport, Storage, Trait}; +use crate::{Config, HeaderToImport, Storage}; use bp_eth_poa::{ rlp_encode, @@ -73,7 +73,7 @@ impl HeaderBuilder { } /// Creates default header on top of parent with given hash. - pub fn with_parent_hash_on_runtime, I: crate::Instance>(parent_hash: H256) -> Self { + pub fn with_parent_hash_on_runtime, I: crate::Instance>(parent_hash: H256) -> Self { use crate::Headers; use frame_support::StorageMap; @@ -82,7 +82,7 @@ impl HeaderBuilder { } /// Creates default header on top of parent with given number. First parent is selected. - pub fn with_parent_number_on_runtime, I: crate::Instance>(parent_number: u64) -> Self { + pub fn with_parent_number_on_runtime, I: crate::Instance>(parent_number: u64) -> Self { use crate::HeadersByNumber; use frame_support::StorageMap; diff --git a/modules/message-lane/src/benchmarking.rs b/modules/message-lane/src/benchmarking.rs index ce1d4eb19c968..e56038a555970 100644 --- a/modules/message-lane/src/benchmarking.rs +++ b/modules/message-lane/src/benchmarking.rs @@ -31,7 +31,7 @@ pub const WORST_MESSAGE_SIZE_FACTOR: u32 = 1000; const SEED: u32 = 0; /// Module we're benchmarking here. -pub struct Module, I: crate::Instance>(crate::Module); +pub struct Module, I: crate::Instance>(crate::Module); /// Benchmark-specific message parameters. pub struct MessageParams { @@ -44,7 +44,7 @@ pub struct MessageParams { } /// Trait that must be implemented by runtime. -pub trait Trait: crate::Trait { +pub trait Config: crate::Config { /// Create given account and give it enough balance for test purposes. fn endow_account(account: &Self::AccountId); /// Prepare message to send over lane. @@ -83,7 +83,7 @@ fn bench_lane_id() -> LaneId { *b"test" } -fn send_regular_message, I: Instance>() { +fn send_regular_message, I: Instance>() { let mut outbound_lane = crate::outbound_lane::(bench_lane_id()); outbound_lane.send_message(MessageData { payload: vec![], @@ -91,7 +91,7 @@ fn send_regular_message, I: Instance>() { }); } -fn confirm_message_delivery, I: Instance>(nonce: MessageNonce) { +fn confirm_message_delivery, I: Instance>(nonce: MessageNonce) { let mut outbound_lane = crate::outbound_lane::(bench_lane_id()); assert!(outbound_lane.confirm_delivery(nonce).is_some()); } diff --git a/modules/message-lane/src/inbound_lane.rs b/modules/message-lane/src/inbound_lane.rs index 3a21a10223fa3..10ec2f54a20fe 100644 --- a/modules/message-lane/src/inbound_lane.rs +++ b/modules/message-lane/src/inbound_lane.rs @@ -282,7 +282,7 @@ mod tests { fn fails_to_receive_messages_above_unrewarded_relayer_entries_limit_per_lane() { run_test(|| { let mut lane = inbound_lane::(TEST_LANE_ID); - let max_nonce = ::MaxUnrewardedRelayerEntriesAtInboundLane::get(); + let max_nonce = ::MaxUnrewardedRelayerEntriesAtInboundLane::get(); for current_nonce in 1..max_nonce + 1 { assert!(lane.receive_message::( TEST_RELAYER_A + current_nonce, @@ -315,7 +315,7 @@ mod tests { fn fails_to_receive_messages_above_unconfirmed_messages_limit_per_lane() { run_test(|| { let mut lane = inbound_lane::(TEST_LANE_ID); - let max_nonce = ::MaxUnconfirmedMessagesAtInboundLane::get(); + let max_nonce = ::MaxUnconfirmedMessagesAtInboundLane::get(); for current_nonce in 1..=max_nonce { assert!(lane.receive_message::( TEST_RELAYER_A, diff --git a/modules/message-lane/src/lib.rs b/modules/message-lane/src/lib.rs index 1c8553b8bb89b..77bfc72f2caaf 100644 --- a/modules/message-lane/src/lib.rs +++ b/modules/message-lane/src/lib.rs @@ -69,11 +69,11 @@ const DELIVERY_OVERHEAD_WEIGHT: Weight = 0; const SINGLE_MESSAGE_DELIVERY_WEIGHT: Weight = 0; /// The module configuration trait -pub trait Trait: frame_system::Trait { +pub trait Config: frame_system::Config { // General types /// They overarching event type. - type Event: From> + Into<::Event>; + type Event: From> + Into<::Event>; /// Maximal number of messages that may be pruned during maintenance. Maintenance occurs /// whenever new message is sent. The reason is that if you want to use lane, you should /// be ready to pay for its maintenance. @@ -133,17 +133,17 @@ pub trait Trait: frame_system::Trait { type MessageDispatch: MessageDispatch; } -/// Shortcut to messages proof type for Trait. +/// Shortcut to messages proof type for Config. type MessagesProofOf = - <>::SourceHeaderChain as SourceHeaderChain<>::InboundMessageFee>>::MessagesProof; -/// Shortcut to messages delivery proof type for Trait. -type MessagesDeliveryProofOf = <>::TargetHeaderChain as TargetHeaderChain< - >::OutboundPayload, - ::AccountId, + <>::SourceHeaderChain as SourceHeaderChain<>::InboundMessageFee>>::MessagesProof; +/// Shortcut to messages delivery proof type for Config. +type MessagesDeliveryProofOf = <>::TargetHeaderChain as TargetHeaderChain< + >::OutboundPayload, + ::AccountId, >>::MessagesDeliveryProof; decl_error! { - pub enum Error for Module, I: Instance> { + pub enum Error for Module, I: Instance> { /// All pallet operations are halted. Halted, /// Message has been treated as invalid by chain verifier. @@ -162,7 +162,7 @@ decl_error! { } decl_storage! { - trait Store for Module, I: Instance = DefaultInstance> as MessageLane { + trait Store for Module, I: Instance = DefaultInstance> as MessageLane { /// Optional pallet owner. /// /// Pallet owner has a right to halt all pallet operations and then resume it. If it is @@ -192,7 +192,7 @@ decl_storage! { decl_event!( pub enum Event where - ::AccountId, + ::AccountId, { /// Message has been accepted and is waiting to be delivered. MessageAccepted(LaneId, MessageNonce), @@ -204,7 +204,7 @@ decl_event!( ); decl_module! { - pub struct Module, I: Instance = DefaultInstance> for enum Call where origin: T::Origin { + pub struct Module, I: Instance = DefaultInstance> for enum Call where origin: T::Origin { /// Deposit one of this module's events by using the default implementation. fn deposit_event() = default; @@ -443,7 +443,7 @@ decl_module! { nonce, }).expect("message was just confirmed; we never prune unconfirmed messages; qed"); - >::MessageDeliveryAndDispatchPayment::pay_relayer_reward( + >::MessageDeliveryAndDispatchPayment::pay_relayer_reward( &confirmation_relayer, &relayer, &message_data.fee, @@ -464,7 +464,7 @@ decl_module! { } } -impl, I: Instance> Module { +impl, I: Instance> Module { /// Get payload of given outbound message. pub fn outbound_message_payload(lane: LaneId, nonce: MessageNonce) -> Option { OutboundMessages::::get(MessageKey { lane_id: lane, nonce }).map(|message_data| message_data.payload) @@ -521,7 +521,7 @@ pub mod storage_keys { use sp_core::storage::StorageKey; /// Storage key of the outbound message in the runtime storage. - pub fn message_key, I: Instance>(lane: &LaneId, nonce: MessageNonce) -> StorageKey { + pub fn message_key, I: Instance>(lane: &LaneId, nonce: MessageNonce) -> StorageKey { let message_key = MessageKey { lane_id: *lane, nonce }; let raw_storage_key = OutboundMessages::::storage_map_final_key(message_key); StorageKey(raw_storage_key) @@ -533,13 +533,13 @@ pub mod storage_keys { } /// Storage key of the inbound message lane state in the runtime storage. - pub fn inbound_lane_data_key, I: Instance>(lane: &LaneId) -> StorageKey { + pub fn inbound_lane_data_key, I: Instance>(lane: &LaneId) -> StorageKey { StorageKey(InboundLanes::::storage_map_final_key(*lane)) } } /// Ensure that the origin is either root, or `ModuleOwner`. -fn ensure_owner_or_root, I: Instance>(origin: T::Origin) -> Result<(), BadOrigin> { +fn ensure_owner_or_root, I: Instance>(origin: T::Origin) -> Result<(), BadOrigin> { match origin.into() { Ok(RawOrigin::Root) => Ok(()), Ok(RawOrigin::Signed(ref signer)) if Some(signer) == Module::::module_owner().as_ref() => Ok(()), @@ -548,7 +548,7 @@ fn ensure_owner_or_root, I: Instance>(origin: T::Origin) -> Result<( } /// Ensure that the pallet is in operational mode (not halted). -fn ensure_operational, I: Instance>() -> Result<(), Error> { +fn ensure_operational, I: Instance>() -> Result<(), Error> { if IsHalted::::get() { Err(Error::::Halted) } else { @@ -557,7 +557,7 @@ fn ensure_operational, I: Instance>() -> Result<(), Error> { } /// Creates new inbound lane object, backed by runtime storage. -fn inbound_lane, I: Instance>(lane_id: LaneId) -> InboundLane> { +fn inbound_lane, I: Instance>(lane_id: LaneId) -> InboundLane> { InboundLane::new(RuntimeInboundLaneStorage { lane_id, cached_data: RefCell::new(None), @@ -566,7 +566,7 @@ fn inbound_lane, I: Instance>(lane_id: LaneId) -> InboundLane, I: Instance>(lane_id: LaneId) -> OutboundLane> { +fn outbound_lane, I: Instance>(lane_id: LaneId) -> OutboundLane> { OutboundLane::new(RuntimeOutboundLaneStorage { lane_id, _phantom: Default::default(), @@ -574,13 +574,13 @@ fn outbound_lane, I: Instance>(lane_id: LaneId) -> OutboundLane, I = DefaultInstance> { +struct RuntimeInboundLaneStorage, I = DefaultInstance> { lane_id: LaneId, cached_data: RefCell>>, _phantom: PhantomData, } -impl, I: Instance> InboundLaneStorage for RuntimeInboundLaneStorage { +impl, I: Instance> InboundLaneStorage for RuntimeInboundLaneStorage { type MessageFee = T::InboundMessageFee; type Relayer = T::InboundRelayer; @@ -625,7 +625,7 @@ struct RuntimeOutboundLaneStorage { _phantom: PhantomData<(T, I)>, } -impl, I: Instance> OutboundLaneStorage for RuntimeOutboundLaneStorage { +impl, I: Instance> OutboundLaneStorage for RuntimeOutboundLaneStorage { type MessageFee = T::OutboundMessageFee; fn id(&self) -> LaneId { @@ -691,7 +691,7 @@ fn verify_and_decode_messages_proof, Fee, Dispatch /// /// This account stores all the fees paid by submitters. Relayers are able to claim these /// funds as at their convenience. -fn relayer_fund_account_id, I: Instance>() -> T::AccountId { +fn relayer_fund_account_id, I: Instance>() -> T::AccountId { use sp_runtime::traits::Convert; let encoded_id = bp_runtime::derive_relayer_fund_account_id(bp_runtime::NO_INSTANCE_ID); T::AccountIdConverter::convert(encoded_id) diff --git a/modules/message-lane/src/mock.rs b/modules/message-lane/src/mock.rs index cdf29938d8987..2c3418b98f44e 100644 --- a/modules/message-lane/src/mock.rs +++ b/modules/message-lane/src/mock.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . -use crate::Trait; +use crate::Config; use bp_message_lane::{ source_chain::{LaneMessageVerifier, MessageDeliveryAndDispatchPayment, Sender, TargetHeaderChain}, @@ -69,7 +69,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -impl frame_system::Trait for TestRuntime { +impl frame_system::Config for TestRuntime { type Origin = Origin; type Index = u64; type Call = (); @@ -81,13 +81,6 @@ impl frame_system::Trait for TestRuntime { type Header = SubstrateHeader; type Event = TestEvent; type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; - type DbWeight = (); - type BlockExecutionWeight = (); - type ExtrinsicBaseWeight = (); - type MaximumExtrinsicWeight = MaximumBlockWeight; - type AvailableBlockRatio = AvailableBlockRatio; - type MaximumBlockLength = MaximumBlockLength; type Version = (); type PalletInfo = (); type AccountData = (); @@ -95,6 +88,9 @@ impl frame_system::Trait for TestRuntime { type OnKilledAccount = (); type BaseCallFilter = (); type SystemWeightInfo = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); } parameter_types! { @@ -104,7 +100,7 @@ parameter_types! { pub const MaxMessagesInDeliveryTransaction: u64 = 128; } -impl Trait for TestRuntime { +impl Config for TestRuntime { type Event = TestEvent; type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; diff --git a/modules/shift-session-manager/src/lib.rs b/modules/shift-session-manager/src/lib.rs index 918c2513f41bc..88928986f0df0 100644 --- a/modules/shift-session-manager/src/lib.rs +++ b/modules/shift-session-manager/src/lib.rs @@ -23,21 +23,21 @@ use frame_support::{decl_module, decl_storage}; use sp_std::prelude::*; /// The module configuration trait. -pub trait Trait: pallet_session::Trait {} +pub trait Config: pallet_session::Config {} decl_module! { /// Shift session manager pallet. - pub struct Module for enum Call where origin: T::Origin {} + pub struct Module for enum Call where origin: T::Origin {} } decl_storage! { - trait Store for Module as ShiftSessionManager { + trait Store for Module as ShiftSessionManager { /// Validators of first two sessions. InitialValidators: Option>; } } -impl pallet_session::SessionManager for Module { +impl pallet_session::SessionManager for Module { fn end_session(_: sp_staking::SessionIndex) {} fn start_session(_: sp_staking::SessionIndex) {} fn new_session(session_index: sp_staking::SessionIndex) -> Option> { @@ -61,7 +61,7 @@ impl pallet_session::SessionManager for Module { } } -impl Module { +impl Module { /// Select validators for session. fn select_validators( session_index: sp_staking::SessionIndex, @@ -112,7 +112,7 @@ mod tests { pub const AvailableBlockRatio: Perbill = Perbill::one(); } - impl frame_system::Trait for TestRuntime { + impl frame_system::Config for TestRuntime { type Origin = Origin; type Index = u64; type Call = (); @@ -124,13 +124,6 @@ mod tests { type Header = Header; type Event = (); type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; - type DbWeight = (); - type BlockExecutionWeight = (); - type ExtrinsicBaseWeight = (); - type MaximumExtrinsicWeight = (); - type AvailableBlockRatio = AvailableBlockRatio; - type MaximumBlockLength = MaximumBlockLength; type Version = (); type PalletInfo = (); type AccountData = (); @@ -138,6 +131,9 @@ mod tests { type OnKilledAccount = (); type BaseCallFilter = (); type SystemWeightInfo = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); } parameter_types! { @@ -145,9 +141,9 @@ mod tests { pub const Offset: u64 = 0; } - impl pallet_session::Trait for TestRuntime { + impl pallet_session::Config for TestRuntime { type Event = (); - type ValidatorId = ::AccountId; + type ValidatorId = ::AccountId; type ValidatorIdOf = ConvertInto; type ShouldEndSession = pallet_session::PeriodicSessions; type NextSessionRotation = pallet_session::PeriodicSessions; @@ -158,7 +154,7 @@ mod tests { type WeightInfo = (); } - impl Trait for TestRuntime {} + impl Config for TestRuntime {} pub struct TestSessionHandler; impl pallet_session::SessionHandler for TestSessionHandler { diff --git a/modules/substrate/src/lib.rs b/modules/substrate/src/lib.rs index 58bf3ea05dd9d..aa01c32964759 100644 --- a/modules/substrate/src/lib.rs +++ b/modules/substrate/src/lib.rs @@ -60,13 +60,13 @@ mod mock; mod fork_tests; /// Block number of the bridged chain. -pub(crate) type BridgedBlockNumber = BlockNumberOf<::BridgedChain>; +pub(crate) type BridgedBlockNumber = BlockNumberOf<::BridgedChain>; /// Block hash of the bridged chain. -pub(crate) type BridgedBlockHash = HashOf<::BridgedChain>; +pub(crate) type BridgedBlockHash = HashOf<::BridgedChain>; /// Hasher of the bridged chain. -pub(crate) type BridgedBlockHasher = HasherOf<::BridgedChain>; +pub(crate) type BridgedBlockHasher = HasherOf<::BridgedChain>; /// Header of the bridged chain. -pub(crate) type BridgedHeader = HeaderOf<::BridgedChain>; +pub(crate) type BridgedHeader = HeaderOf<::BridgedChain>; /// A convenience type identifying headers. #[derive(RuntimeDebug, PartialEq)] @@ -77,13 +77,13 @@ pub struct HeaderId { pub hash: H::Hash, } -pub trait Trait: frame_system::Trait { +pub trait Config: frame_system::Config { /// Chain that we are bridging here. type BridgedChain: Chain; } decl_storage! { - trait Store for Module as SubstrateBridge { + trait Store for Module as SubstrateBridge { /// The number of the highest block(s) we know of. BestHeight: BridgedBlockNumber; /// Hash of the header at the highest known height. @@ -137,7 +137,7 @@ decl_storage! { } decl_error! { - pub enum Error for Module { + pub enum Error for Module { /// This header has failed basic verification. InvalidHeader, /// This header has not been finalized. @@ -156,7 +156,7 @@ decl_error! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::Origin { type Error = Error; /// Import a signed Substrate header into the runtime. @@ -277,7 +277,7 @@ decl_module! { } } -impl Module { +impl Module { /// Get the highest header(s) that the pallet knows of. pub fn best_headers() -> Vec<(BridgedBlockNumber, BridgedBlockHash)> { PalletStorage::::new() @@ -353,7 +353,7 @@ impl Module { } /// Ensure that the origin is either root, or `ModuleOwner`. -fn ensure_owner_or_root(origin: T::Origin) -> Result<(), BadOrigin> { +fn ensure_owner_or_root(origin: T::Origin) -> Result<(), BadOrigin> { match origin.into() { Ok(RawOrigin::Root) => Ok(()), Ok(RawOrigin::Signed(ref signer)) if Some(signer) == >::module_owner().as_ref() => Ok(()), @@ -362,7 +362,7 @@ fn ensure_owner_or_root(origin: T::Origin) -> Result<(), BadOrigin> { } /// Ensure that the pallet is in operational mode (not halted). -fn ensure_operational() -> Result<(), Error> { +fn ensure_operational() -> Result<(), Error> { if IsHalted::get() { Err(>::Halted) } else { @@ -372,7 +372,7 @@ fn ensure_operational() -> Result<(), Error> { /// Since this writes to storage with no real checks this should only be used in functions that were /// called by a trusted origin. -fn initialize_bridge(init_params: InitializationData>) { +fn initialize_bridge(init_params: InitializationData>) { let InitializationData { header, authority_list, @@ -488,7 +488,7 @@ impl PalletStorage { } } -impl BridgeStorage for PalletStorage { +impl BridgeStorage for PalletStorage { type Header = BridgedHeader; fn write_header(&mut self, header: &ImportedHeader>) { diff --git a/modules/substrate/src/mock.rs b/modules/substrate/src/mock.rs index 88ed2ed469816..7c2b5429ed982 100644 --- a/modules/substrate/src/mock.rs +++ b/modules/substrate/src/mock.rs @@ -20,7 +20,7 @@ #![cfg(test)] -use crate::Trait; +use crate::Config; use bp_runtime::Chain; use frame_support::{impl_outer_origin, parameter_types, weights::Weight}; use sp_runtime::{ @@ -45,7 +45,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -impl frame_system::Trait for TestRuntime { +impl frame_system::Config for TestRuntime { type Origin = Origin; type Index = u64; type Call = (); @@ -57,13 +57,6 @@ impl frame_system::Trait for TestRuntime { type Header = Header; type Event = (); type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; - type DbWeight = (); - type BlockExecutionWeight = (); - type ExtrinsicBaseWeight = (); - type MaximumExtrinsicWeight = (); - type AvailableBlockRatio = AvailableBlockRatio; - type MaximumBlockLength = MaximumBlockLength; type Version = (); type PalletInfo = (); type AccountData = (); @@ -71,9 +64,12 @@ impl frame_system::Trait for TestRuntime { type OnKilledAccount = (); type BaseCallFilter = (); type SystemWeightInfo = (); + type DbWeight = (); + type BlockWeights = (); + type BlockLength = (); } -impl Trait for TestRuntime { +impl Config for TestRuntime { type BridgedChain = TestBridgedChain; } @@ -81,10 +77,10 @@ impl Trait for TestRuntime { pub struct TestBridgedChain; impl Chain for TestBridgedChain { - type BlockNumber = ::BlockNumber; - type Hash = ::Hash; - type Hasher = ::Hashing; - type Header = ::Header; + type BlockNumber = ::BlockNumber; + type Hash = ::Hash; + type Hasher = ::Hashing; + type Header = ::Header; } pub fn run_test(test: impl FnOnce() -> T) -> T { diff --git a/modules/substrate/src/storage_proof.rs b/modules/substrate/src/storage_proof.rs index 820a84737f175..4b908dde15e9f 100644 --- a/modules/substrate/src/storage_proof.rs +++ b/modules/substrate/src/storage_proof.rs @@ -65,7 +65,7 @@ pub enum Error { StorageValueUnavailable, } -impl From for crate::Error { +impl From for crate::Error { fn from(error: Error) -> Self { match error { Error::StorageRootMismatch => crate::Error::StorageRootMismatch, diff --git a/primitives/millau/Cargo.toml b/primitives/millau/Cargo.toml index 1c22da3cd9bd5..d512fc632a515 100644 --- a/primitives/millau/Cargo.toml +++ b/primitives/millau/Cargo.toml @@ -22,6 +22,7 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] } # Substrate Based Dependencies frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } @@ -36,6 +37,7 @@ std = [ "bp-runtime/std", "fixed-hash/std", "frame-support/std", + "frame-system/std", "hash256-std-hasher/std", "impl-codec/std", "impl-serde", diff --git a/primitives/millau/src/lib.rs b/primitives/millau/src/lib.rs index 148a19be0f016..5b74ec54c1318 100644 --- a/primitives/millau/src/lib.rs +++ b/primitives/millau/src/lib.rs @@ -24,11 +24,14 @@ mod millau_hash; use bp_message_lane::{LaneId, MessageNonce, UnrewardedRelayersState}; use bp_runtime::Chain; -use frame_support::{weights::Weight, RuntimeDebug}; +use frame_support::{ + weights::{constants::WEIGHT_PER_MILLIS, DispatchClass, Weight}, + RuntimeDebug, +}; use sp_core::Hasher as HasherT; use sp_runtime::{ traits::{IdentifyAccount, Verify}, - MultiSignature, MultiSigner, + MultiSignature, MultiSigner, Perbill, }; use sp_std::prelude::*; use sp_trie::{trie_types::Layout, TrieConfiguration}; @@ -68,23 +71,25 @@ impl sp_runtime::traits::Hash for BlakeTwoAndKeccak256 { } } -/// Maximal weight of single Millau block. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = 10_000_000_000; -/// Portion of block reserved for regular transactions. -pub const AVAILABLE_BLOCK_RATIO: u32 = 75; -/// Maximal weight of single Millau extrinsic (65% of maximum block weight = 75% for regular -/// transactions minus 10% for initialization). -pub const MAXIMUM_EXTRINSIC_WEIGHT: Weight = MAXIMUM_BLOCK_WEIGHT / 100 * (AVAILABLE_BLOCK_RATIO as Weight - 10); -/// Maximal size of Millau block. -pub const MAXIMUM_BLOCK_SIZE: u32 = 2 * 1024 * 1024; -/// Maximal size of single normal Millau extrinsic (75% of maximal block size). -pub const MAXIMUM_EXTRINSIC_SIZE: u32 = MAXIMUM_BLOCK_SIZE / 100 * AVAILABLE_BLOCK_RATIO; +/// Maximum weight of single Millau block. +/// +/// This represents 0.1 seconds of compute assuming a target block time of six seconds. +pub const MAXIMUM_BLOCK_WEIGHT: Weight = 10 * WEIGHT_PER_MILLIS; + +/// Represents the average portion of a block's weight that will be used by an +/// `on_initialize()` runtime call. +pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); + +/// Represents the portion of a block that will be used by Normal extrinsics. +pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); // TODO: may need to be updated after https://github.com/paritytech/parity-bridges-common/issues/78 /// Maximal number of messages in single delivery transaction. pub const MAX_MESSAGES_IN_DELIVERY_TRANSACTION: MessageNonce = 1024; + /// Maximal number of unrewarded relayer entries at inbound lane. pub const MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE: MessageNonce = 1024; + /// Maximal number of unconfirmed messages at inbound lane. pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 1024; @@ -155,6 +160,44 @@ impl sp_runtime::traits::Convert for AccountIdConverte hash.to_fixed_bytes().into() } } + +/// Get a struct which defines the weight limits and values used during extrinsic execution. +pub fn runtime_block_weights() -> frame_system::limits::BlockWeights { + frame_system::limits::BlockWeights::builder() + // Allowance for Normal class + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + // Allowance for Operational class + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Extra reserved space for Operational class + weights.reserved = Some(MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + // By default Mandatory class is not limited at all. + // This parameter is used to derive maximal size of a single extrinsic. + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic() +} + +/// Get the maximum weight (compute time) that a Normal extrinsic on the Millau chain can use. +pub fn max_extrinsic_weight() -> Weight { + runtime_block_weights() + .get(DispatchClass::Normal) + .max_extrinsic + .unwrap_or(Weight::MAX) +} + +/// Get a struct which tracks the length in bytes for each extrinsic class in a Millau block. +pub fn runtime_block_length() -> frame_system::limits::BlockLength { + frame_system::limits::BlockLength::max_with_normal_ratio(2 * 1024 * 1024, NORMAL_DISPATCH_RATIO) +} + +/// Get the maximum length in bytes that a Normal extrinsic on the Millau chain requires. +pub fn max_extrinsic_size() -> u32 { + *runtime_block_length().max.get(DispatchClass::Normal) +} + sp_api::decl_runtime_apis! { /// API for querying information about Millau headers from the Bridge Pallet instance. /// diff --git a/primitives/millau/src/millau_hash.rs b/primitives/millau/src/millau_hash.rs index 521b8997ad603..e917329d2cc09 100644 --- a/primitives/millau/src/millau_hash.rs +++ b/primitives/millau/src/millau_hash.rs @@ -18,7 +18,7 @@ use parity_util_mem::MallocSizeOf; use sp_runtime::traits::CheckEqual; // `sp_core::H512` can't be used, because it doesn't implement `CheckEqual`, which is required -// by `frame_system::Trait::Hash`. +// by `frame_system::Config::Hash`. fixed_hash::construct_fixed_hash! { /// Hash type used in Millau chain. diff --git a/primitives/rialto/Cargo.toml b/primitives/rialto/Cargo.toml index 53305d7ed862e..6d12dd0b0a413 100644 --- a/primitives/rialto/Cargo.toml +++ b/primitives/rialto/Cargo.toml @@ -16,6 +16,7 @@ bp-runtime = { path = "../runtime", default-features = false } # Substrate Based Dependencies frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false } @@ -27,6 +28,7 @@ std = [ "bp-message-lane/std", "bp-runtime/std", "frame-support/std", + "frame-system/std", "sp-api/std", "sp-core/std", "sp-runtime/std", diff --git a/primitives/rialto/src/lib.rs b/primitives/rialto/src/lib.rs index f91f1689b9470..26599786c2d45 100644 --- a/primitives/rialto/src/lib.rs +++ b/primitives/rialto/src/lib.rs @@ -22,31 +22,36 @@ use bp_message_lane::{LaneId, MessageNonce, UnrewardedRelayersState}; use bp_runtime::Chain; -use frame_support::{weights::Weight, RuntimeDebug}; +use frame_support::{ + weights::{constants::WEIGHT_PER_SECOND, DispatchClass, Weight}, + RuntimeDebug, +}; use sp_core::Hasher as HasherT; use sp_runtime::{ traits::{BlakeTwo256, Convert, IdentifyAccount, Verify}, - MultiSignature, MultiSigner, + MultiSignature, MultiSigner, Perbill, }; use sp_std::prelude::*; /// Maximal weight of single Rialto block. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = 2_000_000_000_000; -/// Portion of block reserved for regular transactions. -pub const AVAILABLE_BLOCK_RATIO: u32 = 75; -/// Maximal weight of single Rialto extrinsic (65% of maximum block weight = 75% for regular -/// transactions minus 10% for initialization). -pub const MAXIMUM_EXTRINSIC_WEIGHT: Weight = MAXIMUM_BLOCK_WEIGHT / 100 * (AVAILABLE_BLOCK_RATIO as Weight - 10); -/// Maximal size of Rialto block. -pub const MAXIMUM_BLOCK_SIZE: u32 = 5 * 1024 * 1024; -/// Maximal size of single normal Rialto extrinsic (75% of maximal block size). -pub const MAXIMUM_EXTRINSIC_SIZE: u32 = MAXIMUM_BLOCK_SIZE / 100 * AVAILABLE_BLOCK_RATIO; +/// +/// This represents two seconds of compute assuming a target block time of six seconds. +pub const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND; + +/// Represents the average portion of a block's weight that will be used by an +/// `on_initialize()` runtime call. +pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); + +/// Represents the portion of a block that will be used by Normal extrinsics. +pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); // TODO: may need to be updated after https://github.com/paritytech/parity-bridges-common/issues/78 /// Maximal number of messages in single delivery transaction. pub const MAX_MESSAGES_IN_DELIVERY_TRANSACTION: MessageNonce = 128; + /// Maximal number of unrewarded relayer entries at inbound lane. pub const MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE: MessageNonce = 128; + /// Maximal number of unconfirmed messages at inbound lane. pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 128; @@ -131,6 +136,43 @@ pub fn derive_account_from_millau_id(id: bp_runtime::SourceAccount) - AccountIdConverter::convert(encoded_id) } +/// Get a struct which defines the weight limits and values used during extrinsic execution. +pub fn runtime_block_weights() -> frame_system::limits::BlockWeights { + frame_system::limits::BlockWeights::builder() + // Allowance for Normal class + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + // Allowance for Operational class + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Extra reserved space for Operational class + weights.reserved = Some(MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + // By default Mandatory class is not limited at all. + // This parameter is used to derive maximal size of a single extrinsic. + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic() +} + +/// Get the maximum weight (compute time) that a Normal extrinsic on the Millau chain can use. +pub fn max_extrinsic_weight() -> Weight { + runtime_block_weights() + .get(DispatchClass::Normal) + .max_extrinsic + .unwrap_or(Weight::MAX) +} + +/// Get a struct which tracks the length in bytes for each extrinsic class in a Millau block. +pub fn runtime_block_length() -> frame_system::limits::BlockLength { + frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO) +} + +/// Get the maximum length in bytes that a Normal extrinsic on the Millau chain requires. +pub fn max_extrinsic_size() -> u32 { + *runtime_block_length().max.get(DispatchClass::Normal) +} + sp_api::decl_runtime_apis! { /// API for querying information about Rialto headers from the Bridge Pallet instance. /// diff --git a/relays/substrate-client/src/chain.rs b/relays/substrate-client/src/chain.rs index 37ce156a0ed2a..f309c3f775e76 100644 --- a/relays/substrate-client/src/chain.rs +++ b/relays/substrate-client/src/chain.rs @@ -56,7 +56,7 @@ pub trait Chain: ChainBase { type Call: Dispatchable + Debug; } -/// Substrate-based chain with `frame_system::Trait::AccountData` set to +/// Substrate-based chain with `frame_system::Config::AccountData` set to /// the `pallet_balances::AccountData`. pub trait ChainWithBalances: Chain { /// Balance of an account in native tokens. diff --git a/relays/substrate/src/millau_messages_to_rialto.rs b/relays/substrate/src/millau_messages_to_rialto.rs index 736e278771f0a..268a20beb76ef 100644 --- a/relays/substrate/src/millau_messages_to_rialto.rs +++ b/relays/substrate/src/millau_messages_to_rialto.rs @@ -132,9 +132,9 @@ pub fn run( max_messages_in_single_batch: bp_rialto::MAX_MESSAGES_IN_DELIVERY_TRANSACTION, // TODO: subtract base weight of delivery from this when it'll be known // https://github.com/paritytech/parity-bridges-common/issues/78 - max_messages_weight_in_single_batch: bp_rialto::MAXIMUM_EXTRINSIC_WEIGHT, + max_messages_weight_in_single_batch: bp_rialto::max_extrinsic_weight(), // 2/3 is reserved for proofs and tx overhead - max_messages_size_in_single_batch: bp_rialto::MAXIMUM_EXTRINSIC_SIZE as usize / 3, + max_messages_size_in_single_batch: bp_rialto::max_extrinsic_size() as usize / 3, }, }, MillauSourceClient::new(millau_client, lane.clone(), lane_id, RIALTO_BRIDGE_INSTANCE), diff --git a/relays/substrate/src/rialto_messages_to_millau.rs b/relays/substrate/src/rialto_messages_to_millau.rs index 2f869a122a73c..0615810612b70 100644 --- a/relays/substrate/src/rialto_messages_to_millau.rs +++ b/relays/substrate/src/rialto_messages_to_millau.rs @@ -132,9 +132,9 @@ pub fn run( max_messages_in_single_batch: bp_millau::MAX_MESSAGES_IN_DELIVERY_TRANSACTION, // TODO: subtract base weight of delivery from this when it'll be known // https://github.com/paritytech/parity-bridges-common/issues/78 - max_messages_weight_in_single_batch: bp_millau::MAXIMUM_EXTRINSIC_WEIGHT, + max_messages_weight_in_single_batch: bp_millau::max_extrinsic_weight(), // 2/3 is reserved for proofs and tx overhead - max_messages_size_in_single_batch: bp_millau::MAXIMUM_EXTRINSIC_SIZE as usize / 3, + max_messages_size_in_single_batch: bp_millau::max_extrinsic_size() as usize / 3, }, }, RialtoSourceClient::new(rialto_client, lane.clone(), lane_id, MILLAU_BRIDGE_INSTANCE),