Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mainnet): continue preparing mainnet runtime. #239

Merged
merged 11 commits into from
Aug 28, 2024
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
contents: write
strategy:
matrix:
runtime: [ "devnet", "testnet" ]
runtime: [ "devnet", "testnet", "mainnet" ]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down
76 changes: 76 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ members = [
"node",
"primitives",
"runtime/devnet",
"runtime/live",
"runtime/mainnet",
"runtime/testnet",
]

Expand Down Expand Up @@ -53,7 +53,7 @@ substrate-wasm-builder = "23.0.0"

# Local
pop-primitives = { path = "./primitives", default-features = false }
pop-runtime = { path = "runtime/live", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime = { path = "runtime/mainnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-common = { path = "runtime/common", default-features = false }
pop-runtime-devnet = { path = "runtime/devnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-testnet = { path = "runtime/testnet", default-features = true } # default-features=true required for `-p pop-node` builds
Expand Down
40 changes: 40 additions & 0 deletions networks/mainnet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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
chain = "mainnet"
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"]
16 changes: 8 additions & 8 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub type DevnetChainSpec = sc_service::GenericChainSpec<Extensions>;
pub type TestnetChainSpec = sc_service::GenericChainSpec<Extensions>;

/// Specialized `ChainSpec` for the live parachain runtime.
pub type LiveChainSpec = sc_service::GenericChainSpec<Extensions>;
pub type MainnetChainSpec = sc_service::GenericChainSpec<Extensions>;

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
Expand Down Expand Up @@ -81,7 +81,7 @@ pub fn pop_testnet_session_keys(keys: AuraId) -> pop_runtime_testnet::SessionKey
/// Generate the session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn pop_live_session_keys(keys: AuraId) -> pop_runtime::SessionKeys {
pub fn pop_mainnet_session_keys(keys: AuraId) -> pop_runtime::SessionKeys {
pop_runtime::SessionKeys { aura: keys }
}

Expand All @@ -103,7 +103,7 @@ fn configure_for_relay(
(Extensions { relay_chain, para_id }, para_id)
},
Relay::Polkadot => {
para_id = 3456;
para_id = 3395;
properties.insert("tokenSymbol".into(), "DOT".into());
properties.insert("tokenDecimals".into(), 10.into());
(Extensions { relay_chain: "polkadot".into(), para_id }, para_id)
Expand Down Expand Up @@ -189,7 +189,7 @@ pub fn testnet_config(relay: Relay) -> TestnetChainSpec {
.build()
}

pub fn live_config(relay: Relay) -> LiveChainSpec {
pub fn mainnet_config(relay: Relay) -> MainnetChainSpec {
let mut properties = sc_chain_spec::Properties::new();
let (extensions, para_id) = configure_for_relay(relay, &mut properties);

Expand All @@ -209,14 +209,14 @@ pub fn live_config(relay: Relay) -> LiveChainSpec {
AccountId::from_ss58check("5FPL3ZLqUk6MyBoZrQZ1Co29WAteX6T6N68TZ6jitHvhpyuD").unwrap();

#[allow(deprecated)]
LiveChainSpec::builder(
MainnetChainSpec::builder(
pop_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
extensions,
)
.with_name("Pop Network")
.with_id("pop")
.with_chain_type(ChainType::Live)
.with_genesis_config_patch(live_genesis(
.with_genesis_config_patch(mainnet_genesis(
// initial collators.
vec![
// POP COLLATOR 0
Expand All @@ -234,7 +234,7 @@ pub fn live_config(relay: Relay) -> LiveChainSpec {
.build()
}

fn live_genesis(
fn mainnet_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
root: AccountId,
id: ParaId,
Expand All @@ -260,7 +260,7 @@ fn live_genesis(
(
acc.clone(), // account id
acc, // validator id
pop_live_session_keys(aura), // session keys
pop_mainnet_session_keys(aura), // session keys
)
})
.collect::<Vec<_>>(),
Expand Down
18 changes: 9 additions & 9 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
enum Runtime {
Devnet,
Testnet,
Live,
Mainnet,
}

trait RuntimeResolver {
Expand All @@ -36,8 +36,8 @@ fn runtime(id: &str) -> Runtime {
Runtime::Devnet
} else if id.starts_with("test") || id.ends_with("testnet") {
Runtime::Testnet
} else if id.eq("pop") || id.ends_with("live") {
Runtime::Live
} else if id.eq("pop") || id.ends_with("live") || id.ends_with("mainnet") {
Runtime::Mainnet
} else {
log::warn!(
"No specific runtime was recognized for ChainSpec's Id: '{}', so Runtime::Devnet will \
Expand Down Expand Up @@ -75,15 +75,15 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
"dev" | "devnet" | "dev-paseo" =>
Box::new(chain_spec::development_config(Relay::PaseoLocal)),
"test" | "testnet" | "pop-paseo" => Box::new(chain_spec::testnet_config(Relay::Paseo)),
"pop-network" | "pop" | "pop-polkadot" =>
Box::new(chain_spec::live_config(Relay::Polkadot)),
"pop-network" | "pop" | "pop-polkadot" | "mainnet" =>
Box::new(chain_spec::mainnet_config(Relay::Polkadot)),
"" | "local" => Box::new(chain_spec::development_config(Relay::PaseoLocal)),
path => {
let path: PathBuf = path.into();
match path.runtime() {
Runtime::Devnet => Box::new(chain_spec::DevnetChainSpec::from_json_file(path)?),
Runtime::Testnet => Box::new(chain_spec::TestnetChainSpec::from_json_file(path)?),
Runtime::Live => Box::new(chain_spec::LiveChainSpec::from_json_file(path)?),
Runtime::Mainnet => Box::new(chain_spec::MainnetChainSpec::from_json_file(path)?),
}
},
})
Expand Down Expand Up @@ -181,7 +181,7 @@ macro_rules! construct_async_run {
{ $( $code )* }.map(|v| (v, task_manager))
})
}
Runtime::Live => {
Runtime::Mainnet => {
runner.async_run(|$config| {
let $components = new_partial::<pop_runtime::RuntimeApi>(
&$config
Expand All @@ -205,7 +205,7 @@ macro_rules! construct_benchmark_partials {
let $partials = new_partial::<pop_runtime_testnet::RuntimeApi>(&$config)?;
$code
},
Runtime::Live => {
Runtime::Mainnet => {
let $partials = new_partial::<pop_runtime::RuntimeApi>(&$config)?;
$code
},
Expand Down Expand Up @@ -381,7 +381,7 @@ pub fn run() -> Result<()> {
.map(|r| r.0)
.map_err(Into::into)
},
Runtime::Live => {
Runtime::Mainnet => {
sp_core::crypto::set_default_ss58_version(
pop_runtime::SS58Prefix::get().into(),
);
Expand Down
Loading
Loading