Skip to content

Commit

Permalink
Merge pull request #6 from logion-network/feature/fix-upgrade
Browse files Browse the repository at this point in the history
Fix upgrade
  • Loading branch information
gdethier authored Mar 12, 2024
2 parents ca45c29 + ed35ea8 commit 6189b6f
Show file tree
Hide file tree
Showing 11 changed files with 1,460 additions and 1,288 deletions.
2,415 changes: 1,271 additions & 1,144 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ migrating from the solochain to the parachain.
Logion's [white paper](https://docs.logion.network/logion-white-paper/) describes all the aspects that
will be/are implemented by this runtime.

In particular, you will find there a descripiton of Logion's [tokenomics](https://docs.logion.network/logion-white-paper/tokenomics/introduction-to-logion-tokenomics)
In particular, you will find there a description of Logion's [tokenomics](https://docs.logion.network/logion-white-paper/tokenomics/introduction-to-logion-tokenomics)
and future [governance](https://docs.logion.network/logion-white-paper/governance/the-logion-governance-model-in-a-nutshell).

## Test locally
Expand All @@ -26,12 +26,13 @@ Install [Zombienet](https://github.com/paritytech/zombienet).
1. If not already done, download polkadot binaries with command `./scripts/download_polkadot.sh`

2. If not already done, build logion collator with command `cargo build --release`
or download a pre-compiled binary with `./scripts/download_logion.sh`

3. Run `$ZOMBIENET spawn local-zombienet.toml` where `$ZOMBIENET` is the path to Zombienet binary
3. Run `$ZOMBIENET spawn local-zombienet.toml` where `$ZOMBIENET` is the path to the Zombienet binary

## JSON chainspec generation

Below, `$CHAIN` is one of `logion`, `logion-dev`, `logion-test` or `local`. It is recommanded to define the variable before running the commands (`export CHAIN=...`).
Below, `$CHAIN` is one of `logion`, `logion-dev`, `logion-test` or `local`. It is recommended to define the variable before running the commands (`export CHAIN=...`).

1. Generate plain chainspec:

Expand All @@ -58,7 +59,7 @@ Below, `$CHAIN` is one of `logion`, `logion-dev`, `logion-test` or `local`. It i
## Deploy an upgrade

- Build using [`srtool`](https://docs.substrate.io/reference/command-line-tools/srtool/)
- `srtool build --root --package logion-runtime --runtime-dir runtime`
- `cp rust-toolchain.toml runtime/ ; srtool build --root --package logion-runtime --runtime-dir runtime ; rm runtime/rust-toolchain.toml`
- `parachainSystem.authorizeUpgrade(codeHash, checkVersion)`
- `codeHash`: `BLAKE2_256` field of compressed runtime in `srtool` build output
- `checkVersion`: Yes
Expand Down
98 changes: 49 additions & 49 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "logion"
version = "0.2.0"
version = "0.2.2"
authors = ['Logion Team <https://github.com/logion-network>']
description = "The logion Collator Node."
license = "Apache 2.0"
Expand All @@ -10,68 +10,68 @@ edition = "2021"
build = "build.rs"

[dependencies]
clap = { version = "4.4.10", features = ["derive"] }
log = "0.4.20"
clap = { version = "4.5.1", features = ["derive"] }
log = { version = "0.4.20", default-features = true }
codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.193", features = ["derive"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }
serde = { version = "1.0.193", features = ["derive"], default-features = true }
jsonrpsee = { version = "0.22", features = ["server"] }
futures = "0.3.28"
serde_json = "1.0.108"
serde_json = { version = "1.0.114", default-features = true }

# Local
logion-runtime = { path = "../runtime" }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-network = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-service = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-network = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-service = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }

# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.5.0" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0", default-features = false }

# Cumulus
cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }
color-print = "0.3.4"

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.5.0" }
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.8.0" }

[features]
default = []
Expand Down
7 changes: 5 additions & 2 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ pub enum Subcommand {
/// Remove the whole chain.
PurgeChain(cumulus_client_cli::PurgeChainCmd),

/// Export the genesis state of the parachain.
ExportGenesisState(cumulus_client_cli::ExportGenesisStateCommand),
/// Export the genesis head data of the parachain.
///
/// Head data is the encoded block header.
#[command(alias = "export-genesis-state")]
ExportGenesisHead(cumulus_client_cli::ExportGenesisHeadCommand),

/// Export the genesis wasm of the parachain.
ExportGenesisWasm(cumulus_client_cli::ExportGenesisWasmCommand),
Expand Down
6 changes: 3 additions & 3 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ pub fn run() -> Result<()> {
cmd.run(config, polkadot_config)
})
},
Some(Subcommand::ExportGenesisState(cmd)) => {
Some(Subcommand::ExportGenesisHead(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| {
let partials = new_partial(&config)?;

cmd.run(&*config.chain_spec, &*partials.client)
cmd.run(partials.client)
})
},
Some(Subcommand::ExportGenesisWasm(cmd)) => {
Expand All @@ -185,7 +185,7 @@ pub fn run() -> Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) =>
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| cmd.run::<Block, ()>(config))
runner.sync_run(|config| cmd.run::<sp_runtime::traits::HashingFor<Block>, ()>(config))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
Expand Down
34 changes: 16 additions & 18 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,21 @@ type ParachainBackend = TFullBackend<Block>;

type ParachainBlockImport = TParachainBlockImport<Block, Arc<ParachainClient>, ParachainBackend>;

/// Assembly of PartialComponents (enough to run chain ops subcommands)
pub type Service = PartialComponents<
ParachainClient,
ParachainBackend,
(),
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, ParachainClient>,
(ParachainBlockImport, Option<Telemetry>, Option<TelemetryWorkerHandle>),
>;

/// Starts a `ServiceBuilder` for a full service.
///
/// Use this macro if you don't actually need the full service, but just the builder in order to
/// be able to perform chain operations.
pub fn new_partial(
config: &Configuration,
) -> Result<
PartialComponents<
ParachainClient,
ParachainBackend,
(),
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, ParachainClient>,
(ParachainBlockImport, Option<Telemetry>, Option<TelemetryWorkerHandle>),
>,
sc_service::Error,
> {
pub fn new_partial(config: &Configuration) -> Result<Service, sc_service::Error> {
let telemetry = config
.telemetry_endpoints
.clone()
Expand Down Expand Up @@ -175,8 +173,8 @@ async fn start_node_impl(
collator_options.clone(),
hwbench.clone(),
)
.await
.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;
.await
.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;

let validator = parachain_config.role.is_authority();
let prometheus_registry = parachain_config.prometheus_registry().cloned();
Expand All @@ -195,7 +193,7 @@ async fn start_node_impl(
import_queue: params.import_queue,
sybil_resistance_level: CollatorSybilResistance::Resistant, // because of Aura
})
.await?;
.await?;

if parachain_config.offchain_worker.enabled {
use futures::FutureExt;
Expand All @@ -215,8 +213,8 @@ async fn start_node_impl(
enable_http_requests: false,
custom_extensions: move |_| vec![],
})
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
);
}

Expand Down
Loading

0 comments on commit 6189b6f

Please sign in to comment.