Skip to content

Commit

Permalink
bump version, rustc stable, fmt with nightly, clippy (#292)
Browse files Browse the repository at this point in the history
* bump stable, fmt with nightly

* separate fmt and clippy ymls

* add github env file

* explicit name for clippy runtime

* bump 1.10.0-v52

* fix clippy CI
  • Loading branch information
brenzi authored Jun 4, 2024
1 parent a799a6d commit 7e9a1c2
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 63 deletions.
1 change: 1 addition & 0 deletions .github/env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RUST_NIGHTLY_VERSION=2024-04-14
52 changes: 26 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-dev*'
pull_request:
branches: [master]
branches: [ master ]
workflow_dispatch:
inputs:
verbose:
Expand Down Expand Up @@ -49,9 +49,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
rust: [stable]
binary: [release]
os: [ ubuntu-22.04 ]
rust: [ stable ]
binary: [ release ]
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
Expand All @@ -76,8 +76,8 @@ jobs:

- name: Install protobuf
run: |
sudo apt update
sudo apt install --assume-yes protobuf-compiler
sudo apt update
sudo apt install --assume-yes protobuf-compiler
- name: Release
if: ${{ matrix.binary == 'release' }}
Expand All @@ -104,9 +104,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
rust: [stable]
binary: [release]
os: [ ubuntu-22.04 ]
rust: [ stable ]
binary: [ release ]
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
Expand Down Expand Up @@ -162,11 +162,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]
rust-target: [x86_64-unknown-linux-gnu]
# check: [fmt --all -- --check, clippy -- -D warnings]
check: [fmt --all -- --check, check --features runtime-benchmarks] # skip clippy for now
os: [ ubuntu-latest ]
rust: [ nightly-2024-04-14 ]
rust-target: [ x86_64-unknown-linux-gnu ]
# check: [fmt --all -- --check, clippy -- -D warnings]
check: [ check --features runtime-benchmarks ] # skip clippy for now
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
runtime: ["shell", "integritee"]
runtime: [ "shell", "integritee" ]
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -285,12 +285,12 @@ jobs:
subwasm meta ${{ steps.srtool_build.outputs.wasm }}
subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.runtime }}-metadata.json
# This is unsupported it wants to diff the metadata with a running chain. i.e. wss://kusama-<matrix.chain>-rpc.parity.io
# - name: Check the metadata diff
# shell: bash
# run: |
# subwasm diff ${{ steps.srtool_build.outputs.wasm }} --chain-b ${{ matrix.chain }} > ${{ matrix.chain }}-diff.txt
# cat ${{ matrix.chain }}-diff.txt
# This is unsupported it wants to diff the metadata with a running chain. i.e. wss://kusama-<matrix.chain>-rpc.parity.io
# - name: Check the metadata diff
# shell: bash
# run: |
# subwasm diff ${{ steps.srtool_build.outputs.wasm }} --chain-b ${{ matrix.chain }} > ${{ matrix.chain }}-diff.txt
# cat ${{ matrix.chain }}-diff.txt

- name: Archive Subwasm results
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
Expand Down Expand Up @@ -320,8 +320,8 @@ jobs:
strategy:
fail-fast: false
matrix:
chain: [integritee]
config: [rococo, westend, kusama, polkadot, moonbase, paseo]
chain: [ integritee ]
config: [ rococo, westend, kusama, polkadot, moonbase, paseo ]
include:
- chain: shell
config: kusama-lease2
Expand Down Expand Up @@ -368,7 +368,7 @@ jobs:
name: Draft Release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [create_artifacts, build_primary_binaries, check]
needs: [ create_artifacts, build_primary_binaries, check ]
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
asset_upload_url: ${{ steps.create-release.outputs.upload_url }}
Expand Down Expand Up @@ -415,10 +415,10 @@ jobs:
publish-runtimes:
name: Publish Runtimes
runs-on: ubuntu-latest
needs: ["release"]
needs: [ "release" ]
strategy:
matrix:
runtime: ["shell", "integritee"]
runtime: [ "shell", "integritee" ]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/clippy-runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Clippy-Runtime

on:
pull_request:
branches: [ master ]
paths:
- 'polkadot-parachains/integritee-runtime/**'

# cancel previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
shared-key: "parachain-cache-clippy"
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path polkadot-parachains/integritee-runtime/Cargo.toml
env:
# RUSTFLAGS: "-D warnings" # FAIL-CI
SKIP_WASM_BUILD: 1
34 changes: 34 additions & 0 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Rustfmt (check)"

on:
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-dev*'
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
verbose:
description: "Set --verbose to get verbose build output"
required: false
default: 'true'

jobs:
rustfmt:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install nightly toolchain
run: rustup toolchain install "nightly-$RUST_NIGHTLY_VERSION" --profile minimal --component rustfmt

- name: Rustfmt (check)
run: cargo +nightly-$RUST_NIGHTLY_VERSION fmt --all -- --check
6 changes: 3 additions & 3 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 polkadot-parachains/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "integritee-collator"
description = "The Integritee parachain collator binary"
# align major.minor revision with the runtimes. bump patch revision ad lib. make this the github release tag
version = "1.9.5"
# align major.minor revision with polkadot SDK. bump patch revision ad lib. make this the github release tag
version = "1.10.0"
authors = ["Integritee AG <[email protected]>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/parachain"
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/common/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ where
fn contains(asset: &Asset, origin: &Location) -> bool {
if let Some(ref reserve) = ReserveProvider::reserve(asset) {
if reserve == origin {
return true;
return true
}
}
false
Expand All @@ -61,7 +61,7 @@ where
fn matches_fungible(a: &Asset) -> Option<Amount> {
if let (Fungible(ref amount), AssetId(location)) = (&a.fun, &a.id) {
if CurrencyIdConvert::convert(location.clone()).is_some() {
return CheckedConversion::checked_from(*amount);
return CheckedConversion::checked_from(*amount)
}
}
None
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/integritee-runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "integritee-runtime"
description = "The Integritee parachain runtime"
# patch revision must match runtime spec_version
version = "1.9.51"
# align major.minor revision with polkadot SDK. patch revision must match runtime spec_version
version = "1.10.52"
authors = ["Integritee AG <[email protected]>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/parachain"
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/integritee-runtime/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/// Usage:
/// ```Rust
/// parameter_types! {
/// pub const VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES);
/// pub const VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES);
/// }
#[macro_export]
macro_rules! prod_or_fast {
Expand Down
18 changes: 9 additions & 9 deletions polkadot-parachains/integritee-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub use integritee_parachains_common::{
use pallet_asset_conversion::{Ascending, Chain, WithFirstAsset};
pub use pallet_balances::Call as BalancesCall;
pub use pallet_claims;
use pallet_collective;
pub use pallet_collective;
pub use pallet_enclave_bridge;
pub use pallet_sidechain;
pub use pallet_teeracle;
Expand Down Expand Up @@ -120,7 +120,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("integritee-parachain"),
impl_name: create_runtime_str!("integritee-full"),
authoring_version: 2,
spec_version: 51,
spec_version: 52,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 7,
Expand Down Expand Up @@ -385,7 +385,7 @@ impl pallet_proxy::Config for Runtime {
}

parameter_types! {
pub const MinVestedTransfer: Balance = 1 * TEER;
pub const MinVestedTransfer: Balance = TEER;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}
Expand Down Expand Up @@ -429,7 +429,7 @@ impl pallet_utility::Config for Runtime {
}

parameter_types! {
pub const PreimageBaseDeposit: Balance = 1 * TEER;
pub const PreimageBaseDeposit: Balance = TEER;
pub const PreimageByteDeposit: Balance = deposit(0, 1);
pub const PreimageHoldReason: RuntimeHoldReason =
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
Expand Down Expand Up @@ -595,7 +595,7 @@ pub struct NoConversion;
impl ConversionFromAssetBalance<u128, (), u128> for NoConversion {
type Error = ();
fn from_asset_balance(balance: Balance, _asset_id: ()) -> Result<Balance, Self::Error> {
return Ok(balance);
Ok(balance)
}
#[cfg(feature = "runtime-benchmarks")]
fn ensure_successful(_: ()) {}
Expand Down Expand Up @@ -629,12 +629,12 @@ impl pallet_treasury::Config for Runtime {
}

parameter_types! {
pub const BountyDepositBase: Balance = 1 * TEER;
pub const BountyDepositBase: Balance = TEER;
pub const BountyDepositPayoutDelay: BlockNumber = prod_or_fast!(4 * DAYS, 4 * MINUTES);
pub const BountyUpdatePeriod: BlockNumber = prod_or_fast!(90 * DAYS, 15 * MINUTES);
pub const MaximumReasonLength: u32 = 16384;
pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50);
pub const CuratorDepositMin: Balance = 1 * TEER;
pub const CuratorDepositMin: Balance = TEER;
pub const CuratorDepositMax: Balance = 100 * TEER;
pub const BountyValueMinimum: Balance = 100 * TEER;
}
Expand Down Expand Up @@ -740,7 +740,7 @@ parameter_types! {
pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 2 * MINUTES);
pub const MinimumDeposit: Balance = 100 * TEER;
pub EnactmentPeriod: BlockNumber = prod_or_fast!(2 * DAYS, 1);
pub const CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES);
pub const CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, MINUTES);
pub const InstantAllowed: bool = true;
pub const MaxVotes: u32 = 100;
pub const MaxProposals: u32 = 100;
Expand Down Expand Up @@ -808,7 +808,7 @@ impl EnsureOriginWithArg<RuntimeOrigin, AssetIdForTrustBackedAssets> for NoAsset
o: RuntimeOrigin,
_a: &AssetIdForTrustBackedAssets,
) -> sp_std::result::Result<Self::Success, RuntimeOrigin> {
return Err(o);
Err(o)
}

#[cfg(feature = "runtime-benchmarks")]
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/integritee-runtime/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub mod scheduler {
use sp_runtime::TryRuntimeError;

/// The log target.
const TARGET: &'static str = "runtime::fix::scheduler::migration";
const TARGET: &str = "runtime::fix::scheduler::migration";

pub mod v1 {
use super::*;
Expand Down Expand Up @@ -102,7 +102,7 @@ pub mod scheduler {
Expected version == 4, found {:?}",
onchain_version,
);
return T::DbWeight::get().reads(1);
return T::DbWeight::get().reads(1)
}
log::info!(target: TARGET, "migrating from {:?} to 4, purging agenda", onchain_version);
let purged_agendas = v1::Agenda::<T>::clear(u32::MAX, None).unique as u64;
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/shell-runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "shell-runtime"
description = "The Integritee shell parachain runtime"
# major.minor revision must match collator node. patch should match spec_version
version = "1.9.16"
# align major.minor revision with polkadot SDK. patch should match spec_version
version = "1.10.17"
authors = ["Integritee AG <[email protected]>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/parachain"
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/shell-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("integritee-parachain"),
impl_name: create_runtime_str!("integritee-shell"),
authoring_version: 0,
spec_version: 16,
spec_version: 17,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
Loading

0 comments on commit 7e9a1c2

Please sign in to comment.