Skip to content

Commit

Permalink
fix: bounding polkadot-sdk references to polkadot-stable2412
Browse files Browse the repository at this point in the history
  • Loading branch information
nhussein11 committed Dec 19, 2024
1 parent fc1ca3d commit 8822633
Show file tree
Hide file tree
Showing 24 changed files with 43 additions and 42 deletions.
18 changes: 9 additions & 9 deletions develop/interoperability/test-and-debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This article explores two indispensable tools for XCM testing, the [XCM Simulato

## XCM Simulator

Setting up a live network with multiple interconnected parachains for XCM testing can be complex and resource-intensive. To address this, the [`xcm-simulator`](https://github.com/paritytech/polkadot-sdk/tree/master/polkadot/xcm/xcm-simulator){target=\_blank} was developed. This versatile tool enables developers to test and experiment with XCM in a controlled, simulated network environment.
Setting up a live network with multiple interconnected parachains for XCM testing can be complex and resource-intensive. To address this, the [`xcm-simulator`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/polkadot/xcm/xcm-simulator){target=\_blank} was developed. This versatile tool enables developers to test and experiment with XCM in a controlled, simulated network environment.

The `xcm-simulator` offers a fast and efficient way to test [XCM instructions](https://github.com/polkadot-fellows/xcm-format?tab=readme-ov-file#5-the-xcvm-instruction-set){target=\_blank} against the [`xcm-executor`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm_executor/index.html){target=\_blank}. It serves as an experimental playground for developers, supporting features such as:

Expand All @@ -26,7 +26,7 @@ The `xcm-simulator` achieves this by utilizing mocked runtimes for both the rela

The `xcm-simulator` provides the following macros for building a mocked simulation environment:

- [**`decl_test_relay_chain`**](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/src/lib.rs#L110C14-L110C35){target=\_blank} - implements upward message passing (UMP) for the specified relay chain struct. The struct must define the XCM configuration for the relay chain:
- [**`decl_test_relay_chain`**](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/src/lib.rs#L110C14-L110C35){target=\_blank} - implements upward message passing (UMP) for the specified relay chain struct. The struct must define the XCM configuration for the relay chain:

```rust
decl_test_relay_chain! {
Expand All @@ -38,10 +38,10 @@ The `xcm-simulator` provides the following macros for building a mocked simulati
}
```

The [`relay_ext()`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/example/src/lib.rs#L117C1-L139C2){target=\_blank} sets up a test environment for the relay chain with predefined storage, then returns a [`TestExternalities`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/testing_prelude/type.TestExternalities.html){target=\_blank} instance for further testing.
The [`relay_ext()`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/example/src/lib.rs#L117C1-L139C2){target=\_blank} sets up a test environment for the relay chain with predefined storage, then returns a [`TestExternalities`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/testing_prelude/type.TestExternalities.html){target=\_blank} instance for further testing.


- [**`decl_test_parachain`**](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/src/lib.rs#L180){target=\_blank} - implements the [`XcmMessageHandlerT`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/trait.XcmpMessageHandlerT.html){target=\_blank} and [`DmpMessageHandlerT`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/trait.DmpMessageHandlerT.html){target=\_blank} traits for the specified parachain struct. Requires the parachain struct to include the `XcmpMessageHandler` and `DmpMessageHandler` pallets, which define the logic for processing messages (implemented through [`mock_message_queue`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/mock_message_queue/index.html){target=\_blank}). The patter must be the following:
- [**`decl_test_parachain`**](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/src/lib.rs#L180){target=\_blank} - implements the [`XcmMessageHandlerT`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/trait.XcmpMessageHandlerT.html){target=\_blank} and [`DmpMessageHandlerT`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/trait.DmpMessageHandlerT.html){target=\_blank} traits for the specified parachain struct. Requires the parachain struct to include the `XcmpMessageHandler` and `DmpMessageHandler` pallets, which define the logic for processing messages (implemented through [`mock_message_queue`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/mock_message_queue/index.html){target=\_blank}). The patter must be the following:

```rust
decl_test_parachain! {
Expand All @@ -54,12 +54,12 @@ The `xcm-simulator` provides the following macros for building a mocked simulati
}
```

The [`para_ext(para_id: u32)`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/example/src/lib.rs#L97C1-L115C2){target=\_blank} function initializes a test environment for a parachain with a specified `para_id`, sets the initial configuration of the parachain, returning a [`TestExternalities`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/testing_prelude/type.TestExternalities.html){target=\_blank} instance for testing.
The [`para_ext(para_id: u32)`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/example/src/lib.rs#L97C1-L115C2){target=\_blank} function initializes a test environment for a parachain with a specified `para_id`, sets the initial configuration of the parachain, returning a [`TestExternalities`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/testing_prelude/type.TestExternalities.html){target=\_blank} instance for testing.

!!!note
Developers can take this idea and define as many parachains as they want, like `ParaA`, `ParaB`, `ParaC`, etc

- [**`decl_test_network`**](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/src/lib.rs#L292){target=\_blank} - defines a testing network consisting of a relay chain and multiple parachains. Takes a network struct as input and implements functionalities for testing, including [`ParachainXcmRouter`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator_example/struct.ParachainXcmRouter.html){target=\_blank} and [`RelayChainXcmRouter`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator_example/struct.RelayChainXcmRouter.html){target=\_blank}. The struct must specify the relay chain and an indexed list of parachains to be included in the network:
- [**`decl_test_network`**](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/src/lib.rs#L292){target=\_blank} - defines a testing network consisting of a relay chain and multiple parachains. Takes a network struct as input and implements functionalities for testing, including [`ParachainXcmRouter`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator_example/struct.ParachainXcmRouter.html){target=\_blank} and [`RelayChainXcmRouter`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator_example/struct.RelayChainXcmRouter.html){target=\_blank}. The struct must specify the relay chain and an indexed list of parachains to be included in the network:

```rust
decl_test_network! {
Expand All @@ -82,7 +82,7 @@ For a complete example of how to use the `xcm-simulator`, explore the [`sample`]

## XCM Emulator

The [`xcm-emulator`](https://github.com/paritytech/polkadot-sdk/tree/master/cumulus/xcm/xcm-emulator){target=\_blank} is a tool designed to simulate the execution of XCM programs using predefined runtime configurations. These configurations include those utilized by live networks like Kusama, Polkadot, and the Asset Hub.
The [`xcm-emulator`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/cumulus/xcm/xcm-emulator){target=\_blank} is a tool designed to simulate the execution of XCM programs using predefined runtime configurations. These configurations include those utilized by live networks like Kusama, Polkadot, and the Asset Hub.

This tool enables testing of cross-chain message passing, providing a way to verify outcomes, weights, and side effects efficiently.

Expand All @@ -107,9 +107,9 @@ The XCM Emulator provides both advantages and limitations when testing cross-cha

The `xcm-emulator` package builds upon the functionality provided by the `xcm-simulator` package, offering the same set of macros while extending their capabilities. In addition to the standard features, `xcm-emulator` introduces new tools that make testing cross-chain communication more comprehensive.

One of the key additions is the [`decl_test_bridges`](https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/xcm/xcm-emulator/src/lib.rs#L1178){target=\_blank} macro. This macro allows developers to define and implement mock bridges for testing interoperability in the Polkadot ecosystem.
One of the key additions is the [`decl_test_bridges`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/cumulus/xcm/xcm-emulator/src/lib.rs#L1178){target=\_blank} macro. This macro allows developers to define and implement mock bridges for testing interoperability in the Polkadot ecosystem.

- [**`decl_test_bridges`**](https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/xcm/xcm-emulator/src/lib.rs#L1178){target=\_blank} - enables the creation of multiple bridges between chains, specifying their source chain, target chain, and the handler responsible for processing messages
- [**`decl_test_bridges`**](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/cumulus/xcm/xcm-emulator/src/lib.rs#L1178){target=\_blank} - enables the creation of multiple bridges between chains, specifying their source chain, target chain, and the handler responsible for processing messages

```rust
decl_test_bridges! {
Expand Down
2 changes: 1 addition & 1 deletion develop/interoperability/xcm-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The executor is highly configurable, with the [XCM builder](https://paritytech.g

## XCM Executor Configuration

The `Config` trait defines the XCM executor’s configuration, which requires several associated types. Each type has specific trait bounds that the concrete implementation must fulfill. Some types, such as `RuntimeCall`, come with a default implementation in most cases, while others use the unit type `()` as the default. For many of these types, selecting the appropriate implementation carefully is crucial. Predefined solutions and building blocks can be adapted to your specific needs. These solutions can be found in the [`xcm-builder`](https://github.com/paritytech/polkadot-sdk/tree/master/polkadot/xcm/xcm-builder){target=\_blank} folder.
The `Config` trait defines the XCM executor’s configuration, which requires several associated types. Each type has specific trait bounds that the concrete implementation must fulfill. Some types, such as `RuntimeCall`, come with a default implementation in most cases, while others use the unit type `()` as the default. For many of these types, selecting the appropriate implementation carefully is crucial. Predefined solutions and building blocks can be adapted to your specific needs. These solutions can be found in the [`xcm-builder`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/polkadot/xcm/xcm-builder){target=\_blank} folder.

Each type is explained below, along with an overview of some of its implementations:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ At its core, the `Config` trait typically looks like this:
This basic structure shows that every pallet must define certain types, such as `RuntimeEvent` and `WeightInfo`, to function within the runtime. The actual implementation can vary depending on the pallet’s specific needs.
??? "Example - Utility Pallet"
For instance, in the [`utility pallet`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/utility){target=\_blank}, the `Config` trait is implemented with the following types:
For instance, in the [`utility pallet`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/substrate/frame/utility){target=\_blank}, the `Config` trait is implemented with the following types:
```rust
--8<-- 'code/develop/parachains/customize-parachain/add-existing-pallets/utility-pallet-config-trait.rs'
Expand Down
4 changes: 2 additions & 2 deletions develop/parachains/customize-parachain/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ template: index-page.html

Learn how to build a custom parachain with Polkadot SDK's FRAME framework, which includes pallet development, testing, smart contracts, and runtime customization. Pallets are modular components within the FRAME ecosystem that contain specific blockchain functionalities. This modularity grants developers increased flexibility and control around which behaviors to include in the core logic of their parachain.

The [FRAME directory](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame){target=\_blank} includes a robust library of pre-built pallets you can use as examples or templates to ease development.
The [FRAME directory](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/substrate/frame){target=\_blank} includes a robust library of pre-built pallets you can use as examples or templates to ease development.

## In This Section

Expand All @@ -20,7 +20,7 @@ The [FRAME directory](https://github.com/paritytech/polkadot-sdk/tree/master/sub

<div class="subsection-wrapper">
<div class="card">
<a href="https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame" target="_blank">
<a href="https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/substrate/frame" target="_blank">
<h2 class="title">FRAME Repository</h2>
<p class="description">View the source code of the FRAME development environment that provides pallets you can use, modify, and extend to build the runtime logic to suit the needs of your blockchain.</p>
</a>
Expand Down
2 changes: 1 addition & 1 deletion develop/parachains/customize-parachain/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Developers have the flexibility to implement any desired behavior in the core lo
- Storing information
- Enforcing business rules

Pallets also include necessary wiring code to ensure proper integration and functionality within the runtime. FRAME provides a range of [pre-built pallets](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame){target=\_blank} for standard and common blockchain functionalities, including consensus algorithms, staking mechanisms, governance systems, and more. These pre-existing pallets serve as building blocks or templates, which developers can use as-is, modify, or reference when creating custom functionalities.
Pallets also include necessary wiring code to ensure proper integration and functionality within the runtime. FRAME provides a range of [pre-built pallets](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/substrate/frame){target=\_blank} for standard and common blockchain functionalities, including consensus algorithms, staking mechanisms, governance systems, and more. These pre-existing pallets serve as building blocks or templates, which developers can use as-is, modify, or reference when creating custom functionalities.

#### Pallet Structure

Expand Down
4 changes: 2 additions & 2 deletions develop/parachains/customize-parachain/pallet-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This guide will explore how to mock a runtime and test a pallet. For that, the P

To test a pallet, a mock runtime is created to simulate the behavior of the blockchain environment where the pallet will be included. This involves defining a minimal runtime configuration that only provides for the required dependencies for the tested pallet.

For a complete example of a mocked runtime, check out the `mock.rs` file in the [Solochain Template](https://github.com/paritytech/polkadot-sdk/blob/master/templates/solochain/pallets/template/src/mock.rs){target=\_blank}.
For a complete example of a mocked runtime, check out the `mock.rs` file in the [Solochain Template](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/templates/solochain/pallets/template/src/mock.rs){target=\_blank}.

A `mock.rs` file defines the mock runtime in a typical Polkadot SDK project. It includes the elements described below.

Expand Down Expand Up @@ -104,5 +104,5 @@ Some key considerations are:
## Where to Go Next
- Dive into the full implementation of the [`mock.rs`](https://github.com/paritytech/polkadot-sdk/blob/master/templates/solochain/pallets/template/src/mock.rs){target=\_blank} and [`test.rs`](https://github.com/paritytech/polkadot-sdk/blob/master/templates/solochain/pallets/template/src/tests.rs){target=\_blank} files in the [Solochain Template](https://github.com/paritytech/polkadot-sdk/tree/master/templates/solochain){target=_blank}
- Dive into the full implementation of the [`mock.rs`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/templates/solochain/pallets/template/src/mock.rs){target=\_blank} and [`test.rs`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/templates/solochain/pallets/template/src/tests.rs){target=\_blank} files in the [Solochain Template](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/templates/solochain){target=_blank}
- To evaluate the resource usage of your pallet operations, refer to the [Benchmarking documentation](/develop/parachains/customize-parachain/benchmarking/) for guidance on measuring efficiency
4 changes: 2 additions & 2 deletions develop/parachains/deployment/generate-chain-specs.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ chain-spec-builder create -r <INSERT_RUNTIME_WASM_PATH> <INSERT_COMMAND>

Ensure to replace `<INSERT_RUNTIME_WASM_PATH>` with the path to the runtime Wasm file and `<INSERT_COMMAND>` with the command to insert the runtime into the chain specification. The available commands are:

- **`patch`** - overwrites the runtime's default genesis config with the provided patch. You can check the following [patch file](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable1985-rc1/substrate/bin/utils/chain-spec-builder/tests/input/patch.json){target=\_blank} as a reference
- **`full`** - build the genesis config for runtime using the JSON file. No defaults will be used. As a reference, you can check the following [full file](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable1985-rc1/substrate/bin/utils/chain-spec-builder/tests/input/full.json){target=\_blank}
- **`patch`** - overwrites the runtime's default genesis config with the provided patch. You can check the following [patch file](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/substrate/bin/utils/chain-spec-builder/tests/input/patch.json){target=\_blank} as a reference
- **`full`** - build the genesis config for runtime using the JSON file. No defaults will be used. As a reference, you can check the following [full file](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/substrate/bin/utils/chain-spec-builder/tests/input/full.json){target=\_blank}
- **`default`** - gets the default genesis config for the runtime and uses it in `ChainSpec`. Please note that the default genesis config may not be valid. For some runtimes, initial values should be added there (e.g., session keys, BABE epoch)
- **`named-preset`** - uses named preset provided by the runtime to build the chain spec

Expand Down
Binary file added develop/parachains/deployment/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8822633

Please sign in to comment.