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

Restart testnet on paseo #852

Merged
merged 19 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check for json syntax errors 1
run: "for i in `git ls-tree --full-tree -r --name-only HEAD |grep json`; do echo Checking $i:; json_pp <$i >/dev/null || echo ERROR: $i failed; done"
run: "for i in `git ls-tree --full-tree -r --name-only HEAD |grep json$`; do echo Checking $i:; json_pp <$i >/dev/null || echo ERROR: $i failed; done"
- name: Check for json syntax errors 2
run: "for i in `git ls-tree --full-tree -r --name-only HEAD |grep json`; do echo Checking $i:; json_pp <$i >/dev/null ; done"
run: "for i in `git ls-tree --full-tree -r --name-only HEAD |grep json$`; do echo Checking $i:; json_pp <$i >/dev/null ; done"
lints:
runs-on: ubuntu-latest-8-cores
steps:
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ COPY . /nodle-chain

RUN apt-get update && \
apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y cmake pkg-config libssl-dev git clang build-essential curl protobuf-compiler
DEBIAN_FRONTEND=noninteractive apt-get install -y cmake pkg-config libssl-dev git clang build-essential curl protobuf-compiler bzip2
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
export PATH=$PATH:$HOME/.cargo/bin && \
scripts/init.sh && \
cargo build -p nodle-parachain --$PROFILE
cargo build -p nodle-parachain --$PROFILE && \
bunzip2 node/res/paradis.json.bz2

# ===== SECOND STAGE ======

FROM ubuntu

ARG PROFILE=release

RUN install -d /usr/local/share/nodle
COPY --from=builder /nodle-chain/target/$PROFILE/nodle-parachain /usr/local/bin
COPY --from=builder /nodle-chain/node/res/paradis.json /usr/local/share/nodle

RUN apt-get update && \
apt-get upgrade -y && \
Expand Down
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ polkadot-parachain-primitives.workspace = true
polkadot-primitives.workspace = true
polkadot-service.workspace = true
xcm = { workspace = true, default-features = false}

hex-literal = "0.4.1"
[dev-dependencies]
hex-literal = {workspace = true }
Binary file added node/res/eden-export.json.bz2
Binary file not shown.
108 changes: 0 additions & 108 deletions node/res/eden-testing.json

This file was deleted.

133 changes: 0 additions & 133 deletions node/res/eden-testing.spec.json

This file was deleted.

Binary file added node/res/paradis.json.bz2
Binary file not shown.
Binary file added node/res/runtime_eden.wasm
Binary file not shown.
24 changes: 12 additions & 12 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
// clippy complains about ChainSpecGroup which we cannot modify
#![allow(clippy::derive_partial_eq_without_eq)]

use std::vec;

use cumulus_primitives_core::ParaId;

use primitives::{AccountId, Balance, Signature};
use runtime_eden::{
constants::{EXISTENTIAL_DEPOSIT, NODL},
Expand All @@ -28,8 +31,10 @@ use runtime_eden::{
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};

const SAFE_XCM_VERSION: u32 = xcm::latest::VERSION;

/// Specialized `ChainSpec` for the normal parachain runtime.
Expand Down Expand Up @@ -85,11 +90,11 @@ pub fn eden_session_keys(keys: AuraId) -> SessionKeys {

/// Helper function to create RuntimeGenesisConfig for testing
fn eden_testnet_genesis(
root_key: AccountId,
root_key: Vec<AccountId>,
collators: Vec<(AccountId, AuraId)>,
endowed_accounts: Option<Vec<AccountId>>,
id: ParaId,
) -> serde_json::Value {
) -> Value {
let endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(|| {
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand Down Expand Up @@ -132,17 +137,17 @@ fn eden_testnet_genesis(
"parachainId": id,
},
"technicalMembership": {
"members": vec![root_key],
"members": root_key,
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
})
}

fn development_config_genesis(id: ParaId) -> serde_json::Value {
fn development_config_genesis(id: ParaId) -> Value {
eden_testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand Down Expand Up @@ -184,8 +189,8 @@ pub fn production_config() -> ChainSpec {
ChainSpec::from_json_bytes(&include_bytes!("../res/eden.json")[..]).unwrap()
}

pub fn testing_config() -> ChainSpec {
ChainSpec::from_json_bytes(&include_bytes!("../res/eden-testing.json")[..]).unwrap()
pub fn paradis_config() -> Result<ChainSpec, Box<dyn std::error::Error>> {
Ok(ChainSpec::from_json_file("/usr/local/share/nodle/paradis.json".into())?)
}

#[cfg(test)]
Expand Down Expand Up @@ -220,9 +225,4 @@ pub(crate) mod tests {
hex!("207767fb73e1fcf8ae32455843419e51c94987228a4b77857aff7653d103cac3"),
);
}

#[test]
fn create_testing_spec() {
assert!(testing_config().build_storage().is_ok());
}
}
2 changes: 1 addition & 1 deletion node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const DEFAULT_PARA_ID: u32 = 2026;
fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match id {
"eden-local" | "local" | "eden-dev" | "dev" => Box::new(chain_spec::development_config(DEFAULT_PARA_ID.into())),
"eden-testing" | "testing" | "test" | "paradis" => Box::new(chain_spec::testing_config()),
"eden-testing" | "paradis" => Box::new(chain_spec::paradis_config().map_err(|e| format!("{e:?}"))?),
"eden" | "production" | "main" | "" => Box::new(chain_spec::production_config()),
path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
})
Expand Down
6 changes: 3 additions & 3 deletions pallets/grants/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ fn add_vesting_schedule_overflow_check() {
.execute_with(|| {
System::set_block_number(1);

let schedules = vec![
let schedules = [
VestingSchedule {
start: 0u64,
period: 10u64,
Expand Down Expand Up @@ -508,7 +508,7 @@ fn add_vesting_schedule_overflow_cfg_min_check() {
.execute_with(|| {
System::set_block_number(1);

let schedules = vec![VestingSchedule {
let schedules = [VestingSchedule {
start: 0u64,
period: 10u64,
period_count: 1u32,
Expand Down Expand Up @@ -552,7 +552,7 @@ fn add_vesting_schedule_overflow_cfg_max_check() {
.execute_with(|| {
System::set_block_number(1);

let schedules = vec![VestingSchedule {
let schedules = [VestingSchedule {
start: 0u64,
period: 10u64,
period_count: 1u32,
Expand Down