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

[stable2407] Backport #7367 #7498

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/release-10_branchoff-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Release - Branch off stable branch

on:
workflow_dispatch:
inputs:
stable_version:
description: New stable version in the format stableYYMM
required: true
type: string

node_version:
description: Version of the polkadot node in the format X.XX.X (e.g. 1.15.0)
required: true

jobs:
prepare-tooling:
runs-on: ubuntu-latest
outputs:
node_version: ${{ steps.validate_inputs.outputs.node_version }}
stable_version: ${{ steps.validate_inputs.outputs.stable_version }}

steps:
- name: Checkout sources
uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.7

- name: Validate inputs
id: validate_inputs
run: |
. ./.github/scripts/common/lib.sh

node_version=$(filter_version_from_input "${{ inputs.node_version }}")
echo "node_version=${node_version}" >> $GITHUB_OUTPUT

stable_version=$(validate_stable_tag ${{ inputs.stable_version }})
echo "stable_version=${stable_version}" >> $GITHUB_OUTPUT

create-stable-branch:
needs: [prepare-tooling]
runs-on: ubuntu-latest
environment: release
env:
PGP_KMS_KEY: ${{ secrets.PGP_KMS_SIGN_COMMITS_KEY }}
PGP_KMS_HASH: ${{ secrets.PGP_KMS_HASH }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
STABLE_BRANCH_NAME: ${{ needs.prepare-tooling.outputs.stable_version }}

steps:
- name: Install pgpkkms
run: |
# Install pgpkms that is used to sign commits
pip install git+https://github.com/paritytech-release/pgpkms.git@5a8f82fbb607ea102d8c178e761659de54c7af69

- name: Generate content write token for the release automation
id: generate_write_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.RELEASE_AUTOMATION_APP_ID }}
private-key: ${{ secrets.RELEASE_AUTOMATION_APP_PRIVATE_KEY }}
owner: paritytech

- name: Checkout sources
uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.7
with:
ref: master
token: ${{ steps.generate_write_token.outputs.token }}

- name: Import gpg keys
run: |
. ./.github/scripts/common/lib.sh

import_gpg_keys

- name: Config git
run: |
git config --global commit.gpgsign true
git config --global gpg.program /home/runner/.local/bin/pgpkms-git
git config --global user.name "ParityReleases"
git config --global user.email "release-team@parity.io"
git config --global user.signingKey "D8018FBB3F534D866A45998293C5FB5F6A367B51"

- name: Create stable branch
run: |
git checkout -b "$STABLE_BRANCH_NAME"
git show-ref "$STABLE_BRANCH_NAME"

- name: Bump versions, reorder prdocs and push stable branch
env:
GH_TOKEN: ${{ steps.generate_write_token.outputs.token }}
run: |
. ./.github/scripts/release/release_lib.sh

NODE_VERSION="${{ needs.prepare-tooling.outputs.node_version }}"
NODE_VERSION_PATTERN="\(NODE_VERSION[^=]*= \)\".*\""
set_version $NODE_VERSION_PATTERN $NODE_VERSION "polkadot/node/primitives/src/lib.rs"
commit_with_message "Bump node version to $NODE_VERSION in polkadot-cli"
set_version $NODE_VERSION_PATTERN $NODE_VERSION "cumulus/polkadot-omni-node/lib/src/nodes/mod.rs"
commit_with_message "Bump node version to $NODE_VERSION in polkadot-omni-node-lib"

SPEC_VERSION=$(get_spec_version $NODE_VERSION)
runtimes_list=$(get_filtered_runtimes_list)
set_spec_versions $SPEC_VERSION "${runtimes_list[@]}"

# TODO: clarify what to do with the polkadot-parachain binary
# Set new version for polkadot-parachain binary to match the polkadot node binary
# set_polkadot_parachain_binary_version $NODE_VERSION "cumulus/polkadot-parachain/Cargo.toml"

reorder_prdocs $STABLE_BRANCH_NAME

gh auth setup-git

git push origin "$STABLE_BRANCH_NAME"
62 changes: 62 additions & 0 deletions cumulus/polkadot-omni-node/lib/src/nodes/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.

// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

pub mod aura;
mod manual_seal;

use crate::common::spec::{DynNodeSpec, NodeSpec as NodeSpecT};
use cumulus_primitives_core::ParaId;
use manual_seal::ManualSealNode;
use sc_service::{Configuration, TaskManager};

/// The current node version for cumulus official binaries, which takes the basic
/// SemVer form `<major>.<minor>.<patch>`. It should correspond to the latest
/// `polkadot` version of a stable release.
pub const NODE_VERSION: &'static str = "1.17.1";

/// Trait that extends the `DynNodeSpec` trait with manual seal related logic.
///
/// We need it in order to be able to access both the `DynNodeSpec` and the manual seal logic
/// through dynamic dispatch.
pub trait DynNodeSpecExt: DynNodeSpec {
fn start_manual_seal_node(
&self,
config: Configuration,
para_id: ParaId,
block_time: u64,
) -> sc_service::error::Result<TaskManager>;
}

impl<T> DynNodeSpecExt for T
where
T: NodeSpecT + DynNodeSpec,
{
#[sc_tracing::logging::prefix_logs_with("Parachain")]
fn start_manual_seal_node(
&self,
config: Configuration,
para_id: ParaId,
block_time: u64,
) -> sc_service::error::Result<TaskManager> {
let node = ManualSealNode::<T>::new();
match config.network.network_backend {
sc_network::config::NetworkBackendType::Libp2p =>
node.start_node::<sc_network::NetworkWorker<_, _>>(config, para_id, block_time),
sc_network::config::NetworkBackendType::Litep2p =>
node.start_node::<sc_network::Litep2pNetworkBackend>(config, para_id, block_time),
}
}
}
55 changes: 55 additions & 0 deletions cumulus/polkadot-omni-node/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.

// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

//! White labeled polkadot omni-node.
//!
//! For documentation, see [`polkadot_omni_node_lib`].

#![warn(missing_docs)]
#![warn(unused_extern_crates)]

use polkadot_omni_node_lib::{
chain_spec::DiskChainSpecLoader, run, runtime::DefaultRuntimeResolver, CliConfig as CliConfigT,
RunConfig, NODE_VERSION,
};

struct CliConfig;

impl CliConfigT for CliConfig {
fn impl_version() -> String {
let commit_hash = env!("SUBSTRATE_CLI_COMMIT_HASH");
format!("{}-{commit_hash}", NODE_VERSION)
}

fn author() -> String {
env!("CARGO_PKG_AUTHORS").into()
}

fn support_url() -> String {
"https://github.com/paritytech/polkadot-sdk/issues/new".into()
}

fn copyright_start_year() -> u16 {
2017
}
}

fn main() -> color_eyre::eyre::Result<()> {
color_eyre::install()?;

let config = RunConfig::new(Box::new(DefaultRuntimeResolver), Box::new(DiskChainSpecLoader));
Ok(run::<CliConfig>(config)?)
}
13 changes: 13 additions & 0 deletions cumulus/polkadot-parachain/src/fake_runtime_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,18 @@
//! In an ideal world this would be one runtime which would simplify the code massively.
//! This is not an ideal world - Polkadot Asset Hub has a different key type.

<<<<<<< HEAD:cumulus/polkadot-parachain/src/fake_runtime_api/mod.rs
pub mod asset_hub_polkadot_aura;
pub mod aura;
=======
pub mod cli;
mod command;
mod common;
mod fake_runtime_api;
mod nodes;

pub use cli::CliConfig;
pub use command::{run, RunConfig};
pub use common::{chain_spec, runtime};
pub use nodes::NODE_VERSION;
>>>>>>> 3fb7c8c (Align omni-node and polkadot-parachain versions (#7367)):cumulus/polkadot-omni-node/lib/src/lib.rs
34 changes: 34 additions & 0 deletions cumulus/polkadot-parachain/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,40 @@ mod fake_runtime_api;
mod rpc;
mod service;

<<<<<<< HEAD
fn main() -> sc_cli::Result<()> {
command::run()
=======
use polkadot_omni_node_lib::{run, CliConfig as CliConfigT, RunConfig, NODE_VERSION};

struct CliConfig;

impl CliConfigT for CliConfig {
fn impl_version() -> String {
let commit_hash = env!("SUBSTRATE_CLI_COMMIT_HASH");
format!("{}-{commit_hash}", NODE_VERSION)
}

fn author() -> String {
env!("CARGO_PKG_AUTHORS").into()
}

fn support_url() -> String {
"https://github.com/paritytech/polkadot-sdk/issues/new".into()
}

fn copyright_start_year() -> u16 {
2017
}
}

fn main() -> color_eyre::eyre::Result<()> {
color_eyre::install()?;

let config = RunConfig::new(
Box::new(chain_spec::RuntimeResolver),
Box::new(chain_spec::ChainSpecLoader),
);
Ok(run::<CliConfig>(config)?)
>>>>>>> 3fb7c8c (Align omni-node and polkadot-parachain versions (#7367))
}
Loading