Skip to content

Repository containing Coretime mock runtimes that are used for local testing and simulation

License

Notifications You must be signed in to change notification settings

RegionX-Labs/Coretime-Mock

Repository files navigation

Simulated Coretime Environment

The primary purpose of this repository is to provide all the necessary components for testing the RegionX-Node, as well as the RegionX CoreHub UI.

Topology

The local environment consists of three chains:

  • Rococo relay chain
  • Coretime parachain
  • RegionX parachain

The two parachains are connected through HRMP channels in both directions. In our mock environment, the RegionX parachain treats the Coretime chain as a reserve chain for Coretime regions, thus supporting reserve transfers.

The XCM Nonfungible Index of each region corresponds to the encoded RegionId.

Getting started with Zombienet

Before proceeding, ensure that Zombienet is set up on the machine and accessible from the PATH. Linux and macOS executables for the Zombienet CLI are available here.

Follow the first three steps from the RegionX-Node README to get all the necessary binaries. After getting them move them to Coretime-Mock/bin directory.

After that we can run the zombienet network:

npm run zombienet

After waiting a few seconds for the network initialization and once both parachains start producing blocks, we can proceed with setting up the environment.

This repo provides an initialization program which will based on the selected options set up the local network accordingly. The program provides the following options:

  1. --relayInit:

    • Opens two HRMP channels: Coretime Chain <--> RegionX chain
  2. --coretimeInit:

    • Initializes the Coretime chain by setting the initial configuration, starting the bulk sale, and purchasing a region.
  3. --regionxInit:

    • Initializes the RegionX chain by registering the relay chain token in its asset-registry.
  4. --coretimeAccount <string>:

    • When specified the program will transfer the purchased region to this account.
  5. --regionxAccount <string>:

    • The initialization script will fund the specified account with relay chain tokens.

Example: Setting up the full environment

  1. Run npm run zombienet in a separate terminal
  2. Once the parachains started producing blocks, setup the environment using the command below:
    npm run init -- \
    --coretimeInit \
    --relayInit \
    --regionxInit \
    --coretimeAccount "<ADDRESS PLACEHOLDER>" \
    --regionxAccount "<ADDRESS PLACEHOLDER>" 

Getting started with Chopsticks

Since the Coretime chain is deployed on Rococo, we can use Chopsticks for parts of local frontend testing that do not require the contracts.

The steps to run a Coretime chain locally and setup the mock environment:

cd Coretime-Mock

npm i

# This will run a parallel copy of the Coretime chain
npm run chopsticks-coretime

# It is also possible to run a parallel copy of the RegionX chain (assuming it is available on port 9920).
npm run chopsticks-regionx

About

Repository containing Coretime mock runtimes that are used for local testing and simulation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published