diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 075eca174..856501782 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -25,7 +25,7 @@ env: CARGO_INCREMENTAL: 1 CARGO_TERM_COLOR: always - GITHUB_CACHE_VERSION: 3 + GITHUB_CACHE_VERSION: 4 RUST_BACKTRACE: full diff --git a/Cargo.lock b/Cargo.lock index 74769c6b9..96ef38cec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "account" version = "0.1.1" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#6b21c49d9c3def2b0cd799f67c1feb136831e749" +source = "git+https://github.com/darwinia-network/moonbeam?branch=update-0.9.38#abca6696c3731dd781d7badfb7cd797e36e39bf5" dependencies = [ "blake2-rfc", "hex", @@ -876,7 +876,7 @@ dependencies = [ [[package]] name = "bp-darwinia-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "account", "bp-messages", @@ -893,7 +893,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-runtime", "finality-grandpa", @@ -910,7 +910,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-runtime", "frame-support", @@ -923,7 +923,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bitvec", "bp-runtime", @@ -940,7 +940,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -953,7 +953,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-messages", "bp-runtime", @@ -972,7 +972,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "frame-support", "frame-system", @@ -993,7 +993,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -1008,7 +1008,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-header-chain", "bp-message-dispatch", @@ -2449,9 +2449,9 @@ dependencies = [ "fc-mapping-sync", "fc-rpc", "fc-rpc-core", + "fc-storage", "fp-evm", "fp-rpc", - "fp-storage", "frame-benchmarking", "frame-benchmarking-cli", "futures", @@ -2795,6 +2795,7 @@ dependencies = [ "pallet-democracy", "pallet-elections-phragmen", "pallet-ethereum", + "pallet-ethereum-xcm", "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", @@ -3611,7 +3612,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "clap", "ethereum-types 0.14.1", @@ -3629,7 +3630,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -3648,9 +3649,10 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "fc-db", + "fc-storage", "fp-consensus", "fp-rpc", "futures", @@ -3665,13 +3667,14 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "ethereum", "ethereum-types 0.14.1", "evm", "fc-db", "fc-rpc-core", + "fc-storage", "fp-ethereum", "fp-rpc", "fp-storage", @@ -3699,7 +3702,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-storage", "substrate-prometheus-endpoint", "tokio", ] @@ -3707,7 +3709,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3717,6 +3719,24 @@ dependencies = [ "serde_json", ] +[[package]] +name = "fc-storage" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" +dependencies = [ + "ethereum", + "ethereum-types 0.14.1", + "fp-rpc", + "fp-storage", + "parity-scale-codec", + "sc-client-api", + "sp-api", + "sp-blockchain", + "sp-io", + "sp-runtime", + "sp-storage", +] + [[package]] name = "fdlimit" version = "0.2.1" @@ -3871,7 +3891,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "ethereum", "parity-scale-codec", @@ -3883,7 +3903,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3897,7 +3917,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "evm", "frame-support", @@ -3911,7 +3931,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3927,7 +3947,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "frame-support", "parity-scale-codec", @@ -3939,7 +3959,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "parity-scale-codec", "serde", @@ -7163,7 +7183,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -7179,7 +7199,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-header-chain", "bp-runtime", @@ -7201,7 +7221,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bitvec", "bp-message-dispatch", @@ -7222,7 +7242,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -7368,7 +7388,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -7391,10 +7411,36 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-ethereum-xcm" +version = "1.0.0-dev" +source = "git+https://github.com/darwinia-network/moonbeam?branch=update-0.9.38#abca6696c3731dd781d7badfb7cd797e36e39bf5" +dependencies = [ + "ethereum", + "ethereum-types 0.14.1", + "fp-ethereum", + "fp-evm", + "fp-rpc", + "fp-self-contained", + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "rlp", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", + "xcm-primitives", +] + [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "environmental", "evm", @@ -7418,7 +7464,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "fp-evm", ] @@ -7426,7 +7472,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "fp-evm", "sp-core", @@ -7436,7 +7482,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "fp-evm", "frame-support", @@ -7446,7 +7492,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "fp-evm", "num", @@ -7455,7 +7501,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.38#5644279da588baab7caa9f3a4eb69363e1606461" dependencies = [ "fp-evm", "ripemd", @@ -7483,7 +7529,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#c93f45cda37abe7c6c3144d1895f43bed199584f" dependencies = [ "bp-messages", "bp-runtime", @@ -8192,6 +8238,7 @@ dependencies = [ "pallet-democracy", "pallet-elections-phragmen", "pallet-ethereum", + "pallet-ethereum-xcm", "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", @@ -8295,6 +8342,7 @@ dependencies = [ "pallet-democracy", "pallet-elections-phragmen", "pallet-ethereum", + "pallet-ethereum-xcm", "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", @@ -9850,7 +9898,7 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#6b21c49d9c3def2b0cd799f67c1feb136831e749" +source = "git+https://github.com/darwinia-network/moonbeam?branch=update-0.9.38#abca6696c3731dd781d7badfb7cd797e36e39bf5" dependencies = [ "affix", "derive_more", @@ -9881,7 +9929,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#6b21c49d9c3def2b0cd799f67c1feb136831e749" +source = "git+https://github.com/darwinia-network/moonbeam?branch=update-0.9.38#abca6696c3731dd781d7badfb7cd797e36e39bf5" dependencies = [ "case", "num_enum", @@ -15503,11 +15551,12 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#6b21c49d9c3def2b0cd799f67c1feb136831e749" +source = "git+https://github.com/darwinia-network/moonbeam?branch=update-0.9.38#abca6696c3731dd781d7badfb7cd797e36e39bf5" dependencies = [ "cumulus-primitives-core", "ethereum", "ethereum-types 0.14.1", + "frame-benchmarking", "frame-support", "frame-system", "hex", diff --git a/Cargo.toml b/Cargo.toml index e2d29ea11..acbd8a5dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,29 +84,30 @@ pallet-bridge-parachains = { git = "https://github.com/darwinia-network/darwinia pallet-fee-market = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38", default-features = false } # frontier -fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } -fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } -fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } -fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } -fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } -fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } -fp-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -fp-evm = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -fp-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -fp-self-contained = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -pallet-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -pallet-evm = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -pallet-evm-precompile-blake2 = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -pallet-evm-precompile-bn128 = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -pallet-evm-precompile-dispatch = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -pallet-evm-precompile-modexp = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } -pallet-evm-precompile-simple = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38", default-features = false } +fc-cli = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38" } +fc-consensus = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38" } +fc-db = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38" } +fc-mapping-sync = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38" } +fc-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38" } +fc-rpc-core = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38" } +fc-storage = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38" } +fp-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +fp-self-contained = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +pallet-evm-precompile-blake2 = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +pallet-evm-precompile-bn128 = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +pallet-evm-precompile-dispatch = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +pallet-evm-precompile-modexp = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } +pallet-evm-precompile-simple = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.38", default-features = false } # moonbeam -account = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.38", default-features = false } -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.38", default-features = false } -xcm-primitives = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.38", default-features = false } +account = { git = "https://github.com/darwinia-network/moonbeam", branch = "update-0.9.38", default-features = false } +pallet-ethereum-xcm = { git = "https://github.com/darwinia-network/moonbeam", branch = "update-0.9.38", default-features = false } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "update-0.9.38", default-features = false } +xcm-primitives = { git = "https://github.com/darwinia-network/moonbeam", branch = "update-0.9.38", default-features = false } # polkadot pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false } diff --git a/node/Cargo.toml b/node/Cargo.toml index 5e4fa50b1..6d7e46770 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -45,9 +45,9 @@ fc-db = { workspace = true } fc-mapping-sync = { workspace = true } fc-rpc = { features = ["rpc-binary-search-estimate"], workspace = true } fc-rpc-core = { workspace = true } +fc-storage = { workspace = true } fp-evm = { workspace = true, features = ["std"] } fp-rpc = { workspace = true, features = ["std"] } -fp-storage = { workspace = true, features = ["std"] } # polkadot polkadot-cli = { workspace = true } diff --git a/node/src/frontier_service.rs b/node/src/frontier_service.rs index 16ab6bc12..912cd7110 100644 --- a/node/src/frontier_service.rs +++ b/node/src/frontier_service.rs @@ -19,27 +19,20 @@ //! Service and service factory implementation. Specialized wrapper over substrate service. // std -use std::{collections::BTreeMap, path::PathBuf, sync::Arc, time::Duration}; +use std::{path::PathBuf, sync::Arc, time::Duration}; // crates.io use futures::{future, StreamExt}; // darwinia use crate::cli::Cli; -use dc_primitives::{Block, BlockNumber, Hash, Hashing}; +use dc_primitives::{BlockNumber, Hash, Hashing}; // frontier use fc_db::Backend as FrontierBackend; use fc_mapping_sync::{MappingSyncWorker, SyncStrategy}; -use fc_rpc::{ - EthTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override, - SchemaV3Override, StorageOverride, -}; +use fc_rpc::{EthTask, OverrideHandle}; use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; -use fp_storage::EthereumStorageSchema; // substrate use sc_cli::SubstrateCli; -use sc_client_api::backend::{AuxStore, Backend, StateBackend, StorageProvider}; use sc_service::{BasePath, Configuration, TaskManager}; -use sp_api::ProvideRuntimeApi; -use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; #[allow(clippy::too_many_arguments)] pub fn spawn_frontier_tasks( @@ -73,6 +66,7 @@ pub fn spawn_frontier_tasks( Duration::new(6, 0), client.clone(), backend, + overrides.clone(), frontier_backend, 3, 0, @@ -110,43 +104,3 @@ pub(crate) fn db_config_dir(config: &Configuration) -> PathBuf { .config_dir(config.chain_spec.id()) }) } - -pub(crate) fn overrides_handle(client: Arc) -> Arc> -where - C: 'static - + Send - + Sync - + ProvideRuntimeApi - + StorageProvider - + AuxStore - + HeaderBackend - + HeaderMetadata, - C::Api: sp_api::ApiExt - + fp_rpc::EthereumRuntimeRPCApi - + fp_rpc::ConvertTransactionRuntimeApi, - BE: 'static + Backend, - BE::State: StateBackend, -{ - let mut overrides_map = BTreeMap::new(); - - overrides_map.insert( - EthereumStorageSchema::V1, - Box::new(SchemaV1Override::new(client.clone())) - as Box + Send + Sync>, - ); - overrides_map.insert( - EthereumStorageSchema::V2, - Box::new(SchemaV2Override::new(client.clone())) - as Box + Send + Sync>, - ); - overrides_map.insert( - EthereumStorageSchema::V3, - Box::new(SchemaV3Override::new(client.clone())) - as Box + Send + Sync>, - ); - - Arc::new(OverrideHandle { - schemas: overrides_map, - fallback: Box::new(RuntimeApiStorageOverride::new(client)), - }) -} diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index 01f926172..7a0c7bd33 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -344,7 +344,7 @@ where ); } - let overrides = frontier_service::overrides_handle(client.clone()); + let overrides = fc_storage::overrides_handle(client.clone()); let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new( task_manager.spawn_handle(), overrides.clone(), @@ -808,7 +808,7 @@ where } let prometheus_registry = config.prometheus_registry().cloned(); - let overrides = frontier_service::overrides_handle(client.clone()); + let overrides = fc_storage::overrides_handle(client.clone()); let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new( task_manager.spawn_handle(), overrides.clone(), diff --git a/pallet/message-transact/src/mock.rs b/pallet/message-transact/src/mock.rs index dd59e762a..0c019d3fc 100644 --- a/pallet/message-transact/src/mock.rs +++ b/pallet/message-transact/src/mock.rs @@ -134,7 +134,12 @@ impl pallet_evm::Config for TestRuntime { type WithdrawOrigin = pallet_evm::EnsureAddressNever; } +frame_support::parameter_types! { + pub const PostBlockAndTxnHashes: pallet_ethereum::PostLogContent = pallet_ethereum::PostLogContent::BlockAndTxnHashes; +} + impl pallet_ethereum::Config for TestRuntime { + type PostLogContent = PostBlockAndTxnHashes; type RuntimeEvent = RuntimeEvent; type StateRoot = IntermediateStateRoot; } diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index bcc21e487..102d3570b 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -255,6 +255,9 @@ on-chain-release-build = [ ] runtime-benchmarks = [ + # crates.io + "array-bytes", + # cumulus "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", diff --git a/runtime/crab/src/pallets/ethereum.rs b/runtime/crab/src/pallets/ethereum.rs index 8d53d1276..cb4da4755 100644 --- a/runtime/crab/src/pallets/ethereum.rs +++ b/runtime/crab/src/pallets/ethereum.rs @@ -19,7 +19,12 @@ // darwinia use crate::*; +frame_support::parameter_types! { + pub const PostBlockAndTxnHashes: pallet_ethereum::PostLogContent = pallet_ethereum::PostLogContent::BlockAndTxnHashes; +} + impl pallet_ethereum::Config for Runtime { + type PostLogContent = PostBlockAndTxnHashes; type RuntimeEvent = RuntimeEvent; type StateRoot = pallet_ethereum::IntermediateStateRoot; } diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 9a7805ca1..9d66d6bb8 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -70,8 +70,9 @@ pallet-evm-precompile-modexp = { workspace = true } pallet-evm-precompile-simple = { workspace = true } # moonbeam -precompile-utils = { workspace = true } -xcm-primitives = { workspace = true } +pallet-ethereum-xcm = { workspace = true } +precompile-utils = { workspace = true } +xcm-primitives = { workspace = true } # polkadot pallet-xcm = { workspace = true } @@ -190,6 +191,7 @@ std = [ "pallet-evm-precompile-simple/std", # moonbeam + "pallet-ethereum-xcm/std", "precompile-utils/std", "xcm-primitives/std", @@ -285,6 +287,7 @@ runtime-benchmarks = [ "pallet-evm/runtime-benchmarks", # moonbeam + "pallet-ethereum-xcm/runtime-benchmarks", "xcm-primitives/runtime-benchmarks", # polkadot @@ -342,6 +345,9 @@ try-runtime = [ "pallet-bridge-parachains/try-runtime", "pallet-fee-market/try-runtime", + # moonbeam + "pallet-ethereum-xcm/try-runtime", + # frontier "fp-self-contained/try-runtime", "pallet-ethereum/try-runtime", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index a70555acf..84259f400 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -152,6 +152,7 @@ frame_support::construct_runtime! { XcmpQueue: cumulus_pallet_xcmp_queue = 32, PolkadotXcm: pallet_xcm = 33, CumulusXcm: cumulus_pallet_xcm = 34, + EthereumXcm: pallet_ethereum_xcm = 44, DmpQueue: cumulus_pallet_dmp_queue = 35, // EVM stuff. diff --git a/runtime/darwinia/src/pallets.rs b/runtime/darwinia/src/pallets.rs index 77bf71176..b8b6382b8 100644 --- a/runtime/darwinia/src/pallets.rs +++ b/runtime/darwinia/src/pallets.rs @@ -99,6 +99,8 @@ mod xcmp_queue; mod polkadot_xcm; pub use polkadot_xcm::*; +mod ethereum_xcm; + mod dmp_queue; // EVM stuff. diff --git a/runtime/darwinia/src/pallets/ethereum.rs b/runtime/darwinia/src/pallets/ethereum.rs index 8d53d1276..cb4da4755 100644 --- a/runtime/darwinia/src/pallets/ethereum.rs +++ b/runtime/darwinia/src/pallets/ethereum.rs @@ -19,7 +19,12 @@ // darwinia use crate::*; +frame_support::parameter_types! { + pub const PostBlockAndTxnHashes: pallet_ethereum::PostLogContent = pallet_ethereum::PostLogContent::BlockAndTxnHashes; +} + impl pallet_ethereum::Config for Runtime { + type PostLogContent = PostBlockAndTxnHashes; type RuntimeEvent = RuntimeEvent; type StateRoot = pallet_ethereum::IntermediateStateRoot; } diff --git a/runtime/darwinia/src/pallets/ethereum_xcm.rs b/runtime/darwinia/src/pallets/ethereum_xcm.rs new file mode 100644 index 000000000..9bf6e4bf7 --- /dev/null +++ b/runtime/darwinia/src/pallets/ethereum_xcm.rs @@ -0,0 +1,37 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Darwinia. If not, see . + +// darwinia +use crate::*; + +pub struct EthereumXcmEnsureProxy; +impl xcm_primitives::EnsureProxy for EthereumXcmEnsureProxy { + fn ensure_ok(_delegator: AccountId, _delegatee: AccountId) -> Result<(), &'static str> { + Err("Denied") + } +} + +impl pallet_ethereum_xcm::Config for Runtime { + type ControllerOrigin = frame_system::EnsureRoot; + type EnsureProxy = EthereumXcmEnsureProxy; + type InvalidEvmTransactionError = pallet_ethereum::InvalidTransactionWrapper; + type ReservedXcmpWeight = + ::ReservedXcmpWeight; + type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; + type XcmEthereumOrigin = pallet_ethereum_xcm::EnsureXcmEthereumTransaction; +} diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index b0b688a4b..eecb3de13 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -96,8 +96,6 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< >, // Expected responses are OK. xcm_builder::AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - xcm_builder::AllowSubscriptionsFrom, ), >; @@ -128,6 +126,38 @@ impl xcm_builder::TakeRevenue for ToTreasury { } } +pub type XcmWeigher = xcm_builder::FixedWeightBounds; + +pub struct DarwiniaCall; +impl xcm_executor::traits::CallDispatcher for DarwiniaCall { + fn dispatch( + call: RuntimeCall, + origin: RuntimeOrigin, + ) -> Result< + sp_runtime::traits::PostDispatchInfoOf, + sp_runtime::DispatchErrorWithPostInfo>, + > { + if let Ok(raw_origin) = + TryInto::>::try_into(origin.clone().caller) + { + match (call.clone(), raw_origin) { + ( + RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }), + frame_system::RawOrigin::Signed(account_id), + ) => { + return RuntimeCall::dispatch( + call, + pallet_ethereum_xcm::Origin::XcmEthereumTransaction(account_id.into()) + .into(), + ); + }, + _ => {}, + } + } + RuntimeCall::dispatch(call, origin) + } +} + pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; @@ -137,7 +167,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; - type CallDispatcher = RuntimeCall; + type CallDispatcher = DarwiniaCall; type FeeManager = (); type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); @@ -163,7 +193,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type UniversalAliases = frame_support::traits::Nothing; // Teleporting is disabled. type UniversalLocation = UniversalLocation; - type Weigher = xcm_builder::FixedWeightBounds; + type Weigher = XcmWeigher; type XcmSender = XcmRouter; } @@ -200,7 +230,7 @@ impl pallet_xcm::Config for Runtime { type SovereignAccountOf = LocationToAccountId; type TrustedLockers = (); type UniversalLocation = UniversalLocation; - type Weigher = xcm_builder::FixedWeightBounds; + type Weigher = XcmWeigher; type WeightInfo = pallet_xcm::TestWeightInfo; type XcmExecuteFilter = frame_support::traits::Everything; type XcmExecutor = xcm_executor::XcmExecutor; diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index ac1ed7144..c9394bcf7 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -70,8 +70,9 @@ pallet-evm-precompile-modexp = { workspace = true } pallet-evm-precompile-simple = { workspace = true } # moonbeam -precompile-utils = { workspace = true } -xcm-primitives = { workspace = true } +pallet-ethereum-xcm = { workspace = true } +precompile-utils = { workspace = true } +xcm-primitives = { workspace = true } # polkadot pallet-xcm = { workspace = true } @@ -190,6 +191,7 @@ std = [ "pallet-evm-precompile-simple/std", # moonbeam + "pallet-ethereum-xcm/std", "precompile-utils/std", "xcm-primitives/std", @@ -284,6 +286,7 @@ runtime-benchmarks = [ "pallet-evm/runtime-benchmarks", # moonbeam + "pallet-ethereum-xcm/runtime-benchmarks", "xcm-primitives/runtime-benchmarks", # polkadot @@ -341,6 +344,9 @@ try-runtime = [ "pallet-bridge-parachains/try-runtime", "pallet-fee-market/try-runtime", + # moonbeam + "pallet-ethereum-xcm/try-runtime", + # frontier "fp-self-contained/try-runtime", "pallet-ethereum/try-runtime", diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index cea6087a4..3195cc9bd 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -153,6 +153,7 @@ frame_support::construct_runtime! { XcmpQueue: cumulus_pallet_xcmp_queue = 32, PolkadotXcm: pallet_xcm = 33, CumulusXcm: cumulus_pallet_xcm = 34, + EthereumXcm: pallet_ethereum_xcm = 44, DmpQueue: cumulus_pallet_dmp_queue = 35, // EVM stuff. diff --git a/runtime/pangolin/src/pallets.rs b/runtime/pangolin/src/pallets.rs index 0509cd0d2..48b527a42 100644 --- a/runtime/pangolin/src/pallets.rs +++ b/runtime/pangolin/src/pallets.rs @@ -100,6 +100,8 @@ mod xcmp_queue; mod polkadot_xcm; pub use polkadot_xcm::*; +mod ethereum_xcm; + mod dmp_queue; // EVM stuff. diff --git a/runtime/pangolin/src/pallets/ethereum.rs b/runtime/pangolin/src/pallets/ethereum.rs index 8d53d1276..cb4da4755 100644 --- a/runtime/pangolin/src/pallets/ethereum.rs +++ b/runtime/pangolin/src/pallets/ethereum.rs @@ -19,7 +19,12 @@ // darwinia use crate::*; +frame_support::parameter_types! { + pub const PostBlockAndTxnHashes: pallet_ethereum::PostLogContent = pallet_ethereum::PostLogContent::BlockAndTxnHashes; +} + impl pallet_ethereum::Config for Runtime { + type PostLogContent = PostBlockAndTxnHashes; type RuntimeEvent = RuntimeEvent; type StateRoot = pallet_ethereum::IntermediateStateRoot; } diff --git a/runtime/pangolin/src/pallets/ethereum_xcm.rs b/runtime/pangolin/src/pallets/ethereum_xcm.rs new file mode 100644 index 000000000..9bf6e4bf7 --- /dev/null +++ b/runtime/pangolin/src/pallets/ethereum_xcm.rs @@ -0,0 +1,37 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Darwinia. If not, see . + +// darwinia +use crate::*; + +pub struct EthereumXcmEnsureProxy; +impl xcm_primitives::EnsureProxy for EthereumXcmEnsureProxy { + fn ensure_ok(_delegator: AccountId, _delegatee: AccountId) -> Result<(), &'static str> { + Err("Denied") + } +} + +impl pallet_ethereum_xcm::Config for Runtime { + type ControllerOrigin = frame_system::EnsureRoot; + type EnsureProxy = EthereumXcmEnsureProxy; + type InvalidEvmTransactionError = pallet_ethereum::InvalidTransactionWrapper; + type ReservedXcmpWeight = + ::ReservedXcmpWeight; + type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; + type XcmEthereumOrigin = pallet_ethereum_xcm::EnsureXcmEthereumTransaction; +} diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index b95d6c7d9..6e64f27ee 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -96,8 +96,6 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< >, // Expected responses are OK. xcm_builder::AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - xcm_builder::AllowSubscriptionsFrom, ), >; @@ -128,6 +126,38 @@ impl xcm_builder::TakeRevenue for ToTreasury { } } +pub type XcmWeigher = xcm_builder::FixedWeightBounds; + +pub struct DarwiniaCall; +impl xcm_executor::traits::CallDispatcher for DarwiniaCall { + fn dispatch( + call: RuntimeCall, + origin: RuntimeOrigin, + ) -> Result< + sp_runtime::traits::PostDispatchInfoOf, + sp_runtime::DispatchErrorWithPostInfo>, + > { + if let Ok(raw_origin) = + TryInto::>::try_into(origin.clone().caller) + { + match (call.clone(), raw_origin) { + ( + RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }), + frame_system::RawOrigin::Signed(account_id), + ) => { + return RuntimeCall::dispatch( + call, + pallet_ethereum_xcm::Origin::XcmEthereumTransaction(account_id.into()) + .into(), + ); + }, + _ => {}, + } + } + RuntimeCall::dispatch(call, origin) + } +} + pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; @@ -137,7 +167,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; - type CallDispatcher = RuntimeCall; + type CallDispatcher = DarwiniaCall; type FeeManager = (); type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); @@ -163,7 +193,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type UniversalAliases = frame_support::traits::Nothing; // Teleporting is disabled. type UniversalLocation = UniversalLocation; - type Weigher = xcm_builder::FixedWeightBounds; + type Weigher = XcmWeigher; type XcmSender = XcmRouter; } @@ -200,7 +230,7 @@ impl pallet_xcm::Config for Runtime { type SovereignAccountOf = LocationToAccountId; type TrustedLockers = (); type UniversalLocation = UniversalLocation; - type Weigher = xcm_builder::FixedWeightBounds; + type Weigher = XcmWeigher; type WeightInfo = pallet_xcm::TestWeightInfo; type XcmExecuteFilter = frame_support::traits::Everything; type XcmExecutor = xcm_executor::XcmExecutor; diff --git a/runtime/pangoro/Cargo.toml b/runtime/pangoro/Cargo.toml index 017af21f7..794bec340 100644 --- a/runtime/pangoro/Cargo.toml +++ b/runtime/pangoro/Cargo.toml @@ -70,8 +70,9 @@ pallet-evm-precompile-modexp = { workspace = true } pallet-evm-precompile-simple = { workspace = true } # moonbeam -precompile-utils = { workspace = true } -xcm-primitives = { workspace = true } +pallet-ethereum-xcm = { workspace = true } +precompile-utils = { workspace = true } +xcm-primitives = { workspace = true } # polkadot pallet-xcm = { workspace = true } @@ -190,6 +191,7 @@ std = [ "pallet-evm-precompile-simple/std", # moonbeam + "pallet-ethereum-xcm/std", "precompile-utils/std", "xcm-primitives/std", @@ -285,6 +287,7 @@ runtime-benchmarks = [ "pallet-evm/runtime-benchmarks", # moonbeam + "pallet-ethereum-xcm/runtime-benchmarks", "xcm-primitives/runtime-benchmarks", # polkadot @@ -342,6 +345,9 @@ try-runtime = [ "pallet-bridge-parachains/try-runtime", "pallet-fee-market/try-runtime", + # moonbeam + "pallet-ethereum-xcm/try-runtime", + # frontier "fp-self-contained/try-runtime", "pallet-ethereum/try-runtime", diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index abccc1b28..e393e8596 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -153,6 +153,7 @@ frame_support::construct_runtime! { XcmpQueue: cumulus_pallet_xcmp_queue = 32, PolkadotXcm: pallet_xcm = 33, CumulusXcm: cumulus_pallet_xcm = 34, + EthereumXcm: pallet_ethereum_xcm = 44, DmpQueue: cumulus_pallet_dmp_queue = 35, // EVM stuff. diff --git a/runtime/pangoro/src/pallets.rs b/runtime/pangoro/src/pallets.rs index 0509cd0d2..48b527a42 100644 --- a/runtime/pangoro/src/pallets.rs +++ b/runtime/pangoro/src/pallets.rs @@ -100,6 +100,8 @@ mod xcmp_queue; mod polkadot_xcm; pub use polkadot_xcm::*; +mod ethereum_xcm; + mod dmp_queue; // EVM stuff. diff --git a/runtime/pangoro/src/pallets/ethereum.rs b/runtime/pangoro/src/pallets/ethereum.rs index 8d53d1276..cb4da4755 100644 --- a/runtime/pangoro/src/pallets/ethereum.rs +++ b/runtime/pangoro/src/pallets/ethereum.rs @@ -19,7 +19,12 @@ // darwinia use crate::*; +frame_support::parameter_types! { + pub const PostBlockAndTxnHashes: pallet_ethereum::PostLogContent = pallet_ethereum::PostLogContent::BlockAndTxnHashes; +} + impl pallet_ethereum::Config for Runtime { + type PostLogContent = PostBlockAndTxnHashes; type RuntimeEvent = RuntimeEvent; type StateRoot = pallet_ethereum::IntermediateStateRoot; } diff --git a/runtime/pangoro/src/pallets/ethereum_xcm.rs b/runtime/pangoro/src/pallets/ethereum_xcm.rs new file mode 100644 index 000000000..9bf6e4bf7 --- /dev/null +++ b/runtime/pangoro/src/pallets/ethereum_xcm.rs @@ -0,0 +1,37 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Darwinia. If not, see . + +// darwinia +use crate::*; + +pub struct EthereumXcmEnsureProxy; +impl xcm_primitives::EnsureProxy for EthereumXcmEnsureProxy { + fn ensure_ok(_delegator: AccountId, _delegatee: AccountId) -> Result<(), &'static str> { + Err("Denied") + } +} + +impl pallet_ethereum_xcm::Config for Runtime { + type ControllerOrigin = frame_system::EnsureRoot; + type EnsureProxy = EthereumXcmEnsureProxy; + type InvalidEvmTransactionError = pallet_ethereum::InvalidTransactionWrapper; + type ReservedXcmpWeight = + ::ReservedXcmpWeight; + type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; + type XcmEthereumOrigin = pallet_ethereum_xcm::EnsureXcmEthereumTransaction; +} diff --git a/runtime/pangoro/src/pallets/polkadot_xcm.rs b/runtime/pangoro/src/pallets/polkadot_xcm.rs index 4287ad252..72d89a05e 100644 --- a/runtime/pangoro/src/pallets/polkadot_xcm.rs +++ b/runtime/pangoro/src/pallets/polkadot_xcm.rs @@ -96,8 +96,6 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< >, // Expected responses are OK. xcm_builder::AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - xcm_builder::AllowSubscriptionsFrom, ), >; @@ -128,6 +126,38 @@ impl xcm_builder::TakeRevenue for ToTreasury { } } +pub type XcmWeigher = xcm_builder::FixedWeightBounds; + +pub struct DarwiniaCall; +impl xcm_executor::traits::CallDispatcher for DarwiniaCall { + fn dispatch( + call: RuntimeCall, + origin: RuntimeOrigin, + ) -> Result< + sp_runtime::traits::PostDispatchInfoOf, + sp_runtime::DispatchErrorWithPostInfo>, + > { + if let Ok(raw_origin) = + TryInto::>::try_into(origin.clone().caller) + { + match (call.clone(), raw_origin) { + ( + RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }), + frame_system::RawOrigin::Signed(account_id), + ) => { + return RuntimeCall::dispatch( + call, + pallet_ethereum_xcm::Origin::XcmEthereumTransaction(account_id.into()) + .into(), + ); + }, + _ => {}, + } + } + RuntimeCall::dispatch(call, origin) + } +} + pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; @@ -137,7 +167,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; - type CallDispatcher = RuntimeCall; + type CallDispatcher = DarwiniaCall; type FeeManager = (); type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); @@ -163,7 +193,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type UniversalAliases = frame_support::traits::Nothing; // Teleporting is disabled. type UniversalLocation = UniversalLocation; - type Weigher = xcm_builder::FixedWeightBounds; + type Weigher = XcmWeigher; type XcmSender = XcmRouter; } @@ -200,7 +230,7 @@ impl pallet_xcm::Config for Runtime { type SovereignAccountOf = LocationToAccountId; type TrustedLockers = (); type UniversalLocation = UniversalLocation; - type Weigher = xcm_builder::FixedWeightBounds; + type Weigher = XcmWeigher; type WeightInfo = pallet_xcm::TestWeightInfo; type XcmExecuteFilter = frame_support::traits::Everything; type XcmExecutor = xcm_executor::XcmExecutor;