Skip to content

Zombienet-SDK test for the happy path of the new staking-async flow #8317

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

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
7 changes: 7 additions & 0 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions substrate/frame/staking-async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,26 @@ sp-staking = { features = ["serde"], workspace = true }
frame-benchmarking = { optional = true, workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
env_logger = { workspace = true }
frame-benchmarking = { workspace = true, default-features = true }
frame-support = { features = ["experimental"], workspace = true, default-features = true }
log = { workspace = true }
pallet-bags-list = { workspace = true, default-features = true }
pallet-balances = { workspace = true, default-features = true }
rand_chacha = { workspace = true, default-features = true }
sp-npos-elections = { workspace = true, default-features = true }
sp-tracing = { workspace = true, default-features = true }
substrate-test-utils = { workspace = true }
subxt = { workspace = true }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move them to a separate crate staking-async/zn-test to not increase the compile time of the rust unit tests?

subxt-signer = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread"] }
zombienet-sdk = { workspace = true }

[features]
default = ["std"]
std = [
"anyhow/std",
"codec/std",
"frame-benchmarking?/std",
"frame-election-provider-support/std",
Expand Down
38 changes: 38 additions & 0 deletions substrate/frame/staking-async/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Staking Async test

To run locally:

1. Ensure you have got chainspecs for RC and AH-next in the crate root.
2. Ensure you have got `polkadot`, `polkadot-execute-worker`, `polkadot-prepare-worker` and
`polkadot-parachain` in your `PATH`.
3. Run `ZOMBIE_PROVIDER="native" cargo test happy_case`

## How to build the chainspecs

Courtesy to @kianenigma for these instructions.

1. Run `cargo build --release -p pallet-staking-async-rc-runtime -p
pallet-staking-async-parachain-runtime -p staging-chain-spec-builder`
2. For AH-Next run

```
chain-spec-builder \
create \
-t development \
--runtime ../../target/release/wbuild/pallet-staking-async-parachain-runtime/pallet_staking_async_parachain_runtime.compact.compressed.wasm \
--relay-chain rococo-local \
--para-id 1100 \
named-preset development
mv ./chain_spec.json ./parachain.json
```

3. For RC run

```
chain-spec-builder \
create \
-t development \
--runtime ../../target/release/wbuild/pallet-staking-async-rc-runtime/fast_runtime_binary.rs.wasm \
named-preset local_testnet
mv ./chain_spec.json ./rc.json
```
3 changes: 3 additions & 0 deletions substrate/frame/staking-async/runtimes/rc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pallet-preimage = { workspace = true }
pallet-proxy = { workspace = true }
pallet-recovery = { workspace = true }
pallet-referenda = { workspace = true }
pallet-root-offences = { workspace = true }
pallet-root-testing = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
Expand Down Expand Up @@ -182,6 +183,7 @@ std = [
"pallet-proxy/std",
"pallet-recovery/std",
"pallet-referenda/std",
"pallet-root-offences/std",
"pallet-root-testing/std",
"pallet-scheduler/std",
"pallet-session-benchmarking?/std",
Expand Down Expand Up @@ -333,6 +335,7 @@ try-runtime = [
"pallet-proxy/try-runtime",
"pallet-recovery/try-runtime",
"pallet-referenda/try-runtime",
"pallet-root-offences/try-runtime",
"pallet-root-testing/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
Expand Down
9 changes: 9 additions & 0 deletions substrate/frame/staking-async/runtimes/rc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,11 @@ impl session_historical::Config for Runtime {
type FullIdentificationOf = ah_client::DefaultExposureOf<Self>;
}

impl pallet_root_offences::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OffenceHandler = StakingAsyncAhClient;
}

pub struct AssetHubLocation;
impl Get<Location> for AssetHubLocation {
fn get() -> Location {
Expand Down Expand Up @@ -1840,6 +1845,10 @@ mod runtime {
#[runtime::pallet_index(102)]
pub type RootTesting = pallet_root_testing;

// Root offences pallet
#[runtime::pallet_index(103)]
pub type RootOffences = pallet_root_offences;

// BEEFY Bridges support.
#[runtime::pallet_index(200)]
pub type Beefy = pallet_beefy;
Expand Down
Loading
Loading