diff --git a/Cargo.toml b/Cargo.toml index dd254d0..cf65c62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -163,7 +163,6 @@ pallet-evm-precompile-blake2 = {git = "https://github.com/moonbeam-foundation/fr pallet-evm-precompile-batch = {git = "https://github.com/moonbeam-foundation/moonbeam", tag = "runtime-3701", default-features = false} pallet-evm-precompile-balances-erc20 = {git = "https://github.com/moonbeam-foundation/moonbeam", tag = "runtime-3701", default-features = false} -#ethereum = {version = "0.15.0", default-features = false, features = ["with-codec"]} ethereum = {git = "https://github.com/rust-ethereum/ethereum", rev = "3be0d8fd4c2ad1ba216b69ef65b9382612efc8ba"} # Moonbeam @@ -255,29 +254,15 @@ substrate-wasm-builder = { version = "25.0.1" } cumulus-primitives-storage-weight-reclaim = { version = "9.1.0" } substrate-prometheus-endpoint = { version = "0.17.2" } -#[patch."https://github.com/rust-ethereum/ethereum"] -#ethereum = {version = "0.15.0"} - # XCM xcm = { version = "15.1.0", package = "staging-xcm" } -#[patch."https://github.com/rust-ethereum/ethereum"] -#ethereum = { git = "https://github.com/rust-ethereum/ethereum", rev = "3be0d8f" } - -#[patch."https://github.com/moonbeam-foundation/frontier"] -#fp-ethereum = {git = "https://github.com/moonbeam-foundation/frontier", branch = "moonbeam-polkadot-stable2412"} -#fp-evm = {git = "https://github.com/moonbeam-foundation/frontier", branch = "moonbeam-polkadot-stable2412"} -#fp-rpc = {git = "https://github.com/moonbeam-foundation/frontier", branch = "moonbeam-polkadot-stable2412"} -#fp-self-contained = {git = "https://github.com/moonbeam-foundation/frontier", branch = "moonbeam-polkadot-stable2412"} -#pallet-evm = {git = "https://github.com/moonbeam-foundation/frontier", branch = "moonbeam-polkadot-stable2412"} - [patch."https://github.com/moonbeam-foundation/polkadot-sdk"] staging-xcm-builder = { version = "18.2.1" } xcm-executor = { version = "18.0.3", package = "staging-xcm-executor" } pallet-staking = { version = "39.1.0" } cumulus-primitives-core = { version = "0.17.0" } polkadot-runtime-common = { version = "18.1.0" } -#pallet-election-provider-multi-phase = { version = "38.2.0" } sc-block-builder = { version = "0.43.0" } sc-chain-spec = { version = "41.0.0" } sc-cli = { version = "0.50.2" } @@ -351,9 +336,6 @@ substrate-wasm-builder = { version = "25.0.1" } cumulus-primitives-storage-weight-reclaim = { version = "9.1.0" } substrate-prometheus-endpoint = { version = "0.17.2" } -#[patch."https://github.com/rust-ethereum/ethereum"] -#ethereum = {version = "0.15.0"} - # XCM xcm = { version = "15.1.0", package = "staging-xcm" } diff --git a/runtime/src/configs/xcm.rs b/runtime/src/configs/xcm.rs index b5a3a54..383684b 100644 --- a/runtime/src/configs/xcm.rs +++ b/runtime/src/configs/xcm.rs @@ -45,9 +45,9 @@ use sp_runtime::{ }; use xcm::latest::prelude::*; use xcm_builder::{ - AccountKey20Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, - DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FrameTransactionalProcessor, + AccountKey20Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, + DenyThenTry, DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete, NativeAsset, ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative, SignedAccountKey20AsNative, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, @@ -159,6 +159,14 @@ impl Contains for ParentRelayChain { } } +pub struct ParentsTreasury; +impl Contains for ParentsTreasury { + fn contains(location: &Location) -> bool { + // match the relay chain and any account on it + matches!(location.unpack(), (1, [PalletInstance(14)])) + } +} + pub type Barrier = TrailingSetTopicAsId< DenyThenTry< DenyReserveTransferToRelayChain, @@ -166,7 +174,10 @@ pub type Barrier = TrailingSetTopicAsId< TakeWeightCredit, AllowKnownQueryResponses, WithComputedOrigin< - (AllowTopLevelPaidExecutionFrom,), + ( + AllowTopLevelPaidExecutionFrom, + AllowExplicitUnpaidExecutionFrom, + ), UniversalLocation, ConstU32<8>, >, @@ -177,7 +188,7 @@ pub type Barrier = TrailingSetTopicAsId< pub type TrustedTeleporters = ConcreteAssetFromSystem; -pub type WaivedLocations = (Equals, Equals); +pub type WaivedLocations = (Equals, Equals, ParentsTreasury); pub struct RemoteEVMCall; impl CallDispatcher for RemoteEVMCall { @@ -402,3 +413,23 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type PriceForSiblingDelivery = PriceForSiblingParachainDelivery; type WeightInfo = weights::cumulus_pallet_xcmp_queue::ZKVEvmWeight; } + +#[test] +fn alice_pubkey_conversion() { + use hex_literal::hex; + use xcm::latest::Junctions::X1; + + let loc = Location { + parents: 0, + interior: X1([AccountId32 { + network: None, + id: hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d").into(), + }] + .into()), + }; + assert_eq!( + LocationAccountId32ToAccountId::convert_location(&loc) + .expect("Cannot convert accountid32; qed"), + hex!("04a99fd6822c8558854ccde39a5684e7a56da27d").into() + ); +} diff --git a/runtime/src/tests/constants_test.rs b/runtime/src/tests/constants_test.rs index cb76297..f066511 100644 --- a/runtime/src/tests/constants_test.rs +++ b/runtime/src/tests/constants_test.rs @@ -209,6 +209,10 @@ mod runtime_tests { mod xcm_tests { use super::*; use configs::xcm::*; + use hex_literal::hex; + use xcm::latest::prelude::*; + use xcm::opaque::latest::Junctions::X1; + use xcm_executor::traits::ConvertLocation; #[test] fn xcm_executor_constants() { @@ -225,4 +229,18 @@ mod xcm_tests { 100 ); } + + #[test] + fn relay_treasury_account() { + // TODO: replace with zkv_runtime::TreasuryPalletIdx::get() on next zkVerify tag? + let loc = Location { + parents: 1, + interior: X1([PalletInstance(14)].into()), // 14 is the index of the treasury pallet in zkv-runtime + }; + assert_eq!( + LocationAccountId32ToAccountId::convert_location(&loc) + .expect("Location is not convertible; qed"), + hex!("f260e064445be1b5e12e5cef1e1c11fc4c4b4963").into(), + ); + } } diff --git a/zombienet-config/devnet.toml b/zombienet-config/devnet.toml index 4d5f94d..e84b24f 100644 --- a/zombienet-config/devnet.toml +++ b/zombienet-config/devnet.toml @@ -36,7 +36,6 @@ name = "zkv-para-evm-parachain-collator01" command = "./target/release/zkv-para-evm-node" ws_port = 9933 rpc_port = 8833 -#args = ["--rpc-max-connections 10000 -ltrace"] args = ["-lxcm=trace", "--rpc-max-connections 10000"] [[parachains.collators]]