Skip to content

Commit

Permalink
refactor: remove rococo (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilrobot-01 authored Jul 27, 2024
1 parent bd26cf0 commit 0dd7489
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 321 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: rustup target add ${{ matrix.platform.target }}

- name: Build node
run: cargo build --profile=production -p pop-node --target ${{ matrix.platform.target }} --features paseo
run: cargo build --profile=production -p pop-node --target ${{ matrix.platform.target }}

- name: Package binary (Linux)
if: contains(matrix.platform.target, 'linux')
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

<div align="center">

[![Twitter URL](https://img.shields.io/twitter/follow/Pop?style=social)](https://twitter.com/pop_web3)
[![Twitter URL](https://img.shields.io/twitter/follow/Pop?style=social)](https://x.com/onpopio/)
[![Twitter URL](https://img.shields.io/twitter/follow/R0GUE?style=social)](https://twitter.com/gor0gue)
[![Telegram](https://img.shields.io/badge/Telegram-gray?logo=telegram)](https://t.me/PlasmOfficial](https://t.me/Pop_Network)https://t.me/Pop_Network)
[![Telegram](https://img.shields.io/badge/Telegram-gray?logo=telegram)](https://t.me/onpopio)
[![Build, test and lint](https://github.com/r0gue-io/pop-node/actions/workflows/build.yml/badge.svg)](https://github.com/r0gue-io/pop-node/actions/workflows/build.yml)

</div>
Expand All @@ -26,15 +26,15 @@ Get started by using [Pop API](./pop-api) in your contracts!
You can install the [Pop CLI](https://github.com/r0gue-io/pop-cli) as follows:

```shell
cargo install --git https://github.com/r0gue-io/pop-cli
cargo install pop-cli
```

## Spawn Network

You can spawn a local network as follows:

```shell
pop up parachain -f ./networks/rococo.toml
pop up parachain -f ./networks/paseo.toml
```

Note: `pop` will automatically source the necessary `polkadot` binaries. Currently, these will have to be built if on a
Expand Down
6 changes: 5 additions & 1 deletion networks/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Zombienet

## Installation

You can install the Pop CLI as follows:

```shell
cargo install --git https://github.com/r0gue-io/pop-cli
```

## Spawn Network

You can spawn a local network as follows:

```shell
pop up -c ./networks/rococo.toml
pop up parachain -f ./networks/paseo.toml
```
39 changes: 39 additions & 0 deletions networks/paseo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# pop up parachain -f ./tests/networks/pop.toml

[relaychain]
chain = "paseo-local"

[relaychain.runtime_genesis_patch.balances]
balances = [
# Pop sovereign account
["5Ec4AhPKXY9B4ayGshkz2wFMh7N8gP7XKfAvtt1cigpG9FkJ", 60000000000000000],
]

[[relaychain.nodes]]
name = "alice"
rpc_port = 8833
validator = true

[[relaychain.nodes]]
name = "bob"
validator = true

[[parachains]]
id = 4001
default_command = "./target/release/pop-node"

[parachains.genesis_overrides.balances]
balances = [
# Dev accounts
["5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", 10000000000000000],
["5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty", 10000000000000000],
["5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y", 10000000000000000],
["5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy", 10000000000000000],
["5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw", 10000000000000000],
["5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL", 10000000000000000],
]

[[parachains.collators]]
name = "pop"
rpc_port = 9944
args = ["-lruntime::contracts=debug", "-lpopapi::extension=debug"]
26 changes: 0 additions & 26 deletions networks/rococo.toml

This file was deleted.

7 changes: 1 addition & 6 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,7 @@ color-print.workspace = true
substrate-build-script-utils.workspace = true

[features]
default = ["paseo"]
paseo = [
"pop-runtime-common/paseo",
"pop-runtime-devnet/paseo",
"pop-runtime-testnet/paseo",
]
default = []
runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
Expand Down
73 changes: 0 additions & 73 deletions node/chain_specs/pop-rococo.plain.json

This file was deleted.

74 changes: 0 additions & 74 deletions node/chain_specs/pop-rococo.raw.json

This file was deleted.

48 changes: 13 additions & 35 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@ pub type TestnetChainSpec =

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;

pub(crate) enum Relay {
#[cfg(not(feature = "paseo"))]
Rococo,
#[cfg(feature = "paseo")]
Paseo,
#[cfg(not(feature = "paseo"))]
RococoLocal,
#[cfg(feature = "paseo")]
PaseoLocal,
}

Expand Down Expand Up @@ -89,39 +84,14 @@ fn configure_for_relay(
let para_id;

match relay {
// Test relay chains
#[cfg(not(feature = "paseo"))]
Relay::Rococo => {
para_id = 4385;
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());

(Extensions { relay_chain: "rococo".into(), para_id }, para_id)
},
#[cfg(feature = "paseo")]
Relay::Paseo => {
Relay::Paseo | Relay::PaseoLocal => {
para_id = 4001;
properties.insert("tokenSymbol".into(), "PAS".into());
properties.insert("tokenDecimals".into(), 10.into());

(Extensions { relay_chain: "paseo".into(), para_id }, para_id)
},
// Local relay chains
#[cfg(not(feature = "paseo"))]
Relay::RococoLocal => {
para_id = 4385;
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());

(Extensions { relay_chain: "rococo-local".into(), para_id }, para_id)
},
#[cfg(feature = "paseo")]
Relay::PaseoLocal => {
para_id = 4001;
properties.insert("tokenSymbol".into(), "PAS".into());
properties.insert("tokenDecimals".into(), 10.into());

(Extensions { relay_chain: "paseo-local".into(), para_id }, para_id)
let relay_chain =
if let Relay::Paseo = relay { "paseo".into() } else { "paseo-local".into() };
(Extensions { relay_chain, para_id }, para_id)
},
}
}
Expand Down Expand Up @@ -153,6 +123,8 @@ pub fn development_config(relay: Relay) -> DevnetChainSpec {
get_account_id_from_seed::<sr25519::Public>("Alice"),
para_id.into(),
))
.with_protocol_id("pop-devnet")
.with_properties(properties)
.build()
}

Expand Down Expand Up @@ -210,6 +182,9 @@ fn testnet_genesis(
use pop_runtime_testnet::EXISTENTIAL_DEPOSIT;

serde_json::json!({
"balances": {
"balances": [],
},
"parachainInfo": {
"parachainId": id,
},
Expand Down Expand Up @@ -244,6 +219,9 @@ fn devnet_genesis(
use pop_runtime_devnet::EXISTENTIAL_DEPOSIT;

serde_json::json!({
"balances": {
"balances": [],
},
"parachainInfo": {
"parachainId": id,
},
Expand Down
13 changes: 2 additions & 11 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,9 @@ impl RuntimeResolver for PathBuf {

fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
Ok(match id {
#[cfg(not(feature = "paseo"))]
"dev-rococo" => Box::new(chain_spec::development_config(Relay::RococoLocal)),
#[cfg(feature = "paseo")]
"dev-paseo" => Box::new(chain_spec::development_config(Relay::PaseoLocal)),
#[cfg(not(feature = "paseo"))]
"pop-rococo" => Box::new(chain_spec::testnet_config(Relay::Rococo)),
#[cfg(feature = "paseo")]
"pop-paseo" => Box::new(chain_spec::testnet_config(Relay::Paseo)),
#[cfg(feature = "paseo")]
"dev" | "dev-paseo" => Box::new(chain_spec::development_config(Relay::PaseoLocal)),
"test" | "pop-paseo" => Box::new(chain_spec::testnet_config(Relay::Paseo)),
"" | "local" => Box::new(chain_spec::development_config(Relay::PaseoLocal)),
#[cfg(not(feature = "paseo"))]
"" | "local" => Box::new(chain_spec::development_config(Relay::RococoLocal)),
path => {
let path: PathBuf = path.into();
match path.runtime() {
Expand Down
3 changes: 1 addition & 2 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ std = ["frame-support/std", "sp-runtime/std"]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
paseo = []
]
12 changes: 0 additions & 12 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ pub type Nonce = u32;
/// up by `pallet_aura` to implement `fn slot_duration()`.
///
/// Change this to adjust the block time.
#[cfg(not(feature = "paseo"))]
pub const MILLISECS_PER_BLOCK: u64 = 6000;
#[cfg(feature = "paseo")]
pub const MILLISECS_PER_BLOCK: u64 = 12000;

// NOTE: Currently it is not possible to change the slot duration after the chain has started.
Expand All @@ -44,17 +41,11 @@ pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);

/// We allow for 2 seconds of compute with a 6-second average block.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
#[cfg(not(feature = "paseo"))]
WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
#[cfg(feature = "paseo")]
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
polkadot_primitives::MAX_POV_SIZE as u64,
);

// Unit = the base number of indivisible units for balances
#[cfg(not(feature = "paseo"))]
pub const UNIT: Balance = 1_000_000_000_000; // 12 decimals
#[cfg(feature = "paseo")]
pub const UNIT: Balance = 10_000_000_000; // 10 decimals

pub const MILLIUNIT: Balance = UNIT / 1_000;
Expand All @@ -70,9 +61,6 @@ pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT;
// Async backing
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
#[cfg(not(feature = "paseo"))]
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3;
#[cfg(feature = "paseo")]
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;

/// How many parachain blocks are processed by the relay chain per parent. Limits the
Expand Down
1 change: 0 additions & 1 deletion runtime/devnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,3 @@ try-runtime = [
]

experimental = ["pallet-aura/experimental"]
paseo = ["pop-runtime-common/paseo"]
7 changes: 0 additions & 7 deletions runtime/devnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@ impl pallet_timestamp::Config for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
#[cfg(feature = "experimental")]
#[cfg(not(feature = "paseo"))]
type MinimumPeriod = ConstU64<0>;
#[cfg(not(feature = "experimental"))]
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
type WeightInfo = ();
}
Expand Down Expand Up @@ -444,9 +440,6 @@ impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = ConstU32<100_000>;
#[cfg(not(feature = "paseo"))]
type AllowMultipleBlocksPerSlot = ConstBool<true>;
#[cfg(feature = "paseo")]
type AllowMultipleBlocksPerSlot = ConstBool<false>;
#[cfg(feature = "experimental")]
type SlotDuration = ConstU64<SLOT_DURATION>;
Expand Down
1 change: 0 additions & 1 deletion runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,3 @@ try-runtime = [
]

experimental = ["pallet-aura/experimental"]
paseo = ["pop-runtime-common/paseo"]
7 changes: 0 additions & 7 deletions runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,6 @@ impl pallet_timestamp::Config for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
#[cfg(feature = "experimental")]
#[cfg(not(feature = "paseo"))]
type MinimumPeriod = ConstU64<0>;
#[cfg(not(feature = "experimental"))]
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
type WeightInfo = ();
}
Expand Down Expand Up @@ -443,9 +439,6 @@ impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = ConstU32<100_000>;
#[cfg(not(feature = "paseo"))]
type AllowMultipleBlocksPerSlot = ConstBool<true>;
#[cfg(feature = "paseo")]
type AllowMultipleBlocksPerSlot = ConstBool<false>;
#[cfg(feature = "experimental")]
type SlotDuration = ConstU64<SLOT_DURATION>;
Expand Down
5 changes: 1 addition & 4 deletions scripts/fund-dev-accounts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@ path = "./main.rs"
log.workspace = true
subxt.workspace = true
subxt-signer.workspace = true
tokio.workspace = true

[features]
paseo = []
tokio.workspace = true
Loading

0 comments on commit 0dd7489

Please sign in to comment.