Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored and claravanstaden committed Oct 25, 2023
1 parent 6ba5994 commit fd805ec
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 47 deletions.
9 changes: 5 additions & 4 deletions parachain/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions smoketest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions smoketest/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ use crate::{
pallet_xcm::pallet::Call as RelaychainPalletXcmCall,
rococo_runtime::RuntimeCall as RelaychainRuntimeCall,
sp_weights::weight_v2::Weight as RelaychainWeight,
staging_xcm::{
staging_xcm::v3::multilocation::MultiLocation as RelaychainMultiLocation,
xcm::{
double_encoded::DoubleEncoded as RelaychainDoubleEncoded,
v2::OriginKind as RelaychainOriginKind,
v3::{
junction::Junction as RelaychainJunction,
junctions::Junctions as RelaychainJunctions,
multilocation::MultiLocation as RelaychainMultiLocation,
Instruction as RelaychainInstruction, WeightLimit as RelaychainWeightLimit,
Xcm as RelaychainXcm,
},
Expand All @@ -28,7 +28,7 @@ use crate::{
},
},
template::{
api::runtime_types::staging_xcm as templateXcm,
api::runtime_types as templateTypes,
{self},
},
},
Expand All @@ -49,8 +49,9 @@ use subxt::{
tx::{PairSigner, TxPayload},
Config, OnlineClient, PolkadotConfig, SubstrateConfig,
};
use templateXcm::{
v3::{junction::Junction, junctions::Junctions, multilocation::MultiLocation},
use templateTypes::staging_xcm::v3::multilocation::MultiLocation;
use templateTypes::xcm::{
v3::{junction::Junction, junctions::Junctions},
VersionedMultiLocation, VersionedXcm,
};

Expand Down
9 changes: 5 additions & 4 deletions smoketest/src/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ use crate::parachains::template::{
api::runtime_types as templateTypes, api::runtime_types::staging_xcm as templateXcm,
};
use templateTypes::sp_weights::weight_v2::Weight;
use templateXcm::{
use templateXcm::v3::multilocation::MultiLocation;

use templateTypes::xcm::{
double_encoded::DoubleEncoded,
v2::OriginKind,
v3::{
junctions::Junctions,
multiasset::{AssetId::Concrete, Fungibility::Fungible, MultiAsset, MultiAssets},
multilocation::MultiLocation,
Instruction, MaybeErrorCode, WeightLimit, Xcm,
},
VersionedXcm,
Expand Down Expand Up @@ -42,7 +43,7 @@ pub fn construct_xcm_message(encoded_call: Vec<u8>) -> Box<VersionedXcm> {
pub async fn construct_xcm_message_with_fee(encoded_call: Vec<u8>) -> Box<VersionedXcm> {
let buy_execution_fee = MultiAsset {
id: Concrete(MultiLocation {
parents: 0,
parents: 1,
interior: Junctions::Here,
}),
fun: Fungible(BRIDGE_HUB_FEE_REQUIRED),
Expand All @@ -53,7 +54,7 @@ pub async fn construct_xcm_message_with_fee(encoded_call: Vec<u8>) -> Box<Versio
Instruction::BuyExecution {
fees: MultiAsset {
id: Concrete(MultiLocation {
parents: 0,
parents: 1,
interior: Junctions::Here,
}),
fun: Fungible(BRIDGE_HUB_FEE_REQUIRED),
Expand Down
12 changes: 6 additions & 6 deletions smoketest/tests/create_agent.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use snowbridge_smoketest::contracts::i_gateway::AgentCreatedFilter;
use snowbridge_smoketest::helper::*;
use snowbridge_smoketest::parachains::bridgehub::api::ethereum_control::events::CreateAgent;
use snowbridge_smoketest::xcm::construct_xcm_message;
use snowbridge_smoketest::xcm::construct_xcm_message_with_fee;

#[tokio::test]
async fn create_agent() {
let test_clients = initial_clients().await.expect("initialize clients");

let message = construct_xcm_message(
construct_create_agent_call(&test_clients.bridge_hub_client)
.await
.expect("construct innner call."),
);
let encoded_call = construct_create_agent_call(&test_clients.bridge_hub_client)
.await
.expect("construct inner call.");

let message = construct_xcm_message_with_fee(encoded_call).await;

let result = send_xcm_transact(&test_clients.template_client, message)
.await
Expand Down
2 changes: 1 addition & 1 deletion web/packages/test/config/launch-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ cumulus_based = true
[[parachains.collators]]
name = "assethub01"
#validator = true
command = "{{output_bin_dir}}/polkadot-parachain-asset-hub"
command = "{{output_bin_dir}}/polkadot-parachain"
rpc_port = 8082
ws_port = 12144
args = [
Expand Down
33 changes: 10 additions & 23 deletions web/packages/test/scripts/build-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,24 @@ set -eu

source scripts/set-env.sh

build_cumulus_from_source() {
pushd $root_dir/polkadot-sdk/cumulus
build_binaries() {
pushd $root_dir/polkadot-sdk

local features=''
if [[ "$active_spec" != "minimal" ]]; then
features=--features beacon-spec-mainnet
fi

echo "Building polkadot-parachain binary"
cargo build --release --workspace -p polkadot-parachain-bin $features
#cargo build --release --workspace --locked --bin polkadot-parachain $features
cp ../target/release/polkadot-parachain $output_bin_dir/polkadot-parachain
cp ../target/release/polkadot-parachain $output_bin_dir/polkadot-parachain-asset-hub

echo "Building parachain template node"
cargo build --release --workspace --locked --bin parachain-template-node
cp ../target/release/parachain-template-node $output_bin_dir/parachain-template-node
popd
}

build_relaychain_from_source() {
echo "Building polkadot binary"
pushd $root_dir/polkadot-sdk

cargo build --release --locked --bin polkadot --bin polkadot-execute-worker --bin polkadot-prepare-worker
mkdir -p $output_bin_dir

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
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
cp target/release/polkadot-parachain $output_bin_dir/polkadot-parachain

popd
}
Expand All @@ -53,8 +41,7 @@ build_relayer() {
install_binary() {
echo "Building and installing binaries."
mkdir -p $output_bin_dir
build_cumulus_from_source
build_relaychain_from_source
build_binaries
build_contracts
build_relayer
}
Expand Down

0 comments on commit fd805ec

Please sign in to comment.