Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bridges integration-tests instructions #366

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions integration-tests/bridges/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,30 @@ The tests are designed to be run manually.

To start a test, you need to:

- download latest [zombienet release](https://github.com/paritytech/zombienet/releases) to
`~/local_bridge_testing/bin/zombienet`.

- build Polkadot binary by running `cargo build -p polkadot --release` command in the
[`polkadot-sdk`](https://github.com/paritytech/polkadot-sdk) repository clone.

- download latest [zombienet release](https://github.com/paritytech/zombienet/releases) to `~/local_bridge_testing/bin/zombienet`.
- build Polkadot binaries by running commands in the [`polkadot-sdk`](https://github.com/paritytech/polkadot-sdk) repository clone:
```
cargo build -p polkadot --release
cargo build --bin polkadot-prepare-worker --release
cargo build --bin polkadot-execute-worker --release
```
Copy the binaries to:
```
~/local_bridge_testing/bin/polkadot
~/local_bridge_testing/bin/polkadot-prepare-worker
~/local_bridge_testing/bin/polkadot-execute-worker
```
- build Polkadot Parachain binary by running `cargo build -p polkadot-parachain-bin --release` command in the
[`polkadot-sdk`](https://github.com/paritytech/polkadot-sdk) repository clone.

[`polkadot-sdk`](https://github.com/paritytech/polkadot-sdk) repository clone. Copy the binary to `~/local_bridge_testing/bin/polkadot-parachain`.
- ensure that you have [`node`](https://nodejs.org/en) installed. Additionally, we'll need globally installed
`polkadot/api-cli` package (use `yarn global add @polkadot/api-cli` to install it).

`polkadot/api-cli` / `polkadot/api` packages (use `yarn global add @polkadot/api-cli` to install it).
- build Substrate relay by running `cargo build -p substrate-relay --release` command in the
[`parity-bridges-common`](https://github.com/paritytech/parity-bridges-common) repository clone. Copy the binary to `~/local_bridge_testing/bin/substrate-relay`.

- add the `sudo` pallet to the Polkadot and Kusama runtimes and give sudo rights to Alice. With this change build
the chain spec generator by running `cargo build --release -p chain-spec-generator --features fast-runtime`
[`parity-bridges-common`](https://github.com/paritytech/parity-bridges-common) repository clone. Copy the binary to `~/local_bridge_testing/bin/substrate-relay`.
- build chain spec generator:
- add the `sudo` pallet to the Polkadot and Kusama runtimes and give sudo rights to Alice, e.g. by running `git apply ./integration-tests/bridges/sudo-relay.patch` from the fellows root dir.
- with this change build the chain spec generator by running `cargo build --release -p chain-spec-generator --features fast-runtime`
command. Copy the binary to `~/local_bridge_testing/bin/chain-spec-generator`.

- change the `POLKADOT_BINARY` and `POLKADOT_PARACHAIN_BINARY` paths (and ensure that the nearby variables
- check/change the `POLKADOT_BINARY` and `POLKADOT_PARACHAIN_BINARY` paths (and ensure that the nearby variables
have correct values) in the `./run-test.sh`.

After that, you can run `./run-tests.sh <test_name>` command.
After that, you can run `./run-tests.sh <test_name>` command. E.g. `./run-test.sh 0001-polkadot-kusama-asset-transfer`.
4 changes: 2 additions & 2 deletions integration-tests/bridges/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export FRAMEWORK_PATH=$framework_repo_path/bridges/testing/framework
echo

export ZOMBIENET_BINARY=$LOCAL_BRIDGE_TESTING_PATH/bin/zombienet
export POLKADOT_BINARY=/home/serban/workplace/sources/polkadot-sdk/target/release/polkadot
export POLKADOT_PARACHAIN_BINARY=/home/serban/workplace/sources/polkadot-sdk/target/release/polkadot-parachain
export POLKADOT_BINARY=$LOCAL_BRIDGE_TESTING_PATH/bin/polkadot
export POLKADOT_PARACHAIN_BINARY=$LOCAL_BRIDGE_TESTING_PATH/bin/polkadot-parachain
export CHAIN_SPEC_GEN_BINARY=$LOCAL_BRIDGE_TESTING_PATH/bin/chain-spec-generator
export SUBSTRATE_RELAY_BINARY=$LOCAL_BRIDGE_TESTING_PATH/bin/substrate-relay

Expand Down
140 changes: 140 additions & 0 deletions integration-tests/bridges/sudo-relay.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
diff --git a/Cargo.lock b/Cargo.lock
index 3873911e9..69bcc63be 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -10914,6 +10914,7 @@ dependencies = [
"pallet-staking-reward-fn",
"pallet-staking-runtime-api",
"pallet-state-trie-migration",
+ "pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api",
@@ -16003,6 +16004,7 @@ dependencies = [
"pallet-society",
"pallet-staking",
"pallet-staking-runtime-api",
+ "pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api",
diff --git a/chain-spec-generator/src/relay_chain_specs.rs b/chain-spec-generator/src/relay_chain_specs.rs
index e8c2fa3c8..3b90f7a54 100644
--- a/chain-spec-generator/src/relay_chain_specs.rs
+++ b/chain-spec-generator/src/relay_chain_specs.rs
@@ -223,6 +223,9 @@ pub fn polkadot_testnet_genesis(
})
.collect::<Vec<_>>(),
},
+ "sudo": {
+ "key": Some(_root_key),
+ },
"staking": {
"minimumValidatorCount": 1,
"validatorCount": initial_authorities.len() as u32,
@@ -286,6 +289,9 @@ pub fn kusama_testnet_genesis(
})
.collect::<Vec<_>>(),
},
+ "sudo": {
+ "key": Some(_root_key),
+ },
"staking": {
"minimumValidatorCount": 1,
"validatorCount": initial_authorities.len() as u32,
diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml
index 9f4601f92..9785cb124 100644
--- a/relay/kusama/Cargo.toml
+++ b/relay/kusama/Cargo.toml
@@ -104,6 +104,8 @@ xcm-builder = { workspace = true }

sp-debug-derive = { workspace = true }

+pallet-sudo = { workspace = true }
+
[dev-dependencies]
sp-keyring = { workspace = true }
sp-trie = { workspace = true }
@@ -174,6 +176,7 @@ std = [
"pallet-society/std",
"pallet-staking-runtime-api/std",
"pallet-staking/std",
+ "pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs
index 05724aee5..7d8f60205 100644
--- a/relay/kusama/src/lib.rs
+++ b/relay/kusama/src/lib.rs
@@ -1641,6 +1641,12 @@ impl pallet_im_online::Config for Runtime {
type ValidatorSet = Historical;
}

+impl pallet_sudo::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type RuntimeCall = RuntimeCall;
+ type WeightInfo = ();
+}
+
construct_runtime! {
pub enum Runtime
{
@@ -1771,6 +1777,9 @@ construct_runtime! {

// Pallet for migrating Identity to a parachain. To be removed post-migration.
IdentityMigrator: identity_migrator = 248,
+
+ // Sudo.
+ Sudo: pallet_sudo = 255,
}
}

diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml
index c7f8c92b6..53c87f0e8 100644
--- a/relay/polkadot/Cargo.toml
+++ b/relay/polkadot/Cargo.toml
@@ -101,6 +101,8 @@ xcm-builder = { workspace = true }

sp-debug-derive = { workspace = true }

+pallet-sudo = { workspace = true }
+
[dev-dependencies]
sp-keyring = { workspace = true }
sp-trie = { workspace = true }
@@ -168,6 +170,7 @@ std = [
"pallet-staking-runtime-api/std",
"pallet-staking/std",
"pallet-state-trie-migration/std",
+ "pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs
index b31948725..39d62fe20 100644
--- a/relay/polkadot/src/lib.rs
+++ b/relay/polkadot/src/lib.rs
@@ -1650,6 +1650,12 @@ impl pallet_im_online::Config for Runtime {
type ValidatorSet = Historical;
}

+impl pallet_sudo::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type RuntimeCall = RuntimeCall;
+ type WeightInfo = ();
+}
+
construct_runtime! {
pub enum Runtime
{
@@ -1759,6 +1765,9 @@ construct_runtime! {
// refer to block<N>. See issue #160 for details.
Mmr: pallet_mmr = 201,
BeefyMmrLeaf: pallet_beefy_mmr = 202,
+
+ // Sudo.
+ Sudo: pallet_sudo = 255,
}
}

Loading