Skip to content

Commit

Permalink
Cherry-Pick: 4738643
Browse files Browse the repository at this point in the history
Use rococo as dev network (#918)
* add rococo staging
* cargo update
* update README
* fix bad english
  • Loading branch information
Kailai-Wang authored and BillyWooo committed Nov 7, 2022
1 parent 4890717 commit 59b698f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The Litentry parachain.
Similar to polkadot, different chain-specs/runtimes are compiled into one single binary: in our case it's:
- litentry-parachain-runtime (on polkadot)
- litmus-parachain-runtime (on kusama)
- rococo-parachain-runtime (on rococo)

Therefore, when building node binary or docker image, no distinction is required. But when building runtime/starting binary/running tests, the chain type must be explicitly given. See the examples below.
## Lists of make targets
Expand Down Expand Up @@ -39,28 +40,29 @@ make build-runtime-litentry
```
The wasms should be located under `target/release/wbuild/litentry-parachain-runtime/`

Similarly, use `make build-runtime-litmus` to build the litmus-parachain-runtime.
Similarly, use `make build-runtime-litmus` and `make build-runtime-rococo` to build the litmus-parachain-runtime and rococo-parachain-runtime, respectively.

## launch of local network

The following steps take rococo-parachain for example, because `sudo` will be removed for litentry-parachain and [was removed](https://github.com/litentry/litentry-parachain/issues/775) for litmus-parachain. But generally speaking, lauching a local network works with either of the three chain-settings.

To start a local network with 2 relaychain nodes and 1 parachain node, there're two ways:

### 1. use docker images for both polkadot and litentry-parachain (preferred)
Take the litentry-parachain for example:
### 1. use docker images for both polkadot and parachain (preferred)
```
make launch-docker-litentry
make launch-docker-rococo
```
[parachain-launch](https://github.com/open-web3-stack/parachain-launch) will be installed and used to generate chain-specs and docker-compose files.

The generated files will be under `docker/generated-litentry/`.
The generated files will be under `docker/generated-rococo/`.

When finished with the network, run
```
make clean-docker-litentry
make clean-docker-rococo
```
to stop the processes and tidy things up.

### 2. use raw binaries for both polkadot and litentry-parachain
### 2. use raw binaries for both polkadot and parachain

Only when option 1 doesn't work and you suspect the docker-image went wrong.

Expand All @@ -69,34 +71,34 @@ In this case we could try to launch the network with raw binaries.
**On Linux host:**

- you should have the locally compiled `./target/release/litentry-collator` binary.
- run `make launch-binary-litentry`
- run `make launch-binary-rococo`

**On Non-Linux host:**

- you should have locally compiled binaries, for both `polkadot` and `litentry-collator`
- run `./scripts/launch-local-binary.sh litentry path-to-polkadot-bin path-to-litentry-parachain-bin`
- run `./scripts/launch-local-binary.sh rococo path-to-polkadot-bin path-to-litentry-parachain-bin`

When finished with the network, run
```
make clean-binary
```
to stop the processes and tidy things up.
Note this command should work for both litentry and litmus (you don't have to differentiate them).
Note this command should work for all parachain types (you don't have to differentiate them).

## run ts tests locally

To run the ts tests locally, similar to launching the networks, it's possible to run them in either docker or binary mode:
```
make test-ts-docker-litentry
make test-ts-docker-rococo
```
or
```
# if on Linux
make test-ts-binary-litentry
make test-ts-binary-rococo
# otherwise
./scripts/launch-local-binary.sh litentry path-to-polkadot-bin path-to-litentry-parachain-bin
./scripts/run-ts-test.sh litentry
./scripts/launch-local-binary.sh rococo path-to-polkadot-bin path-to-litentry-parachain-bin
./scripts/run-ts-test.sh rococo
```
Remember to run the clean-up afterwards.

Expand Down
1 change: 0 additions & 1 deletion node/src/chain_specs/litmus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ pub fn get_chain_spec_dev() -> ChainSpec {
)
}

// FIXME Remove this for Litmus?
pub fn get_chain_spec_staging() -> ChainSpec {
// Staging keys are derivative keys based on a single master secret phrase:
//
Expand Down
16 changes: 16 additions & 0 deletions node/src/chain_specs/rococo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@ pub fn get_chain_spec_dev() -> ChainSpec {
)
}

pub fn get_chain_spec_staging() -> ChainSpec {
// Staging keys are derivative keys based on a single master secret phrase:
//
// root: $SECRET
// account: $SECRET//collator//<id>
// aura: $SECRET//collator//<id>//aura
get_chain_spec_from_genesis_info(
include_bytes!("../../res/genesis_info/staging.json"),
"Litentry-rococo-staging",
"litentry-rococo-staging",
ChainType::Local,
"rococo-local".into(),
DEFAULT_PARA_ID.into(),
)
}

pub fn get_chain_spec_prod() -> ChainSpec {
get_chain_spec_from_genesis_info(
include_bytes!("../../res/genesis_info/rococo.json"),
Expand Down
1 change: 1 addition & 0 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
)?),
// Rococo
"rococo-dev" => Box::new(chain_specs::rococo::get_chain_spec_dev()),
"rococo-staging" => Box::new(chain_specs::rococo::get_chain_spec_staging()),
"rococo" => Box::new(chain_specs::rococo::ChainSpec::from_json_bytes(
&include_bytes!("../res/chain_specs/rococo-170000.json")[..],
)?),
Expand Down
6 changes: 3 additions & 3 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,8 @@ parameter_types! {
pub const NativeTokenResourceId: [u8; 32] = hex!("00000000000000000000000000000063a7e2be78898ba83824b0c0cc8dfb6001");
}

pub struct TechnicalCommitteeProvider;
impl SortedMembers<AccountId> for TechnicalCommitteeProvider {
pub struct TransferNativeAnyone;
impl SortedMembers<AccountId> for TransferNativeAnyone {
fn sorted_members() -> Vec<AccountId> {
vec![]
}
Expand All @@ -801,7 +801,7 @@ impl SortedMembers<AccountId> for TechnicalCommitteeProvider {
impl pallet_bridge_transfer::Config for Runtime {
type Event = Event;
type BridgeOrigin = pallet_bridge::EnsureBridge<Runtime>;
type TransferNativeMembers = TechnicalCommitteeProvider;
type TransferNativeMembers = TransferNativeAnyone;
type SetMaximumIssuanceOrigin = EnsureRootOrHalfCouncil;
type NativeTokenResourceId = NativeTokenResourceId;
type DefaultMaximumIssuance = MaximumIssuance;
Expand Down

0 comments on commit 59b698f

Please sign in to comment.