Skip to content

Commit

Permalink
use nightly
Browse files Browse the repository at this point in the history
add components to toolchain

cargo fmt

adding components specifically
  • Loading branch information
ozgunozerk committed Nov 23, 2023
1 parent 7fdeb97 commit 4820a92
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 105 deletions.
131 changes: 62 additions & 69 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,75 @@
name: "ci tests"

on:
push:
branches:
- main
- plain-cumulus-template
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
workflow_dispatch:
inputs:
test-macos-and-windows:
description: "run macOS and Windows tests"
required: true
default: false
type: boolean
push:
branches:
- main
- plain-cumulus-template
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
workflow_dispatch:
inputs:
test-macos-and-windows:
description: "run macOS and Windows tests"
required: true
default: false
type: boolean

env:
# Not needed in CI, should make things a bit faster
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
# Remove unnecessary WASM build artefacts
WASM_BUILD_CLEAN_TARGET: 1
# Not needed in CI, should make things a bit faster
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
# Remove unnecessary WASM build artefacts
WASM_BUILD_CLEAN_TARGET: 1

jobs:
clippy-fmt-test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- macos-12
- windows-2022
run-all:
- ${{ inputs.test-macos-and-windows == true || github.ref == 'refs/heads/main' }}
exclude: # exclude macos-12 and windows-2022 when the condition is false
- run-all: false
os: macos-12
- run-all: false
os: windows-2022
clippy-fmt-test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- macos-12
- windows-2022
run-all:
- ${{ inputs.test-macos-and-windows == true || github.ref == 'refs/heads/main' }}
exclude: # exclude macos-12 and windows-2022 when the condition is false
- run-all: false
os: macos-12
- run-all: false
os: windows-2022

runs-on: ${{ matrix.os }}
steps:
- name: git checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0
runs-on: ${{ matrix.os }}
steps:
- name: git checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Install Protoc
uses: arduino/setup-protoc@9b1ee5b22b0a3f1feb8c2ff99b32c89b3c3191e9 # v2.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Protoc
uses: arduino/setup-protoc@9b1ee5b22b0a3f1feb8c2ff99b32c89b3c3191e9 # v2.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: cargo fmt
uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1
with:
command: fmt
args: --all -- --check

- name: cargo fmt
uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1
with:
command: fmt
args: --all -- --check
- name: cargo test --locked
uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1
with:
command: test

- name: cargo test --locked
uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1
with:
command: test
- name: cargo clippy --locked
uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # @v1.0.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --locked --all-targets -- -D warnings

- name: cargo clippy --locked
uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # @v1.0.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --locked --all-targets -- -D warnings

- name: Check Documentation
run: cargo doc --locked --all --no-deps
env:
RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links"
- name: Check Documentation
run: cargo doc --locked --all --no-deps
env:
RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links"
15 changes: 8 additions & 7 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ pub fn create_full<C, P>(
deps: FullDeps<C, P>,
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
where
C: ProvideRuntimeApi<Block>
+ HeaderBackend<Block>
+ AuxStore
+ HeaderMetadata<Block, Error = BlockChainError>
+ Send
+ Sync
+ 'static,
C:
ProvideRuntimeApi<Block>
+ HeaderBackend<Block>
+ AuxStore
+ HeaderMetadata<Block, Error = BlockChainError>
+ Send
+ Sync
+ 'static,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: BlockBuilder<Block>,
Expand Down
36 changes: 20 additions & 16 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,15 @@ pub fn new_partial(

let executor = ParachainExecutor::new_with_wasm_executor(wasm);

let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;
let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::<
Block,
RuntimeApi,
_,
>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;
let client = Arc::new(client);

let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle());
Expand All @@ -115,13 +118,14 @@ pub fn new_partial(
telemetry
});

let transaction_pool = sc_transaction_pool::BasicPool::new_full(
config.transaction_pool.clone(),
config.role.is_authority().into(),
config.prometheus_registry(),
task_manager.spawn_essential_handle(),
client.clone(),
);
let transaction_pool =
sc_transaction_pool::BasicPool::new_full(
config.transaction_pool.clone(),
config.role.is_authority().into(),
config.prometheus_registry(),
task_manager.spawn_essential_handle(),
client.clone(),
);

let block_import = ParachainBlockImport::new(client.clone(), backend.clone());

Expand Down Expand Up @@ -208,9 +212,9 @@ async fn start_node_impl(
runtime_api_provider: client.clone(),
keystore: Some(params.keystore_container.keystore()),
offchain_db: backend.offchain_storage(),
transaction_pool: Some(OffchainTransactionPoolFactory::new(
transaction_pool.clone(),
)),
transaction_pool: Some(
OffchainTransactionPoolFactory::new(transaction_pool.clone())
),
network_provider: network.clone(),
is_validator: parachain_config.role.is_authority(),
enable_http_requests: false,
Expand Down
21 changes: 11 additions & 10 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,17 @@ impl_opaque_keys! {
}

#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("template-parachain"),
impl_name: create_runtime_str!("template-parachain"),
authoring_version: 1,
spec_version: 1,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
};
pub const VERSION: RuntimeVersion =
RuntimeVersion {
spec_name: create_runtime_str!("template-parachain"),
impl_name: create_runtime_str!("template-parachain"),
authoring_version: 1,
spec_version: 1,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
};

/// This determines the average expected block time that we are targeting.
/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`.
Expand Down
3 changes: 2 additions & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[toolchain]
channel = "stable-2023-11-16"
channel = "nightly-2023-11-20"
targets = ["wasm32-unknown-unknown"]
components = ["rustfmt", "clippy"]
8 changes: 6 additions & 2 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
format_code_in_doc_comments = true

format_macro_bodies = true
format_macro_matchers = true
format_strings = true
Expand All @@ -8,7 +8,11 @@ reorder_impl_items = true
group_imports = "StdExternalCrate"
use_field_init_shorthand = true
use_small_heuristics = "Max"
wrap_comments = true

# most of these are unstable, so we enable them
unstable_features = true


# wanted to enable below, but they are removing the documentation comments if there is an empty line in between
# wrap_comments = true
# format_code_in_doc_comments = true

0 comments on commit 4820a92

Please sign in to comment.