diff --git a/Cargo.lock b/Cargo.lock index d1c2b3c1..774173c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,11 +43,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" dependencies = [ - "gimli 0.27.2", + "gimli 0.27.3", ] [[package]] @@ -106,28 +106,25 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] [[package]] -name = "aho-corasick" -version = "1.0.1" +name = "android-tzdata" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" -dependencies = [ - "memchr", -] +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" [[package]] name = "android_system_properties" @@ -164,15 +161,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] @@ -198,9 +195,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "approx" @@ -240,9 +237,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "asn1_der" @@ -258,9 +255,9 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-channel" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener", @@ -276,7 +273,7 @@ dependencies = [ "async-lock", "async-task", "concurrent-queue", - "fastrand", + "fastrand 1.9.0", "futures-lite", "slab", ] @@ -310,9 +307,9 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.19", + "rustix 0.37.23", "slab", - "socket2", + "socket2 0.4.9", "waker-fn", ] @@ -333,26 +330,26 @@ checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] name = "asynchronous-codec" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" +checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" dependencies = [ "bytes", "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", ] [[package]] @@ -392,16 +389,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ - "addr2line 0.19.0", + "addr2line 0.20.0", "cc", "cfg-if", "libc", - "miniz_oxide 0.6.2", - "object 0.30.3", + "miniz_oxide", + "object 0.31.1", "rustc-demangle", ] @@ -431,9 +428,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "base64ct" @@ -443,9 +440,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basic-toml" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c0de75129aa8d0cceaf750b89013f0e08804d6ec61416da787b35ad0d7cddf1" +checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" dependencies = [ "serde", ] @@ -484,7 +481,7 @@ version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -504,6 +501,12 @@ 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" @@ -522,7 +525,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -542,8 +545,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", - "arrayvec 0.7.2", - "constant_time_eq 0.2.5", + "arrayvec 0.7.4", + "constant_time_eq 0.2.6", ] [[package]] @@ -553,21 +556,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" dependencies = [ "arrayref", - "arrayvec 0.7.2", - "constant_time_eq 0.2.5", + "arrayvec 0.7.4", + "constant_time_eq 0.2.6", ] [[package]] name = "blake3" -version = "1.3.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" +checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "cc", "cfg-if", - "constant_time_eq 0.2.5", + "constant_time_eq 0.3.0", ] [[package]] @@ -626,7 +629,7 @@ dependencies = [ "async-lock", "async-task", "atomic-waker", - "fastrand", + "fastrand 1.9.0", "futures-lite", "log", ] @@ -645,14 +648,14 @@ checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ "lazy_static", "memchr", - "regex-automata", + "regex-automata 0.1.10", ] [[package]] name = "bstr" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", "serde", @@ -669,9 +672,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.2" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byte-slice-cast" @@ -710,18 +713,18 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c530edf18f37068ac2d977409ed5cd50d53d73bc653c7647b48eb78976ac9ae2" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" dependencies = [ "serde", ] @@ -734,7 +737,7 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ "camino", "cargo-platform", - "semver 1.0.17", + "semver 1.0.18", "serde", "serde_json", ] @@ -747,11 +750,12 @@ checksum = "fd6c0e7b807d60291f42f33f58480c0bfafe28ed08286446f45e463728cf9c1c" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -811,13 +815,13 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", "time", "wasm-bindgen", @@ -868,9 +872,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.2.7" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938" +checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" dependencies = [ "clap_builder", "clap_derive", @@ -879,34 +883,33 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.2.7" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" +checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.2.0" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] name = "clap_lex" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "codespan-reporting" @@ -926,9 +929,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "comfy-table" -version = "6.1.4" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e7b787b0dc42e8111badfdbe4c3059158ccb2db8780352fa1b01e8ccf45cc4d" +checksum = "7e959d788268e3bf9d35ace83e81b124190378e4c91c9067524675e33394b8ba" dependencies = [ "strum", "strum_macros", @@ -946,9 +949,9 @@ dependencies = [ [[package]] name = "console" -version = "0.15.6" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0525278dce688103060006713371cedbad27186c7d913f33d866b498da0f595" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" dependencies = [ "encode_unicode", "lazy_static", @@ -958,9 +961,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.2" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "constant_time_eq" @@ -970,9 +973,15 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "constant_time_eq" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" +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" @@ -1022,9 +1031,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -1044,7 +1053,7 @@ version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", @@ -1159,22 +1168,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset 0.9.0", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -1278,9 +1287,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.94" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" +checksum = "ba1ba0a82363c553ecb7b4cd58ba6e1c017baef8e3cca4e7d66ca17879201144" dependencies = [ "cc", "cxxbridge-flags", @@ -1290,9 +1299,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.94" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" +checksum = "ac9ec8372f860c6ee7c6463b96a26d08dd590bcbcd9bf2d1894db09ae81410d3" dependencies = [ "cc", "codespan-reporting", @@ -1300,37 +1309,37 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] name = "cxxbridge-flags" -version = "1.0.94" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" +checksum = "409667bbb937bae87f7cfa91ca29e1415bb92d415371e3344b5269c10d90d595" [[package]] name = "cxxbridge-macro" -version = "1.0.94" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" +checksum = "5fb2a9757fb085d6d97856b28d4f049141ca4a61a64c697f4426433b5f6caa1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] name = "data-encoding" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "data-encoding-macro" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86927b7cd2fe88fa698b87404b287ab98d1a0063a34071d92e575b72d3029aca" +checksum = "c904b33cc60130e1aeea4956ab803d08a3f4a0ca82d64ed757afac3891f2bb99" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -1338,9 +1347,9 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" +checksum = "8fdf3fce3ce863539ec1d7fd1b6dcc3c645663376b43ed376bbf887733e4f772" dependencies = [ "data-encoding", "syn 1.0.109", @@ -1412,9 +1421,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", "crypto-common", @@ -1486,9 +1495,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "dyn-clonable" @@ -1513,9 +1522,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "304e6508efa593091e97a9abbc10f90aa7ca635b6d2784feff3c89d41dd12272" [[package]] name = "ecdsa" @@ -1568,9 +1577,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -1581,7 +1590,7 @@ dependencies = [ "base16ct", "crypto-bigint", "der", - "digest 0.10.6", + "digest 0.10.7", "ff", "generic-array 0.14.7", "group", @@ -1597,6 +1606,15 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + [[package]] name = "enum-as-inner" version = "0.5.1" @@ -1641,9 +1659,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" dependencies = [ "errno-dragonfly", "libc", @@ -1809,6 +1827,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + [[package]] name = "fc-cli" version = "1.0.0-dev" @@ -1974,13 +1998,13 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] @@ -2026,7 +2050,7 @@ checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", "libz-sys", - "miniz_oxide 0.7.1", + "miniz_oxide", ] [[package]] @@ -2044,6 +2068,21 @@ 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" @@ -2054,9 +2093,9 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -2261,7 +2300,7 @@ name = "frame-support" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.36#cb4f2491b00af7d7817f3a54209c26b20faa1f51" dependencies = [ - "bitflags", + "bitflags 1.3.2", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", @@ -2437,12 +2476,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", "parking", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", "waker-fn", ] @@ -2454,7 +2493,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] @@ -2499,7 +2538,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", "pin-utils", "slab", ] @@ -2557,9 +2596,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -2589,9 +2628,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "glob" @@ -2601,12 +2640,12 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" dependencies = [ - "aho-corasick 0.7.20", - "bstr 1.4.0", + "aho-corasick", + "bstr 1.6.0", "fnv", "log", "regex", @@ -2625,9 +2664,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes", "fnv", @@ -2697,18 +2736,9 @@ dependencies = [ [[package]] name = "hermit-abi" -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" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hex" @@ -2748,7 +2778,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -2792,14 +2822,14 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", ] [[package]] name = "http-range-header" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] name = "httparse" @@ -2821,9 +2851,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.26" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -2835,8 +2865,8 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.9", - "socket2", + "pin-project-lite 0.2.11", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -2858,11 +2888,24 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2894,9 +2937,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -3014,11 +3057,11 @@ checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", "windows-sys 0.48.0", ] @@ -3031,31 +3074,30 @@ checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" [[package]] name = "ipconfig" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2", + "socket2 0.5.3", "widestring", - "winapi", - "winreg", + "windows-sys 0.48.0", + "winreg 0.50.0", ] [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes 1.0.10", - "rustix 0.37.19", + "hermit-abi 0.3.2", + "rustix 0.38.7", "windows-sys 0.48.0", ] @@ -3070,9 +3112,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -3085,9 +3127,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -3112,7 +3154,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" dependencies = [ "anyhow", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "async-trait", "beef", "futures-channel", @@ -3219,7 +3261,7 @@ dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -3281,9 +3323,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libloading" @@ -3316,7 +3358,7 @@ dependencies = [ "bytes", "futures", "futures-timer", - "getrandom 0.2.9", + "getrandom 0.2.10", "instant", "lazy_static", "libp2p-core", @@ -3366,7 +3408,7 @@ dependencies = [ "prost-build", "rand 0.8.5", "rw-stream-sink", - "sha2 0.10.6", + "sha2 0.10.7", "smallvec", "thiserror", "unsigned-varint", @@ -3415,7 +3457,7 @@ version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6721c200e2021f6c3fab8b6cf0272ead8912d871610ee194ebd628cecf428f22" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "asynchronous-codec", "bytes", "either", @@ -3429,7 +3471,7 @@ dependencies = [ "prost", "prost-build", "rand 0.8.5", - "sha2 0.10.6", + "sha2 0.10.7", "smallvec", "thiserror", "uint", @@ -3452,7 +3494,7 @@ dependencies = [ "log", "rand 0.8.5", "smallvec", - "socket2", + "socket2 0.4.9", "tokio", "void", ] @@ -3504,7 +3546,7 @@ dependencies = [ "prost", "prost-build", "rand 0.8.5", - "sha2 0.10.6", + "sha2 0.10.7", "snow", "static_assertions", "x25519-dalek", @@ -3588,7 +3630,7 @@ dependencies = [ "libc", "libp2p-core", "log", - "socket2", + "socket2 0.4.9", "tokio", ] @@ -3704,9 +3746,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "pkg-config", @@ -3715,9 +3757,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" dependencies = [ "cc", ] @@ -3755,15 +3797,21 @@ checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" [[package]] name = "linux-raw-sys" -version = "0.3.7" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[package]] +name = "linux-raw-sys" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -3771,12 +3819,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "lru" @@ -3852,7 +3897,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -3883,7 +3928,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.19", + "rustix 0.37.23", ] [[package]] @@ -3906,9 +3951,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -3942,19 +3987,16 @@ dependencies = [ ] [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "mime" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] -name = "miniz_oxide" -version = "0.6.2" +name = "minimal-lexical" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" @@ -3967,14 +4009,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -4043,9 +4084,9 @@ dependencies = [ "blake2s_simd", "blake3", "core2", - "digest 0.10.6", + "digest 0.10.7", "multihash-derive", - "sha2 0.10.6", + "sha2 0.10.7", "sha3 0.10.8", "unsigned-varint", ] @@ -4122,6 +4163,24 @@ dependencies = [ "rand 0.8.5", ] +[[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" @@ -4141,7 +4200,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" dependencies = [ "anyhow", - "bitflags", + "bitflags 1.3.2", "byteorder", "libc", "netlink-packet-core", @@ -4194,7 +4253,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", ] @@ -4229,9 +4288,9 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "num" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ "num-bigint", "num-complex", @@ -4267,7 +4326,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "itoa", ] @@ -4306,9 +4365,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", "libm 0.2.7", @@ -4316,11 +4375,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.2", "libc", ] @@ -4359,18 +4418,18 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -4384,12 +4443,50 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" +dependencies = [ + "bitflags 1.3.2", + "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.28", +] + [[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.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "packed_simd_2" version = "0.3.8" @@ -4987,11 +5084,43 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "pallet-zero-gas-transactions" +version = "0.1.0" +dependencies = [ + "ethereum", + "ethereum-types", + "fp-ethereum", + "fp-evm", + "fp-rpc", + "frame-support", + "frame-system", + "hex", + "pallet-balances", + "pallet-erc20-manager", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-chain-id", + "pallet-fee-rewards-vault", + "pallet-supported-tokens-manager", + "pallet-timestamp", + "pallet-user-fee-selector", + "pallet-validator-fee-selector", + "parity-scale-codec", + "runner", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "stbl-tools", +] + [[package]] name = "parity-db" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4890dcb9556136a4ec2b0c51fa4a08c8b733b829506af8fff2e853f3a065985b" +checksum = "78f19d20a0d2cc52327a88d131fa1c4ea81ea4a04714aedcfeca2dd410049cf8" dependencies = [ "blake2", "crc32fast", @@ -5009,11 +5138,11 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.5.0" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" +checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bitvec", "byte-slice-cast", "bytes", @@ -5024,9 +5153,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.4" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5070,7 +5199,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -5089,22 +5218,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.1", ] [[package]] name = "paste" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pbkdf2" @@ -5132,15 +5261,15 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.6.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" +checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" dependencies = [ "thiserror", "ucd-trie", @@ -5148,9 +5277,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.6.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" +checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" dependencies = [ "pest", "pest_generator", @@ -5158,26 +5287,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.6.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" +checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] name = "pest_meta" -version = "2.6.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" +checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" dependencies = [ "once_cell", "pest", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -5192,22 +5321,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] @@ -5218,9 +5347,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "2c516611246607d0c04186886dbb3a754368ef82c79e9827a802c6d836dd111c" [[package]] name = "pin-utils" @@ -5263,12 +5392,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", "windows-sys 0.48.0", ] @@ -5618,9 +5747,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.58" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -5757,9 +5886,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.27" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -5830,7 +5959,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -5904,7 +6033,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -5913,7 +6042,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -5922,29 +6051,29 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "redox_syscall 0.2.16", "thiserror", ] [[package]] name = "ref-cast" -version = "1.0.16" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43faa91b1c8b36841ee70e97188a869d37ae21759da6846d4be66de5bf7b12c" +checksum = "61ef7e18e8841942ddb1cf845054f8008410030a3997875d9e49b7a363063df1" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.16" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" +checksum = "2dfaf0c85b766276c797f3791f5bc6d5bd116b41d53049af2789666b0c0bc9fa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] @@ -5961,13 +6090,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ - "aho-corasick 1.0.1", + "aho-corasick", "memchr", - "regex-syntax 0.7.1", + "regex-automata 0.3.6", + "regex-syntax 0.7.4", ] [[package]] @@ -5979,6 +6109,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.4", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -5987,9 +6128,46 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" + +[[package]] +name = "reqwest" +version = "0.11.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +dependencies = [ + "base64 0.21.2", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite 0.2.11", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.10.1", +] [[package]] name = "resolv-conf" @@ -6033,7 +6211,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -6157,16 +6335,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.17", + "semver 1.0.18", ] [[package]] name = "rustix" -version = "0.35.13" +version = "0.35.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" +checksum = "6380889b07a03b5ecf1d44dc9ede6fd2145d84b502a2a9ca0b03c48e0cc3220f" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno 0.2.8", "io-lifetimes 0.7.5", "libc", @@ -6176,15 +6354,28 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" +dependencies = [ + "bitflags 1.3.2", + "errno 0.3.2", + "io-lifetimes 1.0.11", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" dependencies = [ - "bitflags", - "errno 0.3.1", - "io-lifetimes 1.0.10", + "bitflags 2.3.3", + "errno 0.3.2", "libc", - "linux-raw-sys 0.3.7", + "linux-raw-sys 0.4.5", "windows-sys 0.48.0", ] @@ -6202,9 +6393,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -6214,18 +6405,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", ] [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rw-stream-sink" @@ -6240,9 +6431,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -6626,7 +6817,7 @@ dependencies = [ "libc", "log", "once_cell", - "rustix 0.35.13", + "rustix 0.35.14", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -6714,7 +6905,7 @@ dependencies = [ "array-bytes", "async-trait", "asynchronous-codec", - "bitflags", + "bitflags 1.3.2", "bytes", "cid", "either", @@ -6779,7 +6970,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.36#cb4f2491b00af7d7817f3a54209c26b20faa1f51" dependencies = [ "async-trait", - "bitflags", + "bitflags 1.3.2", "bytes", "futures", "futures-timer", @@ -7245,9 +7436,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.7.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf" +checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" dependencies = [ "bitvec", "cfg-if", @@ -7259,9 +7450,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" +checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7271,11 +7462,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -7298,15 +7489,15 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scratch" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" [[package]] name = "sct" @@ -7361,11 +7552,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -7374,9 +7565,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -7393,9 +7584,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" dependencies = [ "serde", ] @@ -7408,29 +7599,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" dependencies = [ "itoa", "ryu", @@ -7446,6 +7637,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha-1" version = "0.9.8" @@ -7486,13 +7689,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -7513,7 +7716,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "keccak", ] @@ -7547,7 +7750,7 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "rand_core 0.6.4", ] @@ -7618,9 +7821,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "snap" @@ -7641,7 +7844,7 @@ dependencies = [ "rand_core 0.6.4", "ring", "rustc_version", - "sha2 0.10.6", + "sha2 0.10.7", "subtle", ] @@ -7655,6 +7858,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "soketto" version = "0.7.1" @@ -7883,7 +8096,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.36#cb dependencies = [ "array-bytes", "base58", - "bitflags", + "bitflags 1.3.2", "blake2", "byteorder", "dyn-clonable", @@ -7928,8 +8141,8 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.36#cb dependencies = [ "blake2", "byteorder", - "digest 0.10.6", - "sha2 0.10.6", + "digest 0.10.7", + "sha2 0.10.7", "sha3 0.10.8", "sp-std", "twox-hash", @@ -8389,9 +8602,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.40.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47a8ad42e5fc72d5b1eb104a5546937eaf39843499948bb666d6e93c62423b" +checksum = "bfc443bad666016e012538782d9e3006213a7db43e9fb1dda91657dc06a6fa08" dependencies = [ "Inflector", "num-format", @@ -8467,6 +8680,7 @@ dependencies = [ "stbl-cli-authorship", "stbl-core-primitives", "stbl-primitives-fee-compatible-api", + "stbl-primitives-zero-gas-transactions-api", "stbl-tools", "substrate-build-script-utils", "substrate-frame-rpc-system", @@ -8499,6 +8713,7 @@ dependencies = [ "sp-core", "sp-runtime", "stability-rpc-api", + "stbl-primitives-zero-gas-transactions-api", "substrate-test-runtime-client", "tokio", ] @@ -8560,6 +8775,7 @@ dependencies = [ "pallet-user-fee-selector", "pallet-validator-fee-selector", "pallet-validator-set", + "pallet-zero-gas-transactions", "parity-scale-codec", "precompile-fee-rewards-vault-controller", "precompile-fee-token-selector", @@ -8588,6 +8804,7 @@ dependencies = [ "stability-rpc-api", "stbl-core-primitives", "stbl-primitives-fee-compatible-api", + "stbl-primitives-zero-gas-transactions-api", "stbl-tools", "stbl-transaction-validator", "substrate-wasm-builder", @@ -8631,7 +8848,9 @@ dependencies = [ "log", "memory-db", "pallet-babe", + "pallet-ethereum", "pallet-timestamp", + "pallet-zero-gas-transactions", "parity-scale-codec", "sc-block-builder", "sc-executor", @@ -8663,6 +8882,7 @@ dependencies = [ "stability-test-runtime-client", "stbl-core-primitives", "stbl-primitives-fee-compatible-api", + "stbl-primitives-zero-gas-transactions-api", "substrate-wasm-builder", "trie-db", ] @@ -8703,7 +8923,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg_aliases", "libc", "parking_lot 0.11.2", @@ -8743,11 +8963,15 @@ name = "stbl-cli-authorship" version = "1.0.0" dependencies = [ "account", + "bytes", + "ethereum", "futures", "futures-timer", + "hex", "log", "parity-scale-codec", "parking_lot 0.12.1", + "reqwest", "sc-block-builder", "sc-client-api", "sc-proposer-metrics", @@ -8755,6 +8979,7 @@ dependencies = [ "sc-telemetry", "sc-transaction-pool", "sc-transaction-pool-api", + "serde", "sp-api", "sp-blockchain", "sp-consensus", @@ -8766,6 +8991,8 @@ dependencies = [ "stability-runtime", "stability-test-runtime-client", "stbl-primitives-fee-compatible-api", + "stbl-primitives-zero-gas-transactions-api", + "stbl-tools", "substrate-prometheus-endpoint", ] @@ -8791,6 +9018,17 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "stbl-primitives-zero-gas-transactions-api" +version = "1.0.0" +dependencies = [ + "fp-ethereum", + "parity-scale-codec", + "sp-api", + "sp-runtime", + "sp-std", +] + [[package]] name = "stbl-tools" version = "0.1.0" @@ -9058,9 +9296,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.16" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", @@ -9085,7 +9323,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "system-configuration-sys", ] @@ -9108,21 +9346,21 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.7" +version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" +checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "tempfile" -version = "3.5.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ "cfg-if", - "fastrand", + "fastrand 2.0.0", "redox_syscall 0.3.5", - "rustix 0.37.19", - "windows-sys 0.45.0", + "rustix 0.38.7", + "windows-sys 0.48.0", ] [[package]] @@ -9142,22 +9380,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] @@ -9187,9 +9425,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.5.3+5.3.0-patched" +version = "0.5.4+5.3.0-patched" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a678df20055b43e57ef8cddde41cdfda9a3c1a060b67f4c5836dfb1d78543ba8" +checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" dependencies = [ "cc", "libc", @@ -9251,19 +9489,20 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.1" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", "num_cpus", "parking_lot 0.12.1", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", "signal-hook-registry", - "socket2", + "socket2 0.4.9", "tokio-macros", "windows-sys 0.48.0", ] @@ -9276,7 +9515,17 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", ] [[package]] @@ -9297,7 +9546,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", "tokio", ] @@ -9311,7 +9560,7 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", "tokio", "tracing", ] @@ -9342,14 +9591,14 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytes", "futures-core", "futures-util", "http", "http-body", "http-range-header", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", "tower-layer", "tower-service", ] @@ -9374,20 +9623,20 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "log", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.11", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] @@ -9539,9 +9788,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "trybuild" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501dbdbb99861e4ab6b60eb6a7493956a9defb644fd034bc4a5ef27c693c8a3a" +checksum = "a84e0202ea606ba5ebee8507ab2bfbe89b98551ed9b8f0be198109275cff284b" dependencies = [ "basic-toml", "glob", @@ -9565,7 +9814,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "digest 0.10.6", + "digest 0.10.7", "rand 0.8.5", "static_assertions", ] @@ -9578,9 +9827,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "uint" @@ -9602,9 +9851,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -9663,12 +9912,12 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", - "idna 0.3.0", + "idna 0.4.0", "percent-encoding", ] @@ -9720,11 +9969,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -9748,9 +9996,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -9758,24 +10006,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -9785,9 +10033,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -9795,22 +10043,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-instrument" @@ -9968,7 +10216,7 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix 0.35.13", + "rustix 0.35.14", "serde", "sha2 0.9.9", "toml", @@ -10031,7 +10279,7 @@ dependencies = [ "log", "object 0.29.0", "rustc-demangle", - "rustix 0.35.13", + "rustix 0.35.14", "serde", "target-lexicon", "thiserror", @@ -10049,7 +10297,7 @@ checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" dependencies = [ "object 0.29.0", "once_cell", - "rustix 0.35.13", + "rustix 0.35.14", ] [[package]] @@ -10069,7 +10317,7 @@ dependencies = [ "memoffset 0.6.5", "paste", "rand 0.8.5", - "rustix 0.35.13", + "rustix 0.35.14", "thiserror", "wasmtime-asm-macros", "wasmtime-environ", @@ -10091,9 +10339,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -10131,9 +10379,9 @@ dependencies = [ [[package]] name = "widestring" -version = "0.5.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" [[package]] name = "winapi" @@ -10185,7 +10433,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -10231,7 +10479,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -10251,9 +10499,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -10417,6 +10665,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "wyz" version = "0.5.1" @@ -10493,7 +10751,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.28", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3cdc83fb..97606e51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ members = [ 'precompiles/upgrade-runtime-controller', 'primitives/tools', 'primitives/fee-compatible-api', + 'primitives/zero-gas-transactions-api', 'primitives/stability-rpc-api', 'pallets/erc20-manager', 'pallets/dnt-fee-controller', @@ -66,6 +67,7 @@ futures-timer = "3.0.1" log = "0.4.17" parking_lot = "0.12.1" array-bytes = "4.1" +bytes = "1.0" async-trait = "0.1.57" cfg-if = "1.0" memory-db = { version = "0.31.0", default-features = false } @@ -190,6 +192,8 @@ precompile-validator-controller = { path = "./precompiles/validator-controller", pallet-root-controller = { path = "./pallets/root-controller", default-features = false } pallet-dnt-fee-controller = { path = "./pallets/dnt-fee-controller", default-features = false } pallet-sponsored-transactions = { path = "./pallets/sponsored-transactions", default-features = false } +pallet-zero-gas-transactions = { path = "./pallets/zero-gas-transactions", default-features = false } +stbl-primitives-zero-gas-transactions-api = { path = "./primitives/zero-gas-transactions-api", default-features = false } stbl-primitives-fee-compatible-api = { path = "./primitives/fee-compatible-api", default-features = false } pallet-erc20-manager = { path = "./pallets/erc20-manager", default-features = false } pallet-upgrade-runtime-proposal = { path = "./pallets/upgrade-runtime-proposal", default-features = false } @@ -218,4 +222,5 @@ parity-scale-codec = { version = "3.0.0", default-features = false, features = [ sha3 = { version = "0.9", default-features = false } stability-rpc = { path = "./stability-rpc", default-features = false } stability-rpc-api = { path = "./primitives/stability-rpc-api", default-features = false } -stbl-transaction-validator = { path = "./primitives/transaction-validator", default-features = false } \ No newline at end of file +stbl-transaction-validator = { path = "./primitives/transaction-validator", default-features = false } +reqwest = { version = "0.11", features = ["json"] } \ No newline at end of file diff --git a/client/authorship/Cargo.toml b/client/authorship/Cargo.toml index ac26fd4b..39c055a2 100644 --- a/client/authorship/Cargo.toml +++ b/client/authorship/Cargo.toml @@ -30,10 +30,17 @@ sp-inherents = { workspace = true } sp-keyring = { workspace = true } sp-runtime = { workspace = true } stbl-primitives-fee-compatible-api = { workspace = true, features = ["std"] } +stbl-primitives-zero-gas-transactions-api = { workspace = true, features = ["std"] } +stbl-tools = { workspace = true } +ethereum = { workspace = true } sp-keystore = { workspace = true } stability-runtime = { path = "./../../runtime", features = ["std"] } sc-service = { workspace = true } account = { workspace = true, features = ["std"] } +reqwest = { workspace = true, features = ["json"] } +serde = { workspace = true, features = ["derive"] } +bytes = { workspace = true } +hex = { workspace = true } [dev-dependencies] parking_lot = { workspace = true } diff --git a/client/authorship/src/authorship.rs b/client/authorship/src/authorship.rs index 227d44fb..ee5ccbd1 100644 --- a/client/authorship/src/authorship.rs +++ b/client/authorship/src/authorship.rs @@ -42,6 +42,7 @@ use sp_runtime::{ Digest, Percent, SaturatedConversion, }; use stability_runtime::AccountId; +use stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi; use std::{marker::PhantomData, pin::Pin, sync::Arc, time}; use prometheus_endpoint::Registry as PrometheusRegistry; @@ -61,6 +62,12 @@ pub const DEFAULT_BLOCK_SIZE_LIMIT: usize = 4 * 1024 * 1024 + 512; const DEFAULT_SOFT_DEADLINE_PERCENT: Percent = Percent::from_percent(50); + +#[derive(serde::Deserialize)] +pub struct RawZeroGasTransactionResponse { + transactions: Vec, +} + /// [`Proposer`] factory. pub struct ProposerFactory { spawn_handle: Box, @@ -71,6 +78,10 @@ pub struct ProposerFactory { /// Reference to Keystore keystore: SyncCryptoStorePtr, + + /// HTTP URL of the private pool from which the node will retrieve zero-gas transactions + zero_gas_tx_pool: Option, + /// Prometheus Link, metrics: PrometheusMetrics, /// The default block size limit. @@ -103,6 +114,7 @@ impl ProposerFactory { client: Arc, transaction_pool: Arc, keystore: SyncCryptoStorePtr, + zero_gas_tx_pool: Option, prometheus: Option<&PrometheusRegistry>, telemetry: Option, ) -> Self { @@ -110,6 +122,7 @@ impl ProposerFactory { spawn_handle: Box::new(spawn_handle), transaction_pool, keystore, + zero_gas_tx_pool, metrics: PrometheusMetrics::new(prometheus), default_block_size_limit: DEFAULT_BLOCK_SIZE_LIMIT, soft_deadline_percent: DEFAULT_SOFT_DEADLINE_PERCENT, @@ -133,6 +146,7 @@ impl ProposerFactory { client: Arc, transaction_pool: Arc, keystore: SyncCryptoStorePtr, + zero_gas_tx_pool: Option, prometheus: Option<&PrometheusRegistry>, telemetry: Option, ) -> Self { @@ -141,6 +155,7 @@ impl ProposerFactory { spawn_handle: Box::new(spawn_handle), transaction_pool, keystore, + zero_gas_tx_pool, metrics: PrometheusMetrics::new(prometheus), default_block_size_limit: DEFAULT_BLOCK_SIZE_LIMIT, soft_deadline_percent: DEFAULT_SOFT_DEADLINE_PERCENT, @@ -220,6 +235,7 @@ where parent_number: *parent_header.number(), transaction_pool: self.transaction_pool.clone(), keystore: self.keystore.clone(), + zero_gas_tx_pool: self.zero_gas_tx_pool.clone(), now, metrics: self.metrics.clone(), default_block_size_limit: self.default_block_size_limit, @@ -246,7 +262,8 @@ where + 'static, C::Api: ApiExt> + BlockBuilderApi - + stbl_primitives_fee_compatible_api::CompatibleFeeApi, + + stbl_primitives_fee_compatible_api::CompatibleFeeApi + + stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi, PR: ProofRecording, { type CreateProposer = future::Ready>; @@ -268,6 +285,7 @@ pub struct Proposer { parent_number: <::Header as HeaderT>::Number, transaction_pool: Arc, keystore: SyncCryptoStorePtr, + zero_gas_tx_pool: Option, now: Box time::Instant + Send + Sync>, metrics: PrometheusMetrics, default_block_size_limit: usize, @@ -290,7 +308,8 @@ where + 'static, C::Api: ApiExt> + BlockBuilderApi - + stbl_primitives_fee_compatible_api::CompatibleFeeApi, + + stbl_primitives_fee_compatible_api::CompatibleFeeApi + + stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi, PR: ProofRecording, { type Transaction = backend::TransactionFor; @@ -351,7 +370,8 @@ where + 'static, C::Api: ApiExt> + BlockBuilderApi - + stbl_primitives_fee_compatible_api::CompatibleFeeApi, + + stbl_primitives_fee_compatible_api::CompatibleFeeApi + + stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi, PR: ProofRecording, { async fn propose_with( @@ -406,11 +426,190 @@ where let left = deadline.saturating_duration_since(now); let left_micros: u64 = left.as_micros().saturated_into(); let soft_deadline = - now + time::Duration::from_micros(self.soft_deadline_percent.mul_floor(left_micros)); + now + time::Duration::from_micros(self.soft_deadline_percent.mul_floor(left_micros)); let block_timer = time::Instant::now(); + let mut transaction_pushed = false; let mut skipped = 0; - let mut unqueue_invalid = Vec::new(); + let block_size_limit = block_size_limit.unwrap_or(self.default_block_size_limit); + + + // First we try to push transactions from the zero gas transaction pool + + let raw_zero_gas_transactions_option = if let Some(zero_gas_tx_pool) = self.zero_gas_tx_pool { + + let mut request = Box::pin(reqwest::get(zero_gas_tx_pool).fuse()); + let mut timeout = Box::pin(futures_timer::Delay::new(std::time::Duration::from_millis(100)).fuse()); + + + let result_response_raw_zero = select! { + res = request => { + match res { + Ok(response) => Ok(response), + Err(e) => { + error!("Error getting response from zero gas transaction pool: {}", e); + Err("Error getting response from zero gas transaction pool") + } + } + }, + _ = timeout => { + error!( + "Timeout fired waiting for get transaction from zero gas transaction pool" + ); + Err("Timeout fired waiting for get transaction from zero gas transaction pool") + }, + }; + + match result_response_raw_zero { + Ok(response) => { + match response.json::().await { + Ok(json) => Some(json), + Err(e) => { + error!("Error parsing JSON response from zero gas transaction pool: {}", e); + None + } + } + }, + Err(e) => { + error!("Error getting response from zero gas transaction pool: {}", e); + None + } + } + } else { + None + }; + + + + // If we pull successfully from the zero gas transaction pool, we will try to push them to the block + + if let Some(raw_zero_gas_transactions) = raw_zero_gas_transactions_option { + let mut pending_raw_zero_gas_transactions = raw_zero_gas_transactions.transactions.into_iter(); + + loop { + let pending_hex_string_tx = if let Some(tx) = pending_raw_zero_gas_transactions.next() { + tx + } else { + break EndProposingReason::NoMoreTransactions; + }; + + let now = (self.now)(); + if now > deadline { + debug!( + "Consensus deadline reached when pushing block transactions, \ + proceeding with proposing." + ); + break EndProposingReason::HitDeadline; + } + + let pending_raw_tx = if let Ok(pending_raw_tx) = hex::decode(pending_hex_string_tx) { + pending_raw_tx + } + else { + continue; + }; + + let ethereum_transaction: ethereum::TransactionV2 = ethereum::EnvelopedDecodable::decode(&pending_raw_tx).unwrap(); + + + let keys = SyncCryptoStore::ecdsa_public_keys( + &*self.keystore, + KeyTypeId::try_from("aura").unwrap_or_default(), + ); + + + let public = keys[0].clone().into(); + let hash = ethereum_transaction.hash(); + let hash_string = hex::encode(hash.as_bytes()); + + + let mut message: Vec = Vec::new(); + message.extend_from_slice(b"I consent to validate the transaction for free: 0x"); + message.extend_from_slice(hash_string.as_bytes()); + + let eip191_message = stbl_tools::eth::build_eip191_message_hash(message.clone()); + + let signed_hash_option = SyncCryptoStore::ecdsa_sign_prehashed( + &*self.keystore, + KeyTypeId::try_from("aura").unwrap_or_default(), + &public, + &eip191_message.as_fixed_bytes(), + ).expect("Could not sign the Ethereum transaction hash"); + + let signed_hash = if let Some(signed_hash) = signed_hash_option { + signed_hash + } + else { + continue; + }; + let pending_tx = if let Ok(pending_tx) = self + .client + .runtime_api() + .convert_zero_gas_transaction(&self.parent_id, ethereum_transaction.clone(), signed_hash.0.to_vec()) { + pending_tx + } + else { + continue; + }; + + + + let block_size = + block_builder.estimate_block_size(self.include_proof_in_block_size_estimation); + + if block_size + pending_tx.encoded_size() > block_size_limit { + if skipped < MAX_SKIPPED_TRANSACTIONS { + skipped += 1; + debug!( + "Transaction would overflow the block size limit, \ + but will try {} more transactions before quitting.", + MAX_SKIPPED_TRANSACTIONS - skipped, + ); + continue; + } else if now < soft_deadline { + debug!( + "Transaction would overflow the block size limit, \ + but we still have time before the soft deadline, so \ + we will try a bit more." + ); + continue; + } else { + debug!("Reached block size limit, proceeding with proposing."); + break EndProposingReason::HitBlockSizeLimit; + } + } + + trace!("[{:?}] Pushing to the block.", ethereum_transaction.hash()); + match sc_block_builder::BlockBuilder::push(&mut block_builder, pending_tx) { + Ok(()) => { + transaction_pushed = true; + debug!("[{:?}] Pushed to the block.", ethereum_transaction.hash()); + } + Err(ApplyExtrinsicFailed(Validity(e))) if e.exhausted_resources() => { + if skipped < MAX_SKIPPED_TRANSACTIONS { + skipped += 1; + debug!( + "Block seems full, but will try {} more transactions before quitting.", + MAX_SKIPPED_TRANSACTIONS - skipped, + ); + } else if (self.now)() < soft_deadline { + debug!( + "Block seems full, but we still have time before the soft deadline, \ + so we will try a bit more before quitting." + ); + } else { + debug!("Reached block weight limit, proceeding with proposing."); + break EndProposingReason::HitBlockWeightLimit; + } + } + Err(e) => { + debug!("[{:?}] Invalid transaction: {}", ethereum_transaction.hash(), e); + } + } + }; + } + + let mut unqueue_invalid = Vec::new(); let mut t1 = self.transaction_pool.ready_at(self.parent_number).fuse(); let mut t2 = futures_timer::Delay::new(deadline.saturating_duration_since((self.now)()) / 8).fuse(); @@ -427,7 +626,6 @@ where }, }; - let block_size_limit = block_size_limit.unwrap_or(self.default_block_size_limit); let keys = SyncCryptoStore::ecdsa_public_keys( &*self.keystore, @@ -438,10 +636,10 @@ where debug!("Attempting to push transactions from the pool."); debug!("Pool status: {:?}", self.transaction_pool.status()); - let mut transaction_pushed = false; let end_reason = loop { - let pending_tx = if let Some(pending_tx) = pending_iterator.next() { + + let pending_tx = if let Some(pending_tx) = pending_iterator.next() { pending_tx } else { break EndProposingReason::NoMoreTransactions; @@ -537,6 +735,7 @@ where } }; + if matches!(end_reason, EndProposingReason::HitBlockSizeLimit) && !transaction_pushed { warn!( "Hit block size limit of `{}` without including any transaction!", @@ -708,6 +907,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let cell = Mutex::new((false, time::Instant::now())); @@ -770,6 +970,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let cell = Mutex::new((false, time::Instant::now())); @@ -838,6 +1039,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let proposer = proposer_factory.init_with_now( @@ -924,6 +1126,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let mut propose_block = |client: &TestClient, @@ -1038,6 +1241,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let proposer = block_on(proposer_factory.init(&genesis_header)).unwrap(); @@ -1073,6 +1277,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let proposer = block_on(proposer_factory.init(&genesis_header)).unwrap(); @@ -1150,6 +1355,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let cell = Mutex::new(time::Instant::now()); @@ -1234,6 +1440,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let deadline = time::Duration::from_secs(600); @@ -1311,6 +1518,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let proposer = block_on(proposer_factory.init(&genesis_header)).unwrap(); @@ -1362,6 +1570,7 @@ mod tests { keystore_container.sync_keystore(), None, None, + None, ); let proposer = block_on(proposer_factory.init(&genesis_header)).unwrap(); diff --git a/docker/alphanet/entrypoint.sh b/docker/alphanet/entrypoint.sh index d1a03a80..d1d024e6 100644 --- a/docker/alphanet/entrypoint.sh +++ b/docker/alphanet/entrypoint.sh @@ -23,7 +23,7 @@ if [ -n "$SEED" ]; then fi -START_COMMAND="./target/release/stability --base-path /tmp/node --validator --unsafe-rpc-external --rpc-cors all --unsafe-ws-external --chain alphanet --pruning archive" +START_COMMAND="./target/release/stability --base-path /tmp/node --validator --unsafe-rpc-external --rpc-cors all --unsafe-ws-external --chain alphanet --pruning archive --prometheus-external" if [ -n "$NODE_KEY" ]; then START_COMMAND="$START_COMMAND --node-key $NODE_KEY" diff --git a/docker/monitoring/docker-compose.yml b/docker/monitoring/docker-compose.yml new file mode 100644 index 00000000..2553130b --- /dev/null +++ b/docker/monitoring/docker-compose.yml @@ -0,0 +1,48 @@ +version: '3.8' + +networks: + monitoring: + driver: bridge + +volumes: + prometheus_data: {} + grafana_data: {} + +services: + prometheus: + image: prom/prometheus:latest + container_name: prometheus + restart: unless-stopped + volumes: + - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml + - prometheus_data:/prometheus + command: + - '--config.file=/etc/prometheus/prometheus.yml' + - '--storage.tsdb.path=/prometheus' + - '--web.console.libraries=/etc/prometheus/console_libraries' + - '--web.console.templates=/etc/prometheus/consoles' + - '--web.enable-lifecycle' + ports: + - 9090:9090 + networks: + - monitoring + extra_hosts: + - "host.docker.internal:host-gateway" + + grafana: + image: grafana/grafana + restart: always + environment: + GF_INSTALL_PLUGINS: 'grafana-clock-panel,grafana-simple-json-datasource' + GF_SECURITY_ADMIN_PASSWORD: 'admin' + GF_USERS_ALLOW_SIGN_UP: false + volumes: + # - ./grafana:/var/lib/grafana + - grafana_data:/var/lib/grafana + - ./grafana/provisioning/:/etc/grafana/provisioning/ + ports: + - 3000:3000 + depends_on: + - prometheus + networks: + - monitoring \ No newline at end of file diff --git a/docker/monitoring/grafana/provisioning/dashboards/dashboard.yml b/docker/monitoring/grafana/provisioning/dashboards/dashboard.yml new file mode 100644 index 00000000..22ef1cff --- /dev/null +++ b/docker/monitoring/grafana/provisioning/dashboards/dashboard.yml @@ -0,0 +1,11 @@ +apiVersion: 1 + +providers: + - name: "Prometheus" + orgId: 1 + folder: "" + type: file + disableDeletion: false + editable: true + options: + path: /etc/grafana/provisioning/dashboards diff --git a/docker/monitoring/grafana/provisioning/dashboards/substrate.json b/docker/monitoring/grafana/provisioning/dashboards/substrate.json new file mode 100644 index 00000000..a80d68ac --- /dev/null +++ b/docker/monitoring/grafana/provisioning/dashboards/substrate.json @@ -0,0 +1,494 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Grafana dashboard for substrate template metrics. Instructions on use: https://docs.substrate.io//tutorials/build-a-blockchain/monitor-node-metrics/", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 11784, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "What your node sees as the highest block (NOT finalized)", + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-yellow", + "value": null + } + ] + } + }, + "overrides": [] + }, + "id": 12, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "/^Height\\(best\\)$/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "substrate_block_height{status=\"best\"}", + "interval": "", + "legendFormat": "Height(best)", + "refId": "A" + } + ], + "title": "Block Height (best)", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "What your node sees as the highest finalized block ( less than or equal to best)", + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 6, + "y": 0 + }, + "id": 13, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "textMode": "value" + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "substrate_block_height{status=\"finalized\"}", + "interval": "", + "legendFormat": "Height(finalized)", + "refId": "A" + } + ], + "title": "Block Height (finalized)", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "Total transactions in best block", + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "yellow", + "value": 100 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 0, + "y": 3 + }, + "id": 16, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "substrate_proposer_number_of_transactions", + "interval": "", + "legendFormat": "Height(best)", + "refId": "A" + } + ], + "title": "Block Total Tx", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "What your node sees as the highest finalized block ( less than or equal to best)", + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "yellow", + "value": 500000 + }, + { + "color": "red", + "value": 1000000 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 6, + "y": 3 + }, + "id": 17, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "textMode": "value" + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "substrate_state_cache_bytes", + "format": "time_series", + "interval": "", + "legendFormat": "Size (bytes)", + "refId": "A" + } + ], + "title": "State Cashe (bytes)", + "type": "stat" + }, + { + "aliasColors": {}, + "bars": true, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "Number of connected peers", + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 6 + }, + "hiddenSeries": false, + "id": 10, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.3", + "pointradius": 2, + "points": true, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "substrate_sub_libp2p_peers_count", + "instant": false, + "interval": "", + "legendFormat": "Number of network gossip peers", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "LibP2P peers", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:673", + "decimals": 0, + "format": "none", + "label": "Peers", + "logBase": 1, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:674", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "histogram 90th quantiles for time to construct a block (seconds) More info: https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile", + "fill": 1, + "fillGradient": 8, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 14 + }, + "hiddenSeries": false, + "id": 15, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.3", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "histogram_quantile(0.90, sum(rate(substrate_proposer_block_constructed_bucket[5m])) by (le))", + "format": "time_series", + "instant": false, + "interval": "", + "legendFormat": "90th quantile for block construction time (s)", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Proposer Block Construction Time", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:517", + "format": "short", + "label": "Time (s)", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:518", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "refresh": "5s", + "schemaVersion": 38, + "style": "dark", + "tags": [ + "substrate", + "blockchain", + "node", + "template", + "polkadot", + "kusama" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "Substrate Node Template Metrics", + "uid": "PUYzGbwWz", + "version": 1, + "weekStart": "" +} \ No newline at end of file diff --git a/docker/monitoring/grafana/provisioning/datasources/datasource.yml b/docker/monitoring/grafana/provisioning/datasources/datasource.yml new file mode 100644 index 00000000..e84213b4 --- /dev/null +++ b/docker/monitoring/grafana/provisioning/datasources/datasource.yml @@ -0,0 +1,50 @@ +# config file version +apiVersion: 1 + +# list of datasources that should be deleted from the database +deleteDatasources: + - name: Prometheus + orgId: 1 + +# list of datasources to insert/update depending +# whats available in the database +datasources: + # name of the datasource. Required + - name: Prometheus + # datasource type. Required + type: prometheus + # access mode. direct or proxy. Required + access: proxy + # org id. will default to orgId 1 if not specified + orgId: 1 + # url + url: http://prometheus:9090 + # database password, if used + password: + # database user, if used + user: + # database name, if used + database: + # enable/disable basic auth + basicAuth: false + # basic auth username, if used + basicAuthUser: + # basic auth password, if used + basicAuthPassword: + # enable/disable with credentials headers + withCredentials: + # mark as default datasource. Max one per org + isDefault: true + # fields that will be converted to json and stored in json_data + jsonData: + graphiteVersion: "1.1" + tlsAuth: false + tlsAuthWithCACert: false + # json object of data that will be encrypted. + secureJsonData: + tlsCACert: "..." + tlsClientCert: "..." + tlsClientKey: "..." + version: 1 + # allow users to edit datasources from the UI. + editable: true diff --git a/docker/monitoring/prometheus/prometheus.yml b/docker/monitoring/prometheus/prometheus.yml new file mode 100644 index 00000000..8f25e565 --- /dev/null +++ b/docker/monitoring/prometheus/prometheus.yml @@ -0,0 +1,6 @@ +# A scrape configuration containing exactly one endpoint to scrape: +scrape_configs: + - job_name: "substrate_node" + scrape_interval: 5s + static_configs: + - targets: ["host.docker.internal:9615"] diff --git a/docs/GETTING-STARTED.md b/docs/GETTING-STARTED.md new file mode 100644 index 00000000..ca028f7d --- /dev/null +++ b/docs/GETTING-STARTED.md @@ -0,0 +1,78 @@ +## Table of Contents + +1. [Introduction](#introduction) +2. [Generating Keys](#generating-keys) +3. [Insert Keys in the Node](#) +4. [Running a Stability Validator Node](#running-a-stability-validator-node) + +--- + +## Introduction + +In this README, we'll provide initial instructions for booting a Stability node. + +## Generating Keys + +A Stability node uses 3 keys to operate: + +1. ECDSA key for ImOnline Pallet +2. ECDSA key for Aura (Stability's consensus mechanism) +3. ED25519 key for Grandpa (Stability's finality mechanism) + +At Stability, we recommend generating a single SEED for all these keys and using it to produce all the necessary keys from it. + +To generate a SEED, you can either use a reliable SEED generation service (ensure its safety) or use the Stability node itself, which incorporates a SEED generation mechanism. To achieve this, execute the following command: + +```sh +./target/release/stability key generate +``` + +This command will produce the SEED. + +## Insert Keys in the Node + +To insert the keys using the seed previously generated, use the following script + +```sh + ## TO RUN THIS COMMAND YOU SHOULD DEFINE + ## $SEED - Seed phrase from which Stability keys are derived + ## $PATH - Path where you save your node data + ./target/release/stability key insert \ + --keystore-path $PATH/chains/alphanet/keystore \ + --base-path $PATH \ + --scheme ecdsa \ + --suri "$SEED" \ + --key-type aura + + ./target/release/stability key insert \ + --keystore-path $PATH/chains/alphanet/keystore \ + --base-path $PATH \ + --scheme Ed25519 \ + --suri "$SEED" \ + --key-type gran + + ./target/release/stability key insert \ + --keystore-path $PATH/chains/alphanet/keystore \ + --base-path $PATH \ + --scheme ecdsa \ + --suri "$SEED" \ + --key-type imon +``` + +With this, you will have inserted the keys into the node, ready to run a Stability validator. + +## Running a Stability Validator Node + +To run a Stability node, execute the following command: + +```sh +./target/release/stability --chain alphanet +``` + +Additionally, you can configure the following flags: + +- `--validator`: Assumes that you are a validator and begins validation if you are on the validators' list. +- `--pruning archive`: Runs your node in archival mode. An archival node maintains a complete copy and allows queries on any historical chain state. +- `--unsafe-rpc-external --rpc-cors all --unsafe-ws-external`: Use if your node will be accessed from a system external to your localhost. +- `--bootnodes`: A list of p2p nodes for Stability to join the network. What is known as bootnodes +- `--base-path`: Specifies a custom base path for the data folder diff --git a/docs/MONITORING.md b/docs/MONITORING.md new file mode 100644 index 00000000..a4f19c9e --- /dev/null +++ b/docs/MONITORING.md @@ -0,0 +1,33 @@ +# Monitoring + +Substrate provides detailed metrics about your network's operations, these metrics can help to have insights about the number of peers connects, block finalized, peaks of transactions, among others. + +The client presents telemetry in a format compatible with a Prometheus endpoint. This allows for its visualization through charts or integration with Grafana dashboards. + +This guide focuses solely on configuring a local environment to monitor our development chain. For additional details, please refer to the provided link. + +- https://docs.substrate.io/tutorials/build-a-blockchain/monitor-node-metrics/ + +## Quick start + +To monitor your local client, we offer a `docker-compose` file that facilitates the setup of both `grafana` and `prometheus` services: + +- Prometheus is an open-source tool tailored for monitoring and alerting in cloud-native ecosystems. It gathers and retains metrics, and features an API that can be tapped by other applications, such as dashboards. +- Grafana aids in visualizing the collected monitoring data. It offers tools to craft charts and tables, enhancing business intelligence operations. + +For this last one, we also offer a pre-set dashboard that displays various metrics sourced from Substrate. + +To begin with, we'll execute the `docker-compose` that houses the two previously mentioned services. + +```bash +$ docker-compose -f docker/monitoring/docker-compose.yml +``` + +After it's up and running, proceed to launch the client with the `--prometheus-external` flag activated. The client metrics can be viewed at: http://localhost:9165/metrics + +At this point, we're all set to begin monitoring the node. To do this, access Grafana locally via: http://localhost:3000. +The username and password are both set to `admin`. + +You can locate the pre-configured dashboard by navigating to the left menu and selecting **Dashboards > General**. + +![screenshot](https://docs.substrate.io/static/0e72182eb3c2bcb4c4d4112729e9b39a/1c7bd/grafana-template-dashboard.avif) diff --git a/docs/README.md b/docs/README.md index 773a6989..2dda9763 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,6 @@ # Docs +- [Getting Started](./GETTING-STARTED.md) - [Decentralized native token](./DECENTRALIZED-NATIVE-TOKEN.md) - [Council](COUNCIL.md) - [Parameters](PARAMETERS.md) @@ -9,5 +10,6 @@ - [Transaction sorting](TRANSACTION-SORTING.md) - [Unified Accounts](UNIFIED-ACCOUNTS.md) - [Sponsored Transactions](SPONSORED-TRANSACTIONS.md) +- [Zero Gas Transactions](ZERO-GAS-TRANSACTIONS.md) - [Custom RPCs](RPC.md) - [Validator connection handling](VALIDATOR-CONNECTION-HANDLING.md) diff --git a/docs/ZERO-GAS-TRANSACTIONS.md b/docs/ZERO-GAS-TRANSACTIONS.md new file mode 100644 index 00000000..00b3f3e1 --- /dev/null +++ b/docs/ZERO-GAS-TRANSACTIONS.md @@ -0,0 +1,41 @@ +# Zero Gas Transactions + +- [1. Introduction](#1-introduction) +- [2. How do Zero Gas Transactions work?](#2-how-do-zero-gas-transactions-work) + - [External Private Mempool](#external-private-mempool) + - [Setting up the External Mempool for Validators](#setting-up-the-external-mempool-for-validators) +- [3. Other considerations](#3-other-considerations) + +## 1. Introduction + +Zero Gas Transactions represent an innovative type of transaction developed in Stability. Their main appeal lies in their ability to execute without incurring gas fees. Moreover, these transactions are stored in a private mempool, separate from the network's validating nodes. + +This system contrasts with [Sponsored Transactions](SPONSORED-TRANSACTIONS.md), where, even if the user doesn't pay, a third entity named "sponsor" assumes the execution costs. In the case of Zero Gas Transactions, the gas fee is nil for all parties involved. This is because the validator itself, when mining the transaction, decides to include it during its validation cycle, resulting in a gas fee of 0. + +## 2. How do Zero Gas Transactions work? + +The mechanism underlying Zero Gas Transactions is relatively straightforward. As mentioned earlier, the validator is responsible for selecting and processing these no-cost transactions during their validation cycle. + +### External Private Mempool + +The validator selects the transactions from an external private mempool. This mempool is a service that exposes a GET HTTP interface and returns a list of transactions with the following format: + +```json +{ + "transactions": [ + "..." // signed Ethereum transaction in hexadecimal format without the 0x prefix + ] +} +``` + +All transactions retrieved from this mempool will be processed as Zero Gas Transactions. + +### Setting up the External Mempool for Validators + +If you are a validator and wish to integrate this functionality, you simply need to configure your node with the `--zero-gas-tx-pool ` parameter. This option determines the HTTP address to which the validating node will make GET requests to obtain the Zero Gas Transactions during its validation cycle. + +## 3. Other considerations + +- If the external mempool takes longer than 100ms to respond, the Zero Gas Transactions will be ignored. +- If the JSON format returned by the external private mempool is incorrect, the transactions will be ignored. +- It is essential that, to be processed as a Zero Gas Transaction, the `gasPriceLimit` parameter is set to 0. \ No newline at end of file diff --git a/node/Cargo.toml b/node/Cargo.toml index 7e56db83..394a8f6c 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -80,6 +80,7 @@ stability-runtime = { path = "./../runtime", features = ["std"] } # Stability stbl-cli-authorship = { workspace = true } stbl-primitives-fee-compatible-api = { workspace = true, features = ["std"] } +stbl-primitives-zero-gas-transactions-api = { workspace = true, features = ["std"] } sp-application-crypto = { workspace = true } account = { workspace = true, features = ["std"] } stbl-core-primitives = { workspace = true, features = ["std"] } diff --git a/node/src/cli.rs b/node/src/cli.rs index e800e2e4..9956c702 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -1,4 +1,5 @@ use crate::service::EthConfiguration; +use crate::stability::StabilityConfiguration; /// Available Sealing methods. #[derive(Debug, Copy, Clone, clap::ValueEnum)] @@ -30,6 +31,9 @@ pub struct Cli { #[command(flatten)] pub eth: EthConfiguration, + + #[command(flatten)] + pub stability: StabilityConfiguration, } #[derive(Debug, clap::Subcommand)] diff --git a/node/src/client.rs b/node/src/client.rs index 978acaf1..fdcb77c5 100644 --- a/node/src/client.rs +++ b/node/src/client.rs @@ -68,6 +68,7 @@ pub trait RuntimeApiCollection: + frame_system_rpc_runtime_api::AccountNonceApi + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi + stbl_primitives_fee_compatible_api::CompatibleFeeApi + + stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi where >::StateBackend: sp_api::StateBackend, { @@ -81,7 +82,8 @@ where + sp_finality_grandpa::GrandpaApi + frame_system_rpc_runtime_api::AccountNonceApi + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi - + stbl_primitives_fee_compatible_api::CompatibleFeeApi, + + stbl_primitives_fee_compatible_api::CompatibleFeeApi + + stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi, >::StateBackend: sp_api::StateBackend, { } diff --git a/node/src/command.rs b/node/src/command.rs index ebb29aba..4a8946c5 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -215,7 +215,7 @@ pub fn run() -> sc_cli::Result<()> { None => { let runner = cli.create_runner(&cli.run)?; runner.run_node_until_exit(|config| async move { - service::build_full(config, cli.eth, cli.sealing).map_err(Into::into) + service::build_full(config, cli.eth, cli.sealing, cli.stability).map_err(Into::into) }) } } diff --git a/node/src/main.rs b/node/src/main.rs index b00d6c4b..db614a14 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -10,6 +10,7 @@ mod cli; mod client; mod command; mod eth; +mod stability; mod rpc; mod service; diff --git a/node/src/rpc/mod.rs b/node/src/rpc/mod.rs index 1c80b253..dc7e7c9f 100644 --- a/node/src/rpc/mod.rs +++ b/node/src/rpc/mod.rs @@ -18,6 +18,7 @@ use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; use sp_runtime::traits::{BlakeTwo256, Block as BlockT}; +use stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi; // Runtime use stability_runtime::{opaque::Block, AccountId, Balance, Hash, Index}; @@ -56,6 +57,7 @@ where C::Api: fp_rpc::ConvertTransactionRuntimeApi, C::Api: fp_rpc::EthereumRuntimeRPCApi, C::Api: stability_rpc::StabilityRpcRuntimeApi, + C::Api: ZeroGasTransactionApi, P: TransactionPool + 'static, A: ChainApi + 'static, CT: fp_rpc::ConvertTransaction<::Extrinsic> + Send + Sync + 'static, diff --git a/node/src/service.rs b/node/src/service.rs index e946a20a..4c826fb7 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -14,6 +14,7 @@ use sp_api::{ConstructRuntimeApi, TransactionFor}; use sp_core::U256; use sp_runtime::traits::BlakeTwo256; use sp_trie::PrefixedMemoryDB; +use stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi; // Runtime use sc_service::KeystoreContainer; use stability_runtime::{opaque::Block, Hash, TransactionConverter}; @@ -31,6 +32,8 @@ pub use crate::{ eth::{db_config_dir, EthConfiguration}, }; +pub use crate::stability::StabilityConfiguration; + type BasicImportQueue = sc_consensus::DefaultImportQueue; type FullPool = sc_transaction_pool::FullPool; type FullSelectChain = sc_consensus::LongestChain; @@ -258,12 +261,14 @@ pub fn new_full( mut config: Configuration, eth_config: EthConfiguration, sealing: Option, + stability_config: StabilityConfiguration, ) -> Result where RuntimeApi: ConstructRuntimeApi>, RuntimeApi: Send + Sync + 'static, RuntimeApi::RuntimeApi: RuntimeApiCollection> - + stability_rpc::StabilityRpcRuntimeApi, + + stability_rpc::StabilityRpcRuntimeApi + + ZeroGasTransactionApi, Executor: NativeExecutionDispatch + 'static, { let build_import_queue = if sealing.is_some() { @@ -272,6 +277,7 @@ where build_aura_grandpa_import_queue:: }; + let PartialComponents { client, backend, @@ -424,6 +430,7 @@ where client, transaction_pool, keystore_container, + &stability_config, select_chain, block_import, &task_manager, @@ -442,6 +449,7 @@ where client.clone(), transaction_pool, keystore_container.sync_keystore(), + stability_config.zero_gas_tx_pool.clone(), prometheus_registry.as_ref(), telemetry.as_ref().map(|x| x.handle()), ); @@ -549,6 +557,7 @@ fn run_manual_seal_authorship( client: Arc>, transaction_pool: Arc>>, keystore: KeystoreContainer, + stability_config: &StabilityConfiguration, select_chain: FullSelectChain, block_import: BoxBlockImport>, task_manager: &TaskManager, @@ -568,6 +577,7 @@ where client.clone(), transaction_pool.clone(), keystore.sync_keystore(), + stability_config.zero_gas_tx_pool.clone(), prometheus_registry, telemetry.as_ref().map(|x| x.handle()), ); @@ -646,8 +656,9 @@ pub fn build_full( config: Configuration, eth_config: EthConfiguration, sealing: Option, + stability_config: StabilityConfiguration, ) -> Result { - new_full::(config, eth_config, sealing) + new_full::(config, eth_config, sealing, stability_config) } pub fn new_chain_ops( diff --git a/node/src/stability.rs b/node/src/stability.rs new file mode 100644 index 00000000..07250933 --- /dev/null +++ b/node/src/stability.rs @@ -0,0 +1,7 @@ +#[derive(Clone, Debug, clap::Parser)] +pub struct StabilityConfiguration { + + /// HTTP URL of the private pool from which the node will retrieve zero-gas transactions + #[arg(long, value_name = "URL")] + pub zero_gas_tx_pool: Option, +} \ No newline at end of file diff --git a/pallets/token-fee-controller/validator-fee-selector/src/lib.rs b/pallets/token-fee-controller/validator-fee-selector/src/lib.rs index 028bcc17..a23f663d 100644 --- a/pallets/token-fee-controller/validator-fee-selector/src/lib.rs +++ b/pallets/token-fee-controller/validator-fee-selector/src/lib.rs @@ -13,7 +13,6 @@ mod tests; pub mod pallet { use super::*; - use core::str::FromStr; use frame_support::{ pallet_prelude::*, @@ -92,7 +91,7 @@ pub mod pallet { impl Default for GenesisConfig { fn default() -> Self { Self { - initial_default_conversion_rate_controller: H160::from_str( + initial_default_conversion_rate_controller: ::from_str( "0x444212d6E4827893A70d19921E383130281Cda4a", ) .expect("invalid address"), diff --git a/pallets/zero-gas-transactions/Cargo.toml b/pallets/zero-gas-transactions/Cargo.toml new file mode 100644 index 00000000..495bb72d --- /dev/null +++ b/pallets/zero-gas-transactions/Cargo.toml @@ -0,0 +1,50 @@ +[package] +name = "pallet-zero-gas-transactions" +version = "0.1.0" +edition = "2021" + +[dependencies] +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } +codec = { package = "parity-scale-codec", workspace = true } +hex = { workspace = true, default-features = false } +scale-info = { workspace = true } +sp-core = { workspace = true } +sp-io = { workspace = true } +pallet-evm = { workspace = true } +stbl-tools = { workspace = true } +pallet-erc20-manager = { workspace = true } +pallet-user-fee-selector = { workspace = true } +pallet-validator-fee-selector = { workspace = true } +pallet-supported-tokens-manager = { workspace = true } +runner = { workspace = true } +pallet-fee-rewards-vault = { workspace = true } +pallet-ethereum = { workspace = true } +fp-ethereum = { workspace = true } +fp-evm = { workspace = true } +fp-rpc = { workspace = true } +ethereum = { workspace = true } +ethereum-types = { workspace = true } + +[dev-dependencies] +pallet-timestamp = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } +pallet-evm-chain-id = { workspace = true, features = ["std"] } +pallet-evm = { workspace = true, features = ["std"]} +pallet-ethereum = { workspace = true, features = ["std"]} +ethereum = { workspace = true, features = ["std"] } + +[features] +default = ["std"] +std = [ + "codec/std", + "scale-info/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + 'pallet-erc20-manager/std', + 'runner/std', +] diff --git a/pallets/zero-gas-transactions/src/lib.rs b/pallets/zero-gas-transactions/src/lib.rs new file mode 100644 index 00000000..5527bcbf --- /dev/null +++ b/pallets/zero-gas-transactions/src/lib.rs @@ -0,0 +1,239 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use sp_core::H160; + +// #[cfg(test)] +// mod mock; +// #[cfg(test)] +// mod tests; + +pub use pallet::*; +#[frame_support::pallet] +pub mod pallet { + use super::*; + use fp_ethereum::TransactionData; + use fp_evm::FeeCalculator; + use frame_support::dispatch::GetDispatchInfo; + use frame_support::pallet_prelude::{StorageMap, *}; + use frame_support::sp_runtime::traits::UniqueSaturatedInto; + use frame_system::pallet_prelude::*; + use pallet_evm::GasWeightMapping; + use pallet_user_fee_selector::UserFeeTokenController; + use sp_core::U256; + use sp_std::vec; + use sp_core::{H256}; + use sp_std::{vec::Vec}; + + pub use fp_rpc::TransactionStatus; + + use pallet_ethereum::Transaction; + + #[pallet::pallet] + #[pallet::without_storage_info] + pub struct Pallet(_); + + #[pallet::storage] + pub type SponsorNonce = StorageMap<_, Blake2_128Concat, H160, u64, ValueQuery>; + + #[pallet::config] + pub trait Config: frame_system::Config + pallet_evm::Config + pallet_ethereum::Config { + type RuntimeCall: Parameter + GetDispatchInfo; + type UserFeeTokenController: UserFeeTokenController; + } + + #[pallet::validate_unsigned] + impl ValidateUnsigned for Pallet + where + Result::RuntimeOrigin>: + From<::RuntimeOrigin>, + ::RuntimeOrigin: From, + { + type Call = Call; + + fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { + match call { + Call::send_zero_gas_transaction { transaction, validator_signature } => { + let from = + Self::ensure_transaction_signature(transaction.clone()).map_err(|_| { + TransactionValidityError::Invalid(InvalidTransaction::BadProof) + })?; + + let current_block_validator = >::find_author(); + + Self::ensure_zero_gas_transaction( + transaction.clone(), + current_block_validator, + validator_signature.clone() + ).map_err(|_| { + TransactionValidityError::Invalid(InvalidTransaction::BadProof) + })?; + + let transaction_data: TransactionData = transaction.into(); + + Self::pool_ensure_transaction_unicity(&from, transaction) + .map_err(|_| TransactionValidityError::Invalid(InvalidTransaction::Call))?; + + return sp_runtime::transaction_validity::ValidTransactionBuilder::default() + .and_provides((from, transaction_data.nonce)) + .priority(u64::MAX) + .build(); + } + _ => Err(TransactionValidityError::Unknown( + UnknownTransaction::Custom(0), + )), + }?; + + return sp_runtime::transaction_validity::ValidTransactionBuilder::default() + .and_provides((H160::zero(), U256::zero())) + .priority(u64::MAX) + .build(); + } + } + + #[pallet::call] + impl Pallet + where + Result::RuntimeOrigin>: + From<::RuntimeOrigin>, + ::RuntimeOrigin: From, + { + #[pallet::call_index(0)] + #[pallet::weight({ + let without_base_extrinsic_weight = true; + ::GasWeightMapping::gas_to_weight({ + let transaction_data: TransactionData = transaction.into(); + transaction_data.gas_limit.unique_saturated_into() + }, without_base_extrinsic_weight) + })] + pub fn send_zero_gas_transaction( + _origin: OriginFor, + transaction: Transaction, + validator_signature: Vec, + ) -> DispatchResultWithPostInfo { + let from = Self::ensure_transaction_signature(transaction.clone()) + .map_err(|_| DispatchError::Other("Invalid transaction signature"))?; + + let current_block_validator = >::find_author(); + + Self::ensure_zero_gas_transaction( + transaction.clone(), + current_block_validator, + validator_signature + ) + .map_err(|_| DispatchError::Other("Invalid zero gas transaction signature"))?; + + let origin: T::RuntimeOrigin = + pallet_ethereum::Origin::EthereumTransaction(from).into(); + let dispatch = pallet_ethereum::Pallet::::transact(origin, transaction) + .map_err(|_| DispatchError::Other("Signature doesn't meet with sponsor address"))?; + + let used_gas = Self::gas_from_actual_weight(dispatch.actual_weight.unwrap()); + + Ok(frame_support::dispatch::PostDispatchInfo { + actual_weight: Some(T::GasWeightMapping::gas_to_weight( + used_gas.unique_saturated_into(), + true, + )), + pays_fee: Pays::No, + }) + } + } + + impl Pallet { + fn gas_from_actual_weight(weight: Weight) -> u64 { + let actual_weight = weight.saturating_add( + T::BlockWeights::get() + .get(frame_support::dispatch::DispatchClass::Normal) + .base_extrinsic, + ); + + ::GasWeightMapping::weight_to_gas(actual_weight) + } + + fn ensure_transaction_signature( + transaction: pallet_ethereum::Transaction, + ) -> Result { + match stbl_tools::eth::recover_signer(&transaction) { + None => Err(()), + Some(address) => Ok(address), + } + } + + fn pool_ensure_transaction_unicity( + origin: &H160, + transaction: &pallet_ethereum::Transaction, + ) -> Result<(), ()> { + let transaction_data: TransactionData = transaction.into(); + + let (base_fee, _) = ::FeeCalculator::min_gas_price(); + let (who, _) = pallet_evm::Pallet::::account_basic(origin); + + fp_evm::CheckEvmTransaction::::new( + fp_evm::CheckEvmTransactionConfig { + evm_config: T::config(), + block_gas_limit: T::BlockGasLimit::get(), + base_fee, + chain_id: T::ChainId::get(), + is_transactional: true, + }, + transaction_data.into(), + ) + .validate_in_pool_for(&who) + .and_then(|v| v.with_chain_id()) + .map_err(|_| ())?; + + Ok(()) + } + + fn ensure_zero_gas_transaction( + transaction: pallet_ethereum::Transaction, + expected_validator: H160, + validator_signature: Vec, + ) -> Result<(), ()> { + let zero_gas_trx_internal_message: Vec = + Self::get_zero_gas_transaction_signing_message(transaction.clone()); + + let eip191_message = + stbl_tools::eth::build_eip191_message_hash(zero_gas_trx_internal_message); + + let zero_gas_trx_signer_address = Self::get_zero_gas_trx_signer( + validator_signature.clone(), + eip191_message.clone(), + ); + + match zero_gas_trx_signer_address { + Some(address) if address == expected_validator => Ok(()), + _ => Err(()), + } + } + + pub fn get_zero_gas_transaction_signing_message(trx: pallet_ethereum::Transaction) -> Vec { + let mut message: Vec = Vec::new(); + + let trx_hash = trx.hash(); + let trx_bytes_hash = trx_hash.as_bytes(); + let trx_hash_string = hex::encode(trx_bytes_hash); + + message.extend_from_slice(b"I consent to validate the transaction for free: 0x"); + message.extend_from_slice(trx_hash_string.as_bytes()); + + return message; + } + + fn get_zero_gas_trx_signer(signature: Vec, message: H256) -> Option { + let result = match sp_io::crypto::secp256k1_ecdsa_recover( + signature.as_slice().try_into().unwrap(), + message.as_fixed_bytes(), + ) { + Ok(pubkey) => { + let mut address = sp_io::hashing::keccak_256(&pubkey); + address[0..12].copy_from_slice(&[0u8; 12]); + address.to_vec() + } + Err(_) => return None, + }; + + return Some(H160::from_slice(&result[12..32])); + } + } +} diff --git a/pallets/zero-gas-transactions/src/mock.rs b/pallets/zero-gas-transactions/src/mock.rs new file mode 100644 index 00000000..be3497e2 --- /dev/null +++ b/pallets/zero-gas-transactions/src/mock.rs @@ -0,0 +1,278 @@ +#![cfg(test)] + +use core::str::FromStr; + +use runner::Runner as StabilityRunner; + +use frame_support::{ + construct_runtime, + pallet_prelude::{StorageValue, ValueQuery}, + parameter_types, + traits::{Everything, GenesisBuild, StorageInstance}, + weights::Weight, +}; +use pallet_evm::{EnsureAddressNever, EnsureAddressRoot}; +use sp_core::{H160, H256, U256}; +use sp_runtime::{ + traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, + MultiSignature, +}; +use std::collections::BTreeMap; + +pub type Signature = MultiSignature; + +pub type AccountId = <::Signer as IdentifyAccount>::AccountId; +pub type Balance = u128; +pub type BlockNumber = u32; +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +pub struct MockUserFeeTokenController; +impl pallet_user_fee_selector::UserFeeTokenController for MockUserFeeTokenController { + type Error = (); + + fn balance_of(_token: H160) -> sp_core::U256 { + return U256::from(1000000); + } + + fn get_user_fee_token(_account: H160) -> H160 { + return ERC20SlotZero::get(); + } + + fn set_user_fee_token(_account: H160, _token: H160) -> Result<(), Self::Error> { + Ok(()) + } +} + +parameter_types! { + pub const BlockHashCount: u32 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl frame_system::Config for Runtime { + type BaseCallFilter = Everything; + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type Index = u64; + type BlockNumber = BlockNumber; + type RuntimeCall = RuntimeCall; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type Header = sp_runtime::generic::Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type BlockWeights = (); + type BlockLength = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +parameter_types! { + pub const ExistentialDeposit: u128 = 0; +} + +impl pallet_balances::Config for Runtime { + type MaxReserves = (); + type ReserveIdentifier = (); + type MaxLocks = (); + type Balance = Balance; + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); +} + +parameter_types! { + pub const MinimumPeriod: u64 = 5; +} + +impl pallet_timestamp::Config for Runtime { + type Moment = u64; + type OnTimestampSet = (); + type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); +} + +pub struct MockDNTFeeController; +impl runner::OnChargeDecentralizedNativeTokenFee for MockDNTFeeController { + type Error = (); + + fn get_transaction_fee_token(_from: H160) -> H160 { + Default::default() + } + + fn get_transaction_conversion_rate( + _user: H160, + _validator: H160, + _token: H160, + ) -> (U256, U256) { + (1.into(), 1.into()) + } + + fn get_fee_vault() -> H160 { + Default::default() + } + + fn withdraw_fee( + _from: H160, + _token: H160, + _conversion_rate: (U256, U256), + _amount: U256, + ) -> Result<(), Self::Error> { + Ok(()) + } + + fn correct_fee( + _from: H160, + _token: H160, + _conversion_rate: (U256, U256), + _paid_amount: U256, + _actual_amount: U256, + ) -> Result<(), Self::Error> { + Ok(()) + } + + fn pay_fees( + _token: H160, + _conversion_rate: (U256, U256), + _actual_amount: U256, + _validator: H160, + _to: Option, + ) -> Result<(U256, U256), Self::Error> { + Ok((Default::default(), Default::default())) + } +} + +parameter_types! { + pub BlockGasLimit: U256 = U256::max_value(); + pub const WeightPerGas: Weight = Weight::from_ref_time(1); + pub ERC20SlotZero: H160 = H160::from_str("0x22D598E0a9a1b474CdC7c6fBeA0B4F83E12046a9").unwrap(); + pub ZeroSlot : H256 = H256::from_low_u64_be(0); +} + +parameter_types! { + pub const ChainId: u64 = 20180428; +} +impl pallet_evm::Config for Runtime { + type FeeCalculator = (); + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type WeightPerGas = WeightPerGas; + type CallOrigin = EnsureAddressRoot; + type WithdrawOrigin = EnsureAddressNever; + type AddressMapping = pallet_evm::HashedAddressMapping; + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + type Runner = StabilityRunner; + type PrecompilesType = (); + type PrecompilesValue = (); + type ChainId = ChainId; + type OnChargeTransaction = (); + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; + type FindAuthor = (); +} + +impl pallet_ethereum::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + + type StateRoot = (); +} + +pub struct MockPrefix; +impl StorageInstance for MockPrefix { + fn pallet_prefix() -> &'static str { + "MockPrefix" + } + + const STORAGE_PREFIX: &'static str = "MockPrefix"; +} + +// Bool value is true for deposit and false for withdraw +pub type StorageCalledArguments = + StorageValue, ValueQuery>; + +pub struct MockERC20Manager; +impl pallet_erc20_manager::ERC20Manager for MockERC20Manager { + type Error = (); + + fn balance_of(_token: H160, _payer: H160) -> U256 { + U256::max_value() + } + + fn withdraw_amount(token: H160, from: H160, amount: U256) -> Result { + StorageCalledArguments::mutate(|args| { + args.push((false, token, from, amount)); + }); + Ok(amount.into()) + } + + fn deposit_amount(token: H160, from: H160, amount: U256) -> Result { + StorageCalledArguments::mutate(|args| { + args.push((true, token, from, amount)); + }); + Ok(amount.into()) + } +} + +impl crate::Config for Runtime { + type RuntimeCall = RuntimeCall; + type ERC20Manager = MockERC20Manager; + type DNTFeeController = MockDNTFeeController; +} + +// Configure a mock runtime to test the pallet. +construct_runtime!( + pub enum Runtime where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + Evm: pallet_evm::{Pallet, Call, Storage, Event}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Ethereum: pallet_ethereum, + MetaTransactions: crate + } +); + +parameter_types! { + pub MetaDeploymentTransaction: Vec = hex::decode("02f92115840133edcc80849502f90085010c388d00832dc6c08080b920b760806040523480156200001157600080fd5b506040518060400160405280600f81526020017f4d65616e696e676c6573732045555200000000000000000000000000000000008152506040518060400160405280600481526020017f4d4555520000000000000000000000000000000000000000000000000000000081525081600390805190602001906200009692919062000357565b508060049080519060200190620000af92919062000357565b505050620000d2620000c6620000fb60201b60201c565b6200010360201b60201c565b620000f5337002f050fe938943acc45f65568000000000620001c960201b60201c565b620005a5565b600033905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b620001db8282620001df60201b60201c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141562000252576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000249906200045a565b60405180910390fd5b62000266600083836200034d60201b60201c565b80600260008282546200027a9190620004aa565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200032d91906200047c565b60405180910390a362000349600083836200035260201b60201c565b5050565b505050565b505050565b828054620003659062000511565b90600052602060002090601f016020900481019282620003895760008555620003d5565b82601f10620003a457805160ff1916838001178555620003d5565b82800160010185558215620003d5579182015b82811115620003d4578251825591602001919060010190620003b7565b5b509050620003e49190620003e8565b5090565b5b8082111562000403576000816000905550600101620003e9565b5090565b600062000416601f8362000499565b91507f45524332303a206d696e7420746f20746865207a65726f2061646472657373006000830152602082019050919050565b620004548162000507565b82525050565b60006020820190508181036000830152620004758162000407565b9050919050565b600060208201905062000493600083018462000449565b92915050565b600082825260208201905092915050565b6000620004b78262000507565b9150620004c48362000507565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115620004fc57620004fb62000547565b5b828201905092915050565b6000819050919050565b600060028204905060018216806200052a57607f821691505b6020821081141562000541576200054062000576565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b611b0280620005b56000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a257806395d89b411161007157806395d89b41146102a6578063a457c2d7146102c4578063a9059cbb146102f4578063dd62ed3e14610324578063f2fde38b146103545761010b565b806370a0823114610232578063715018a61461026257806379cc67901461026c5780638da5cb5b146102885761010b565b8063313ce567116100de578063313ce567146101ac57806339509351146101ca57806340c10f19146101fa57806342966c68146102165761010b565b806306fdde0314610110578063095ea7b31461012e57806318160ddd1461015e57806323b872dd1461017c575b600080fd5b610118610370565b604051610125919061172b565b60405180910390f35b610148600480360381019061014391906111c5565b610402565b6040516101559190611710565b60405180910390f35b610166610425565b60405161017391906118cd565b60405180910390f35b61019660048036038101906101919190611176565b61042f565b6040516101a39190611710565b60405180910390f35b6101b461045e565b6040516101c191906118e8565b60405180910390f35b6101e460048036038101906101df91906111c5565b610467565b6040516101f19190611710565b60405180910390f35b610214600480360381019061020f91906111c5565b61049e565b005b610230600480360381019061022b9190611201565b6104ac565b005b61024c60048036038101906102479190611111565b6104c0565b60405161025991906118cd565b60405180910390f35b61026a610508565b005b610286600480360381019061028191906111c5565b61051c565b005b61029061053c565b60405161029d91906116f5565b60405180910390f35b6102ae610566565b6040516102bb919061172b565b60405180910390f35b6102de60048036038101906102d991906111c5565b6105f8565b6040516102eb9190611710565b60405180910390f35b61030e600480360381019061030991906111c5565b61066f565b60405161031b9190611710565b60405180910390f35b61033e6004803603810190610339919061113a565b610692565b60405161034b91906118cd565b60405180910390f35b61036e60048036038101906103699190611111565b610719565b005b60606003805461037f906119fd565b80601f01602080910402602001604051908101604052809291908181526020018280546103ab906119fd565b80156103f85780601f106103cd576101008083540402835291602001916103f8565b820191906000526020600020905b8154815290600101906020018083116103db57829003601f168201915b5050505050905090565b60008061040d61079d565b905061041a8185856107a5565b600191505092915050565b6000600254905090565b60008061043a61079d565b9050610447858285610970565b6104528585856109fc565b60019150509392505050565b60006012905090565b60008061047261079d565b90506104938185856104848589610692565b61048e919061191f565b6107a5565b600191505092915050565b6104a88282610c74565b5050565b6104bd6104b761079d565b82610dcb565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610510610f99565b61051a6000611017565b565b61052e8261052861079d565b83610970565b6105388282610dcb565b5050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054610575906119fd565b80601f01602080910402602001604051908101604052809291908181526020018280546105a1906119fd565b80156105ee5780601f106105c3576101008083540402835291602001916105ee565b820191906000526020600020905b8154815290600101906020018083116105d157829003601f168201915b5050505050905090565b60008061060361079d565b905060006106118286610692565b905083811015610656576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064d9061188d565b60405180910390fd5b61066382868684036107a5565b60019250505092915050565b60008061067a61079d565b90506106878185856109fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610721610f99565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610791576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107889061178d565b60405180910390fd5b61079a81611017565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610815576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080c9061186d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610885576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087c906117ad565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161096391906118cd565b60405180910390a3505050565b600061097c8484610692565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109f657818110156109e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109df906117cd565b60405180910390fd5b6109f584848484036107a5565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a639061184d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610adc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad39061174d565b60405180910390fd5b610ae78383836110dd565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610b6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b64906117ed565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c5b91906118cd565b60405180910390a3610c6e8484846110e2565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ce4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cdb906118ad565b60405180910390fd5b610cf0600083836110dd565b8060026000828254610d02919061191f565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610db391906118cd565b60405180910390a3610dc7600083836110e2565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e329061182d565b60405180910390fd5b610e47826000836110dd565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec49061176d565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282540392505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610f8091906118cd565b60405180910390a3610f94836000846110e2565b505050565b610fa161079d565b73ffffffffffffffffffffffffffffffffffffffff16610fbf61053c565b73ffffffffffffffffffffffffffffffffffffffff1614611015576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100c9061180d565b60405180910390fd5b565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b505050565b505050565b6000813590506110f681611a9e565b92915050565b60008135905061110b81611ab5565b92915050565b60006020828403121561112357600080fd5b6000611131848285016110e7565b91505092915050565b6000806040838503121561114d57600080fd5b600061115b858286016110e7565b925050602061116c858286016110e7565b9150509250929050565b60008060006060848603121561118b57600080fd5b6000611199868287016110e7565b93505060206111aa868287016110e7565b92505060406111bb868287016110fc565b9150509250925092565b600080604083850312156111d857600080fd5b60006111e6858286016110e7565b92505060206111f7858286016110fc565b9150509250929050565b60006020828403121561121357600080fd5b6000611221848285016110fc565b91505092915050565b61123381611975565b82525050565b61124281611987565b82525050565b600061125382611903565b61125d818561190e565b935061126d8185602086016119ca565b61127681611a8d565b840191505092915050565b600061128e60238361190e565b91507f45524332303a207472616e7366657220746f20746865207a65726f206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006112f460228361190e565b91507f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008301527f63650000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061135a60268361190e565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006113c060228361190e565b91507f45524332303a20617070726f766520746f20746865207a65726f20616464726560008301527f73730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611426601d8361190e565b91507f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006000830152602082019050919050565b600061146660268361190e565b91507f45524332303a207472616e7366657220616d6f756e742065786365656473206260008301527f616c616e636500000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006114cc60208361190e565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b600061150c60218361190e565b91507f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008301527f73000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061157260258361190e565b91507f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006115d860248361190e565b91507f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061163e60258361190e565b91507f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008301527f207a65726f0000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006116a4601f8361190e565b91507f45524332303a206d696e7420746f20746865207a65726f2061646472657373006000830152602082019050919050565b6116e0816119b3565b82525050565b6116ef816119bd565b82525050565b600060208201905061170a600083018461122a565b92915050565b60006020820190506117256000830184611239565b92915050565b600060208201905081810360008301526117458184611248565b905092915050565b6000602082019050818103600083015261176681611281565b9050919050565b60006020820190508181036000830152611786816112e7565b9050919050565b600060208201905081810360008301526117a68161134d565b9050919050565b600060208201905081810360008301526117c6816113b3565b9050919050565b600060208201905081810360008301526117e681611419565b9050919050565b6000602082019050818103600083015261180681611459565b9050919050565b60006020820190508181036000830152611826816114bf565b9050919050565b60006020820190508181036000830152611846816114ff565b9050919050565b6000602082019050818103600083015261186681611565565b9050919050565b60006020820190508181036000830152611886816115cb565b9050919050565b600060208201905081810360008301526118a681611631565b9050919050565b600060208201905081810360008301526118c681611697565b9050919050565b60006020820190506118e260008301846116d7565b92915050565b60006020820190506118fd60008301846116e6565b92915050565b600081519050919050565b600082825260208201905092915050565b600061192a826119b3565b9150611935836119b3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561196a57611969611a2f565b5b828201905092915050565b600061198082611993565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156119e85780820151818401526020810190506119cd565b838111156119f7576000848401525b50505050565b60006002820490506001821680611a1557607f821691505b60208210811415611a2957611a28611a5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b611aa781611975565b8114611ab257600080fd5b50565b611abe816119b3565b8114611ac957600080fd5b5056fea2646970667358221220d8232e5686cdc879a90d7ddc96a6201a16df458937fe021864cb22c9c7b392dc64736f6c63430008000033c001a06973bf638baba2b3f46e78e46303e8460ae185a5bc99f7dcba6efdefdf095871a0623b4531e28bb7361ae1aa9a86a3c82502949770077340098991632ac44c595f").unwrap(); + pub MetaDeploymentSignature: Vec = hex::decode("81d1647ef7fef33fb4f54ec87c57af771994b7709b9f88d0264d3673ae9d870f10084ca26a0bfb1c787b8b47d59a8ec3cdf54976eddd6ca9e6883b5267c0e4971b").unwrap(); + pub RawTransaction0: Vec = hex::decode("02f86f840133edcc808459682f0084a0eebb0083200b2094f0a57f274781b0ed17f2ae5f1709a0c360cbe4898080c001a0fe83852a38f766aafc7cc0fdffd2728c16f6dc1f10578d75eee885e9dc4016f1a01e000f6d5d275993612014ade48a8666fd23b747a099c0a623be7bdf11e1c3be").unwrap(); + // pub RawTransaction1: Vec = hex::decode("f86b01843b9aca0082520894f0a57f274781b0ed17f2ae5f1709a0c360cbe489880de0b6b3a7640000801ca029343cf22be72d879c6392a2ff5dd7e3675b6b70ffc7b7a15529ed9bdad33668a04d5de0209d299c37af1642ea17ca43fdcf0b07d4aa44fe87e338b4fe9b2fa995").unwrap(); + pub MetaTransaction0Signature: Vec = hex::decode("3171eaa7a85b9e089690bd7a2438ac99c0cd17fca959aefc7a2109371f66b7a161a62c28795e12e794bf5551ca21828e97becf89502fef18c5d785f8c3846b8e1c").unwrap(); + // pub MetaTransaction1Signature: Vec = hex::decode("fb0482cfa593aa03aaa1d7c2e5a07269d65a4a589b14c109de8d8ca0c268efca198d1d898e7022002e34d91ced41deda8ae526856a8e23d100ab92e5dbb948c31b").unwrap(); + pub Sponsor: H160 = H160::from_str("0xaf537bd156c7e548d0bf2cd43168dabf7af2feb5").unwrap(); +} + +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap(); + let config = pallet_evm::GenesisConfig { + accounts: BTreeMap::new(), + }; + >::assimilate_storage(&config, &mut t) + .unwrap(); + + let eth_config: pallet_ethereum::GenesisConfig = Default::default(); + + >::assimilate_storage( + ð_config, + &mut t, + ) + .unwrap(); + + t.into() +} diff --git a/pallets/zero-gas-transactions/src/tests.rs b/pallets/zero-gas-transactions/src/tests.rs new file mode 100644 index 00000000..cc98f192 --- /dev/null +++ b/pallets/zero-gas-transactions/src/tests.rs @@ -0,0 +1,197 @@ +use sp_core::{H160, H256, U256}; +use sp_runtime::DispatchError; +use stbl_tools::eth::recover_signer; + +use crate::mock::{ + new_test_ext, MetaDeploymentSignature, MetaDeploymentTransaction, MetaTransaction0Signature, + RawTransaction0, Runtime, Sponsor, StorageCalledArguments, +}; + +#[test] +fn fail_to_execute_meta_transaction_twice() { + new_test_ext().execute_with(|| { + let trx0 = get_transaction_from_bytes(RawTransaction0::get()); + + let from = recover_signer(&trx0).unwrap(); + let origin: ::RuntimeOrigin = + pallet_ethereum::Origin::EthereumTransaction(from).into(); + + crate::Pallet::::send_sponsored_transaction( + origin.clone(), + trx0.clone(), + Sponsor::get(), + MetaTransaction0Signature::get(), + ) + .unwrap(); + + let error = crate::Pallet::::send_sponsored_transaction( + origin.clone(), + trx0.clone(), + Sponsor::get(), + MetaTransaction0Signature::get(), + ) + .unwrap_err(); + + assert!(matches!( + error, + DispatchError::Other("Transaction object is invalid") + )); + }); +} + +#[test] +fn fail_to_execute_meta_transaction_twice_with_invalid_trx() { + new_test_ext().execute_with(|| { + let trx0 = get_transaction_from_bytes(RawTransaction0::get()); + + let from = recover_signer(&trx0).unwrap(); + let origin: ::RuntimeOrigin = + pallet_ethereum::Origin::EthereumTransaction(from).into(); + + pallet_ethereum::Pallet::::transact(origin.clone(), trx0.clone()).unwrap(); + + let error = crate::Pallet::::send_sponsored_transaction( + origin.clone(), + trx0.clone(), + Sponsor::get(), + MetaTransaction0Signature::get(), + ) + .unwrap_err(); + + assert!(matches!( + error, + DispatchError::Other("Transaction object is invalid") + )); + }); +} + +#[test] +fn fail_to_execute_meta_transaction_twice_with_invalid_trx_signature() { + new_test_ext().execute_with(|| { + let trx0 = ethereum::TransactionV2::Legacy(ethereum::LegacyTransaction { + nonce: 0.into(), + gas_price: 0.into(), + gas_limit: 0.into(), + action: ethereum::TransactionAction::Call(H160::zero()), + value: 0.into(), + input: Vec::new(), + signature: ethereum::TransactionSignature::new( + 27, + H256::from_low_u64_be(10), + H256::from_low_u64_be(10), + ) + .unwrap(), + }); + + let from = H160::zero(); + let origin: ::RuntimeOrigin = + pallet_ethereum::Origin::EthereumTransaction(from).into(); + + pallet_ethereum::Pallet::::transact(origin.clone(), trx0.clone()).unwrap(); + + let error = crate::Pallet::::send_sponsored_transaction( + origin.clone(), + trx0.clone(), + Sponsor::get(), + MetaTransaction0Signature::get(), + ) + .unwrap_err(); + + assert!(matches!( + error, + DispatchError::Other("Invalid transaction signature") + )); + }); +} + +#[test] +fn fail_to_execute_meta_transaction_with_wrong_meta_signature() { + new_test_ext().execute_with(|| { + let trx1 = get_transaction_from_bytes(RawTransaction0::get()); + + let from = recover_signer(&trx1).unwrap(); + let origin: ::RuntimeOrigin = + pallet_ethereum::Origin::EthereumTransaction(from).into(); + + let error = crate::Pallet::::send_sponsored_transaction( + origin.clone(), + trx1.clone(), + Sponsor::get(), + hex::decode("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap(), + ) + .unwrap_err(); + + assert!(matches!( + error, + DispatchError::Other("Invalid metatransaction signature") + )); + }); +} + +// fee checks + +#[test] +fn fees_managed_correctly_native_token_transaction() { + new_test_ext().execute_with(|| { + let trx0 = get_transaction_from_bytes(RawTransaction0::get()); + + let from = recover_signer(&trx0).unwrap(); + let origin: ::RuntimeOrigin = + pallet_ethereum::Origin::EthereumTransaction(from).into(); + + crate::Pallet::::send_sponsored_transaction( + origin.clone(), + trx0.clone(), + Sponsor::get(), + MetaTransaction0Signature::get(), + ) + .unwrap(); + + let fee_called_arguments = StorageCalledArguments::get(); + + check_correct_fee_management(fee_called_arguments); + }); +} + +#[test] +fn fees_managed_correctly_deploy_contract() { + new_test_ext().execute_with(|| { + let trx0 = get_transaction_from_bytes(MetaDeploymentTransaction::get()); + + let from = recover_signer(&trx0).unwrap(); + let origin: ::RuntimeOrigin = + pallet_ethereum::Origin::EthereumTransaction(from).into(); + + crate::Pallet::::send_sponsored_transaction( + origin.clone(), + trx0.clone(), + Sponsor::get(), + MetaDeploymentSignature::get(), + ) + .unwrap(); + + let fee_called_arguments = StorageCalledArguments::get(); + + check_correct_fee_management(fee_called_arguments); + }); +} + +// Utils + +fn get_transaction_from_bytes(trx_bytes: Vec) -> pallet_ethereum::Transaction { + ethereum::EnvelopedDecodable::decode(trx_bytes.as_slice()).unwrap() +} + +fn check_correct_fee_management(called_arguments: Vec<(bool, H160, H160, U256)>) { + let mut total_deposited = U256::from(0); + let mut total_withdrawn = U256::from(0); + for (is_deposit, token, _, amount) in called_arguments.iter() { + assert!(token.eq(&called_arguments[0].1)); + if *is_deposit { + total_deposited = amount.saturating_add(total_deposited); + } else { + total_withdrawn = amount.saturating_add(total_withdrawn); + } + } + assert_eq!(total_deposited, total_withdrawn); +} diff --git a/precompiles/token-fee-controller/fee-token-selector/src/lib.rs b/precompiles/token-fee-controller/fee-token-selector/src/lib.rs index e13ec048..a3074b8a 100644 --- a/precompiles/token-fee-controller/fee-token-selector/src/lib.rs +++ b/precompiles/token-fee-controller/fee-token-selector/src/lib.rs @@ -64,6 +64,10 @@ where fn set_fee_token(handle: &mut impl PrecompileHandle, token_address: Address) -> EvmResult { let msg_sender = handle.context().caller; + if token_address == H160::zero().into() { + return Err(revert(b"UserFeeTokenController: zero address is invalid")); + } + handle.record_cost(RuntimeHelper::::db_write_gas_cost())?; match UserFeeTokenController::set_user_fee_token(msg_sender.into(), token_address.into()) { Err(_) => { diff --git a/precompiles/token-fee-controller/fee-token-selector/src/tests.rs b/precompiles/token-fee-controller/fee-token-selector/src/tests.rs index 446edbba..4c4098ca 100644 --- a/precompiles/token-fee-controller/fee-token-selector/src/tests.rs +++ b/precompiles/token-fee-controller/fee-token-selector/src/tests.rs @@ -2,7 +2,7 @@ use precompile_utils::{ prelude::Address, testing::{CryptoAlith, Precompile1, PrecompileTesterExt}, }; -use sp_core::H256; +use sp_core::{H160, H256}; use crate::mock::{ ExtBuilder, MeaninglessTokenAddress, MockDefaultFeeToken, PCall, Precompiles, PrecompilesValue, @@ -44,6 +44,21 @@ fn fail_set_for_unsupported_token() { }); } +#[test] +fn fail_set_for_zero_address() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test( + CryptoAlith, + Precompile1, + PCall::set_fee_token { + token_address: Address(H160::zero()), + }, + ) + .execute_reverts(|x| x == b"UserFeeTokenController: zero address is invalid"); + }); +} + #[test] fn set_token() { ExtBuilder::default().build().execute_with(|| { diff --git a/precompiles/token-fee-controller/supported-tokens-manager/src/lib.rs b/precompiles/token-fee-controller/supported-tokens-manager/src/lib.rs index cec8dfa5..d677a16a 100644 --- a/precompiles/token-fee-controller/supported-tokens-manager/src/lib.rs +++ b/precompiles/token-fee-controller/supported-tokens-manager/src/lib.rs @@ -160,6 +160,10 @@ where Self::require_owner(handle, msg_sender)?; + if token == H160::zero().into() { + return Err(revert("SupportedTokensManager: Invalid address")); + } + handle.record_cost(RuntimeHelper::::db_write_gas_cost())?; match SupportedTokensManager::add_supported_token(token.into(), slot) { Ok(_) => { @@ -226,6 +230,10 @@ where let msg_sender = handle.context().caller; + if token == H160::zero().into() { + return Err(revert("SupportedTokensManager: Invalid address")); + } + Self::require_owner(handle, msg_sender) .map_err(|_| revert("SupportedTokensManager: Caller is not the owner"))?; diff --git a/precompiles/token-fee-controller/supported-tokens-manager/src/tests.rs b/precompiles/token-fee-controller/supported-tokens-manager/src/tests.rs index 4f5b3541..17fda29a 100644 --- a/precompiles/token-fee-controller/supported-tokens-manager/src/tests.rs +++ b/precompiles/token-fee-controller/supported-tokens-manager/src/tests.rs @@ -202,6 +202,22 @@ fn fail_add_token_if_already_added() { }); } +#[test] +fn fail_add_token_if_address_zero() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test( + DefaultOwner::get(), + Precompile1, + PCall::add_token { + token: H160::zero().into(), + slot: H256::from_low_u64_be(0), + }, + ) + .execute_reverts(|x| x == b"SupportedTokensManager: Invalid address"); + }); +} + #[test] fn fail_remove_token_if_not_added() { ExtBuilder::default().build().execute_with(|| { @@ -221,6 +237,21 @@ fn fail_remove_token_if_not_added() { }); } +#[test] +fn zero_address_should_not_be_included_never() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test( + DefaultOwner::get(), + Precompile1, + PCall::is_token_supported { + token: sp_core::H160::zero().into(), + }, + ) + .execute_returns_encoded(false); + }) +} + #[test] fn add_token_and_remove_after() { ExtBuilder::default().build().execute_with(|| { @@ -311,6 +342,21 @@ fn fail_update_default_token() { }) } +#[test] +fn fail_update_default_token_to_zero() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test( + DefaultOwner::get(), + Precompile1, + PCall::update_default_token { + token: H160::zero().into(), + }, + ) + .execute_reverts(|x| x == b"SupportedTokensManager: Invalid address"); + }) +} + #[test] fn fail_update_default_token_is_not_supported() { ExtBuilder::default().build().execute_with(|| { diff --git a/primitives/runner/src/lib.rs b/primitives/runner/src/lib.rs index af4269de..49235755 100644 --- a/primitives/runner/src/lib.rs +++ b/primitives/runner/src/lib.rs @@ -162,6 +162,9 @@ where })?; let token = FC::get_transaction_fee_token(source); + + let is_zero_gas_transaction: bool = total_fee_per_gas == U256::zero(); + let validator = >::find_author(); let vault = FC::get_fee_vault(); @@ -175,13 +178,15 @@ where custom_fee_info.max_conversion_rate.unwrap() }; - // Deduct fee from the `source` account. Returns `None` if `total_fee` is Zero. - FC::withdraw_fee(source, token, actual_conversion_rate, total_fee).map_err(|_| { - RunnerError { - error: Error::::FeeOverflow, - weight, - } - })?; + if !is_zero_gas_transaction { + // Deduct fee from the `source` account. Returns `None` if `total_fee` is Zero. + FC::withdraw_fee(source, token, actual_conversion_rate, total_fee).map_err(|_| { + RunnerError { + error: Error::::FeeOverflow, + weight, + } + })?; + } // Execute the EVM call. let vicinity = Vicinity { @@ -212,41 +217,43 @@ where is_transactional ); - FC::correct_fee(source, token, actual_conversion_rate, total_fee, actual_fee).map_err( - |_| RunnerError { - error: Error::::FeeOverflow, - weight, - }, - )?; - - let (validator_fee, dapp_fee) = - FC::pay_fees(token, actual_conversion_rate, actual_fee, validator, dapp).map_err( + if !is_zero_gas_transaction { + FC::correct_fee(source, token, actual_conversion_rate, total_fee, actual_fee).map_err( |_| RunnerError { error: Error::::FeeOverflow, weight, }, )?; - executor - .log( - vault, - sp_std::vec![TRANSACTION_FEE_TOPIC.into()], - stbl_tools::eth::args_to_bytes(sp_std::vec![ - token.into(), - stbl_tools::misc::u256_to_h256(validator_fee + dapp_fee), - validator.into(), - stbl_tools::misc::u256_to_h256(validator_fee), - match dapp { - None => H160::zero().into(), - Some(dapp) => dapp.into(), + let (validator_fee, dapp_fee) = + FC::pay_fees(token, actual_conversion_rate, actual_fee, validator, dapp).map_err( + |_| RunnerError { + error: Error::::FeeOverflow, + weight, }, - stbl_tools::misc::u256_to_h256(dapp_fee), - ]), - ) - .map_err(|_| RunnerError { - error: Error::::FeeOverflow, - weight, - })?; + )?; + + executor + .log( + vault, + sp_std::vec![TRANSACTION_FEE_TOPIC.into()], + stbl_tools::eth::args_to_bytes(sp_std::vec![ + token.into(), + stbl_tools::misc::u256_to_h256(validator_fee + dapp_fee), + validator.into(), + stbl_tools::misc::u256_to_h256(validator_fee), + match dapp { + None => H160::zero().into(), + Some(dapp) => dapp.into(), + }, + stbl_tools::misc::u256_to_h256(dapp_fee), + ]), + ) + .map_err(|_| RunnerError { + error: Error::::FeeOverflow, + weight, + })?; + } let state = executor.into_state(); diff --git a/primitives/runner/src/mock.rs b/primitives/runner/src/mock.rs index 86ff8f9c..8878cb31 100644 --- a/primitives/runner/src/mock.rs +++ b/primitives/runner/src/mock.rs @@ -125,7 +125,7 @@ impl crate::OnChargeDecentralizedNativeTokenFee for MockDNTFeeController { type Error = (); fn get_transaction_fee_token(_from: H160) -> H160 { - Default::default() + return ERC20SlotZero::get(); } fn get_transaction_conversion_rate( diff --git a/primitives/runner/src/tests.rs b/primitives/runner/src/tests.rs index 399fa28b..dc654eff 100644 --- a/primitives/runner/src/tests.rs +++ b/primitives/runner/src/tests.rs @@ -136,7 +136,7 @@ fn transaction_fee_log_emitted() { stbl_tools::eth::generate_calldata("balanceOf(address)", &vec![token_addr.into()]), U256::from(0), u64::MAX, - None, + Some(U256::from(1)), None, None, vec![], diff --git a/primitives/zero-gas-transactions-api/Cargo.toml b/primitives/zero-gas-transactions-api/Cargo.toml new file mode 100644 index 00000000..601bdfa7 --- /dev/null +++ b/primitives/zero-gas-transactions-api/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "stbl-primitives-zero-gas-transactions-api" +version = "1.0.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +sp-runtime = { workspace = true} +sp-api = { workspace = true} +codec = { package = "parity-scale-codec", workspace = true } +fp-ethereum = { workspace = true, default-features = false } +sp-std = { workspace = true, default-features = false } + +[features] +default = ['std'] +std = [ + 'sp-runtime/std', + 'sp-api/std', + 'codec/std', +] \ No newline at end of file diff --git a/primitives/zero-gas-transactions-api/src/lib.rs b/primitives/zero-gas-transactions-api/src/lib.rs new file mode 100644 index 00000000..16d19785 --- /dev/null +++ b/primitives/zero-gas-transactions-api/src/lib.rs @@ -0,0 +1,10 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use sp_runtime::traits::Block as BlockT; +use sp_std::vec::Vec; + +sp_api::decl_runtime_apis! { + pub trait ZeroGasTransactionApi { + fn convert_zero_gas_transaction(transaction: fp_ethereum::Transaction, validator_signature: Vec) -> ::Extrinsic; + } +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 74b4579d..50d3a33f 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -137,6 +137,7 @@ pallet-evm-precompile-sha3fips = { workspace = true } pallet-evm-precompile-simple = { workspace = true } pallet-hotfix-sufficients = { workspace = true } pallet-sponsored-transactions = { workspace = true } +pallet-zero-gas-transactions = { workspace = true } # Stability pallet-evm-precompile-blake2 = { workspace = true } pallet-evm-precompile-bn128 = { workspace = true } @@ -150,6 +151,7 @@ precompile-validator-controller = { workspace = true } pallet-root-controller = { workspace = true } pallet-collective = { workspace = true } stbl-primitives-fee-compatible-api = { workspace = true } +stbl-primitives-zero-gas-transactions-api = { workspace = true } pallet-erc20-manager = { workspace = true } pallet-supported-tokens-manager = { workspace = true } precompile-supported-tokens-manager = { workspace = true } @@ -160,7 +162,6 @@ runner = { workspace = true } precompile-fee-rewards-vault-controller = { workspace = true } pallet-fee-rewards-vault = { workspace = true } stbl-transaction-validator = { workspace = true } - stbl-core-primitives = { workspace = true } account = { workspace = true } stability-rpc-api = { workspace = true } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index af617a87..e504785f 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -767,6 +767,7 @@ construct_runtime!( UpgradeRuntimeProposal: pallet_upgrade_runtime_proposal, FeeRewardsVault: pallet_fee_rewards_vault, MetaTransactions: pallet_sponsored_transactions, + ZeroGasTransactions: pallet_zero_gas_transactions } ); @@ -909,6 +910,11 @@ impl pallet_sponsored_transactions::Config for Runtime { type DNTFeeController = DNTFeeController; } +impl pallet_zero_gas_transactions::Config for Runtime { + type RuntimeCall = RuntimeCall; + type UserFeeTokenController = pallet_user_fee_selector::Pallet; +} + parameter_types! { pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::with_sensible_defaults(MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO); @@ -1146,6 +1152,14 @@ impl_runtime_apis! { fn gas_limit_multiplier_support() {} } + impl stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi for Runtime { + fn convert_zero_gas_transaction(transaction: EthereumTransaction, validator_signature: Vec) -> ::Extrinsic { + UncheckedExtrinsic::new_unsigned( + pallet_zero_gas_transactions::Call::::send_zero_gas_transaction { transaction, validator_signature }.into(), + ) + } + } + impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { fn convert_transaction(transaction: EthereumTransaction) -> ::Extrinsic { UncheckedExtrinsic::new_unsigned( diff --git a/stability-rpc/Cargo.toml b/stability-rpc/Cargo.toml index f3918c63..010166b6 100644 --- a/stability-rpc/Cargo.toml +++ b/stability-rpc/Cargo.toml @@ -24,6 +24,7 @@ async-trait = { workspace = true } # local packages stability-rpc-api = { workspace = true, default-features = false } +stbl-primitives-zero-gas-transactions-api = { workspace = true, default-features = false} sc-transaction-pool-api = { workspace = true } pallet-sponsored-transactions = { workspace = true } futures-util = { version = "0.3.17" } diff --git a/test-utils/stability-runtime-client/src/lib.rs b/test-utils/stability-runtime-client/src/lib.rs index 9114e985..de7b5948 100644 --- a/test-utils/stability-runtime-client/src/lib.rs +++ b/test-utils/stability-runtime-client/src/lib.rs @@ -30,11 +30,7 @@ use std::sync::Arc; pub use self::block_builder_ext::BlockBuilderExt; -use sp_core::{ - sr25519, - storage::{ChildInfo, Storage, StorageChild}, - Pair, -}; +use sp_core::{sr25519, storage::ChildInfo, Pair}; use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT}; use stability_test_runtime::genesismap::{additional_storage_with_genesis, GenesisConfig}; diff --git a/test-utils/stability-runtime/Cargo.toml b/test-utils/stability-runtime/Cargo.toml index 99971631..613b0730 100644 --- a/test-utils/stability-runtime/Cargo.toml +++ b/test-utils/stability-runtime/Cargo.toml @@ -45,6 +45,9 @@ sc-service = { workspace=true, optional = true, features = ["test-helpers"] } sp-state-machine = { workspace = true } sp-externalities = { workspace = true } stbl-primitives-fee-compatible-api = { workspace = true } +stbl-primitives-zero-gas-transactions-api = { workspace = true } +pallet-zero-gas-transactions = { workspace = true } +pallet-ethereum = { workspace = true } # 3rd party cfg-if = { workspace = true } log = { workspace = true } diff --git a/test-utils/stability-runtime/src/lib.rs b/test-utils/stability-runtime/src/lib.rs index adaf7f93..ba8f26f8 100644 --- a/test-utils/stability-runtime/src/lib.rs +++ b/test-utils/stability-runtime/src/lib.rs @@ -34,7 +34,7 @@ use sp_trie::{ PrefixedMemoryDB, StorageProof, }; use trie_db::{Trie, TrieMut}; - +use pallet_ethereum::{Call::transact, Transaction as EthereumTransaction}; use cfg_if::cfg_if; use frame_support::{ dispatch::RawOrigin, @@ -1032,6 +1032,12 @@ cfg_if! { true } } + + impl stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi for Runtime { + fn convert_zero_gas_transaction(transaction: EthereumTransaction, validator_signature: Vec) -> ::Extrinsic { + return Extrinsic::Skipped(0); + } + } } } else { impl_runtime_apis! { @@ -1276,6 +1282,12 @@ cfg_if! { true } } + + impl stbl_primitives_zero_gas_transactions_api::ZeroGasTransactionApi for Runtime { + fn convert_zero_gas_transaction(transaction: EthereumTransaction, validator_signature: Vec) -> ::Extrinsic { + return Extrinsic::Skipped(0); + } + } } } }