diff --git a/parachain/Cargo.lock b/parachain/Cargo.lock index 2f6fcdddff..926821846e 100644 --- a/parachain/Cargo.lock +++ b/parachain/Cargo.lock @@ -1527,7 +1527,7 @@ dependencies = [ [[package]] name = "ethabi-decode" version = "1.3.3" -source = "git+https://github.com/snowfork/ethabi-decode.git?branch=master#6f63405bb33ef4365a1c62b72d499fa0f448118e" +source = "git+https://github.com/Snowfork/ethabi-decode.git?branch=master#6f63405bb33ef4365a1c62b72d499fa0f448118e" dependencies = [ "ethereum-types", "tiny-keccak 1.5.0", diff --git a/polkadot-sdk b/polkadot-sdk index 1a6f3d75fb..aa29476ec3 160000 --- a/polkadot-sdk +++ b/polkadot-sdk @@ -1 +1 @@ -Subproject commit 1a6f3d75fb70b16f5e420ac836ccacb124674b79 +Subproject commit aa29476ec3abb8c6e6f01f0a4d8b22bbc0333f95 diff --git a/smoketest/.gitignore b/smoketest/.gitignore index 5a6a269397..e40652197b 100644 --- a/smoketest/.gitignore +++ b/smoketest/.gitignore @@ -15,5 +15,4 @@ src/parachains/assethub.rs src/parachains/bridgehub.rs src/parachains/penpal.rs src/parachains/relaychain.rs -src/parachains/template.rs src/contracts diff --git a/smoketest/make-bindings.sh b/smoketest/make-bindings.sh index aceb1a716c..d70dc0cb6e 100755 --- a/smoketest/make-bindings.sh +++ b/smoketest/make-bindings.sh @@ -23,6 +23,5 @@ fi # Fetch metadata from BridgeHub and generate client subxt codegen --url ws://localhost:11144 > src/parachains/bridgehub.rs subxt codegen --url ws://localhost:12144 > src/parachains/assethub.rs -subxt codegen --url ws://localhost:13144 > src/parachains/template.rs -subxt codegen --url ws://localhost:14144 > src/parachains/penpal.rs +subxt codegen --url ws://localhost:13144 > src/parachains/penpal.rs subxt codegen --url ws://localhost:9944 > src/parachains/relaychain.rs diff --git a/smoketest/src/constants.rs b/smoketest/src/constants.rs index 5263c9f80c..0c2ed43cb9 100644 --- a/smoketest/src/constants.rs +++ b/smoketest/src/constants.rs @@ -10,7 +10,7 @@ pub const ETHEREUM_HTTP_API: &str = "http://localhost:8545"; pub const ASSET_HUB_WS_URL: &str = "ws://127.0.0.1:12144"; pub const BRIDGE_HUB_WS_URL: &str = "ws://127.0.0.1:11144"; -pub const PENPAL_WS_URL: &str = "ws://127.0.0.1:14144"; +pub const PENPAL_WS_URL: &str = "ws://127.0.0.1:13144"; pub const RELAY_CHAIN_WS_URL: &str = "ws://127.0.0.1:9944"; pub const TEMPLATE_NODE_WS_URL: &str = "ws://127.0.0.1:13144"; @@ -29,9 +29,9 @@ pub const BRIDGE_HUB_AGENT_ID: [u8; 32] = // Agent for asset hub parachain 1000 pub const ASSET_HUB_AGENT_ID: [u8; 32] = hex!("72456f48efed08af20e5b317abf8648ac66e86bb90a411d9b0b713f7364b75b4"); -// Agent for template parachain 1001 +// Agent for penpal parachain 2000 pub const SIBLING_AGENT_ID: [u8; 32] = - hex!("e01018a3378502770faff44fbef3910d120a0353d18be653625b8daa88a86453"); + hex!("5097ee1101e90c3aadb882858c59a22108668021ec81bce9f4930155e5c21e59"); pub const ASSET_HUB_SOVEREIGN: [u8; 32] = hex!("7369626ce8030000000000000000000000000000000000000000000000000000"); diff --git a/smoketest/src/helper.rs b/smoketest/src/helper.rs index 9c4af585f3..15abb1fa37 100644 --- a/smoketest/src/helper.rs +++ b/smoketest/src/helper.rs @@ -31,8 +31,8 @@ use crate::{ VersionedXcm as RelaychainVersionedXcm, }, }, - template::{ - api::runtime_types as templateTypes, + penpal::{ + api::runtime_types as penpalTypes, {self}, }, }, @@ -53,28 +53,16 @@ use subxt::{ tx::{PairSigner, TxPayload}, Config, OnlineClient, PolkadotConfig, SubstrateConfig, }; -use templateTypes::{ +use penpalTypes::{ staging_xcm::v3::multilocation::MultiLocation, xcm::{ v3::{junction::Junction, junctions::Junctions}, VersionedMultiLocation, VersionedXcm, }, + pallet_xcm::pallet::Call, + penpal_runtime::RuntimeCall }; -/// Custom config that works with TemplateParachain -pub enum TemplateConfig {} - -impl Config for TemplateConfig { - type Index = ::Index; - type Hash = ::Hash; - type AccountId = ::AccountId; - type Address = ::Address; - type Signature = ::Signature; - type Hasher = ::Hasher; - type Header = ::Header; - type ExtrinsicParams = ::ExtrinsicParams; -} - /// Custom config that works with Penpal pub enum PenpalConfig {} @@ -106,7 +94,6 @@ impl Config for AssetHubConfig { pub struct TestClients { pub asset_hub_client: Box>, pub bridge_hub_client: Box>, - pub template_client: Box>, pub penpal_client: Box>, pub relaychain_client: Box>, pub ethereum_client: Box>>, @@ -122,11 +109,6 @@ pub async fn initial_clients() -> Result .await .expect("can not connect to bridgehub"); - let template_client: OnlineClient = - OnlineClient::from_url(TEMPLATE_NODE_WS_URL) - .await - .expect("can not connect to template parachain"); - let penpal_client: OnlineClient = OnlineClient::from_url(PENPAL_WS_URL) .await .expect("can not connect to penpal parachain"); @@ -148,7 +130,6 @@ pub async fn initial_clients() -> Result Ok(TestClients { asset_hub_client: Box::new(asset_hub_client), bridge_hub_client: Box::new(bridge_hub_client), - template_client: Box::new(template_client), penpal_client: Box::new(penpal_client), relaychain_client: Box::new(relaychain_client), ethereum_client: Box::new(ethereum_client), @@ -207,24 +188,24 @@ pub async fn wait_for_ethereum_event(ethereum_client: &Box>, +pub async fn send_sudo_xcm_transact( + penpal_client: &Box>, message: Box, -) -> Result, Box> { +) -> Result, Box> { let dest = Box::new(VersionedMultiLocation::V3(MultiLocation { parents: 1, interior: Junctions::X1(Junction::Parachain(BRIDGE_HUB_PARA_ID)), })); - let xcm_call = template::api::template_pallet::calls::TransactionApi.send_xcm(*dest, *message); + let sudo_call = penpal::api::sudo::calls::TransactionApi::sudo(&penpal::api::sudo::calls::TransactionApi,RuntimeCall::PolkadotXcm(Call::send { dest, message })); let owner: Pair = Pair::from_string("//Alice", None).expect("cannot create keypair"); - let signer: PairSigner = PairSigner::new(owner); + let signer: PairSigner = PairSigner::new(owner); - let result = template_client + let result = penpal_client .tx() - .sign_and_submit_then_watch_default(&xcm_call, &signer) + .sign_and_submit_then_watch_default(&sudo_call, &signer) .await .expect("send through xcm call.") .wait_for_finalized_success() diff --git a/smoketest/src/parachains/mod.rs b/smoketest/src/parachains/mod.rs index b1195f1820..acadad41d9 100644 --- a/smoketest/src/parachains/mod.rs +++ b/smoketest/src/parachains/mod.rs @@ -2,4 +2,3 @@ pub mod assethub; pub mod bridgehub; pub mod penpal; pub mod relaychain; -pub mod template; diff --git a/smoketest/src/xcm.rs b/smoketest/src/xcm.rs index 1efea9d698..70785456a4 100644 --- a/smoketest/src/xcm.rs +++ b/smoketest/src/xcm.rs @@ -1,10 +1,10 @@ -use crate::parachains::template::api::{ - runtime_types as templateTypes, runtime_types::staging_xcm as templateXcm, +use crate::parachains::penpal::api::{ + runtime_types as penpalTypes, runtime_types::staging_xcm as penpalXcm, }; -use templateTypes::sp_weights::weight_v2::Weight; -use templateXcm::v3::multilocation::MultiLocation; +use penpalTypes::sp_weights::weight_v2::Weight; +use penpalXcm::v3::multilocation::MultiLocation; -use templateTypes::xcm::{ +use penpalTypes::xcm::{ double_encoded::DoubleEncoded, v2::OriginKind, v3::{ diff --git a/smoketest/tests/create_agent.rs b/smoketest/tests/create_agent.rs index e68ecd2784..ffefd28fff 100644 --- a/smoketest/tests/create_agent.rs +++ b/smoketest/tests/create_agent.rs @@ -14,7 +14,7 @@ async fn create_agent() { let message = construct_xcm_message_with_fee(encoded_call).await; - let result = send_xcm_transact(&test_clients.template_client, message) + let result = send_sudo_xcm_transact(&test_clients.penpal_client, message) .await .expect("failed to send xcm transact."); diff --git a/smoketest/tests/create_channel.rs b/smoketest/tests/create_channel.rs index e4f2f4f449..6689950969 100644 --- a/smoketest/tests/create_channel.rs +++ b/smoketest/tests/create_channel.rs @@ -10,11 +10,11 @@ async fn create_channel() { let encoded_call = construct_create_channel_call(&test_clients.bridge_hub_client) .await - .expect("construct innner call."); + .expect("construct inner call."); let message = construct_xcm_message_with_fee(encoded_call).await; - let result = send_xcm_transact(&test_clients.template_client, message) + let result = send_sudo_xcm_transact(&test_clients.penpal_client, message) .await .expect("failed to send xcm transact."); diff --git a/smoketest/tests/transfer_native_from_agent.rs b/smoketest/tests/transfer_native_from_agent.rs index 99e082ce97..8c78cc4c32 100644 --- a/smoketest/tests/transfer_native_from_agent.rs +++ b/smoketest/tests/transfer_native_from_agent.rs @@ -41,7 +41,7 @@ async fn transfer_native_from_agent() { ) .await; - let result = send_xcm_transact(&test_clients.template_client, message) + let result = send_sudo_xcm_transact(&test_clients.penpal_client, message) .await .expect("failed to send xcm transact."); diff --git a/web/packages/test/config/launch-config.toml b/web/packages/test/config/launch-config.toml index 6751e27d7c..4920e4c4f2 100644 --- a/web/packages/test/config/launch-config.toml +++ b/web/packages/test/config/launch-config.toml @@ -70,25 +70,6 @@ cumulus_based = true "-lparachain=debug,xcm=trace,runtime::bridge-assets-transfer=trace,runtime::assets=trace,runtime::bridge-transfer=trace", ] - -## Template node -[[parachains]] -id = 1001 -chain = "template-rococo" -cumulus_based = true - - # run alice as parachain collator - [[parachains.collators]] - name = "template01" - validator = true - command = "{{output_bin_dir}}/parachain-template-node" - rpc_port = 8083 - ws_port = 13144 - args = [ - "--force-authoring", - "-lparachain=debug,xcm=trace,runtime::bridge-assets-transfer=trace,runtime::assets=trace,runtime::bridge-transfer=trace", - ] - ## Penpal [[parachains]] id = 2000 @@ -100,8 +81,8 @@ cumulus_based = true validator = true command = "{{output_bin_dir}}/polkadot-parachain" rpc_port = 8084 - ws_port = 14144 - args = [ + ws_port = 13144 + args = [ "--force-authoring", "-lxcm=trace,runtime::assets=trace", ] diff --git a/web/packages/test/scripts/build-binary.sh b/web/packages/test/scripts/build-binary.sh index 7984d330ce..d8355c2053 100755 --- a/web/packages/test/scripts/build-binary.sh +++ b/web/packages/test/scripts/build-binary.sh @@ -11,12 +11,11 @@ build_binaries() { features=--features beacon-spec-mainnet fi - echo "Building polkadot binary and parachain template node" - cargo build --release --workspace --locked --bin polkadot --bin polkadot-execute-worker --bin polkadot-prepare-worker --bin parachain-template-node + echo "Building polkadot binary" + cargo build --release --workspace --locked --bin polkadot --bin polkadot-execute-worker --bin polkadot-prepare-worker cp target/release/polkadot $output_bin_dir/polkadot cp target/release/polkadot-execute-worker $output_bin_dir/polkadot-execute-worker cp target/release/polkadot-prepare-worker $output_bin_dir/polkadot-prepare-worker - cp target/release/parachain-template-node $output_bin_dir/parachain-template-node echo "Building polkadot-parachain binary" cargo build --release --workspace --locked --bin polkadot-parachain $features diff --git a/web/packages/test/scripts/configure-bridgehub.sh b/web/packages/test/scripts/configure-bridgehub.sh index 73001cff7e..a8c2260b85 100755 --- a/web/packages/test/scripts/configure-bridgehub.sh +++ b/web/packages/test/scripts/configure-bridgehub.sh @@ -24,7 +24,7 @@ wait_beacon_chain_ready() { fund_accounts() { echo "Funding substrate accounts" transfer_balance $relaychain_ws_url "//Charlie" 1013 1000000000000000 $assethub_sovereign_account - transfer_balance $relaychain_ws_url "//Charlie" 1013 1000000000000000 $template_sovereign_account + transfer_balance $relaychain_ws_url "//Charlie" 1013 1000000000000000 $penpal_sovereign_account transfer_balance $relaychain_ws_url "//Charlie" 1013 1000000000000000 $beacon_relayer_pub_key transfer_balance $relaychain_ws_url "//Charlie" 1013 1000000000000000 $execution_relayer_pub_key } @@ -63,8 +63,8 @@ open_hrmp_channels() echo "Opening HRMP channels" open_hrmp_channel "${relaychain_ws_url}" "${relaychain_sudo_seed}" 1000 1013 8 512 # Assethub -> BridgeHub open_hrmp_channel "${relaychain_ws_url}" "${relaychain_sudo_seed}" 1013 1000 8 512 # BridgeHub -> Assethub - open_hrmp_channel "${relaychain_ws_url}" "${relaychain_sudo_seed}" 1001 1013 8 512 # TemplateNode -> BridgeHub - open_hrmp_channel "${relaychain_ws_url}" "${relaychain_sudo_seed}" 1013 1001 8 512 # BridgeHub -> TemplateNode + open_hrmp_channel "${relaychain_ws_url}" "${relaychain_sudo_seed}" 2000 1013 8 512 # Penpal -> BridgeHub + open_hrmp_channel "${relaychain_ws_url}" "${relaychain_sudo_seed}" 1013 2000 8 512 # BridgeHub -> Penpal open_hrmp_channel "${relaychain_ws_url}" "${relaychain_sudo_seed}" 1000 2000 8 512 # Penpal -> AssetHub open_hrmp_channel "${relaychain_ws_url}" "${relaychain_sudo_seed}" 2000 1000 8 512 # Assethub -> Penpal } diff --git a/web/packages/test/scripts/set-env.sh b/web/packages/test/scripts/set-env.sh index 500033831a..2ee59946d1 100755 --- a/web/packages/test/scripts/set-env.sh +++ b/web/packages/test/scripts/set-env.sh @@ -42,11 +42,9 @@ assethub_ws_url="${ASSET_HUB_WS_URL:-ws://127.0.0.1:12144}" assethub_seed="${ASSET_HUB_SEED:-//Alice}" export ASSET_HUB_PARAID="${ASSET_HUB_PARAID:-1000}" export ASSET_HUB_AGENT_ID="${ASSET_HUB_AGENT_ID:-0x72456f48efed08af20e5b317abf8648ac66e86bb90a411d9b0b713f7364b75b4}" -export TEMPLATE_PARA_ID="${TEMPLATE_PARA_ID:-1001}" -export TEMPLATE_AGENT_ID="${TEMPLATE_AGENT_ID:-0x2075b9f5bc236462eb1473c9a6236c3588e33ed19ead53aa3d9c62ed941cb793}" export ASSET_HUB_CHANNEL_ID="0xc173fac324158e77fb5840738a1a541f633cbec8884c6a601c567d2b376a0539" -export TEMPLATE_CHANNEL_ID="0x26c13363ad6499b895574b3ca482545dda41d657ffc5673b39a218cd34053e5b" +export PENPAL_CHANNEL_ID="0xa69fbbae90bb6096d59b1930bbcfc8a3ef23959d226b1861deb7ad8fb06c6fa3" export PRIMARY_GOVERNANCE_CHANNEL_ID="0x0000000000000000000000000000000000000000000000000000000000000001" export SECONDARY_GOVERNANCE_CHANNEL_ID="0x0000000000000000000000000000000000000000000000000000000000000002" @@ -57,10 +55,11 @@ skip_relayer="${SKIP_RELAYER:-false}" ## Important accounts +# Useful tool to get these account values: https://www.shawntabrizi.com/substrate-js-utilities/ # Account for assethub (Sibling parachain 1000 5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV in testnet) assethub_sovereign_account="${ASSETHUB_SOVEREIGN_ACCOUNT:-0x7369626ce8030000000000000000000000000000000000000000000000000000}" -# Account for template (Sibling parachain 1001 5Eg2fntP2UgYZNc5tW8xmmCmeXJ3hmNXaZ9MvcpbMdvh1bBJ in testnet) -template_sovereign_account="${TEMPLATE_SOVEREIGN_ACCOUNT:-0x7369626ce9030000000000000000000000000000000000000000000000000000}" +# Account for penpal (Sibling parachain 2000 5Eg2fntJ27qsari4FGrGhrMqKFDRnkNSR6UshkZYBGXmSuC8 in testnet) +penpal_sovereign_account="${PENPAL_SOVEREIGN_ACCOUNT:-0x7369626cd0070000000000000000000000000000000000000000000000000000}" # Beacon relay account (//BeaconRelay 5GWFwdZb6JyU46e6ZiLxjGxogAHe8SenX76btfq8vGNAaq8c in testnet) beacon_relayer_pub_key="${BEACON_RELAYER_PUB_KEY:-0xc46e141b5083721ad5f5056ba1cded69dce4a65f027ed3362357605b1687986a}" # Execution relay account (//ExecutionRelay 5CFNWKMFPsw5Cs2Teo6Pvg7rWyjKiFfqPZs8U4MZXzMYFwXL in testnet) diff --git a/web/packages/test/scripts/start-relayer.sh b/web/packages/test/scripts/start-relayer.sh index 23c27fcfe0..d5a0bf0bfe 100755 --- a/web/packages/test/scripts/start-relayer.sh +++ b/web/packages/test/scripts/start-relayer.sh @@ -71,12 +71,12 @@ config_relayer() { ' \ config/parachain-relay.json >$output_dir/parachain-relay-asset-hub.json - # Configure parachain relay (parachain template) + # Configure parachain relay (penpal) jq \ --arg k1 "$(address_for GatewayProxy)" \ --arg k2 "$(address_for BeefyClient)" \ --arg eth_endpoint_ws $eth_endpoint_ws \ - --arg channelID $TEMPLATE_CHANNEL_ID \ + --arg channelID $PENPAL_CHANNEL_ID \ --arg eth_gas_limit $eth_gas_limit \ ' .source.contracts.Gateway = $k1 @@ -87,7 +87,7 @@ config_relayer() { | .sink.ethereum."gas-limit" = $eth_gas_limit | .source."channel-id" = $channelID ' \ - config/parachain-relay.json >$output_dir/parachain-relay-template.json + config/parachain-relay.json >$output_dir/parachain-relay-penpal.json # Configure beacon relay jq \ @@ -111,17 +111,17 @@ config_relayer() { ' \ config/execution-relay.json >$output_dir/execution-relay-asset-hub.json - # Configure execution relay for template node + # Configure execution relay for penpal jq \ --arg eth_endpoint_ws $eth_endpoint_ws \ --arg k1 "$(address_for GatewayProxy)" \ - --arg channelID $TEMPLATE_CHANNEL_ID \ + --arg channelID $PENPAL_CHANNEL_ID \ ' .source.ethereum.endpoint = $eth_endpoint_ws | .source.contracts.Gateway = $k1 | .source."channel-id" = $channelID ' \ - config/execution-relay.json >$output_dir/execution-relay-template.json + config/execution-relay.json >$output_dir/execution-relay-penpal.json } start_relayer() { @@ -178,15 +178,15 @@ start_relayer() { done ) & - # Launch parachain relay for parachain template + # Launch parachain relay for parachain penpal ( - : >"$output_dir"/parachain-relay-template.log + : >"$output_dir"/parachain-relay-penpal.log while :; do - echo "Starting parachain-relay (parachain-template) at $(date)" + echo "Starting parachain-relay (penpal) at $(date)" "${relay_bin}" run parachain \ - --config "$output_dir/parachain-relay-template.json" \ + --config "$output_dir/parachain-relay-penpal.json" \ --ethereum.private-key $parachain_relay_eth_key \ - >>"$output_dir"/parachain-relay-template.log 2>&1 || true + >>"$output_dir"/parachain-relay-penpal.log 2>&1 || true sleep 20 done ) & @@ -217,15 +217,15 @@ start_relayer() { done ) & - # Launch execution relay for template + # Launch execution relay for penpal ( - : >$output_dir/execution-relay-template.log + : >$output_dir/execution-relay-penpal.log while :; do - echo "Starting execution relay (parachain-template) at $(date)" + echo "Starting execution relay (penpal) at $(date)" "${relay_bin}" run execution \ - --config $output_dir/execution-relay-template.json \ + --config $output_dir/execution-relay-penpal.json \ --substrate.private-key "//ExecutionRelay" \ - >>"$output_dir"/execution-relay-template.log 2>&1 || true + >>"$output_dir"/execution-relay-penpal.log 2>&1 || true sleep 20 done ) &