From 05975b50081e6208ddd6bdd1e0a340754e752b77 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Fri, 5 Jan 2024 01:33:12 +0000 Subject: [PATCH] evm: Add native contract Dispatch --- Cargo.lock | 173 ++++++++++++++------------ Cargo.toml | 1 + standalone/pruntime/Cargo.lock | 157 ++++++++++++----------- standalone/runtime/Cargo.toml | 2 + standalone/runtime/src/precompiles.rs | 9 +- 5 files changed, 189 insertions(+), 153 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index baab331ac..5badb081b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1100,7 +1100,7 @@ checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -1248,7 +1248,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -1419,7 +1419,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -2126,7 +2126,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -2939,7 +2939,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -3054,7 +3054,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -3087,7 +3087,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" dependencies = [ "darling_core 0.20.1", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -3218,7 +3218,7 @@ checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -3323,7 +3323,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics 0.10.0", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -3515,7 +3515,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.43", + "syn 2.0.47", "termcolor", "toml 0.8.2", "walkdir", @@ -3786,7 +3786,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -3826,7 +3826,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -4073,7 +4073,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.43", + "syn 2.0.47", "toml 0.7.3", "walkdir", ] @@ -4091,7 +4091,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -4117,7 +4117,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.43", + "syn 2.0.47", "tempfile", "thiserror", "tiny-keccak", @@ -4335,7 +4335,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -5009,7 +5009,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -5149,7 +5149,7 @@ dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -5161,7 +5161,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -5171,7 +5171,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -5410,7 +5410,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -6360,7 +6360,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -6417,7 +6417,7 @@ dependencies = [ "itertools 0.10.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -6432,7 +6432,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", "synstructure 0.13.0", ] @@ -7749,7 +7749,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -7763,7 +7763,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -7774,7 +7774,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -7785,7 +7785,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -8646,7 +8646,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -8658,7 +8658,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -8787,7 +8787,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -9074,7 +9074,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -9211,6 +9211,18 @@ dependencies = [ "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.5.0)", ] +[[package]] +name = "pallet-evm-precompile-dispatch" +version = "2.0.0-dev" +source = "git+https://github.com/kvinwang/frontier?branch=polkadot-v1.5.0#67990f8e62b7cc969ca62ec38318ab8a59da6142" +dependencies = [ + "fp-evm", + "frame-support", + "pallet-evm", + "parity-scale-codec", + "sp-runtime", +] + [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" @@ -9700,7 +9712,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -10502,6 +10514,7 @@ dependencies = [ "pallet-elections-phragmen", "pallet-ethereum", "pallet-evm", + "pallet-evm-precompile-dispatch", "pallet-evm-precompile-modexp", "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", @@ -10871,7 +10884,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -10910,7 +10923,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -11009,7 +11022,7 @@ dependencies = [ "proc-macro2", "quote", "rustfmt-snippet 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 2.0.43", + "syn 2.0.47", "unzip3", ] @@ -11413,7 +11426,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9825a04601d60621feed79c4e6b56d65db77cdca55cef43b46b0de1096d1c282" dependencies = [ "proc-macro2", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -11488,14 +11501,14 @@ checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" dependencies = [ "unicode-ident", ] @@ -11521,7 +11534,7 @@ checksum = "606c4ba35817e2922a308af55ad51bab3645b59eae5c570d4a6cf07e36bd493b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", "version_check", "yansi 0.5.1", ] @@ -11850,9 +11863,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -12527,7 +12540,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.43", + "syn 2.0.47", "unicode-xid", "version_check", ] @@ -13006,7 +13019,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -13945,7 +13958,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -14419,9 +14432,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" dependencies = [ "serde_derive", ] @@ -14449,13 +14462,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -14996,7 +15009,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -15233,13 +15246,13 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "quote", "sp-core-hashing", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] name = "sp-crypto-ec-utils" version = "0.4.1" -source = "git+https://github.com/paritytech/polkadot-sdk#a813e4da8ff2e4248044c21ad524885ec9379c01" +source = "git+https://github.com/paritytech/polkadot-sdk#f82c297728373b9aa09893d15c2c8f9c01ba8cf3" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -15273,17 +15286,17 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a813e4da8ff2e4248044c21ad524885ec9379c01" +source = "git+https://github.com/paritytech/polkadot-sdk#f82c297728373b9aa09893d15c2c8f9c01ba8cf3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -15300,7 +15313,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a813e4da8ff2e4248044c21ad524885ec9379c01" +source = "git+https://github.com/paritytech/polkadot-sdk#f82c297728373b9aa09893d15c2c8f9c01ba8cf3" dependencies = [ "environmental", "parity-scale-codec", @@ -15501,7 +15514,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a813e4da8ff2e4248044c21ad524885ec9379c01" +source = "git+https://github.com/paritytech/polkadot-sdk#f82c297728373b9aa09893d15c2c8f9c01ba8cf3" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -15526,20 +15539,20 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a813e4da8ff2e4248044c21ad524885ec9379c01" +source = "git+https://github.com/paritytech/polkadot-sdk#f82c297728373b9aa09893d15c2c8f9c01ba8cf3" dependencies = [ "Inflector", "expander", "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -15624,7 +15637,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a813e4da8ff2e4248044c21ad524885ec9379c01" +source = "git+https://github.com/paritytech/polkadot-sdk#f82c297728373b9aa09893d15c2c8f9c01ba8cf3" [[package]] name = "sp-storage" @@ -15642,7 +15655,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a813e4da8ff2e4248044c21ad524885ec9379c01" +source = "git+https://github.com/paritytech/polkadot-sdk#f82c297728373b9aa09893d15c2c8f9c01ba8cf3" dependencies = [ "impl-serde", "parity-scale-codec", @@ -15680,7 +15693,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a813e4da8ff2e4248044c21ad524885ec9379c01" +source = "git+https://github.com/paritytech/polkadot-sdk#f82c297728373b9aa09893d15c2c8f9c01ba8cf3" dependencies = [ "parity-scale-codec", "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk)", @@ -15763,7 +15776,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -15782,7 +15795,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a813e4da8ff2e4248044c21ad524885ec9379c01" +source = "git+https://github.com/paritytech/polkadot-sdk#f82c297728373b9aa09893d15c2c8f9c01ba8cf3" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -16372,7 +16385,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -16638,7 +16651,7 @@ dependencies = [ "quote", "scale-info", "subxt-metadata", - "syn 2.0.43", + "syn 2.0.47", "thiserror", "tokio", ] @@ -16650,7 +16663,7 @@ dependencies = [ "darling 0.20.1", "proc-macro-error", "subxt-codegen", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -16697,9 +16710,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.43" +version = "2.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" +checksum = "1726efe18f42ae774cc644f330953a5e7b3c3003d3edcecf18850fe9d4dd9afb" dependencies = [ "proc-macro2", "quote", @@ -16732,7 +16745,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", "unicode-xid", ] @@ -16919,7 +16932,7 @@ checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -17074,7 +17087,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -17333,7 +17346,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] @@ -17663,7 +17676,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", "digest 0.10.7", - "rand 0.8.5", + "rand 0.4.6", "static_assertions", ] @@ -18146,7 +18159,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", "wasm-bindgen-shared", ] @@ -18203,7 +18216,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -19530,7 +19543,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.47", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a272c7dfb..e0a482f6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,6 +124,7 @@ pallet-evm = { git = "https://github.com/kvinwang/frontier", branch = "polkadot- pallet-evm-precompile-modexp = { git = "https://github.com/kvinwang/frontier", branch = "polkadot-v1.5.0", default-features = false } pallet-evm-precompile-sha3fips = { git = "https://github.com/kvinwang/frontier", branch = "polkadot-v1.5.0", default-features = false } pallet-evm-precompile-simple = { git = "https://github.com/kvinwang/frontier", branch = "polkadot-v1.5.0", default-features = false } +pallet-evm-precompile-dispatch = { git = "https://github.com/kvinwang/frontier", branch = "polkadot-v1.5.0", default-features = false } pallet-evm-test-vector-support = { git = "https://github.com/kvinwang/frontier", branch = "polkadot-v1.5.0" } pallet-hotfix-sufficients = { git = "https://github.com/kvinwang/frontier", branch = "polkadot-v1.5.0", default-features = false } # Frontier Template diff --git a/standalone/pruntime/Cargo.lock b/standalone/pruntime/Cargo.lock index bac0212da..b5cb760c4 100644 --- a/standalone/pruntime/Cargo.lock +++ b/standalone/pruntime/Cargo.lock @@ -585,7 +585,7 @@ checksum = "7b2d0f03b3640e3a630367e40c468cb7f309529c708ed1d88597047b0e7c6ef7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -1156,7 +1156,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -1638,7 +1638,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -1758,7 +1758,7 @@ checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -1832,7 +1832,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics 0.10.0", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -1935,7 +1935,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.43", + "syn 2.0.48", "termcolor", "toml 0.8.2", "walkdir", @@ -2126,7 +2126,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -2166,7 +2166,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -2402,7 +2402,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.43", + "syn 2.0.48", "toml 0.7.6", "walkdir", ] @@ -2420,7 +2420,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -2446,7 +2446,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.43", + "syn 2.0.48", "tempfile", "thiserror", "tiny-keccak", @@ -2649,7 +2649,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -2980,7 +2980,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3087,7 +3087,7 @@ dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3099,7 +3099,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3109,7 +3109,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3263,7 +3263,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3937,7 +3937,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3994,7 +3994,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4009,7 +4009,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "synstructure", ] @@ -4440,7 +4440,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4454,7 +4454,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4465,7 +4465,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4476,7 +4476,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4874,7 +4874,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4883,10 +4883,10 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" dependencies = [ - "proc-macro-crate 1.2.1", + "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -5176,7 +5176,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -5313,6 +5313,18 @@ dependencies = [ "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.5.0)", ] +[[package]] +name = "pallet-evm-precompile-dispatch" +version = "2.0.0-dev" +source = "git+https://github.com/kvinwang/frontier?branch=polkadot-v1.5.0#67990f8e62b7cc969ca62ec38318ab8a59da6142" +dependencies = [ + "fp-evm", + "frame-support", + "pallet-evm", + "parity-scale-codec", + "sp-runtime", +] + [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" @@ -5801,7 +5813,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -6354,6 +6366,7 @@ dependencies = [ "pallet-elections-phragmen", "pallet-ethereum", "pallet-evm", + "pallet-evm-precompile-dispatch", "pallet-evm-precompile-modexp", "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", @@ -6645,7 +6658,7 @@ checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -6731,7 +6744,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "unzip3", ] @@ -6877,7 +6890,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9825a04601d60621feed79c4e6b56d65db77cdca55cef43b46b0de1096d1c282" dependencies = [ "proc-macro2", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -6953,14 +6966,14 @@ checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" dependencies = [ "unicode-ident", ] @@ -6986,7 +6999,7 @@ checksum = "606c4ba35817e2922a308af55ad51bab3645b59eae5c570d4a6cf07e36bd493b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "version_check", "yansi 0.5.1", ] @@ -7237,9 +7250,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -7788,7 +7801,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.43", + "syn 2.0.48", "unicode-xid", "version_check", ] @@ -8271,9 +8284,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" dependencies = [ "serde_derive", ] @@ -8301,13 +8314,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -8691,7 +8704,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -8878,13 +8891,13 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "quote", "sp-core-hashing", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] name = "sp-crypto-ec-utils" version = "0.4.1" -source = "git+https://github.com/paritytech/polkadot-sdk#b4c816665bd094b6ad703f1d11291c49bf66408f" +source = "git+https://github.com/paritytech/polkadot-sdk#19de1c96607f80ea1f55584c42e7050df08cb3e2" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -8909,17 +8922,17 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b4c816665bd094b6ad703f1d11291c49bf66408f" +source = "git+https://github.com/paritytech/polkadot-sdk#19de1c96607f80ea1f55584c42e7050df08cb3e2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -8936,7 +8949,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b4c816665bd094b6ad703f1d11291c49bf66408f" +source = "git+https://github.com/paritytech/polkadot-sdk#19de1c96607f80ea1f55584c42e7050df08cb3e2" dependencies = [ "environmental", "parity-scale-codec", @@ -9106,7 +9119,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b4c816665bd094b6ad703f1d11291c49bf66408f" +source = "git+https://github.com/paritytech/polkadot-sdk#19de1c96607f80ea1f55584c42e7050df08cb3e2" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -9131,20 +9144,20 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b4c816665bd094b6ad703f1d11291c49bf66408f" +source = "git+https://github.com/paritytech/polkadot-sdk#19de1c96607f80ea1f55584c42e7050df08cb3e2" dependencies = [ "Inflector", "expander", "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -9205,7 +9218,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b4c816665bd094b6ad703f1d11291c49bf66408f" +source = "git+https://github.com/paritytech/polkadot-sdk#19de1c96607f80ea1f55584c42e7050df08cb3e2" [[package]] name = "sp-storage" @@ -9223,7 +9236,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b4c816665bd094b6ad703f1d11291c49bf66408f" +source = "git+https://github.com/paritytech/polkadot-sdk#19de1c96607f80ea1f55584c42e7050df08cb3e2" dependencies = [ "impl-serde", "parity-scale-codec", @@ -9261,7 +9274,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b4c816665bd094b6ad703f1d11291c49bf66408f" +source = "git+https://github.com/paritytech/polkadot-sdk#19de1c96607f80ea1f55584c42e7050df08cb3e2" dependencies = [ "parity-scale-codec", "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk)", @@ -9329,7 +9342,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -9348,7 +9361,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b4c816665bd094b6ad703f1d11291c49bf66408f" +source = "git+https://github.com/paritytech/polkadot-sdk#19de1c96607f80ea1f55584c42e7050df08cb3e2" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -9618,7 +9631,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -9673,9 +9686,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.43" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -9690,7 +9703,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "unicode-xid", ] @@ -9845,7 +9858,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -9974,7 +9987,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -10144,7 +10157,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -10350,7 +10363,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", "digest 0.10.7", - "rand 0.8.5", + "rand 0.4.6", "static_assertions", ] @@ -10745,7 +10758,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -10802,7 +10815,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -11674,7 +11687,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -11715,7 +11728,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] diff --git a/standalone/runtime/Cargo.toml b/standalone/runtime/Cargo.toml index 8b1815520..b9098f69d 100644 --- a/standalone/runtime/Cargo.toml +++ b/standalone/runtime/Cargo.toml @@ -124,6 +124,7 @@ pallet-evm = { workspace = true } pallet-evm-precompile-modexp = { workspace = true } pallet-evm-precompile-sha3fips = { workspace = true } pallet-evm-precompile-simple = { workspace = true } +pallet-evm-precompile-dispatch = { workspace = true } pallet-hotfix-sufficients = { workspace = true } [build-dependencies] @@ -221,6 +222,7 @@ std = [ "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-sha3fips/std", "pallet-evm-precompile-simple/std", + "pallet-evm-precompile-dispatch/std", "pallet-hotfix-sufficients/std", ] runtime-benchmarks = [ diff --git a/standalone/runtime/src/precompiles.rs b/standalone/runtime/src/precompiles.rs index 018c32a83..df6dbb78a 100644 --- a/standalone/runtime/src/precompiles.rs +++ b/standalone/runtime/src/precompiles.rs @@ -1,9 +1,12 @@ +use frame_support::dispatch::{GetDispatchInfo, PostDispatchInfo}; use pallet_evm::{ IsPrecompileResult, Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, }; use sp_core::H160; +use sp_runtime::traits::Dispatchable; use sp_std::marker::PhantomData; +use pallet_evm_precompile_dispatch::Dispatch; use pallet_evm_precompile_modexp::Modexp; use pallet_evm_precompile_sha3fips::Sha3FIPS256; use pallet_evm_precompile_simple::{ECRecover, ECRecoverPublicKey, Identity, Ripemd160, Sha256}; @@ -19,7 +22,7 @@ impl FrontierPrecompiles where R: pallet_evm::Config, { - pub fn used_addresses() -> [H160; 7] { + pub fn used_addresses() -> [H160; 8] { [ hash(1), hash(2), @@ -28,12 +31,15 @@ where hash(5), hash(1024), hash(1025), + hash(2048), ] } } impl PrecompileSet for FrontierPrecompiles where R: pallet_evm::Config, + R::RuntimeCall: Dispatchable + GetDispatchInfo, + ::RuntimeOrigin: From>, { fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { match handle.code_address() { @@ -46,6 +52,7 @@ where // Non-Frontier specific nor Ethereum precompiles : a if a == hash(1024) => Some(Sha3FIPS256::execute(handle)), a if a == hash(1025) => Some(ECRecoverPublicKey::execute(handle)), + a if a == hash(2048) => Some(Dispatch::::execute(handle)), _ => None, } }