Skip to content

Commit

Permalink
refactor: remove rococo
Browse files Browse the repository at this point in the history
  • Loading branch information
evilrobot-01 committed Jun 22, 2024
1 parent 33505ba commit 44ac4f1
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 144 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
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
```
22 changes: 22 additions & 0 deletions networks/paseo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# pop up parachain -f ./tests/networks/pop.toml

[relaychain]
chain = "paseo-local"

[[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.collators]]
name = "pop"
rpc_port = 9944
args = ["-lruntime::contracts=debug", "-lpopapi::extension=debug"]
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
40 changes: 5 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 => {
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 => {
Relay::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
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 @@ -333,10 +333,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 @@ -481,9 +477,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 @@ -332,10 +332,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 @@ -480,9 +476,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
57 changes: 1 addition & 56 deletions scripts/fund-dev-accounts/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,66 +9,11 @@ use subxt_signer::sr25519::{dev, Keypair};

use std::time::Duration;

#[cfg(feature = "paseo")]
mod paseo_interface;
#[cfg(not(feature = "paseo"))]
mod rococo_interface;

mod pop_interface;

const PARA_ID: u32 = 4385;

#[cfg(not(feature = "paseo"))]
mod relay {
use super::*;
pub(crate) use crate::rococo_interface::api as runtime;
pub(crate) type RuntimeCall = runtime::runtime_types::rococo_runtime::RuntimeCall;
pub(crate) const UNIT: u128 = 1_000_000_000_000;

use runtime::runtime_types::{
staging_xcm::v4::{
asset::Fungibility::Fungible,
asset::{Asset, AssetId, Assets},
junction::Junction,
junctions::Junctions,
junctions::Junctions::X1,
location::Location,
},
xcm::{v3::WeightLimit, VersionedAssets, VersionedLocation},
};

// generate XCM message to reserve transfer funds to a designated account on
// Pop Parachain
pub(crate) fn gen_account_fund_message_call(account: Keypair) -> RuntimeCall {
let pop_location = VersionedLocation::V4(Location {
parents: 0,
interior: X1([Junction::Parachain(PARA_ID)]),
});
let pop_beneficiary = VersionedLocation::V4(Location {
parents: 0,
interior: X1([Junction::AccountId32 { network: None, id: account.public_key().0 }]),
});
let amount = Fungible(AMOUNT_TO_FUND);
let assets = VersionedAssets::V4(Assets {
0: vec![Asset {
id: AssetId { 0: Location { parents: 0, interior: Junctions::Here } },
fun: amount,
}],
});

RuntimeCall::XcmPallet(
crate::relay::runtime::xcm_pallet::Call::limited_reserve_transfer_assets {
dest: Box::new(pop_location),
beneficiary: Box::new(pop_beneficiary),
assets: Box::new(assets),
fee_asset_item: 0,
weight_limit: WeightLimit::Unlimited,
},
)
}
}
const PARA_ID: u32 = 4001;

#[cfg(feature = "paseo")]
mod relay {
use super::*;
pub(crate) use crate::paseo_interface::api as runtime;
Expand Down

0 comments on commit 44ac4f1

Please sign in to comment.