diff --git a/Cargo.lock b/Cargo.lock index 66cdf58459..28ef08b727 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,9 +23,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.20.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ "gimli 0.27.3", ] @@ -170,6 +170,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "aho-corasick" version = "1.0.2" @@ -179,6 +188,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "always-assert" version = "0.1.3" @@ -282,9 +297,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "approx" @@ -344,7 +359,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.23", + "time 0.3.22", ] [[package]] @@ -360,7 +375,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.23", + "time 0.3.22", ] [[package]] @@ -412,9 +427,9 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-channel" -version = "1.9.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" dependencies = [ "concurrent-queue", "event-listener", @@ -435,7 +450,7 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.23", + "rustix 0.37.20", "slab", "socket2 0.4.9", "waker-fn", @@ -458,31 +473,40 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] name = "async-trait" -version = "0.1.72" +version = "0.1.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] name = "asynchronous-codec" -version = "0.6.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" +checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" dependencies = [ "bytes", "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", +] + +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", ] [[package]] @@ -502,6 +526,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "auto_impl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "autocfg" version = "0.1.8" @@ -519,16 +555,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line 0.20.0", + "addr2line 0.19.0", "cc", "cfg-if", "libc", - "miniz_oxide", - "object 0.31.1", + "miniz_oxide 0.6.2", + "object 0.30.4", "rustc-demangle", ] @@ -588,7 +624,7 @@ name = "binary-merkle-tree" version = "4.0.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "hash-db", + "hash-db 0.16.0", "log", ] @@ -607,7 +643,7 @@ version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cexpr", "clang-sys", "lazy_static", @@ -666,12 +702,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" - [[package]] name = "bitvec" version = "1.0.1" @@ -701,7 +731,7 @@ checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", "arrayvec 0.7.4", - "constant_time_eq 0.2.6", + "constant_time_eq", ] [[package]] @@ -712,20 +742,20 @@ checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" dependencies = [ "arrayref", "arrayvec 0.7.4", - "constant_time_eq 0.2.6", + "constant_time_eq", ] [[package]] name = "blake3" -version = "1.4.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", "arrayvec 0.7.4", "cc", "cfg-if", - "constant_time_eq 0.3.0", + "constant_time_eq", "digest 0.10.7", ] @@ -813,9 +843,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "1.6.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" dependencies = [ "memchr", "serde", @@ -929,18 +959,18 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.6" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "c530edf18f37068ac2d977409ed5cd50d53d73bc653c7647b48eb78976ac9ae2" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.3" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" dependencies = [ "serde", ] @@ -953,7 +983,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.18", + "semver 1.0.17", "serde", "serde_json", "thiserror", @@ -1112,9 +1142,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.19" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +checksum = "bba77a07e4489fb41bd90e8d4201c3eb246b3c2c9ea2ba0bddd6c1d1df87db7d" dependencies = [ "clap_builder", "clap_derive", @@ -1123,26 +1153,27 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.19" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +checksum = "2c9b4a88bb4bc35d3d6f65a21b0f0bafe9c894fa00978de242c555ec28bea1c0" dependencies = [ "anstream", "anstyle", + "bitflags", "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -1177,7 +1208,7 @@ version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -1269,9 +1300,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.4" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" +checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" [[package]] name = "constant_time_eq" @@ -1279,12 +1310,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - [[package]] name = "convert_case" version = "0.4.0" @@ -1337,9 +1362,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] @@ -1875,7 +1900,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -2174,9 +2199,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.102" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f68e12e817cb19eaab81aaec582b4052d07debd3c3c6b083b9d361db47c7dc9d" +checksum = "e88abab2f5abbe4c56e8f1fb431b784d710b709888f35755a160e62e33fe38e8" dependencies = [ "cc", "cxxbridge-flags", @@ -2186,9 +2211,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.102" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e789217e4ab7cf8cc9ce82253180a9fe331f35f5d339f0ccfe0270b39433f397" +checksum = "5c0c11acd0e63bae27dcd2afced407063312771212b7a823b4fd72d633be30fb" dependencies = [ "cc", "codespan-reporting", @@ -2196,24 +2221,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] name = "cxxbridge-flags" -version = "1.0.102" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78a19f4c80fd9ab6c882286fa865e92e07688f4387370a209508014ead8751d0" +checksum = "8d3816ed957c008ccd4728485511e3d9aaf7db419aa321e3d2c5a2f3411e36c8" [[package]] name = "cxxbridge-macro" -version = "1.0.102" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fcfa71f66c8563c4fa9dd2bb68368d50267856f831ac5d85367e0805f9606c" +checksum = "a26acccf6f445af85ea056362561a24ef56cdc15fcc685f03aec50b9c702cb6d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -2313,9 +2338,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.7" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" dependencies = [ "const-oid", "zeroize", @@ -2622,9 +2647,15 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + [[package]] name = "downcast" version = "0.11.0" @@ -2639,9 +2670,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.9" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" +checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" [[package]] name = "dyn-clonable" @@ -2666,9 +2697,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.12" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "304e6508efa593091e97a9abbc10f90aa7ca635b6d2784feff3c89d41dd12272" +checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" [[package]] name = "ecdsa" @@ -2684,11 +2715,11 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" dependencies = [ - "der 0.7.7", + "der 0.7.6", "digest 0.10.7", "elliptic-curve 0.13.5", "rfc6979 0.4.0", @@ -2735,9 +2766,12 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +dependencies = [ + "serde", +] [[package]] name = "elliptic-curve" @@ -2775,7 +2809,7 @@ dependencies = [ "group 0.13.0", "pkcs8 0.10.2", "rand_core 0.6.4", - "sec1 0.7.3", + "sec1 0.7.2", "subtle", "zeroize", ] @@ -2815,18 +2849,18 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] name = "enumn" -version = "0.1.11" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b893c4eb2dc092c811165f84dc7447fae16fb66521717968c34c509b39b1a5c5" +checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -2863,9 +2897,9 @@ checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" [[package]] name = "errno" @@ -2932,12 +2966,115 @@ dependencies = [ "sp-api", ] +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde 0.4.0", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a89fb87a9e103f71b903b80b670200b54cc67a07578f070681f1fffb7396fb7" +dependencies = [ + "bytes", + "ethereum-types", + "hash-db 0.15.2", + "hash256-std-hasher", + "parity-scale-codec", + "rlp", + "scale-info", + "serde", + "sha3", + "triehash", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde 0.4.0", + "primitive-types", + "scale-info", + "uint", +] + [[package]] name = "event-listener" version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "evm" +version = "0.39.1" +source = "git+https://github.com/rust-blockchain/evm?rev=b7b82c7e1fc57b7449d6dfa6826600de37cc1e65#b7b82c7e1fc57b7449d6dfa6826600de37cc1e65" +dependencies = [ + "auto_impl", + "environmental", + "ethereum", + "evm-core", + "evm-gasometer", + "evm-runtime", + "log", + "parity-scale-codec", + "primitive-types", + "rlp", + "scale-info", + "serde", + "sha3", +] + +[[package]] +name = "evm-core" +version = "0.39.0" +source = "git+https://github.com/rust-blockchain/evm?rev=b7b82c7e1fc57b7449d6dfa6826600de37cc1e65#b7b82c7e1fc57b7449d6dfa6826600de37cc1e65" +dependencies = [ + "parity-scale-codec", + "primitive-types", + "scale-info", + "serde", +] + +[[package]] +name = "evm-gasometer" +version = "0.39.0" +source = "git+https://github.com/rust-blockchain/evm?rev=b7b82c7e1fc57b7449d6dfa6826600de37cc1e65#b7b82c7e1fc57b7449d6dfa6826600de37cc1e65" +dependencies = [ + "environmental", + "evm-core", + "evm-runtime", + "primitive-types", +] + +[[package]] +name = "evm-runtime" +version = "0.39.0" +source = "git+https://github.com/rust-blockchain/evm?rev=b7b82c7e1fc57b7449d6dfa6826600de37cc1e65#b7b82c7e1fc57b7449d6dfa6826600de37cc1e65" +dependencies = [ + "auto_impl", + "environmental", + "evm-core", + "primitive-types", + "sha3", +] + [[package]] name = "exit-future" version = "0.2.0" @@ -2994,7 +3131,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -3042,12 +3179,6 @@ dependencies = [ "instant", ] -[[package]] -name = "fastrand" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" - [[package]] name = "fatality" version = "0.0.6" @@ -3073,6 +3204,156 @@ dependencies = [ "thiserror", ] +[[package]] +name = "fc-consensus" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "async-trait", + "fp-consensus", + "fp-rpc", + "sc-consensus", + "sp-api", + "sp-block-builder", + "sp-consensus", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "fc-db" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "async-trait", + "ethereum", + "fc-storage", + "fp-consensus", + "fp-rpc", + "fp-storage", + "futures", + "kvdb-rocksdb", + "log", + "parity-db", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-client-api", + "sc-client-db", + "smallvec", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-database 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42)", + "sp-runtime", + "sp-storage", + "sqlx", + "tokio", +] + +[[package]] +name = "fc-mapping-sync" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "fc-db", + "fc-storage", + "fp-consensus", + "fp-rpc", + "futures", + "futures-timer", + "log", + "parking_lot 0.12.1", + "sc-client-api", + "sc-utils", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "tokio", +] + +[[package]] +name = "fc-rpc" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "ethereum", + "ethereum-types", + "evm", + "fc-db", + "fc-mapping-sync", + "fc-rpc-core", + "fc-storage", + "fp-ethereum", + "fp-evm", + "fp-rpc", + "fp-storage", + "futures", + "hex", + "jsonrpsee", + "libsecp256k1 0.7.1", + "log", + "lru 0.8.1", + "pallet-evm", + "parity-scale-codec", + "prometheus", + "rand 0.8.5", + "rlp", + "sc-client-api", + "sc-network", + "sc-network-common", + "sc-network-sync", + "sc-rpc", + "sc-service", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sc-utils", + "serde", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-storage", + "substrate-prometheus-endpoint", + "tokio", +] + +[[package]] +name = "fc-rpc-core" +version = "1.1.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "ethereum", + "ethereum-types", + "jsonrpsee", + "rustc-hex", + "serde", + "serde_json", +] + +[[package]] +name = "fc-storage" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "ethereum", + "ethereum-types", + "fp-rpc", + "fp-storage", + "parity-scale-codec", + "sc-client-api", + "sp-api", + "sp-blockchain", + "sp-io", + "sp-runtime", + "sp-storage", +] + [[package]] name = "fdlimit" version = "0.2.1" @@ -3210,7 +3491,7 @@ checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", "libz-sys", - "miniz_oxide", + "miniz_oxide 0.7.1", ] [[package]] @@ -3223,26 +3504,151 @@ dependencies = [ ] [[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fork-tree" -version = "3.0.0" -source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "pin-project", + "spin 0.9.8", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "fork-tree" +version = "3.0.0" +source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fp-account" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "hex", + "impl-serde 0.4.0", + "libsecp256k1 0.7.1", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-runtime-interface", + "sp-std", +] + +[[package]] +name = "fp-consensus" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "ethereum", + "parity-scale-codec", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "fp-ethereum" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "ethereum", + "ethereum-types", + "fp-evm", + "frame-support", + "num_enum", + "parity-scale-codec", + "sp-std", +] + +[[package]] +name = "fp-evm" +version = "3.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "evm", + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "fp-rpc" +version = "3.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "ethereum", + "ethereum-types", + "fp-evm", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-std", +] + +[[package]] +name = "fp-self-contained" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" dependencies = [ + "frame-support", "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime", ] [[package]] -name = "form_urlencoded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +name = "fp-storage" +version = "2.0.0" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" dependencies = [ - "percent-encoding", + "parity-scale-codec", + "serde", ] [[package]] @@ -3310,7 +3716,7 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-core", - "sp-database", + "sp-database 4.0.0-dev (git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42)", "sp-externalities", "sp-inherents", "sp-keystore", @@ -3331,7 +3737,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -3405,7 +3811,7 @@ name = "frame-support" version = "4.0.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "bitflags 1.3.2", + "bitflags", "environmental", "frame-metadata", "frame-support-procedural", @@ -3446,7 +3852,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -3458,7 +3864,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -3468,7 +3874,7 @@ source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#f dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -3543,11 +3949,11 @@ dependencies = [ [[package]] name = "fs4" -version = "0.6.6" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" +checksum = "7672706608ecb74ab2e055c68327ffc25ae4cac1e12349204fd5fb0f3487cce2" dependencies = [ - "rustix 0.38.4", + "rustix 0.37.20", "windows-sys 0.48.0", ] @@ -3606,6 +4012,17 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot 0.12.1", +] + [[package]] name = "futures-io" version = "0.3.28" @@ -3618,12 +4035,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand 1.9.0", + "fastrand", "futures-core", "futures-io", "memchr", "parking", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "waker-fn", ] @@ -3635,7 +4052,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -3680,7 +4097,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "pin-utils", "slab", ] @@ -3791,11 +4208,11 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.11" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1391ab1f92ffcc08911957149833e682aa3fe252b9f45f966d2ef972274c97df" +checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ - "aho-corasick", + "aho-corasick 0.7.20", "bstr", "fnv", "log", @@ -3857,6 +4274,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "hash-db" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" + [[package]] name = "hash-db" version = "0.16.0" @@ -3895,12 +4318,28 @@ name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "ahash 0.8.3", + "allocator-api2", +] + +[[package]] +name = "hashlink" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" +dependencies = [ + "hashbrown 0.14.0", +] [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "hermit-abi" @@ -3913,9 +4352,18 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "hex" @@ -4033,14 +4481,14 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", ] [[package]] name = "http-range-header" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" +checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" [[package]] name = "httparse" @@ -4076,7 +4524,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "socket2 0.4.9", "tokio", "tower-service", @@ -4188,6 +4636,15 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + [[package]] name = "impl-serde" version = "0.3.2" @@ -4294,6 +4751,7 @@ dependencies = [ name = "interbtc-parachain" version = "1.2.0" dependencies = [ + "async-trait", "bitcoin", "btc-relay-rpc-runtime-api", "clap", @@ -4315,6 +4773,13 @@ dependencies = [ "dex-general-rpc-runtime-api", "dex-stable-rpc-runtime-api", "escrow-rpc-runtime-api", + "fc-consensus", + "fc-db", + "fc-mapping-sync", + "fc-rpc", + "fc-rpc-core", + "fp-evm", + "fp-rpc", "frame-benchmarking", "frame-benchmarking-cli", "frame-support", @@ -4331,6 +4796,7 @@ dependencies = [ "loans-rpc-runtime-api", "log", "oracle-rpc-runtime-api", + "pallet-evm", "pallet-transaction-payment", "pallet-transaction-payment-rpc", "parity-scale-codec", @@ -4406,6 +4872,12 @@ dependencies = [ "dex-general-rpc", "dex-stable-rpc", "escrow-rpc", + "fc-db", + "fc-mapping-sync", + "fc-rpc", + "fc-rpc-core", + "fc-storage", + "fp-rpc", "futures", "interbtc-primitives", "issue-rpc", @@ -4416,15 +4888,20 @@ dependencies = [ "redeem-rpc", "replace-rpc", "reward-rpc", + "sc-client-api", "sc-consensus-manual-seal", + "sc-network", + "sc-network-sync", "sc-rpc", "sc-rpc-api", + "sc-transaction-pool", "sc-transaction-pool-api", "sp-api", "sp-arithmetic", "sp-block-builder", "sp-blockchain", "sp-core", + "sp-runtime", "substrate-frame-rpc-system", "vault-registry", "vault-registry-rpc", @@ -4478,6 +4955,8 @@ dependencies = [ "escrow-rpc-runtime-api", "farming", "fee", + "fp-rpc", + "fp-self-contained", "frame-benchmarking", "frame-executive", "frame-support", @@ -4507,7 +4986,12 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", + "pallet-base-fee", "pallet-collective", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-chain-id", + "pallet-evm-precompile-dispatch", "pallet-identity", "pallet-membership", "pallet-multisig", @@ -4569,7 +5053,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.1", "libc", "windows-sys 0.48.0", ] @@ -4600,12 +5084,13 @@ checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ - "hermit-abi 0.3.2", - "rustix 0.38.4", + "hermit-abi 0.3.1", + "io-lifetimes", + "rustix 0.37.20", "windows-sys 0.48.0", ] @@ -4676,9 +5161,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "jobserver" @@ -4849,7 +5334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", - "ecdsa 0.16.8", + "ecdsa 0.16.7", "elliptic-curve 0.13.5", "once_cell", "sha2 0.10.7", @@ -4893,6 +5378,8 @@ dependencies = [ "escrow-rpc-runtime-api", "farming", "fee", + "fp-rpc", + "fp-self-contained", "frame-benchmarking", "frame-executive", "frame-support", @@ -4923,9 +5410,14 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", + "pallet-base-fee", "pallet-collective", "pallet-contracts", "pallet-contracts-primitives", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-chain-id", + "pallet-evm-precompile-dispatch", "pallet-identity", "pallet-membership", "pallet-multisig", @@ -5730,11 +6222,22 @@ dependencies = [ "libsecp256k1-core 0.3.0", ] +[[package]] +name = "libsqlite3-sys" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "libz-sys" -version = "1.1.10" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e6ab01971eb092ffe6a7d42f49f9ff42662f17604681e2843ad65077ba47dc" +checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" dependencies = [ "cc", "pkg-config", @@ -5743,9 +6246,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.9" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -5767,9 +6270,9 @@ dependencies = [ [[package]] name = "linregress" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de0b5f52a9f84544d268f5fabb71b38962d6aa3c6600b8bcd27d44ccf9c9c45" +checksum = "475015a7f8f017edb28d2e69813be23500ad4b32cfe3421c4148efc97324ee52" dependencies = [ "nalgebra", ] @@ -5786,12 +6289,6 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" -[[package]] -name = "linux-raw-sys" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" - [[package]] name = "loans" version = "1.9.3" @@ -5939,7 +6436,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] @@ -5979,7 +6476,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.23", + "rustix 0.37.20", ] [[package]] @@ -6015,7 +6512,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" dependencies = [ - "hash-db", + "hash-db 0.16.0", ] [[package]] @@ -6053,6 +6550,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -6291,9 +6797,9 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.32.3" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" +checksum = "d68d47bba83f9e2006d117a9a33af1524e655516b8919caac694427a6fb1e511" dependencies = [ "approx", "matrixmultiply", @@ -6307,9 +6813,9 @@ dependencies = [ [[package]] name = "nalgebra-macros" -version = "0.2.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" +checksum = "d232c68884c0c99810a5a4d333ef7e47689cfd0edc85efc9e54e1e6bf5212766" dependencies = [ "proc-macro2", "quote", @@ -6331,6 +6837,24 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "netlink-packet-core" version = "0.4.2" @@ -6350,7 +6874,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" dependencies = [ "anyhow", - "bitflags 1.3.2", + "bitflags", "byteorder", "libc", "netlink-packet-core", @@ -6403,7 +6927,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg-if", "libc", "memoffset 0.6.5", @@ -6462,6 +6986,20 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" +[[package]] +name = "num" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.3" @@ -6502,6 +7040,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", +] + [[package]] name = "num-rational" version = "0.4.1" @@ -6516,9 +7065,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg 1.1.0", "libm 0.2.7", @@ -6526,14 +7075,35 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.16.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.2.6", "libc", ] +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.22", +] + [[package]] name = "number_prefix" version = "0.4.0" @@ -6554,9 +7124,9 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] @@ -6597,12 +7167,50 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.22", +] + [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-sys" +version = "0.9.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "oracle" version = "1.2.0" @@ -7003,6 +7611,20 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-base-fee" +version = "1.0.0" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "fp-evm", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + [[package]] name = "pallet-beefy" version = "4.0.0-dev" @@ -7105,7 +7727,7 @@ name = "pallet-contracts" version = "4.0.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "bitflags 1.3.2", + "bitflags", "environmental", "frame-benchmarking", "frame-support", @@ -7134,7 +7756,7 @@ name = "pallet-contracts-primitives" version = "7.0.0" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "bitflags 1.3.2", + "bitflags", "parity-scale-codec", "scale-info", "sp-runtime", @@ -7149,7 +7771,7 @@ source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#f dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -7193,52 +7815,149 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ "frame-benchmarking", - "frame-election-provider-support", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-election-provider-support-benchmarking", + "parity-scale-codec", + "rand 0.8.5", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-npos-elections", + "sp-runtime", + "sp-std", + "strum", +] + +[[package]] +name = "pallet-election-provider-support-benchmarking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-system", + "parity-scale-codec", + "sp-npos-elections", + "sp-runtime", +] + +[[package]] +name = "pallet-elections-phragmen" +version = "5.0.0-dev" +source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-npos-elections", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-ethereum" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "ethereum", + "ethereum-types", + "evm", + "fp-consensus", + "fp-ethereum", + "fp-evm", + "fp-rpc", + "fp-storage", + "frame-support", + "frame-system", + "pallet-evm", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-evm" +version = "6.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "environmental", + "evm", + "fp-account", + "fp-evm", + "frame-benchmarking", "frame-support", "frame-system", + "hex", + "hex-literal 0.4.1", + "impl-trait-for-tuples", "log", - "pallet-election-provider-support-benchmarking", "parity-scale-codec", - "rand 0.8.5", + "rlp", "scale-info", - "sp-arithmetic", "sp-core", "sp-io", - "sp-npos-elections", "sp-runtime", "sp-std", - "strum", ] [[package]] -name = "pallet-election-provider-support-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +name = "pallet-evm-chain-id" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" dependencies = [ - "frame-benchmarking", - "frame-election-provider-support", + "frame-support", "frame-system", "parity-scale-codec", - "sp-npos-elections", - "sp-runtime", + "scale-info", ] [[package]] -name = "pallet-elections-phragmen" -version = "5.0.0-dev" -source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +name = "pallet-evm-precompile-dispatch" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" dependencies = [ - "frame-benchmarking", + "fp-evm", "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-core", + "pallet-evm", +] + +[[package]] +name = "pallet-evm-precompile-modexp" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "fp-evm", + "num", +] + +[[package]] +name = "pallet-evm-precompile-sha3fips" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "fp-evm", + "tiny-keccak", +] + +[[package]] +name = "pallet-evm-precompile-simple" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +dependencies = [ + "fp-evm", + "ripemd", "sp-io", - "sp-npos-elections", - "sp-runtime", - "sp-std", ] [[package]] @@ -7673,7 +8392,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -7948,9 +8667,13 @@ dependencies = [ "dex-swap-router", "env_logger 0.9.3", "escrow", + "ethereum", "farming", "fee", "flate2", + "fp-ethereum", + "fp-evm", + "fp-rpc", "frame-benchmarking", "frame-executive", "frame-support", @@ -7987,6 +8710,9 @@ dependencies = [ "pallet-collective", "pallet-contracts", "pallet-contracts-primitives", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-chain-id", "pallet-membership", "pallet-multisig", "pallet-preimage", @@ -8047,9 +8773,9 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.4.10" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f19d20a0d2cc52327a88d131fa1c4ea81ea4a04714aedcfeca2dd410049cf8" +checksum = "4890dcb9556136a4ec2b0c51fa4a08c8b733b829506af8fff2e853f3a065985b" dependencies = [ "blake2", "crc32fast", @@ -8067,9 +8793,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.4" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" +checksum = "2287753623c76f953acd29d15d8100bcab84d29db78fb6f352adb3c53e83b967" dependencies = [ "arrayvec 0.7.4", "bitvec", @@ -8082,9 +8808,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.4" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" +checksum = "2b6937b5e67bfba3351b87b040d48352a2fcb6ad72f81855412ce97b45c8f110" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -8155,14 +8881,14 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.1", + "windows-targets 0.48.0", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "pbkdf2" @@ -8214,9 +8940,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d2d1d55045829d65aad9d389139882ad623b33b904e7c9f1b10c5b8927298e5" +checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" dependencies = [ "thiserror", "ucd-trie", @@ -8224,9 +8950,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f94bca7e7a599d89dea5dfa309e217e7906c3c007fb9c3299c40b10d6a315d3" +checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" dependencies = [ "pest", "pest_generator", @@ -8234,22 +8960,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d490fe7e8556575ff6911e45567ab95e71617f43781e5c05490dc8d75c965c" +checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] name = "pest_meta" -version = "2.7.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674c66ebb4b4d9036012091b537aae5878970d6999f81a265034d85b136b341" +checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" dependencies = [ "once_cell", "pest", @@ -8268,22 +8994,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -8294,9 +9020,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -8320,7 +9046,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.7", + "der 0.7.6", "spki 0.7.2", ] @@ -9333,7 +10059,7 @@ name = "polkadot-runtime-parachains" version = "0.9.42" source = "git+https://github.com/paritytech//polkadot?branch=release-v0.9.42#6f991987c0b4cbbd7d4badc9ef08d83da5fefbfd" dependencies = [ - "bitflags 1.3.2", + "bitflags", "bitvec", "derive_more", "frame-benchmarking", @@ -9520,12 +10246,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg 1.1.0", - "bitflags 1.3.2", + "bitflags", "cfg-if", "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "windows-sys 0.48.0", ] @@ -9566,9 +10292,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.4.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc55135a600d700580e406b4de0d59cb9ad25e344a3a091a97ded2622ec4ec6" +checksum = "767eb9f07d4a5ebcb39bbf2d452058a93c011373abf6832e24194a1c3f004794" [[package]] name = "ppv-lite86" @@ -9636,6 +10362,7 @@ checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash 0.8.0", "impl-codec", + "impl-rlp", "impl-serde 0.4.0", "scale-info", "uint", @@ -9705,14 +10432,14 @@ checksum = "0e99670bafb56b9a106419397343bdbc8b8742c3cc449fec6345f86173f47cd4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] @@ -9761,7 +10488,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", - "bitflags 1.3.2", + "bitflags", "byteorder", "lazy_static", "num-traits", @@ -9878,9 +10605,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.9.4" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31999cfc7927c4e212e60fd50934ab40e8e8bfd2d493d6095d2d306bc0764d9" +checksum = "67c10f662eee9c94ddd7135043e544f3c82fa839a1e7b865911331961b53186c" dependencies = [ "bytes", "rand 0.8.5", @@ -9896,9 +10623,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -10140,7 +10867,7 @@ checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ "pem", "ring", - "time 0.3.23", + "time 0.3.22", "x509-parser 0.13.2", "yasna", ] @@ -10153,7 +10880,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring", - "time 0.3.23", + "time 0.3.22", "yasna", ] @@ -10227,7 +10954,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -10236,7 +10963,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -10265,22 +10992,22 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.19" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ef7e18e8841942ddb1cf845054f8008410030a3997875d9e49b7a363063df1" +checksum = "f43faa91b1c8b36841ee70e97188a869d37ae21759da6846d4be66de5bf7b12c" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.19" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfaf0c85b766276c797f3791f5bc6d5bd116b41d53049af2789666b0c0bc9fa" +checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -10297,14 +11024,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.1" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ - "aho-corasick", + "aho-corasick 1.0.2", "memchr", - "regex-automata 0.3.3", - "regex-syntax 0.7.4", + "regex-syntax 0.7.2", ] [[package]] @@ -10316,17 +11042,6 @@ dependencies = [ "regex-syntax 0.6.29", ] -[[package]] -name = "regex-automata" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.7.4", -] - [[package]] name = "regex-syntax" version = "0.6.29" @@ -10335,9 +11050,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "region" @@ -10345,7 +11060,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" dependencies = [ - "bitflags 1.3.2", + "bitflags", "libc", "mach", "winapi", @@ -10496,6 +11211,37 @@ dependencies = [ "winapi", ] +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rlp-derive", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "rocksdb" version = "0.20.1" @@ -10695,10 +11441,19 @@ dependencies = [ "orml-xcm-support", "orml-xtokens", "pallet-aura", + "pallet-base-fee", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-chain-id", + "pallet-evm-precompile-modexp", + "pallet-evm-precompile-sha3fips", + "pallet-evm-precompile-simple", + "parachain-info", "redeem", "replace", "reward", "security", + "sp-core", "sp-runtime", "sp-std", "staking", @@ -10733,7 +11488,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.18", + "semver 1.0.17", ] [[package]] @@ -10747,11 +11502,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.15" +version = "0.36.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c37f1bd5ef1b5422177b7646cba67430579cfe2ace80f284fee876bca52ad941" +checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62" dependencies = [ - "bitflags 1.3.2", + "bitflags", "errno", "io-lifetimes", "libc", @@ -10761,11 +11516,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.23" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ - "bitflags 1.3.2", + "bitflags", "errno", "io-lifetimes", "libc", @@ -10773,19 +11528,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "rustix" -version = "0.38.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" -dependencies = [ - "bitflags 2.3.3", - "errno", - "libc", - "linux-raw-sys 0.4.3", - "windows-sys 0.48.0", -] - [[package]] name = "rustls" version = "0.19.1" @@ -10834,9 +11576,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" [[package]] name = "rusty-fork" @@ -10863,15 +11605,15 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "safe_arch" -version = "0.7.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" +checksum = "62a7484307bd40f8f7ccbacccac730108f2cae119a3b11c74485b48aa9ea650f" dependencies = [ "bytemuck", ] @@ -10989,7 +11731,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -11049,7 +11791,7 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-core", - "sp-database", + "sp-database 4.0.0-dev (git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42)", "sp-externalities", "sp-keystore", "sp-runtime", @@ -11063,7 +11805,7 @@ name = "sc-client-db" version = "0.10.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "hash-db", + "hash-db 0.16.0", "kvdb", "kvdb-memorydb", "kvdb-rocksdb", @@ -11078,7 +11820,7 @@ dependencies = [ "sp-arithmetic", "sp-blockchain", "sp-core", - "sp-database", + "sp-database 4.0.0-dev (git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42)", "sp-runtime", "sp-state-machine", "sp-trie", @@ -11440,7 +12182,7 @@ dependencies = [ "libc", "log", "once_cell", - "rustix 0.36.15", + "rustix 0.36.14", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -11551,7 +12293,7 @@ source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#f dependencies = [ "array-bytes 4.2.0", "async-trait", - "bitflags 1.3.2", + "bitflags", "bytes", "futures", "futures-timer", @@ -11999,7 +12741,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -12123,9 +12865,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.9.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" +checksum = "ad560913365790f17cbf12479491169f01b9d46d29cfc7422bf8c64bdc61b731" dependencies = [ "bitvec", "cfg-if", @@ -12137,9 +12879,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.9.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" +checksum = "19df9bd9ace6cc2fe19387c96ce677e823e07d017ceed253e7bb3d1d1bd9c73b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -12149,11 +12891,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.42.0", ] [[package]] @@ -12187,15 +12929,15 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.2.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.7" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "sct" @@ -12245,12 +12987,12 @@ dependencies = [ [[package]] name = "sec1" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" dependencies = [ "base16ct 0.2.0", - "der 0.7.7", + "der 0.7.6", "generic-array 0.14.7", "pkcs8 0.10.2", "subtle", @@ -12321,11 +13063,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -12334,9 +13076,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" dependencies = [ "core-foundation-sys", "libc", @@ -12353,9 +13095,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" dependencies = [ "serde", ] @@ -12368,29 +13110,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.175" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.175" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] name = "serde_json" -version = "1.0.103" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" +checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" dependencies = [ "itoa", "ryu", @@ -12577,9 +13319,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snap" @@ -12646,7 +13388,7 @@ name = "sp-api" version = "4.0.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "hash-db", + "hash-db 0.16.0", "log", "parity-scale-codec", "scale-info", @@ -12672,7 +13414,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -12739,7 +13481,7 @@ dependencies = [ "parking_lot 0.12.1", "sp-api", "sp-consensus", - "sp-database", + "sp-database 4.0.0-dev (git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42)", "sp-runtime", "sp-state-machine", "thiserror", @@ -12854,14 +13596,14 @@ version = "7.0.0" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ "array-bytes 4.2.0", - "bitflags 1.3.2", + "bitflags", "blake2", "bounded-collections", "bs58", "dyn-clonable", "ed25519-zebra", "futures", - "hash-db", + "hash-db 0.16.0", "hash256-std-hasher", "impl-serde 0.4.0", "lazy_static", @@ -12914,7 +13656,7 @@ dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -12926,6 +13668,15 @@ dependencies = [ "parking_lot 0.12.1", ] +[[package]] +name = "sp-database" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" +dependencies = [ + "kvdb", + "parking_lot 0.12.1", +] + [[package]] name = "sp-debug-derive" version = "5.0.0" @@ -12933,7 +13684,7 @@ source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#f dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -13019,7 +13770,7 @@ version = "4.1.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ "thiserror", - "zstd 0.12.4", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] @@ -13144,7 +13895,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -13179,7 +13930,7 @@ name = "sp-state-machine" version = "0.13.0" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "hash-db", + "hash-db 0.16.0", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -13270,7 +14021,7 @@ version = "7.0.0" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ "ahash 0.8.3", - "hash-db", + "hash-db 0.16.0", "hashbrown 0.13.2", "lazy_static", "memory-db", @@ -13312,7 +14063,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -13361,6 +14112,9 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] [[package]] name = "spinners" @@ -13390,14 +14144,135 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", - "der 0.7.7", + "der 0.7.6", +] + +[[package]] +name = "sqlformat" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e" +dependencies = [ + "itertools", + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53" +dependencies = [ + "ahash 0.8.3", + "atoi", + "byteorder", + "bytes", + "crc", + "crossbeam-queue", + "dotenvy", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap 2.0.0", + "log", + "memchr", + "native-tls", + "once_cell", + "paste", + "percent-encoding", + "serde", + "sha2 0.10.7", + "smallvec", + "sqlformat", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", +] + +[[package]] +name = "sqlx-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc" +dependencies = [ + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2 0.10.7", + "sqlx-core", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio", + "url", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4c21bf34c7cae5b283efb3ac1bcc7670df7561124dc2f8bdc0b59be40f79a2" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "tracing", + "url", ] [[package]] name = "ss58-registry" -version = "1.41.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfc443bad666016e012538782d9e3006213a7db43e9fb1dda91657dc06a6fa08" +checksum = "eb47a8ad42e5fc72d5b1eb104a5546937eaf39843499948bb666d6e93c62423b" dependencies = [ "Inflector", "num-format", @@ -13462,7 +14337,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg_aliases", "libc", "parking_lot 0.11.2", @@ -13640,7 +14515,7 @@ dependencies = [ "sp-maybe-compressed-blob", "strum", "tempfile", - "toml 0.7.6", + "toml 0.7.5", "walkdir", "wasm-opt", ] @@ -13694,9 +14569,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.27" +version = "2.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" +checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" dependencies = [ "proc-macro2", "quote", @@ -13721,7 +14596,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "system-configuration-sys", ] @@ -13744,20 +14619,21 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.10" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2faeef5759ab89935255b1a4cd98e0baf99d1085e37d36599c625dac49ae8e" +checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" [[package]] name = "tempfile" -version = "3.7.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg 1.1.0", "cfg-if", - "fastrand 2.0.0", + "fastrand", "redox_syscall 0.3.5", - "rustix 0.38.4", + "rustix 0.37.20", "windows-sys 0.48.0", ] @@ -13778,22 +14654,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -13868,9 +14744,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.23" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa", "serde", @@ -13886,9 +14762,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.10" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" +checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" dependencies = [ "time-core", ] @@ -13912,6 +14788,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinytemplate" version = "1.2.1" @@ -13939,9 +14824,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "374442f06ee49c3a28a8fc9f01a2596fed7559c6b99b31279c3261778e77d84f" dependencies = [ "autocfg 1.1.0", "backtrace", @@ -13950,7 +14835,7 @@ dependencies = [ "mio", "num_cpus", "parking_lot 0.12.1", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "signal-hook-registry", "socket2 0.4.9", "tokio-macros", @@ -13965,7 +14850,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -13986,7 +14871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "tokio", "tokio-util", ] @@ -14001,7 +14886,7 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "tokio", "tracing", ] @@ -14017,9 +14902,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "1ebafdf5ad1220cb59e7d17cf4d2c72015297b75b19a10472f99b89225089240" dependencies = [ "serde", "serde_spanned", @@ -14038,9 +14923,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7" dependencies = [ "indexmap 2.0.0", "serde", @@ -14066,14 +14951,14 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ - "bitflags 1.3.2", + "bitflags", "bytes", "futures-core", "futures-util", "http", "http-body", "http-range-header", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "tower-layer", "tower-service", ] @@ -14098,7 +14983,7 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "log", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "tracing-attributes", "tracing-core", ] @@ -14111,7 +14996,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -14154,7 +15039,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -14227,7 +15112,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "767abe6ffed88a1889671a102c2861ae742726f52e0a5a425b92c9fbfa7e9c85" dependencies = [ - "hash-db", + "hash-db 0.16.0", "hashbrown 0.13.2", "log", "rustc-hex", @@ -14240,7 +15125,17 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" dependencies = [ - "hash-db", + "hash-db 0.16.0", +] + +[[package]] +name = "triehash" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1631b201eb031b563d2e85ca18ec8092508e262a3196ce9bd10a67ec87b9f5c" +dependencies = [ + "hash-db 0.15.2", + "rlp", ] [[package]] @@ -14329,7 +15224,7 @@ dependencies = [ "sp-version", "sp-weights", "substrate-rpc-client", - "zstd 0.12.4", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] @@ -14395,9 +15290,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "uint" @@ -14425,9 +15320,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -14438,6 +15333,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-width" version = "0.1.10" @@ -14450,6 +15351,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + [[package]] name = "universal-hash" version = "0.4.1" @@ -14507,9 +15414,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" dependencies = [ "getrandom 0.2.10", ] @@ -14690,7 +15597,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", "wasm-bindgen-shared", ] @@ -14724,7 +15631,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -14941,7 +15848,7 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix 0.36.15", + "rustix 0.36.14", "serde", "sha2 0.10.7", "toml 0.5.11", @@ -15021,7 +15928,7 @@ checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" dependencies = [ "object 0.29.0", "once_cell", - "rustix 0.36.15", + "rustix 0.36.14", ] [[package]] @@ -15052,7 +15959,7 @@ dependencies = [ "memoffset 0.6.5", "paste", "rand 0.8.5", - "rustix 0.36.15", + "rustix 0.36.14", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", @@ -15136,7 +16043,7 @@ dependencies = [ "sha2 0.10.7", "stun", "thiserror", - "time 0.3.23", + "time 0.3.22", "tokio", "turn", "url", @@ -15305,7 +16212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" dependencies = [ "async-trait", - "bitflags 1.3.2", + "bitflags", "bytes", "cc", "ipnet", @@ -15438,9 +16345,9 @@ dependencies = [ [[package]] name = "wide" -version = "0.7.11" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa469ffa65ef7e0ba0f164183697b89b854253fd31aeb92358b7b6155177d62f" +checksum = "40018623e2dba2602a9790faba8d33f2ebdebf4b86561b83928db735f8784728" dependencies = [ "bytemuck", "safe_arch", @@ -15502,7 +16409,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.48.0", ] [[package]] @@ -15535,7 +16442,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.48.0", ] [[package]] @@ -15555,9 +16462,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -15684,9 +16591,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.5.0" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" +checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" dependencies = [ "memchr", ] @@ -15748,7 +16655,7 @@ dependencies = [ "ring", "rusticata-macros", "thiserror", - "time 0.3.23", + "time 0.3.22", ] [[package]] @@ -15766,7 +16673,7 @@ dependencies = [ "oid-registry 0.6.1", "rusticata-macros", "thiserror", - "time 0.3.23", + "time 0.3.22", ] [[package]] @@ -15860,7 +16767,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -15900,7 +16807,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ - "time 0.3.23", + "time 0.3.22", ] [[package]] @@ -15920,7 +16827,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.22", ] [[package]] @@ -15934,11 +16841,11 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.4" +version = "0.12.3+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" dependencies = [ - "zstd-safe 6.0.6", + "zstd-safe 6.0.5+zstd.1.5.4", ] [[package]] @@ -15953,9 +16860,9 @@ dependencies = [ [[package]] name = "zstd-safe" -version = "6.0.6" +version = "6.0.5+zstd.1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" dependencies = [ "libc", "zstd-sys", diff --git a/Cargo.toml b/Cargo.toml index 5fa33dab70..8d79b83b4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -257,4 +257,23 @@ orml-utilities = { git = "https://github.com/open-web3-stack//open-runtime-modul orml-vesting = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "ca05423f4f32be1d30765caacdc7d90130f5554a" } orml-xcm-support = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "ca05423f4f32be1d30765caacdc7d90130f5554a" } orml-xcm = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "ca05423f4f32be1d30765caacdc7d90130f5554a" } -orml-xtokens = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "ca05423f4f32be1d30765caacdc7d90130f5554a" } \ No newline at end of file +orml-xtokens = { git = "https://github.com/open-web3-stack//open-runtime-module-library", rev = "ca05423f4f32be1d30765caacdc7d90130f5554a" } + +[patch."https://github.com/paritytech/frontier"] +fc-consensus = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +fc-db = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +fc-mapping-sync = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +fc-rpc = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +fc-rpc-core = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +fc-storage = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } + +fp-ethereum = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +fp-evm = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +fp-rpc = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +fp-self-contained = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } + +pallet-base-fee = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +pallet-ethereum = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +pallet-evm = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +pallet-evm-chain-id = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } +pallet-evm-precompile-dispatch = { git = "https://github.com/paritytech//frontier", branch = "polkadot-v0.9.42" } diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index 30a87cd88b..29e46babfc 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -15,6 +15,7 @@ name = "interbtc-parachain" substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } [dependencies] +async-trait = "0.1" clap = { version = "4.0.9", features = [ "derive" ] } log = "0.4.8" codec = { package = "parity-scale-codec", version = "3.1.5" } @@ -113,6 +114,16 @@ polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "relea polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.31" } polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.31" } +# Frontier dependencies +fc-consensus = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fc-db = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fc-mapping-sync = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", features = ["sql"] } +fc-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fc-rpc-core = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } + [features] default = [] diff --git a/parachain/runtime/common/Cargo.toml b/parachain/runtime/common/Cargo.toml index 508cd9b5ae..b66f349dcf 100644 --- a/parachain/runtime/common/Cargo.toml +++ b/parachain/runtime/common/Cargo.toml @@ -12,6 +12,7 @@ targets = ['x86_64-unknown-linux-gnu'] # Substrate dependencies sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31", default-features = false } frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31", default-features = false, optional = true } @@ -19,6 +20,9 @@ xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.3 xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.31", default-features = false } pallet-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31", default-features = false } +# Cumulus dependencies +parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.31", default-features = false } + # Parachain dependencies annuity = { path = "../../../crates/annuity", default-features = false } btc-relay = { path = "../../../crates/btc-relay", default-features = false } @@ -53,6 +57,15 @@ orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-l orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "3fcd3cf9e63fe80fd9671912833a900ba09d1cc0", default-features = false } orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "3fcd3cf9e63fe80fd9671912833a900ba09d1cc0", default-features = false } +# Frontier dependencies +pallet-base-fee = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm-chain-id = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm-precompile-modexp = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm-precompile-sha3fips = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm-precompile-simple = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } + # TODO: enable weak dependency activation when available # https://github.com/rust-lang/cargo/issues/8832 # https://github.com/paritytech/substrate/issues/8161 @@ -62,6 +75,7 @@ default = ["std"] std = [ "sp-std/std", "sp-runtime/std", + "sp-core/std", "frame-support/std", "frame-system/std", "frame-benchmarking?/std", @@ -69,6 +83,8 @@ std = [ "xcm-executor/std", "pallet-aura/std", + "parachain-info/std", + "annuity/std", "btc-relay/std", "clients-info/std", @@ -100,6 +116,14 @@ std = [ "orml-xtokens/std", "orml-xcm-support/std", "orml-unknown-tokens/std", + + "pallet-base-fee/std", + "pallet-ethereum/std", + "pallet-evm/std", + "pallet-evm-chain-id/std", + "pallet-evm-precompile-modexp/std", + "pallet-evm-precompile-sha3fips/std", + "pallet-evm-precompile-simple/std", ] try-runtime = [ "frame-support/try-runtime", @@ -128,7 +152,12 @@ try-runtime = [ "orml-vesting/try-runtime", "orml-asset-registry/try-runtime", "orml-xtokens/try-runtime", - "orml-unknown-tokens/try-runtime" + "orml-unknown-tokens/try-runtime", + + "pallet-base-fee/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", + "pallet-evm-chain-id/try-runtime", ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/parachain/runtime/common/src/evm/mod.rs b/parachain/runtime/common/src/evm/mod.rs new file mode 100644 index 0000000000..92787363c5 --- /dev/null +++ b/parachain/runtime/common/src/evm/mod.rs @@ -0,0 +1,71 @@ +use frame_support::{ + traits::OnRuntimeUpgrade, + weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, +}; +use pallet_ethereum::{Transaction, TransactionAction}; +use sp_core::Get; +use sp_runtime::Permill; +use sp_std::marker::PhantomData; + +pub mod precompiles; + +/// Current approximation of the gas/s consumption (Moonbeam) +pub const GAS_PER_SECOND: u64 = 40_000_000; +/// Approximate ratio of the amount of Weight per Gas (Moonbeam) +pub const WEIGHT_PER_GAS: u64 = WEIGHT_REF_TIME_PER_SECOND / GAS_PER_SECOND; + +/// Sets the ideal block fullness to 50%. +/// If the block weight is between: +/// - 0-50% the gas fee will decrease +/// - 50-100% the gas fee will increase +pub struct BaseFeeThreshold; +impl pallet_base_fee::BaseFeeThreshold for BaseFeeThreshold { + fn lower() -> Permill { + Permill::zero() + } + fn ideal() -> Permill { + Permill::from_parts(500_000) + } + fn upper() -> Permill { + Permill::from_parts(1_000_000) + } +} + +/// Get the "action" (call or create) of an Ethereum transaction +pub trait GetTransactionAction { + fn action(&self) -> TransactionAction; +} + +impl GetTransactionAction for Transaction { + fn action(&self) -> TransactionAction { + match self { + Transaction::Legacy(transaction) => transaction.action, + Transaction::EIP2930(transaction) => transaction.action, + Transaction::EIP1559(transaction) => transaction.action, + } + } +} + +/// Set the EVM chain ID based on the parachain ID +pub struct SetEvmChainId(PhantomData); +impl OnRuntimeUpgrade for SetEvmChainId +where + T: frame_system::Config + parachain_info::Config + pallet_evm_chain_id::Config, +{ + fn on_runtime_upgrade() -> Weight { + let para_id: u32 = parachain_info::Pallet::::parachain_id().into(); + let evm_id: u64 = para_id.into(); + pallet_evm_chain_id::ChainId::::put(evm_id); + ::DbWeight::get().reads_writes(1, 1) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + Ok(Default::default()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_: sp_std::vec::Vec) -> Result<(), &'static str> { + Ok(()) + } +} diff --git a/parachain/runtime/common/src/evm/precompiles.rs b/parachain/runtime/common/src/evm/precompiles.rs new file mode 100644 index 0000000000..03c58c5f17 --- /dev/null +++ b/parachain/runtime/common/src/evm/precompiles.rs @@ -0,0 +1,45 @@ +use pallet_evm::{IsPrecompileResult, Precompile, PrecompileHandle, PrecompileResult, PrecompileSet}; +use sp_core::H160; +use sp_std::marker::PhantomData; + +use pallet_evm_precompile_modexp::Modexp; +use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; + +pub struct InterBtcPrecompiles(PhantomData); + +impl InterBtcPrecompiles { + pub fn new() -> Self { + Self(Default::default()) + } + pub fn used_addresses() -> [H160; 5] { + [hash(1), hash(2), hash(3), hash(4), hash(5)] + } +} + +impl PrecompileSet for InterBtcPrecompiles +where + R: pallet_evm::Config, +{ + fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { + match handle.code_address() { + // Ethereum precompiles: + a if a == hash(1) => Some(ECRecover::execute(handle)), + a if a == hash(2) => Some(Sha256::execute(handle)), + a if a == hash(3) => Some(Ripemd160::execute(handle)), + a if a == hash(4) => Some(Identity::execute(handle)), + a if a == hash(5) => Some(Modexp::execute(handle)), + _ => None, + } + } + + fn is_precompile(&self, address: H160, _gas: u64) -> IsPrecompileResult { + IsPrecompileResult::Answer { + is_precompile: Self::used_addresses().contains(&address), + extra_cost: 0, + } + } +} + +fn hash(a: u64) -> H160 { + H160::from_low_u64_be(a) +} diff --git a/parachain/runtime/common/src/lib.rs b/parachain/runtime/common/src/lib.rs index bfeeb54c64..a39590d6bb 100644 --- a/parachain/runtime/common/src/lib.rs +++ b/parachain/runtime/common/src/lib.rs @@ -13,6 +13,8 @@ use sp_std::prelude::*; #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; +pub mod evm; + // The relay chain is limited to 12s to include parachain blocks. pub const MILLISECS_PER_BLOCK: u64 = 12000; pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); diff --git a/parachain/runtime/interlay/Cargo.toml b/parachain/runtime/interlay/Cargo.toml index 1808aea663..43d729e0d2 100644 --- a/parachain/runtime/interlay/Cargo.toml +++ b/parachain/runtime/interlay/Cargo.toml @@ -131,6 +131,15 @@ orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-l orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } +# Frontier dependencies +fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +fp-self-contained = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-base-fee = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm-chain-id = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm-precompile-dispatch = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } + [dev-dependencies] hex = '0.4.2' mocktopus = "0.8.0" @@ -258,6 +267,14 @@ std = [ "orml-xtokens/std", "orml-xcm-support/std", "orml-unknown-tokens/std", + + "fp-rpc/std", + "fp-self-contained/std", + "pallet-base-fee/std", + "pallet-ethereum/std", + "pallet-evm/std", + "pallet-evm-chain-id/std", + "pallet-evm-precompile-dispatch/std", ] runtime-benchmarks = [ "frame-benchmarking", @@ -307,6 +324,9 @@ runtime-benchmarks = [ "primitives/runtime-benchmarks", "runtime-common/runtime-benchmarks", + + "pallet-ethereum/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", ] try-runtime = [ "frame-try-runtime", @@ -371,4 +391,10 @@ try-runtime = [ "orml-asset-registry/try-runtime", "orml-xtokens/try-runtime", "orml-unknown-tokens/try-runtime", + + "fp-self-contained/try-runtime", + "pallet-base-fee/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", + "pallet-evm-chain-id/try-runtime", ] \ No newline at end of file diff --git a/parachain/runtime/interlay/src/evm.rs b/parachain/runtime/interlay/src/evm.rs new file mode 100644 index 0000000000..754a2c89d2 --- /dev/null +++ b/parachain/runtime/interlay/src/evm.rs @@ -0,0 +1,95 @@ +use crate::{ + AccountId, Aura, BaseFee, EVMChainId, NativeCurrency, Runtime, RuntimeEvent, Timestamp, CENTS, + MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, +}; +use frame_support::{ + parameter_types, + traits::{ConstU32, FindAuthor}, + weights::Weight, + ConsensusEngineId, +}; +use pallet_ethereum::PostLogContent; +use pallet_evm::{EnsureAddressRoot, EnsureAddressTruncated, FixedGasWeightMapping, HashedAddressMapping}; +use sp_core::{crypto::ByteArray, H160, U256}; +use sp_runtime::{traits::BlakeTwo256, Permill}; +use sp_std::marker::PhantomData; + +pub use runtime_common::evm::{ + precompiles::InterBtcPrecompiles, BaseFeeThreshold, GetTransactionAction, SetEvmChainId, WEIGHT_PER_GAS, +}; + +pub type Precompiles = InterBtcPrecompiles; +pub type AccountConverter = HashedAddressMapping; + +parameter_types! { + pub DefaultBaseFeePerGas: U256 = U256::from(CENTS); + pub DefaultElasticity: Permill = Permill::from_parts(125_000); +} + +impl pallet_base_fee::Config for Runtime { + type DefaultBaseFeePerGas = DefaultBaseFeePerGas; + type DefaultElasticity = DefaultElasticity; + type RuntimeEvent = RuntimeEvent; + type Threshold = BaseFeeThreshold; +} + +parameter_types! { + pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; + // 0x96c899190652984ee67b82942ff38f43 + pub storage EnableCreate: bool = false; +} + +impl pallet_ethereum::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type StateRoot = pallet_ethereum::IntermediateStateRoot; + type PostLogContent = PostBlockAndTxnHashes; + type ExtraDataLength = ConstU32<30>; +} + +pub struct FindAuthorTruncated(PhantomData); +impl> FindAuthor for FindAuthorTruncated { + fn find_author<'a, I>(digests: I) -> Option + where + I: 'a + IntoIterator, + { + if let Some(author_index) = F::find_author(digests) { + let authority_id = Aura::authorities()[author_index as usize].clone(); + return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24])); + } + None + } +} + +parameter_types! { + pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub PrecompilesValue: InterBtcPrecompiles = InterBtcPrecompiles::<_>::new(); + pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0); + /// The amount of gas per pov, taken from Moonbeam: + /// ceil(MAXIMUM_BLOCK_WEIGHT.ref_time() / MAXIMUM_BLOCK_WEIGHT.proof_size() / WEIGHT_PER_GAS) + pub const GasLimitPovSizeRatio: u64 = 4; +} + +impl pallet_evm::Config for Runtime { + type AddressMapping = AccountConverter; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; + type CallOrigin = EnsureAddressRoot; + type WithdrawOrigin = EnsureAddressTruncated; + type ChainId = EVMChainId; + type Currency = NativeCurrency; + type FeeCalculator = BaseFee; + type FindAuthor = FindAuthorTruncated; + type GasWeightMapping = FixedGasWeightMapping; + type OnChargeTransaction = (); + type OnCreate = (); + type PrecompilesType = InterBtcPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type GasLimitPovSizeRatio = GasLimitPovSizeRatio; + type Timestamp = Timestamp; + type WeightInfo = pallet_evm::weights::SubstrateWeight; +} + +impl pallet_evm_chain_id::Config for Runtime {} diff --git a/parachain/runtime/interlay/src/lib.rs b/parachain/runtime/interlay/src/lib.rs index 14179ef55b..78cb61a8b1 100644 --- a/parachain/runtime/interlay/src/lib.rs +++ b/parachain/runtime/interlay/src/lib.rs @@ -43,6 +43,18 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use weights::{block_weights::BlockExecutionWeight, extrinsic_weights::ExtrinsicBaseWeight}; +// Frontier imports +use codec::{Decode, Encode}; +use fp_rpc::TransactionStatus; +use frame_support::traits::OnFinalize; +use pallet_ethereum::{Transaction as EthereumTransaction, TransactionAction}; +use pallet_evm::{Account as EVMAccount, FeeCalculator, Runner}; +use sp_core::{H160, U256}; +use sp_runtime::{ + traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf, UniqueSaturatedInto}, + transaction_validity::{InvalidTransaction, TransactionValidityError}, +}; + // A few exports that help ease life for downstream crates. pub use frame_support::{ construct_runtime, @@ -83,7 +95,8 @@ pub mod constants; pub mod weights; pub mod xcm_config; -mod dex; +pub mod dex; +pub mod evm; type VaultId = primitives::VaultId; @@ -189,6 +202,9 @@ impl Contains for BaseCallFilter { // governance are still able to call these (sudo is explicitly white-listed, while // governance bypasses this call filter). false + } else if let RuntimeCall::EVM(_) = call { + // disable non-root EVM access + false } else { // normal operation: allow all calls that are not explicitly paused TxPause::contains(call) @@ -306,6 +322,7 @@ impl pallet_aura::Config for Runtime { parameter_types! { pub const MinimumPeriod: u64 = SLOT_DURATION / 2; + // 0x13fe8e6572d0617ab8b9721f4e28cb46 pub storage EnableManualSeal: bool = false; } @@ -1266,6 +1283,12 @@ construct_runtime! { DexGeneral: dex_general::{Pallet, Call, Storage, Event} = 101, DexStable: dex_stable::{Pallet, Call, Storage, Event} = 102, DexSwapRouter: dex_swap_router::{Pallet, Call, Event} = 103, + + // # Smart contracts + BaseFee: pallet_base_fee::{Pallet, Call, Storage, Event, Config} = 111, + Ethereum: pallet_ethereum::{Pallet, Call, Storage, Event, Config, Origin} = 112, + EVM: pallet_evm::{Pallet, Call, Storage, Event, Config} = 113, + EVMChainId: pallet_evm_chain_id::{Pallet, Storage, Config} = 114, } } @@ -1288,9 +1311,9 @@ pub type SignedExtra = ( pallet_transaction_payment::ChargeTransactionPayment, ); /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +pub type UncheckedExtrinsic = fp_self_contained::UncheckedExtrinsic; /// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -1303,9 +1326,90 @@ pub type Executive = frame_executive::Executive< orml_unknown_tokens::Migration, dex::SetLoansExchangeRates, issue::migration::v1::Migration, + evm::SetEvmChainId, ), >; +impl fp_self_contained::SelfContainedCall for RuntimeCall { + type SignedInfo = H160; + + fn is_self_contained(&self) -> bool { + match self { + RuntimeCall::Ethereum(call) => call.is_self_contained(), + _ => false, + } + } + + fn check_self_contained(&self) -> Option> { + match self { + RuntimeCall::Ethereum(call) => match call { + pallet_ethereum::Call::transact { transaction } + if !evm::EnableCreate::get() + && evm::GetTransactionAction::action(transaction) == TransactionAction::Create => + { + Some(Err(TransactionValidityError::Invalid(InvalidTransaction::Call))) + } + _ => call.check_self_contained(), + }, + _ => None, + } + } + + fn validate_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option { + match self { + RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn pre_dispatch_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option> { + match self { + RuntimeCall::Ethereum(call) => call.pre_dispatch_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn apply_self_contained( + self, + info: Self::SignedInfo, + ) -> Option>> { + match self { + call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch( + RuntimeOrigin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)), + )), + _ => None, + } + } +} + +#[derive(Clone, Default)] +pub struct TransactionConverter; + +impl fp_rpc::ConvertTransaction for TransactionConverter { + fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_unsigned(pallet_ethereum::Call::::transact { transaction }.into()) + } +} + +impl fp_rpc::ConvertTransaction for TransactionConverter { + fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> sp_runtime::OpaqueExtrinsic { + let extrinsic = + UncheckedExtrinsic::new_unsigned(pallet_ethereum::Call::::transact { transaction }.into()); + let encoded = extrinsic.encode(); + sp_runtime::OpaqueExtrinsic::decode(&mut &encoded[..]).expect("Encoded extrinsic is always valid") + } +} + #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking; @@ -1887,6 +1991,172 @@ impl_runtime_apis! { Executive::try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed") } } + + impl fp_rpc::EthereumRuntimeRPCApi for Runtime { + fn chain_id() -> u64 { + ::ChainId::get() + } + + fn account_basic(address: H160) -> EVMAccount { + let (account, _) = pallet_evm::Pallet::::account_basic(&address); + account + } + + fn gas_price() -> U256 { + let (gas_price, _) = ::FeeCalculator::min_gas_price(); + gas_price + } + + fn account_code_at(address: H160) -> Vec { + pallet_evm::AccountCodes::::get(address) + } + + fn author() -> H160 { + >::find_author() + } + + fn storage_at(address: H160, index: U256) -> H256 { + let mut tmp = [0u8; 32]; + index.to_big_endian(&mut tmp); + pallet_evm::AccountStorages::::get(address, H256::from_slice(&tmp[..])) + } + + fn call( + from: H160, + to: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + let mut config = ::config().clone(); + config.estimate = estimate; + + let is_transactional = false; + let validate = true; + ::Runner::call( + from, + to, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + // TODO: we probably want to support external cost recording in non-transactional calls + None, + None, + &config, + ).map_err(|err| err.error.into()) + } + + fn create( + from: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + if !evm::EnableCreate::get() { + return Err(sp_runtime::DispatchError::Other("Contract creation is disabled")); + } + + let mut config = ::config().clone(); + config.estimate = estimate; + + let is_transactional = false; + let validate = true; + ::Runner::create( + from, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + // TODO: we probably want to support external cost recording in non-transactional calls + None, + None, + &config, + ).map_err(|err| err.error.into()) + } + + fn current_transaction_statuses() -> Option> { + pallet_ethereum::CurrentTransactionStatuses::::get() + } + + fn current_block() -> Option { + pallet_ethereum::CurrentBlock::::get() + } + + fn current_receipts() -> Option> { + pallet_ethereum::CurrentReceipts::::get() + } + + fn current_all() -> ( + Option, + Option>, + Option> + ) { + ( + pallet_ethereum::CurrentBlock::::get(), + pallet_ethereum::CurrentReceipts::::get(), + pallet_ethereum::CurrentTransactionStatuses::::get() + ) + } + + fn extrinsic_filter( + xts: Vec<::Extrinsic>, + ) -> Vec { + xts.into_iter().filter_map(|xt| match xt.0.function { + RuntimeCall::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction), + _ => None + }).collect::>() + } + + fn elasticity() -> Option { + Some(pallet_base_fee::Elasticity::::get()) + } + + fn gas_limit_multiplier_support() {} + + fn pending_block( + xts: Vec<::Extrinsic>, + ) -> (Option, Option>) { + for ext in xts.into_iter() { + let _ = Executive::apply_extrinsic(ext); + } + + Ethereum::on_finalize(System::block_number() + 1); + + ( + pallet_ethereum::CurrentBlock::::get(), + pallet_ethereum::CurrentTransactionStatuses::::get() + ) + } + } + + impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { + fn convert_transaction(transaction: EthereumTransaction) -> ::Extrinsic { + UncheckedExtrinsic::new_unsigned( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } + } } struct CheckInherents; diff --git a/parachain/runtime/kintsugi/Cargo.toml b/parachain/runtime/kintsugi/Cargo.toml index 72a2316291..d209eaabfe 100644 --- a/parachain/runtime/kintsugi/Cargo.toml +++ b/parachain/runtime/kintsugi/Cargo.toml @@ -135,12 +135,20 @@ orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-modu orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } orml-asset-registry= { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } +# Frontier dependencies +fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +fp-self-contained = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-base-fee = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm-chain-id = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } +pallet-evm-precompile-dispatch = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42", default-features = false } + [dev-dependencies] hex = '0.4.2' mocktopus = "0.8.0" serde_json = "1.0" - [build-dependencies] substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } @@ -268,6 +276,14 @@ std = [ "orml-xtokens/std", "orml-xcm-support/std", "orml-unknown-tokens/std", + + "fp-rpc/std", + "fp-self-contained/std", + "pallet-base-fee/std", + "pallet-ethereum/std", + "pallet-evm/std", + "pallet-evm-chain-id/std", + "pallet-evm-precompile-dispatch/std", ] runtime-benchmarks = [ "frame-benchmarking", @@ -317,6 +333,9 @@ runtime-benchmarks = [ "primitives/runtime-benchmarks", "runtime-common/runtime-benchmarks", + + "pallet-ethereum/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", ] try-runtime = [ "frame-try-runtime", @@ -382,4 +401,11 @@ try-runtime = [ "orml-asset-registry/try-runtime", "orml-xtokens/try-runtime", "orml-unknown-tokens/try-runtime", + "multi-transaction-payment/try-runtime", + + "fp-self-contained/try-runtime", + "pallet-base-fee/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", + "pallet-evm-chain-id/try-runtime", ] \ No newline at end of file diff --git a/parachain/runtime/kintsugi/src/evm.rs b/parachain/runtime/kintsugi/src/evm.rs new file mode 100644 index 0000000000..e9103dadef --- /dev/null +++ b/parachain/runtime/kintsugi/src/evm.rs @@ -0,0 +1,95 @@ +use crate::{ + AccountId, Aura, BaseFee, EVMChainId, NativeCurrency, Runtime, RuntimeEvent, Timestamp, CENTS, + MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, +}; +use frame_support::{ + parameter_types, + traits::{ConstU32, FindAuthor}, + weights::Weight, + ConsensusEngineId, +}; +use pallet_ethereum::PostLogContent; +use pallet_evm::{EnsureAddressRoot, EnsureAddressTruncated, FixedGasWeightMapping, HashedAddressMapping}; +use sp_core::{crypto::ByteArray, H160, U256}; +use sp_runtime::{traits::BlakeTwo256, Permill}; +use sp_std::marker::PhantomData; + +pub use runtime_common::evm::{ + precompiles::InterBtcPrecompiles, BaseFeeThreshold, GetTransactionAction, SetEvmChainId, WEIGHT_PER_GAS, +}; + +pub type Precompiles = InterBtcPrecompiles; +pub type AccountConverter = HashedAddressMapping; + +parameter_types! { + pub DefaultBaseFeePerGas: U256 = U256::from(CENTS * 10); + pub DefaultElasticity: Permill = Permill::from_parts(125_000); +} + +impl pallet_base_fee::Config for Runtime { + type DefaultBaseFeePerGas = DefaultBaseFeePerGas; + type DefaultElasticity = DefaultElasticity; + type RuntimeEvent = RuntimeEvent; + type Threshold = BaseFeeThreshold; +} + +parameter_types! { + pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; + // 0x96c899190652984ee67b82942ff38f43 + pub storage EnableCreate: bool = false; +} + +impl pallet_ethereum::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type StateRoot = pallet_ethereum::IntermediateStateRoot; + type PostLogContent = PostBlockAndTxnHashes; + type ExtraDataLength = ConstU32<30>; +} + +pub struct FindAuthorTruncated(PhantomData); +impl> FindAuthor for FindAuthorTruncated { + fn find_author<'a, I>(digests: I) -> Option + where + I: 'a + IntoIterator, + { + if let Some(author_index) = F::find_author(digests) { + let authority_id = Aura::authorities()[author_index as usize].clone(); + return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24])); + } + None + } +} + +parameter_types! { + pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub PrecompilesValue: InterBtcPrecompiles = InterBtcPrecompiles::<_>::new(); + pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0); + /// The amount of gas per pov, taken from Moonbeam: + /// ceil(MAXIMUM_BLOCK_WEIGHT.ref_time() / MAXIMUM_BLOCK_WEIGHT.proof_size() / WEIGHT_PER_GAS) + pub const GasLimitPovSizeRatio: u64 = 4; +} + +impl pallet_evm::Config for Runtime { + type AddressMapping = AccountConverter; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; + type CallOrigin = EnsureAddressRoot; + type WithdrawOrigin = EnsureAddressTruncated; + type ChainId = EVMChainId; + type Currency = NativeCurrency; + type FeeCalculator = BaseFee; + type FindAuthor = FindAuthorTruncated; + type GasWeightMapping = FixedGasWeightMapping; + type OnChargeTransaction = (); + type OnCreate = (); + type PrecompilesType = InterBtcPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type GasLimitPovSizeRatio = GasLimitPovSizeRatio; + type Timestamp = Timestamp; + type WeightInfo = pallet_evm::weights::SubstrateWeight; +} + +impl pallet_evm_chain_id::Config for Runtime {} diff --git a/parachain/runtime/kintsugi/src/lib.rs b/parachain/runtime/kintsugi/src/lib.rs index 2422f06ff8..64c4300d73 100644 --- a/parachain/runtime/kintsugi/src/lib.rs +++ b/parachain/runtime/kintsugi/src/lib.rs @@ -43,6 +43,18 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use weights::{block_weights::BlockExecutionWeight, extrinsic_weights::ExtrinsicBaseWeight}; +// Frontier imports +use codec::{Decode, Encode}; +use fp_rpc::TransactionStatus; +use frame_support::traits::OnFinalize; +use pallet_ethereum::{Transaction as EthereumTransaction, TransactionAction}; +use pallet_evm::{Account as EVMAccount, FeeCalculator, Runner}; +use sp_core::{H160, U256}; +use sp_runtime::{ + traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf, UniqueSaturatedInto}, + transaction_validity::{InvalidTransaction, TransactionValidityError}, +}; + // A few exports that help ease life for downstream crates. pub use frame_support::{ construct_runtime, @@ -83,7 +95,8 @@ pub mod constants; pub mod contracts; pub mod xcm_config; -mod dex; +pub mod dex; +pub mod evm; type VaultId = primitives::VaultId; @@ -188,6 +201,9 @@ impl Contains for BaseCallFilter { // governance are still able to call these (sudo is explicitly white-listed, while // governance bypasses this call filter). false + } else if let RuntimeCall::EVM(_) = call { + // disable non-root EVM access + false } else { // normal operation: allow all calls that are not explicitly paused TxPause::contains(call) @@ -305,6 +321,7 @@ impl pallet_aura::Config for Runtime { parameter_types! { pub const MinimumPeriod: u64 = SLOT_DURATION / 2; + // 0x13fe8e6572d0617ab8b9721f4e28cb46 pub storage EnableManualSeal: bool = false; } @@ -1268,8 +1285,12 @@ construct_runtime! { DexStable: dex_stable::{Pallet, Call, Storage, Event} = 102, DexSwapRouter: dex_swap_router::{Pallet, Call, Event} = 103, - // # smart contracts + // # Smart contracts Contracts: pallet_contracts::{Pallet, Call, Storage, Event} = 110, + BaseFee: pallet_base_fee::{Pallet, Call, Storage, Event, Config} = 111, + Ethereum: pallet_ethereum::{Pallet, Call, Storage, Event, Config, Origin} = 112, + EVM: pallet_evm::{Pallet, Call, Storage, Event, Config} = 113, + EVMChainId: pallet_evm_chain_id::{Pallet, Storage, Config} = 114, } } @@ -1292,9 +1313,9 @@ pub type SignedExtra = ( pallet_transaction_payment::ChargeTransactionPayment, ); /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +pub type UncheckedExtrinsic = fp_self_contained::UncheckedExtrinsic; /// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -1306,9 +1327,90 @@ pub type Executive = frame_executive::Executive< orml_asset_registry::Migration, orml_unknown_tokens::Migration, issue::migration::v1::Migration, + evm::SetEvmChainId, ), >; +impl fp_self_contained::SelfContainedCall for RuntimeCall { + type SignedInfo = H160; + + fn is_self_contained(&self) -> bool { + match self { + RuntimeCall::Ethereum(call) => call.is_self_contained(), + _ => false, + } + } + + fn check_self_contained(&self) -> Option> { + match self { + RuntimeCall::Ethereum(call) => match call { + pallet_ethereum::Call::transact { transaction } + if !evm::EnableCreate::get() + && evm::GetTransactionAction::action(transaction) == TransactionAction::Create => + { + Some(Err(TransactionValidityError::Invalid(InvalidTransaction::Call))) + } + _ => call.check_self_contained(), + }, + _ => None, + } + } + + fn validate_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option { + match self { + RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn pre_dispatch_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option> { + match self { + RuntimeCall::Ethereum(call) => call.pre_dispatch_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn apply_self_contained( + self, + info: Self::SignedInfo, + ) -> Option>> { + match self { + call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch( + RuntimeOrigin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)), + )), + _ => None, + } + } +} + +#[derive(Clone, Default)] +pub struct TransactionConverter; + +impl fp_rpc::ConvertTransaction for TransactionConverter { + fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_unsigned(pallet_ethereum::Call::::transact { transaction }.into()) + } +} + +impl fp_rpc::ConvertTransaction for TransactionConverter { + fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> sp_runtime::OpaqueExtrinsic { + let extrinsic = + UncheckedExtrinsic::new_unsigned(pallet_ethereum::Call::::transact { transaction }.into()); + let encoded = extrinsic.encode(); + sp_runtime::OpaqueExtrinsic::decode(&mut &encoded[..]).expect("Encoded extrinsic is always valid") + } +} + #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking; @@ -1890,6 +1992,172 @@ impl_runtime_apis! { Executive::try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed") } } + + impl fp_rpc::EthereumRuntimeRPCApi for Runtime { + fn chain_id() -> u64 { + ::ChainId::get() + } + + fn account_basic(address: H160) -> EVMAccount { + let (account, _) = pallet_evm::Pallet::::account_basic(&address); + account + } + + fn gas_price() -> U256 { + let (gas_price, _) = ::FeeCalculator::min_gas_price(); + gas_price + } + + fn account_code_at(address: H160) -> Vec { + pallet_evm::AccountCodes::::get(address) + } + + fn author() -> H160 { + >::find_author() + } + + fn storage_at(address: H160, index: U256) -> H256 { + let mut tmp = [0u8; 32]; + index.to_big_endian(&mut tmp); + pallet_evm::AccountStorages::::get(address, H256::from_slice(&tmp[..])) + } + + fn call( + from: H160, + to: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + let mut config = ::config().clone(); + config.estimate = estimate; + + let is_transactional = false; + let validate = true; + ::Runner::call( + from, + to, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + // TODO: we probably want to support external cost recording in non-transactional calls + None, + None, + &config, + ).map_err(|err| err.error.into()) + } + + fn create( + from: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + if !evm::EnableCreate::get() { + return Err(sp_runtime::DispatchError::Other("Contract creation is disabled")); + } + + let mut config = ::config().clone(); + config.estimate = estimate; + + let is_transactional = false; + let validate = true; + ::Runner::create( + from, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + // TODO: we probably want to support external cost recording in non-transactional calls + None, + None, + &config, + ).map_err(|err| err.error.into()) + } + + fn current_transaction_statuses() -> Option> { + pallet_ethereum::CurrentTransactionStatuses::::get() + } + + fn current_block() -> Option { + pallet_ethereum::CurrentBlock::::get() + } + + fn current_receipts() -> Option> { + pallet_ethereum::CurrentReceipts::::get() + } + + fn current_all() -> ( + Option, + Option>, + Option> + ) { + ( + pallet_ethereum::CurrentBlock::::get(), + pallet_ethereum::CurrentReceipts::::get(), + pallet_ethereum::CurrentTransactionStatuses::::get() + ) + } + + fn extrinsic_filter( + xts: Vec<::Extrinsic>, + ) -> Vec { + xts.into_iter().filter_map(|xt| match xt.0.function { + RuntimeCall::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction), + _ => None + }).collect::>() + } + + fn elasticity() -> Option { + Some(pallet_base_fee::Elasticity::::get()) + } + + fn gas_limit_multiplier_support() {} + + fn pending_block( + xts: Vec<::Extrinsic>, + ) -> (Option, Option>) { + for ext in xts.into_iter() { + let _ = Executive::apply_extrinsic(ext); + } + + Ethereum::on_finalize(System::block_number() + 1); + + ( + pallet_ethereum::CurrentBlock::::get(), + pallet_ethereum::CurrentTransactionStatuses::::get() + ) + } + } + + impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { + fn convert_transaction(transaction: EthereumTransaction) -> ::Extrinsic { + UncheckedExtrinsic::new_unsigned( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } + } } struct CheckInherents; diff --git a/parachain/runtime/runtime-tests/Cargo.toml b/parachain/runtime/runtime-tests/Cargo.toml index 8484c008fa..c03780f265 100644 --- a/parachain/runtime/runtime-tests/Cargo.toml +++ b/parachain/runtime/runtime-tests/Cargo.toml @@ -143,6 +143,15 @@ orml-xcm = { git = "https://github.com/open-web3-stack/open-runtime-module-libra orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404" } orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404" } +# Frontier dependencies +ethereum = { version = "0.14.0", default-features = false, features = ["with-codec"] } +fp-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +pallet-evm-chain-id = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } + [dev-dependencies] hex = '0.4.2' mocktopus = "0.8.0" diff --git a/parachain/runtime/runtime-tests/src/parachain.rs b/parachain/runtime/runtime-tests/src/parachain.rs index 52ad91ddbc..cff8f8b063 100644 --- a/parachain/runtime/runtime-tests/src/parachain.rs +++ b/parachain/runtime/runtime-tests/src/parachain.rs @@ -4,6 +4,7 @@ mod clients_info; #[cfg(not(feature = "with-interlay-runtime"))] mod contracts; mod escrow; +mod ethereum; mod fee_pool; mod governance; mod issue; diff --git a/parachain/runtime/runtime-tests/src/parachain/ethereum.rs b/parachain/runtime/runtime-tests/src/parachain/ethereum.rs new file mode 100644 index 0000000000..1afc047a66 --- /dev/null +++ b/parachain/runtime/runtime-tests/src/parachain/ethereum.rs @@ -0,0 +1,135 @@ +use crate::setup::{assert_eq, *}; +use fp_evm::{ExecutionInfoV2, FeeCalculator}; +use fp_rpc::ConvertTransaction; +use hex_literal::hex; +use pallet_evm::{AddressMapping, ExitReason, ExitSucceed, GasWeightMapping, Runner}; + +// pragma solidity ^0.8.9; +// contract flipper { +// bool private value; +// constructor(bool initvalue) { +// value = initvalue; +// } +// +// function flip() public { +// value = !value; +// } +// +// function get() public view returns (bool) { +// return value; +// } +// } +pub const CONTRACT_TX: &str = "02f9024682084980849502f90085010c388d0083020a778080b901ea608060405234801561001057600080fd5b506040516101ca3803806101ca8339818101604052810190610032919061008e565b806000806101000a81548160ff021916908315150217905550506100bb565b600080fd5b60008115159050919050565b61006b81610056565b811461007657600080fd5b50565b60008151905061008881610062565b92915050565b6000602082840312156100a4576100a3610051565b5b60006100b284828501610079565b91505092915050565b610100806100ca6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c80636d4ce63c146037578063cde4efa9146051575b600080fd5b603d6059565b6040516048919060b1565b60405180910390f35b6057606f565b005b60008060009054906101000a900460ff16905090565b60008054906101000a900460ff16156000806101000a81548160ff021916908315150217905550565b60008115159050919050565b60ab816098565b82525050565b600060208201905060c4600083018460a4565b9291505056fea2646970667358221220da54b58a2aebbc9317cfd38d215d97502ce00c8af859f5dd42453d3a47e35be164736f6c634300081100330000000000000000000000000000000000000000000000000000000000000000c080a0a7e73235820df76570958958146ff8ea0e8bbc989ea8e9f77ab849e51b763852a01afd2d44c171f03b9de17c8731f6543cae18d8a0b95103ef33cb8a5ae923498c"; +pub const TRANSFER_TX: &str = "02f87382084980843b9aca00843b9aca008252089470997970c51812dc3a010c7d01b50e0d17dc79c8872386f26fc1000080c001a01b14ef6be71ca69615ad5818f74a3a8bf9d50dbac28dfa64326260caa5e50089a0468d7023ece460138491ff25c5fb6df2ab0c706f592fef18a640d1cb4434c180"; + +pub fn unchecked_eth_tx(raw_hex_tx: &str) -> UncheckedExtrinsic { + let converter = TransactionConverter; + converter.convert_transaction(ethereum_transaction(raw_hex_tx)) +} + +pub fn ethereum_transaction(raw_hex_tx: &str) -> pallet_ethereum::Transaction { + let bytes = hex::decode(raw_hex_tx).expect("Transaction bytes"); + ethereum::EnvelopedDecodable::decode(&bytes[..]).expect("Transaction is valid") +} + +#[test] +fn test_transfer() { + ExtBuilder::build().execute_with(|| { + let from_address = H160(hex!["f39fd6e51aad88f6f4ce6ab8827279cfffb92266"]); + let from_account_id = ::AddressMapping::into_account_id(from_address.clone()); + let to_address = H160(hex!["70997970c51812dc3a010c7d01b50e0d17dc79c8"]); + let to_account_id = ::AddressMapping::into_account_id(to_address); + + set_balance(from_account_id.clone(), NATIVE_CURRENCY_ID, 1 << 60); + assert_eq!(Tokens::free_balance(NATIVE_CURRENCY_ID, &to_account_id), 0); + + pallet_evm_chain_id::ChainId::::put(2121); + let uxt = unchecked_eth_tx(TRANSFER_TX); + // NOTE: we can also apply using ValidatedTransaction + // but this allows us to check signature recovery + assert_ok!(Executive::apply_extrinsic(uxt)); + + assert_eq!( + Tokens::free_balance(NATIVE_CURRENCY_ID, &to_account_id), + 10000000000000000 + ); + + let tx_hash = H256(hex!["b237d25ba8c7b1fe45c795da35ec6cb20f643c15dc97d9c6eabfdb9e3d37f3ea"]); + assert!(System::events().iter().any(|a| { + match a.event { + RuntimeEvent::Ethereum(pallet_ethereum::Event::Executed { + from, + to, + transaction_hash, + exit_reason: ExitReason::Succeed(ExitSucceed::Stopped), + .. + }) if from == from_address && to == to_address && transaction_hash == tx_hash => true, + _ => false, + } + })); + }) +} + +fn call_contract(from: H160, to: H160, input: Vec) -> ExecutionInfoV2> { + let gas_limit: u64 = 1_000_000; + let weight_limit = ::GasWeightMapping::gas_to_weight(gas_limit, true); + let min_gas_price = ::min_gas_price().0; + ::Runner::call( + from, + to, + input, + U256::zero(), // value + gas_limit, + Some(min_gas_price), + None, // max_priority_fee_per_gas + None, // nonce + Vec::new(), // access_list + true, // is_transactional + true, // validate + Some(weight_limit), + Some(0), + &::config().clone(), + ) + .unwrap() +} + +#[test] +fn test_contract() { + ExtBuilder::build().execute_with(|| { + let user_address = H160(hex!["f39fd6e51aad88f6f4ce6ab8827279cfffb92266"]); + let user_account_id = ::AddressMapping::into_account_id(user_address.clone()); + set_balance(user_account_id.clone(), NATIVE_CURRENCY_ID, 1 << 60); + + evm::EnableCreate::set(&true); + pallet_evm_chain_id::ChainId::::put(2121); + let uxt = unchecked_eth_tx(CONTRACT_TX); + assert_ok!(Executive::apply_extrinsic(uxt)); + let contract_address = H160(hex!["5FbDB2315678afecb367f032d93F642f64180aa3"]); + + assert_eq!( + call_contract( + user_address, + contract_address, + hex!["6d4ce63c"].to_vec(), // get() + ) + .value, + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + ); + + call_contract( + user_address, + contract_address, + hex!["cde4efa9"].to_vec(), // flip() + ); + + assert_eq!( + call_contract( + user_address, + contract_address, + hex!["6d4ce63c"].to_vec(), // get() + ) + .value, + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] + ); + }) +} diff --git a/parachain/src/chain_spec/interlay.rs b/parachain/src/chain_spec/interlay.rs index 2e0f54eb86..827bf39191 100644 --- a/parachain/src/chain_spec/interlay.rs +++ b/parachain/src/chain_spec/interlay.rs @@ -15,12 +15,15 @@ pub struct InterlayDevGenesisExt { pub(crate) genesis_config: interlay_runtime::GenesisConfig, /// The flag to enable instant-seal mode. pub(crate) enable_instant_seal: bool, + /// The flag to enable EVM contract creation. + pub(crate) enable_create: bool, } impl sp_runtime::BuildStorage for InterlayDevGenesisExt { fn assimilate_storage(&self, storage: &mut Storage) -> Result<(), String> { sp_state_machine::BasicExternalities::execute_with_storage(storage, || { interlay_runtime::EnableManualSeal::set(&self.enable_instant_seal); + interlay_runtime::evm::EnableCreate::set(&self.enable_create); }); self.genesis_config.assimilate_storage(storage) } @@ -62,12 +65,14 @@ pub fn interlay_dev_config(enable_instant_seal: bool) -> InterlayDevChainSpec { BoundedVec::truncate_from("Bob".as_bytes().to_vec()), )], vec![get_account_id_from_seed::("Alice")], + endowed_evm_accounts(), Some(get_account_id_from_seed::("Alice")), id, 1, false, // disable difficulty check ), enable_instant_seal, + enable_create: true, }, Vec::new(), None, @@ -132,7 +137,8 @@ pub fn interlay_mainnet_config() -> InterlayChainSpec { BoundedVec::truncate_from("Interlay".as_bytes().to_vec()), )], vec![], // no endowed accounts - None, // no sudo key + vec![], + None, // no sudo key id, SECURE_BITCOIN_CONFIRMATIONS, false, // enable difficulty check @@ -153,12 +159,19 @@ pub fn interlay_mainnet_config() -> InterlayChainSpec { pub fn interlay_genesis( invulnerables: Vec<(AccountId, AuraId)>, authorized_oracles: Vec<(AccountId, interlay_runtime::OracleName)>, - endowed_accounts: Vec, + mut endowed_accounts: Vec, + endowed_evm_accounts: Vec<[u8; 20]>, root_key: Option, id: ParaId, bitcoin_confirmations: u32, disable_difficulty_check: bool, ) -> interlay_runtime::GenesisConfig { + let chain_id: u32 = id.into(); + endowed_accounts.extend( + endowed_evm_accounts + .into_iter() + .map(|addr| interlay_runtime::evm::AccountConverter::into_account_id(H160::from(addr))), + ); interlay_runtime::GenesisConfig { system: interlay_runtime::SystemConfig { code: interlay_runtime::WASM_BINARY @@ -268,5 +281,28 @@ pub fn interlay_genesis( max_exchange_rate: Rate::from_inner(loans::DEFAULT_MAX_EXCHANGE_RATE), min_exchange_rate: Rate::from_inner(loans::DEFAULT_MIN_EXCHANGE_RATE), }, + base_fee: Default::default(), + ethereum: Default::default(), + evm: kintsugi_runtime::EVMConfig { + // we need _some_ code inserted at the precompile address so that + // the evm will actually call the address. + accounts: interlay_runtime::evm::Precompiles::used_addresses() + .into_iter() + .map(|addr| { + ( + addr.into(), + fp_evm::GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }) + .collect(), + }, + evm_chain_id: kintsugi_runtime::EVMChainIdConfig { + chain_id: chain_id.into(), + }, } } diff --git a/parachain/src/chain_spec/kintsugi.rs b/parachain/src/chain_spec/kintsugi.rs index 441ed14179..a77c2ee6ab 100644 --- a/parachain/src/chain_spec/kintsugi.rs +++ b/parachain/src/chain_spec/kintsugi.rs @@ -15,12 +15,15 @@ pub struct KintsugiDevGenesisExt { pub(crate) genesis_config: kintsugi_runtime::GenesisConfig, /// The flag to enable instant-seal mode. pub(crate) enable_instant_seal: bool, + /// The flag to enable EVM contract creation. + pub(crate) enable_create: bool, } impl sp_runtime::BuildStorage for KintsugiDevGenesisExt { fn assimilate_storage(&self, storage: &mut Storage) -> Result<(), String> { sp_state_machine::BasicExternalities::execute_with_storage(storage, || { kintsugi_runtime::EnableManualSeal::set(&self.enable_instant_seal); + kintsugi_runtime::evm::EnableCreate::set(&self.enable_create); }); self.genesis_config.assimilate_storage(storage) } @@ -62,12 +65,14 @@ pub fn kintsugi_dev_config(enable_instant_seal: bool) -> KintsugiDevChainSpec { BoundedVec::truncate_from("Bob".as_bytes().to_vec()), )], vec![get_account_id_from_seed::("Alice")], + endowed_evm_accounts(), Some(get_account_id_from_seed::("Alice")), id, 1, false, // disable difficulty check ), enable_instant_seal, + enable_create: true, }, Vec::new(), None, @@ -136,7 +141,8 @@ pub fn kintsugi_mainnet_config() -> KintsugiChainSpec { BoundedVec::truncate_from("Interlay".as_bytes().to_vec()), )], vec![], // no endowed accounts - None, // no sudo key + vec![], + None, // no sudo key id, SECURE_BITCOIN_CONFIRMATIONS, false, // enable difficulty check @@ -157,12 +163,19 @@ pub fn kintsugi_mainnet_config() -> KintsugiChainSpec { pub fn kintsugi_genesis( invulnerables: Vec<(AccountId, AuraId)>, authorized_oracles: Vec<(AccountId, kintsugi_runtime::OracleName)>, - endowed_accounts: Vec, + mut endowed_accounts: Vec, + endowed_evm_accounts: Vec<[u8; 20]>, root_key: Option, id: ParaId, bitcoin_confirmations: u32, disable_difficulty_check: bool, ) -> kintsugi_runtime::GenesisConfig { + let chain_id: u32 = id.into(); + endowed_accounts.extend( + endowed_evm_accounts + .into_iter() + .map(|addr| kintsugi_runtime::evm::AccountConverter::into_account_id(H160::from(addr))), + ); kintsugi_runtime::GenesisConfig { system: kintsugi_runtime::SystemConfig { code: kintsugi_runtime::WASM_BINARY @@ -296,5 +309,28 @@ pub fn kintsugi_genesis( max_exchange_rate: Rate::from_inner(loans::DEFAULT_MAX_EXCHANGE_RATE), min_exchange_rate: Rate::from_inner(loans::DEFAULT_MIN_EXCHANGE_RATE), }, + base_fee: Default::default(), + ethereum: Default::default(), + evm: kintsugi_runtime::EVMConfig { + // we need _some_ code inserted at the precompile address so that + // the evm will actually call the address. + accounts: kintsugi_runtime::evm::Precompiles::used_addresses() + .into_iter() + .map(|addr| { + ( + addr.into(), + fp_evm::GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }) + .collect(), + }, + evm_chain_id: kintsugi_runtime::EVMChainIdConfig { + chain_id: chain_id.into(), + }, } } diff --git a/parachain/src/chain_spec/mod.rs b/parachain/src/chain_spec/mod.rs index 339fa46919..1bda869dcb 100644 --- a/parachain/src/chain_spec/mod.rs +++ b/parachain/src/chain_spec/mod.rs @@ -2,6 +2,7 @@ use bitcoin::utils::{virtual_transaction_size, InputType, TransactionInputMetada use cumulus_primitives_core::ParaId; use frame_support::BoundedVec; use hex_literal::hex; +use pallet_evm::AddressMapping; use primitives::{ AccountId, Balance, CurrencyId, CurrencyId::Token, CurrencyInfo, Rate, Signature, VaultCurrencyPair, BITCOIN_MAINNET, BITCOIN_REGTEST, BITCOIN_TESTNET, DOT, IBTC, INTR, KBTC, KINT, KSM, @@ -12,7 +13,7 @@ use serde::{Deserialize, Serialize}; use serde_json::{map::Map, Value}; use sp_arithmetic::{FixedPointNumber, FixedU128}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; -use sp_core::{crypto::UncheckedInto, sr25519, storage::Storage, Pair, Public}; +use sp_core::{crypto::UncheckedInto, sr25519, storage::Storage, Pair, Public, H160}; use sp_runtime::traits::{IdentifyAccount, Verify, Zero}; use std::str::FromStr; @@ -98,3 +99,36 @@ fn expected_transaction_size() -> u32 { }, ) } + +// this is the simplest bytecode to revert without returning any data +// pre-deploy it under all of our precompiles to ensure they can be +// called from within contracts (PUSH1 0x00 PUSH1 0x00 REVERT) +pub const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; + +// Default dev accounts (taken from Foundry) +pub fn endowed_evm_accounts() -> Vec<[u8; 20]> { + // Mnemonic: test test test test test test test test test test test junk + // Derivation path: m/44'/60'/0'/0/ + vec![ + // (0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 + hex!["f39fd6e51aad88f6f4ce6ab8827279cfffb92266"], + // (1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d + hex!["70997970c51812dc3a010c7d01b50e0d17dc79c8"], + // (2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a + hex!["3c44cdddb6a900fa2b585dd299e03d12fa4293bc"], + // (3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 + hex!["90f79bf6eb2c4f870365e785982e1f101e93b906"], + // (4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a + hex!["15d34aaf54267db7d7c367839aaf71a00a2c6a65"], + // (5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba + hex!["9965507d1a55bcc2695c58ba16fb37d819b0a4dc"], + // (6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e + hex!["976ea74026e726554db657fa54763abd0c3a0aa9"], + // (7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 + hex!["14dc79964da2c08b23698b3d3cc7ca32193d9955"], + // (8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 + hex!["23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f"], + // (9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 + hex!["a0ee7a142d267c1f36714e4a8f75612f20a79720"], + ] +} diff --git a/parachain/src/chain_spec/testnet_interlay.rs b/parachain/src/chain_spec/testnet_interlay.rs index 5d4c69402d..63547b5537 100644 --- a/parachain/src/chain_spec/testnet_interlay.rs +++ b/parachain/src/chain_spec/testnet_interlay.rs @@ -65,6 +65,7 @@ pub fn staging_mainnet_config(benchmarking: bool) -> InterlayChainSpec { vec![] }) .collect(), + vec![], // 5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv (//sudo/1) Some(get_account_id_from_string( "5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv", diff --git a/parachain/src/chain_spec/testnet_kintsugi.rs b/parachain/src/chain_spec/testnet_kintsugi.rs index 77831f7c4f..7ec7628e1a 100644 --- a/parachain/src/chain_spec/testnet_kintsugi.rs +++ b/parachain/src/chain_spec/testnet_kintsugi.rs @@ -42,6 +42,7 @@ pub fn local_config(id: ParaId) -> KintsugiChainSpec { get_account_id_from_seed::("Eve//stash"), get_account_id_from_seed::("Ferdie//stash"), ], + vec![], None, id, DEFAULT_BITCOIN_CONFIRMATIONS, @@ -96,12 +97,14 @@ pub fn development_config(id: ParaId, enable_instant_seal: bool) -> KintsugiDevC get_account_id_from_seed::("Eve//stash"), get_account_id_from_seed::("Ferdie//stash"), ], + endowed_evm_accounts(), Some(get_account_id_from_seed::("Alice")), id, DEFAULT_BITCOIN_CONFIRMATIONS, true, // disable difficulty check ), enable_instant_seal, + enable_create: true, }, Vec::new(), None, @@ -164,6 +167,7 @@ pub fn staging_mainnet_config(benchmarking: bool) -> KintsugiChainSpec { vec![] }) .collect(), + vec![], // 5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv (//sudo/1) Some(get_account_id_from_string( "5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv", diff --git a/parachain/src/cli.rs b/parachain/src/cli.rs index 349ab59f13..f6aaad6011 100644 --- a/parachain/src/cli.rs +++ b/parachain/src/cli.rs @@ -1,7 +1,7 @@ use clap::Parser; use std::path::PathBuf; -use crate::chain_spec; +use crate::{chain_spec, eth::EthConfiguration}; /// Sub-commands supported by the collator. #[derive(Debug, Parser)] @@ -87,6 +87,9 @@ pub struct Cli { #[clap(flatten)] pub run: cumulus_client_cli::RunCmd, + #[clap(flatten)] + pub eth: EthConfiguration, + /// Relaychain arguments #[clap(raw = true)] pub relaychain_args: Vec, diff --git a/parachain/src/command.rs b/parachain/src/command.rs index 58780d6afa..e3aa51ec4e 100644 --- a/parachain/src/command.rs +++ b/parachain/src/command.rs @@ -106,12 +106,20 @@ macro_rules! with_runtime_or_err { ($chain_spec:expr, { $( $code:tt )* }) => { if $chain_spec.is_interlay() { #[allow(unused_imports)] - use { interlay_runtime::RuntimeApi, crate::service::InterlayRuntimeExecutor as Executor }; + use { + interlay_runtime::RuntimeApi, + crate::service::InterlayRuntimeExecutor as Executor, + interlay_runtime::TransactionConverter, + }; $( $code )* } else if $chain_spec.is_kintsugi() { #[allow(unused_imports)] - use { kintsugi_runtime::RuntimeApi, crate::service::KintsugiRuntimeExecutor as Executor }; + use { + kintsugi_runtime::RuntimeApi, + crate::service::KintsugiRuntimeExecutor as Executor, + kintsugi_runtime::TransactionConverter, + }; $( $code )* } else { @@ -223,6 +231,7 @@ macro_rules! construct_async_run { runner.async_run(|$config| { let $components = new_partial::( &$config, + &$cli.eth, true, )?; let task_manager = $components.task_manager; @@ -237,6 +246,7 @@ macro_rules! construct_async_run { KintsugiRuntimeExecutor, >( &$config, + &$cli.eth, true, )?; let task_manager = $components.task_manager; @@ -327,7 +337,7 @@ pub fn run() -> Result<()> { with_runtime_or_err!(chain_spec, { runner.sync_run(|config| { - let partials = new_partial::(&config, false)?; + let partials = new_partial::(&config, &cli.eth, false)?; cmd.run(partials.client) }) }) @@ -348,7 +358,7 @@ pub fn run() -> Result<()> { with_runtime_or_err!(chain_spec, { runner.sync_run(|config| { - let partials = new_partial::(&config, false)?; + let partials = new_partial::(&config, &cli.eth, false)?; let db = partials.backend.expose_db(); let storage = partials.backend.expose_storage(); cmd.run(config, partials.client.clone(), db, storage) @@ -366,7 +376,7 @@ pub fn run() -> Result<()> { with_runtime_or_err!(chain_spec, { let selected_runtime = SelectedRuntime::from_chain_spec(chain_spec)?; runner.sync_run(|config| { - let partials = new_partial::(&config, false)?; + let partials = new_partial::(&config, &cli.eth, false)?; let remark_builder = RemarkBuilder { client: partials.client.clone(), selected_runtime, @@ -461,7 +471,7 @@ pub fn run() -> Result<()> { runner .run_node_until_exit(|config| async move { if cli.instant_seal { - start_instant(config).await + start_instant(cli, config).await } else { start_node(cli, config).await } @@ -471,10 +481,10 @@ pub fn run() -> Result<()> { } } -async fn start_instant(config: Configuration) -> sc_service::error::Result { +async fn start_instant(cli: Cli, config: Configuration) -> sc_service::error::Result { with_runtime_or_err!(config.chain_spec, { { - crate::service::start_instant::(config) + crate::service::start_instant::(config, cli.eth) .await .map(|r| r.0) .map_err(Into::into) @@ -511,10 +521,16 @@ async fn start_node(cli: Cli, config: Configuration) -> sc_service::error::Resul with_runtime_or_err!(config.chain_spec, { { - crate::service::start_node::(config, polkadot_config, collator_options, id) - .await - .map(|r| r.0) - .map_err(Into::into) + crate::service::start_node::( + config, + polkadot_config, + cli.eth, + collator_options, + id, + ) + .await + .map(|r| r.0) + .map_err(Into::into) } }) } diff --git a/parachain/src/eth.rs b/parachain/src/eth.rs new file mode 100644 index 0000000000..6bf4ab9d4e --- /dev/null +++ b/parachain/src/eth.rs @@ -0,0 +1,344 @@ +use crate::service::{FullBackend, FullClient}; +use cumulus_client_consensus_common::ParachainBlockImportMarker; +pub use fc_consensus::FrontierBlockImport; +use fc_rpc::{EthTask, OverrideHandle}; +pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; +use fp_rpc::EthereumRuntimeRPCApi; +use futures::{future, prelude::*}; +use primitives::Block; +use sc_client_api::{BlockchainEvents, StateBackendFor}; +use sc_consensus::{BlockCheckParams, BlockImport as BlockImportT, BlockImportParams, ImportResult}; +use sc_executor::NativeExecutionDispatch; +use sc_network_sync::SyncingService; +use sc_service::{error::Error as ServiceError, BasePath, Configuration, TaskManager}; +use sc_transaction_pool::{ChainApi, Pool}; +use sp_api::{ConstructRuntimeApi, ProvideRuntimeApi}; +use sp_block_builder::BlockBuilder as BlockBuilderApi; +use sp_consensus::Error as ConsensusError; +use sp_runtime::traits::{BlakeTwo256, Block as BlockT}; +use std::{ + collections::BTreeMap, + path::{Path, PathBuf}, + sync::{Arc, Mutex}, + time::Duration, +}; + +/// Frontier DB backend type. +pub type FrontierBackend = fc_db::Backend; + +pub fn db_config_dir(config: &Configuration) -> PathBuf { + let application = &config.impl_name; + config + .base_path + .as_ref() + .map(|base_path| base_path.config_dir(config.chain_spec.id())) + .unwrap_or_else(|| BasePath::from_project("", "", application).config_dir(config.chain_spec.id())) +} + +pub fn open_frontier_backend( + client: Arc, + config: &Configuration, + eth_config: &EthConfiguration, + overrides: Arc>, +) -> Result +where + C: sc_client_api::HeaderBackend, +{ + let frontier_backend = match eth_config.frontier_backend_type { + BackendType::KeyValue => FrontierBackend::KeyValue(fc_db::kv::Backend::open( + Arc::clone(&client), + &config.database, + &db_config_dir(config), + )?), + BackendType::Sql => { + let db_path = db_config_dir(config).join("sql"); + std::fs::create_dir_all(&db_path).expect("failed creating sql db directory"); + let backend = futures::executor::block_on(fc_db::sql::Backend::new( + fc_db::sql::BackendConfig::Sqlite(fc_db::sql::SqliteBackendConfig { + path: Path::new("sqlite:///") + .join(db_path) + .join("frontier.db3") + .to_str() + .unwrap(), + create_if_missing: true, + thread_count: eth_config.frontier_sql_backend_thread_count, + cache_size: eth_config.frontier_sql_backend_cache_size, + }), + eth_config.frontier_sql_backend_pool_size, + std::num::NonZeroU32::new(eth_config.frontier_sql_backend_num_ops_timeout), + overrides, + )) + .unwrap_or_else(|err| panic!("failed creating sql backend: {:?}", err)); + FrontierBackend::Sql(backend) + } + }; + Ok(frontier_backend) +} + +/// Available frontier backend types. +#[derive(Debug, Copy, Clone, Default, clap::ValueEnum)] +pub enum BackendType { + /// Either RocksDb or ParityDb as per inherited from the global backend settings. + #[default] + KeyValue, + /// Sql database with custom log indexing. + Sql, +} + +/// The ethereum-compatibility configuration used to run a node. +#[derive(Clone, Debug, clap::Parser)] +pub struct EthConfiguration { + /// Maximum number of logs in a query. + #[arg(long, default_value = "10000")] + pub max_past_logs: u32, + + /// Maximum fee history cache size. + #[arg(long, default_value = "2048")] + pub fee_history_limit: u64, + + #[arg(long)] + pub enable_dev_signer: bool, + + /// The dynamic-fee pallet target gas price set by block author + #[arg(long, default_value = "1")] + pub target_gas_price: u64, + + /// Maximum allowed gas limit will be `block.gas_limit * execute_gas_limit_multiplier` + /// when using eth_call/eth_estimateGas. + #[arg(long, default_value = "10")] + pub execute_gas_limit_multiplier: u64, + + /// Size in bytes of the LRU cache for block data. + #[arg(long, default_value = "50")] + pub eth_log_block_cache: usize, + + /// Size in bytes of the LRU cache for transactions statuses data. + #[arg(long, default_value = "50")] + pub eth_statuses_cache: usize, + + /// Sets the frontier backend type (KeyValue or Sql) + #[arg(long, value_enum, ignore_case = true, default_value_t = BackendType::default())] + pub frontier_backend_type: BackendType, + + // Sets the SQL backend's pool size. + #[arg(long, default_value = "100")] + pub frontier_sql_backend_pool_size: u32, + + /// Sets the SQL backend's query timeout in number of VM ops. + #[arg(long, default_value = "10000000")] + pub frontier_sql_backend_num_ops_timeout: u32, + + /// Sets the SQL backend's auxiliary thread limit. + #[arg(long, default_value = "4")] + pub frontier_sql_backend_thread_count: u32, + + /// Sets the SQL backend's query timeout in number of VM ops. + /// Default value is 200MB. + #[arg(long, default_value = "209715200")] + pub frontier_sql_backend_cache_size: u64, +} + +pub struct FrontierPartialComponents { + pub filter_pool: Option, + pub fee_history_cache: FeeHistoryCache, + pub fee_history_cache_limit: FeeHistoryCacheLimit, +} + +pub fn new_frontier_partial(config: &EthConfiguration) -> Result { + Ok(FrontierPartialComponents { + filter_pool: Some(Arc::new(Mutex::new(BTreeMap::new()))), + fee_history_cache: Arc::new(Mutex::new(BTreeMap::new())), + fee_history_cache_limit: config.fee_history_limit, + }) +} + +/// A set of APIs that ethereum-compatible runtimes must implement. +pub trait EthCompatRuntimeApiCollection: + sp_api::ApiExt + fp_rpc::ConvertTransactionRuntimeApi + fp_rpc::EthereumRuntimeRPCApi +where + >::StateBackend: sp_api::StateBackend, +{ +} + +impl EthCompatRuntimeApiCollection for Api +where + Api: sp_api::ApiExt + fp_rpc::ConvertTransactionRuntimeApi + fp_rpc::EthereumRuntimeRPCApi, + >::StateBackend: sp_api::StateBackend, +{ +} + +pub async fn spawn_frontier_tasks( + task_manager: &TaskManager, + client: Arc>, + backend: Arc, + frontier_backend: FrontierBackend, + filter_pool: Option, + overrides: Arc>, + fee_history_cache: FeeHistoryCache, + fee_history_cache_limit: FeeHistoryCacheLimit, + sync: Arc>, + pubsub_notification_sinks: Arc< + fc_mapping_sync::EthereumBlockNotificationSinks>, + >, +) where + RuntimeApi: ConstructRuntimeApi>, + RuntimeApi: Send + Sync + 'static, + RuntimeApi::RuntimeApi: EthCompatRuntimeApiCollection>, + Executor: NativeExecutionDispatch + 'static, +{ + // Spawn main mapping sync worker background task. + match frontier_backend { + fc_db::Backend::KeyValue(b) => { + task_manager.spawn_essential_handle().spawn( + "frontier-mapping-sync-worker", + Some("frontier"), + fc_mapping_sync::kv::MappingSyncWorker::new( + client.import_notification_stream(), + Duration::new(6, 0), + client.clone(), + backend, + overrides.clone(), + Arc::new(b), + 3, + 0, + fc_mapping_sync::SyncStrategy::Normal, + sync, + pubsub_notification_sinks, + ) + .for_each(|()| future::ready(())), + ); + } + fc_db::Backend::Sql(b) => { + task_manager.spawn_essential_handle().spawn_blocking( + "frontier-mapping-sync-worker", + Some("frontier"), + fc_mapping_sync::sql::SyncWorker::run( + client.clone(), + backend, + Arc::new(b), + client.import_notification_stream(), + fc_mapping_sync::sql::SyncWorkerConfig { + read_notification_timeout: Duration::from_secs(10), + check_indexed_blocks_interval: Duration::from_secs(60), + }, + fc_mapping_sync::SyncStrategy::Parachain, + sync, + pubsub_notification_sinks, + ), + ); + } + } + + // Spawn Frontier EthFilterApi maintenance task. + if let Some(filter_pool) = filter_pool { + // Each filter is allowed to stay in the pool for 100 blocks. + const FILTER_RETAIN_THRESHOLD: u64 = 100; + task_manager.spawn_essential_handle().spawn( + "frontier-filter-pool", + Some("frontier"), + EthTask::filter_pool_task(client.clone(), filter_pool, FILTER_RETAIN_THRESHOLD), + ); + } + + // Spawn Frontier FeeHistory cache maintenance task. + task_manager.spawn_essential_handle().spawn( + "frontier-fee-history", + Some("frontier"), + EthTask::fee_history_task(client, overrides, fee_history_cache, fee_history_cache_limit), + ); +} + +#[derive(Clone)] +pub struct BlockImport, C>(FrontierBlockImport); + +impl BlockImport +where + B: BlockT, + I: BlockImportT>, + I::Error: Into, + C: ProvideRuntimeApi, + C::Api: BlockBuilderApi + EthereumRuntimeRPCApi, +{ + pub fn new(inner: I, client: Arc) -> Self { + Self(FrontierBlockImport::new(inner, client)) + } +} + +#[async_trait::async_trait] +impl BlockImportT for BlockImport +where + B: BlockT, + I: BlockImportT> + Send + Sync, + I::Error: Into, + C: ProvideRuntimeApi + Send + Sync, + C::Api: BlockBuilderApi + EthereumRuntimeRPCApi, +{ + type Error = ConsensusError; + type Transaction = sp_api::TransactionFor; + + async fn check_block(&mut self, block: BlockCheckParams) -> Result { + self.0.check_block(block).await + } + + async fn import_block( + &mut self, + block: BlockImportParams, + ) -> Result { + self.0.import_block(block).await + } +} + +impl, C> ParachainBlockImportMarker for BlockImport {} + +pub fn new_eth_deps( + client: Arc, + transaction_pool: Arc

, + graph: Arc>, + config: &mut Configuration, + eth_config: &EthConfiguration, + network: Arc::Hash>>, + sync_service: Arc>, + frontier_backend: FrontierBackend, + overrides: Arc>, + task_manager: &TaskManager, + filter_pool: Option, + fee_history_cache: FeeHistoryCache, + fee_history_cache_limit: FeeHistoryCacheLimit, +) -> interbtc_rpc::EthDeps +where + C: ProvideRuntimeApi, + C::Api: EthereumRuntimeRPCApi, + C: sc_client_api::HeaderBackend + sc_client_api::StorageProvider + 'static, + CT: fp_rpc::ConvertTransaction<::Extrinsic> + Default + Send + Sync + 'static, +{ + // use ethereum style for subscription ids + config.rpc_id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider)); + interbtc_rpc::EthDeps { + client: client.clone(), + pool: transaction_pool, + graph, + converter: Some(CT::default()), + is_authority: config.role.is_authority(), + enable_dev_signer: eth_config.enable_dev_signer, + network, + sync: sync_service.clone(), + frontier_backend: match frontier_backend { + fc_db::Backend::KeyValue(b) => Arc::new(b), + fc_db::Backend::Sql(b) => Arc::new(b), + }, + overrides: overrides.clone(), + block_data_cache: Arc::new(fc_rpc::EthBlockDataCacheTask::new( + task_manager.spawn_handle(), + overrides.clone(), + eth_config.eth_log_block_cache, + eth_config.eth_statuses_cache, + config.prometheus_registry().cloned(), + )), + filter_pool, + max_past_logs: eth_config.max_past_logs, + fee_history_cache, + fee_history_cache_limit, + execute_gas_limit_multiplier: eth_config.execute_gas_limit_multiplier, + forced_parent_hashes: None, + } +} diff --git a/parachain/src/lib.rs b/parachain/src/lib.rs index 38e43372ca..5a048e9d6d 100644 --- a/parachain/src/lib.rs +++ b/parachain/src/lib.rs @@ -1,2 +1,4 @@ pub mod chain_spec; pub mod service; + +mod eth; diff --git a/parachain/src/main.rs b/parachain/src/main.rs index df8e9fffe1..b5e880fa4b 100644 --- a/parachain/src/main.rs +++ b/parachain/src/main.rs @@ -5,6 +5,7 @@ mod chain_spec; #[macro_use] mod cli; mod command; +mod eth; mod service; #[cfg(feature = "runtime-benchmarks")] diff --git a/parachain/src/service.rs b/parachain/src/service.rs index 92f0a4de7a..76719ed7de 100644 --- a/parachain/src/service.rs +++ b/parachain/src/service.rs @@ -13,7 +13,7 @@ use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node; use futures::StreamExt; use polkadot_service::CollatorPair; use primitives::*; -use sc_client_api::HeaderBackend; +use sc_client_api::{HeaderBackend, StateBackendFor}; use sc_consensus::{ImportQueue, LongestChain}; use sc_executor::NativeElseWasmExecutor; use sc_network::NetworkBlock; @@ -27,10 +27,16 @@ use sp_consensus_aura::{ }; use sp_core::H256; use sp_keystore::KeystorePtr; -use sp_runtime::traits::BlakeTwo256; +use sp_runtime::traits::{BlakeTwo256, Block as BlockT}; use std::{sync::Arc, time::Duration}; use substrate_prometheus_endpoint::Registry; +// Frontier imports +use crate::eth::{ + new_eth_deps, new_frontier_partial, open_frontier_backend, spawn_frontier_tasks, BlockImport as EthBlockImport, + EthCompatRuntimeApiCollection, EthConfiguration, FrontierBackend, FrontierPartialComponents, +}; + macro_rules! new_runtime_executor { ($name:ident,$runtime:ident) => { pub struct $name; @@ -55,13 +61,33 @@ new_runtime_executor!(InterlayRuntimeExecutor, interlay_runtime); // Native kintsugi executor instance. new_runtime_executor!(KintsugiRuntimeExecutor, kintsugi_runtime); -pub trait RuntimeApiCollection: - sp_transaction_pool::runtime_api::TaggedTransactionQueue +/// A set of APIs that every runtime must implement. +pub trait BaseRuntimeApiCollection: + sp_api::ApiExt + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt, Block>> - + sp_offchain::OffchainWorkerApi + sp_block_builder::BlockBuilder + + sp_offchain::OffchainWorkerApi + + sp_session::SessionKeys + + sp_transaction_pool::runtime_api::TaggedTransactionQueue +where + >::StateBackend: sp_api::StateBackend, +{ +} + +impl BaseRuntimeApiCollection for Api +where + Api: sp_api::ApiExt + + sp_api::Metadata + + sp_block_builder::BlockBuilder + + sp_offchain::OffchainWorkerApi + + sp_session::SessionKeys + + sp_transaction_pool::runtime_api::TaggedTransactionQueue, + >::StateBackend: sp_api::StateBackend, +{ +} +pub trait RuntimeApiCollection: + BaseRuntimeApiCollection + + EthCompatRuntimeApiCollection + substrate_frame_rpc_system::AccountNonceApi + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + cumulus_primitives_core::CollectCollationInfo @@ -108,12 +134,8 @@ where impl RuntimeApiCollection for Api where - Api: sp_transaction_pool::runtime_api::TaggedTransactionQueue - + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt, Block>> - + sp_offchain::OffchainWorkerApi - + sp_block_builder::BlockBuilder + Api: BaseRuntimeApiCollection + + EthCompatRuntimeApiCollection + substrate_frame_rpc_system::AccountNonceApi + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + cumulus_primitives_core::CollectCollationInfo @@ -157,10 +179,10 @@ where { } -type FullBackend = TFullBackend; +pub(crate) type FullBackend = TFullBackend; -type FullClient = - sc_service::TFullClient>; +pub(crate) type FullClient = + TFullClient>; type MaybeFullSelectChain = Option>; @@ -196,21 +218,28 @@ where /// be able to perform chain operations. pub fn new_partial( config: &Configuration, + eth_config: &EthConfiguration, instant_seal: bool, ) -> Result< PartialComponents< - TFullClient>, - TFullBackend, + FullClient, + FullBackend, MaybeFullSelectChain, - sc_consensus::DefaultImportQueue>>, - sc_transaction_pool::FullPool>>, - (Option, Option), + sc_consensus::DefaultImportQueue>, + sc_transaction_pool::FullPool>, + ( + Option, + Option, + FrontierBackend, + Arc>, + ), >, sc_service::Error, > where RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, - RuntimeApi::RuntimeApi: RuntimeApiCollection>, + RuntimeApi::RuntimeApi: BaseRuntimeApiCollection>, + RuntimeApi::RuntimeApi: EthCompatRuntimeApiCollection>, RuntimeApi::RuntimeApi: sp_consensus_aura::AuraApi, Executor: sc_executor::NativeExecutionDispatch + 'static, { @@ -262,10 +291,13 @@ where None }; + let overrides = interbtc_rpc::overrides_handle(client.clone()); + let frontier_backend = open_frontier_backend(client.clone(), config, eth_config, overrides.clone())?; + let import_queue = if instant_seal { - // instance sealing + // instant sealing sc_consensus_manual_seal::import_queue( - Box::new(client.clone()), + Box::new(EthBlockImport::new(client.clone(), client.clone())), &task_manager.spawn_essential_handle(), registry, ) @@ -274,7 +306,10 @@ where cumulus_client_consensus_aura::import_queue::( cumulus_client_consensus_aura::ImportQueueParams { - block_import: ParachainBlockImport::new(client.clone(), backend.clone()), + block_import: EthBlockImport::new( + ParachainBlockImport::new(client.clone(), backend.clone()), + client.clone(), + ), client: client.clone(), create_inherent_data_providers: move |_parent: sp_core::H256, _| async move { let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); @@ -301,7 +336,7 @@ where task_manager, transaction_pool, select_chain, - other: (telemetry, telemetry_worker_handle), + other: (telemetry, telemetry_worker_handle, frontier_backend, overrides), }; Ok(params) @@ -331,9 +366,10 @@ async fn build_relay_chain_interface( /// /// This is the actual implementation that is abstract over the executor and the runtime api. #[sc_tracing::logging::prefix_logs_with("Parachain")] -async fn start_node_impl( +async fn start_node_impl( parachain_config: Configuration, polkadot_config: Configuration, + eth_config: EthConfiguration, collator_options: CollatorOptions, id: ParaId, build_consensus: BIC, @@ -343,9 +379,10 @@ where RuntimeApi::RuntimeApi: RuntimeApiCollection>, RuntimeApi::RuntimeApi: sp_consensus_aura::AuraApi, Executor: sc_executor::NativeExecutionDispatch + 'static, + CT: fp_rpc::ConvertTransaction<::Extrinsic> + Clone + Default + Send + Sync + 'static, BIC: FnOnce( Arc>, - ParachainBlockImport, + EthBlockImport, FullClient>, Option<&Registry>, Option, &TaskManager, @@ -356,10 +393,10 @@ where bool, ) -> Result>, sc_service::Error>, { - let parachain_config = prepare_node_config(parachain_config); + let mut parachain_config = prepare_node_config(parachain_config); - let params = new_partial(¶chain_config, false)?; - let (mut telemetry, telemetry_worker_handle) = params.other; + let params = new_partial(¶chain_config, ð_config, false)?; + let (mut telemetry, telemetry_worker_handle, frontier_backend, overrides) = params.other; let client = params.client.clone(); let backend = params.backend.clone(); @@ -393,19 +430,49 @@ where warp_sync_params: None, })?; + let FrontierPartialComponents { + filter_pool, + fee_history_cache, + fee_history_cache_limit, + } = new_frontier_partial(ð_config)?; + + let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks< + fc_mapping_sync::EthereumBlockNotification, + > = Default::default(); + let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks); + + let eth_rpc_params = new_eth_deps::<_, _, _, CT>( + client.clone(), + transaction_pool.clone(), + transaction_pool.pool().clone(), + &mut parachain_config, + ð_config, + network.clone(), + sync_service.clone(), + frontier_backend.clone(), + overrides.clone(), + &task_manager, + filter_pool.clone(), + fee_history_cache.clone(), + fee_history_cache_limit, + ); + let rpc_builder = { let client = client.clone(); let transaction_pool = transaction_pool.clone(); + let pubsub_notification_sinks = pubsub_notification_sinks.clone(); - move |deny_unsafe, _| { + move |deny_unsafe, subscription_task_executor| { let deps = interbtc_rpc::FullDeps { client: client.clone(), pool: transaction_pool.clone(), deny_unsafe, command_sink: None, + eth: eth_rpc_params.clone(), }; - interbtc_rpc::create_full(deps).map_err(Into::into) + interbtc_rpc::create_full(deps, subscription_task_executor, pubsub_notification_sinks.clone()) + .map_err(Into::into) } }; @@ -433,6 +500,20 @@ where sync_service: sync_service.clone(), })?; + spawn_frontier_tasks( + &task_manager, + client.clone(), + backend.clone(), + frontier_backend, + filter_pool, + overrides, + fee_history_cache, + fee_history_cache_limit, + sync_service.clone(), + pubsub_notification_sinks, + ) + .await; + let announce_block = { let sync_service = sync_service.clone(); Arc::new(move |hash, data| sync_service.announce_block(hash, data)) @@ -447,7 +528,10 @@ where if validator { let parachain_consensus = build_consensus( client.clone(), - ParachainBlockImport::new(client.clone(), backend.clone()), + EthBlockImport::new( + ParachainBlockImport::new(client.clone(), backend.clone()), + client.clone(), + ), prometheus_registry.as_ref(), telemetry.as_ref().map(|t| t.handle()), &task_manager, @@ -499,9 +583,10 @@ where } /// Start a normal parachain node. -pub async fn start_node( +pub async fn start_node( parachain_config: Configuration, polkadot_config: Configuration, + eth_config: EthConfiguration, collator_options: CollatorOptions, id: ParaId, ) -> sc_service::error::Result<(TaskManager, Arc>)> @@ -510,10 +595,12 @@ where RuntimeApi::RuntimeApi: RuntimeApiCollection>, RuntimeApi::RuntimeApi: sp_consensus_aura::AuraApi, Executor: sc_executor::NativeExecutionDispatch + 'static, + CT: fp_rpc::ConvertTransaction<::Extrinsic> + Clone + Default + Send + Sync + 'static, { - start_node_impl( + start_node_impl::<_, _, CT, _>( parachain_config, polkadot_config, + eth_config, collator_options, id, |client, @@ -589,14 +676,16 @@ where .await } -pub async fn start_instant( - config: Configuration, +pub async fn start_instant( + mut config: Configuration, + eth_config: EthConfiguration, ) -> sc_service::error::Result<(TaskManager, RpcHandlers)> where RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, RuntimeApi::RuntimeApi: RuntimeApiCollection>, RuntimeApi::RuntimeApi: sp_consensus_aura::AuraApi, Executor: sc_executor::NativeExecutionDispatch + 'static, + CT: fp_rpc::ConvertTransaction<::Extrinsic> + Clone + Default + Send + Sync + 'static, { let sc_service::PartialComponents { client, @@ -606,8 +695,8 @@ where keystore_container, select_chain: maybe_select_chain, transaction_pool, - other: (mut telemetry, _), - } = new_partial::(&config, true)?; + other: (mut telemetry, _telemetry_worker_handle, frontier_backend, overrides), + } = new_partial::(&config, ð_config, true)?; let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) = sc_service::build_network(sc_service::BuildNetworkParams { @@ -655,7 +744,7 @@ where let client_for_cidp = client.clone(); let authorship_future = sc_consensus_manual_seal::run_manual_seal(sc_consensus_manual_seal::ManualSealParams { - block_import: client.clone(), + block_import: EthBlockImport::new(client.clone(), client.clone()), env: proposer_factory, client: client.clone(), pool: transaction_pool.clone(), @@ -694,19 +783,49 @@ where None }; + let FrontierPartialComponents { + filter_pool, + fee_history_cache, + fee_history_cache_limit, + } = new_frontier_partial(ð_config)?; + + let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks< + fc_mapping_sync::EthereumBlockNotification, + > = Default::default(); + let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks); + + let eth_rpc_params = new_eth_deps::<_, _, _, CT>( + client.clone(), + transaction_pool.clone(), + transaction_pool.pool().clone(), + &mut config, + ð_config, + network.clone(), + sync_service.clone(), + frontier_backend.clone(), + overrides.clone(), + &task_manager, + filter_pool.clone(), + fee_history_cache.clone(), + fee_history_cache_limit, + ); + let rpc_builder = { let client = client.clone(); let transaction_pool = transaction_pool.clone(); + let pubsub_notification_sinks = pubsub_notification_sinks.clone(); - move |deny_unsafe, _| { + move |deny_unsafe, subscription_task_executor| { let deps = interbtc_rpc::FullDeps { client: client.clone(), pool: transaction_pool.clone(), deny_unsafe, command_sink: command_sink.clone(), + eth: eth_rpc_params.clone(), }; - interbtc_rpc::create_full(deps).map_err(Into::into) + interbtc_rpc::create_full(deps, subscription_task_executor, pubsub_notification_sinks.clone()) + .map_err(Into::into) } }; @@ -717,14 +836,28 @@ where task_manager: &mut task_manager, config, keystore: keystore_container.keystore(), - backend, + backend: backend.clone(), network, system_rpc_tx, tx_handler_controller, telemetry: telemetry.as_mut(), - sync_service, + sync_service: sync_service.clone(), })?; + spawn_frontier_tasks( + &task_manager, + client.clone(), + backend, + frontier_backend, + filter_pool, + overrides, + fee_history_cache, + fee_history_cache_limit, + sync_service.clone(), + pubsub_notification_sinks, + ) + .await; + network_starter.start_network(); Ok((task_manager, rpc_handlers)) diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 85aa0213e9..f09ee2ea4d 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -37,3 +37,17 @@ sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "pol pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } + +# Ethereum +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } +sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } + +fc-db = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fc-mapping-sync = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fc-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fc-rpc-core = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fc-storage = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } +fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" } \ No newline at end of file diff --git a/rpc/src/eth.rs b/rpc/src/eth.rs new file mode 100644 index 0000000000..5e264624eb --- /dev/null +++ b/rpc/src/eth.rs @@ -0,0 +1,198 @@ +pub use fc_rpc::{EthBlockDataCacheTask, EthConfig, OverrideHandle, StorageOverride, TxPool}; +pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; +pub use fc_storage::overrides_handle; +use fp_rpc::{ConvertTransaction, ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi}; +use jsonrpsee::RpcModule; +use sc_client_api::{ + backend::{Backend, StorageProvider}, + client::BlockchainEvents, +}; +use sc_network::NetworkService; +use sc_network_sync::SyncingService; +use sc_rpc::SubscriptionTaskExecutor; +use sc_transaction_pool::{ChainApi, Pool}; +use sc_transaction_pool_api::TransactionPool; +use sp_api::{CallApiAt, ProvideRuntimeApi}; +use sp_block_builder::BlockBuilder as BlockBuilderApi; +use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; +use sp_core::H256; +use sp_runtime::traits::Block as BlockT; +use std::{collections::BTreeMap, sync::Arc}; + +/// Extra dependencies for Ethereum compatibility. +pub struct EthDeps { + /// The client instance to use. + pub client: Arc, + /// Transaction pool instance. + pub pool: Arc

, + /// Graph pool instance. + pub graph: Arc>, + /// Ethereum transaction converter. + pub converter: Option, + /// The Node authority flag + pub is_authority: bool, + /// Whether to enable dev signer + pub enable_dev_signer: bool, + /// Network service + pub network: Arc>, + /// Chain syncing service + pub sync: Arc>, + /// Frontier Backend. + pub frontier_backend: Arc + Send + Sync>, + /// Ethereum data access overrides. + pub overrides: Arc>, + /// Cache for Ethereum block data. + pub block_data_cache: Arc>, + /// EthFilterApi pool. + pub filter_pool: Option, + /// Maximum number of logs in a query. + pub max_past_logs: u32, + /// Fee history cache. + pub fee_history_cache: FeeHistoryCache, + /// Maximum fee history cache size. + pub fee_history_cache_limit: FeeHistoryCacheLimit, + /// Maximum allowed gas limit will be ` block.gas_limit * execute_gas_limit_multiplier` when + /// using eth_call/eth_estimateGas. + pub execute_gas_limit_multiplier: u64, + /// Mandated parent hashes for a given block hash. + pub forced_parent_hashes: Option>, +} + +impl Clone for EthDeps { + fn clone(&self) -> Self { + Self { + client: self.client.clone(), + pool: self.pool.clone(), + graph: self.graph.clone(), + converter: self.converter.clone(), + is_authority: self.is_authority, + enable_dev_signer: self.enable_dev_signer, + network: self.network.clone(), + sync: self.sync.clone(), + frontier_backend: self.frontier_backend.clone(), + overrides: self.overrides.clone(), + block_data_cache: self.block_data_cache.clone(), + filter_pool: self.filter_pool.clone(), + max_past_logs: self.max_past_logs, + fee_history_cache: self.fee_history_cache.clone(), + fee_history_cache_limit: self.fee_history_cache_limit, + execute_gas_limit_multiplier: self.execute_gas_limit_multiplier, + forced_parent_hashes: self.forced_parent_hashes.clone(), + } + } +} + +/// Instantiate Ethereum-compatible RPC extensions. +pub fn create_eth>( + mut io: RpcModule<()>, + deps: EthDeps, + subscription_task_executor: SubscriptionTaskExecutor, + pubsub_notification_sinks: Arc< + fc_mapping_sync::EthereumBlockNotificationSinks>, + >, +) -> Result, Box> +where + B: BlockT, + C: CallApiAt + ProvideRuntimeApi, + C::Api: BlockBuilderApi + ConvertTransactionRuntimeApi + EthereumRuntimeRPCApi, + C: BlockchainEvents + 'static, + C: HeaderBackend + HeaderMetadata + StorageProvider, + BE: Backend + 'static, + P: TransactionPool + 'static, + A: ChainApi + 'static, + CT: ConvertTransaction<::Extrinsic> + Send + Sync + 'static, +{ + use fc_rpc::{ + Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, EthSigner, Net, + NetApiServer, TxPoolApiServer, Web3, Web3ApiServer, + }; + + let EthDeps { + client, + pool, + graph, + converter, + is_authority, + enable_dev_signer, + network, + sync, + frontier_backend, + overrides, + block_data_cache, + filter_pool, + max_past_logs, + fee_history_cache, + fee_history_cache_limit, + execute_gas_limit_multiplier, + forced_parent_hashes, + } = deps; + + let mut signers = Vec::new(); + if enable_dev_signer { + signers.push(Box::new(EthDevSigner::new()) as Box); + } + + io.merge( + Eth::new( + client.clone(), + pool.clone(), + graph.clone(), + converter, + sync.clone(), + signers, + overrides.clone(), + frontier_backend.clone(), + is_authority, + block_data_cache.clone(), + fee_history_cache, + fee_history_cache_limit, + execute_gas_limit_multiplier, + forced_parent_hashes, + ) + .replace_config::() + .into_rpc(), + )?; + + let tx_pool = TxPool::new(client.clone(), graph); + if let Some(filter_pool) = filter_pool { + io.merge( + EthFilter::new( + client.clone(), + frontier_backend, + tx_pool.clone(), + filter_pool, + 500_usize, // max stored filters + max_past_logs, + block_data_cache, + ) + .into_rpc(), + )?; + } + + io.merge( + EthPubSub::new( + pool, + client.clone(), + sync, + subscription_task_executor, + overrides, + pubsub_notification_sinks, + ) + .into_rpc(), + )?; + + io.merge( + Net::new( + client.clone(), + network, + // Whether to format the `peer_count` response as Hex (default) or not. + true, + ) + .into_rpc(), + )?; + + io.merge(Web3::new(client).into_rpc())?; + io.merge(tx_pool.into_rpc())?; + + Ok(io) +} diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 5f365a6862..764a7f69e8 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -3,8 +3,6 @@ //! used by Substrate nodes. This file extends those RPC definitions with //! capabilities that are specific to this project's runtime configuration. -#![warn(missing_docs)] - use primitives::{ issue::IssueRequest, redeem::RedeemRequest, replace::ReplaceRequest, AccountId, Balance, Block, BlockNumber, CurrencyId, H256Le, Hash, Nonce, StablePoolId, VaultId, @@ -19,13 +17,21 @@ use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; use sp_core::H256; use std::sync::Arc; -pub use jsonrpsee; +// Frontier imports +use sc_client_api::{backend::Backend, client::BlockchainEvents, StorageProvider}; +use sc_rpc::SubscriptionTaskExecutor; +use sc_transaction_pool::ChainApi; +use sp_api::CallApiAt; +use sp_runtime::traits::Block as BlockT; + +pub mod eth; +pub use self::eth::{create_eth, overrides_handle, EthDeps}; /// A type representing all RPC extensions. pub type RpcExtension = jsonrpsee::RpcModule<()>; /// Full client dependencies. -pub struct FullDeps { +pub struct FullDeps { /// The client instance to use. pub client: Arc, /// Transaction pool instance. @@ -34,14 +40,37 @@ pub struct FullDeps { pub deny_unsafe: DenyUnsafe, /// Manual seal command sink pub command_sink: Option>>, + /// Ethereum-compatibility specific dependencies. + pub eth: EthDeps, +} + +pub struct DefaultEthConfig(std::marker::PhantomData<(C, BE)>); + +impl fc_rpc::EthConfig for DefaultEthConfig +where + C: sc_client_api::StorageProvider + Sync + Send + 'static, + BE: Backend + 'static, +{ + type EstimateGasAdapter = (); + type RuntimeStorageOverride = fc_rpc::frontier_backend_client::SystemAccountId20StorageOverride; } /// Instantiate all full RPC extensions. -pub fn create_full(deps: FullDeps) -> Result> +pub fn create_full( + deps: FullDeps, + subscription_task_executor: SubscriptionTaskExecutor, + pubsub_notification_sinks: Arc< + fc_mapping_sync::EthereumBlockNotificationSinks>, + >, +) -> Result> where - C: ProvideRuntimeApi, - C: HeaderBackend + HeaderMetadata + 'static, + C: CallApiAt + ProvideRuntimeApi, + C: BlockchainEvents, + C: HeaderBackend + HeaderMetadata + StorageProvider, C: Send + Sync + 'static, + C::Api: BlockBuilder, + C::Api: fp_rpc::ConvertTransactionRuntimeApi, + C::Api: fp_rpc::EthereumRuntimeRPCApi, C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: btc_relay_rpc::BtcRelayRuntimeApi, @@ -81,8 +110,10 @@ where C::Api: loans_rpc::LoansRuntimeApi, C::Api: dex_general_rpc::DexGeneralRuntimeApi, C::Api: dex_stable_rpc::DexStableRuntimeApi, - C::Api: BlockBuilder, - P: TransactionPool + 'static, + P: TransactionPool + 'static, + BE: Backend + 'static, + A: ChainApi + 'static, + CT: fp_rpc::ConvertTransaction<::Extrinsic> + Send + Sync + 'static, { use btc_relay_rpc::{BtcRelay, BtcRelayApiServer}; use dex_general_rpc::{DexGeneral, DexGeneralApiServer}; @@ -104,6 +135,7 @@ where pool, deny_unsafe, command_sink, + eth, } = deps; if let Some(command_sink) = command_sink { @@ -114,6 +146,14 @@ where )?; } + // Ethereum compatibility RPCs + let mut module = create_eth::<_, _, _, _, _, _, DefaultEthConfig>( + module, + eth, + subscription_task_executor, + pubsub_notification_sinks, + )?; + module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?;