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

Mkl fix workflows combined 2 #1273

Closed
wants to merge 7 commits into from
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
21 changes: 6 additions & 15 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install rust toolchain
run: rustup show

- uses: actions-rs/[email protected]
with:
crate: grcov
use-tool-cache: true

# No disk space: https://github.com/zeitgeistpm/zeitgeist/actions/runs/5085081984/jobs/9144298675?pr=1006
# Workaround: https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
- name: Free up disk space on GitHub hosted runners
run: |
# Ensure context is GitHub hosted runner
# https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context
if [[ "${{ runner.name }}" == "GitHub Actions"* ]]; then
echo "Freeing up space in GitHub hosted runner"
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
fi

- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
Expand All @@ -58,4 +49,4 @@ jobs:
fail_ci_if_error: true
flags: tests
verbose: true
name: unit-tests
name: unit-tests
5 changes: 5 additions & 0 deletions .github/workflows/migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ jobs:
- name: Install build tools
run: ./scripts/init.sh

- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- run: ./scripts/runtime-upgrade/test_runtime_upgrade.sh ${{ github.event.inputs.block }}
53 changes: 25 additions & 28 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install build tools
run: ./scripts/init.sh

Expand All @@ -101,6 +106,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install build tools
run: ./scripts/init.sh

Expand All @@ -118,22 +128,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install build tools
run: ./scripts/init.sh

# No disk space: https://github.com/zeitgeistpm/zeitgeist/actions/runs/5085081984/jobs/9144298675?pr=1006
# Workaround: https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
- name: Free up disk space on GitHub hosted runners
run: |
# Ensure context is GitHub hosted runner
# https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context
if [[ "${{ runner.name }}" == "GitHub Actions"* ]]; then
echo "Freeing up space in GitHub hosted runner"
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
fi

- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
Expand All @@ -153,22 +154,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install build tools
run: ./scripts/init.sh

# No disk space: https://github.com/zeitgeistpm/zeitgeist/actions/runs/5085081984/jobs/9144298675?pr=1006
# Workaround: https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
- name: Free up disk space on GitHub hosted runners
run: |
# Ensure context is GitHub hosted runner
# https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context
if [[ "${{ runner.name }}" == "GitHub Actions"* ]]; then
echo "Freeing up space in GitHub hosted runner"
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
fi

- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
Expand All @@ -188,6 +180,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install build tools
run: ./scripts/init.sh

Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install build tools
run: ./scripts/init.sh

Expand All @@ -27,6 +32,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install build tools
run: ./scripts/init.sh

Expand Down
4 changes: 2 additions & 2 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Forecasting Technologies LTD.
// Copyright 2023-2024 Forecasting Technologies LTD.
// Copyright 2021-2022 Zeitgeist PM LLC.
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
//
Expand Down Expand Up @@ -38,8 +38,8 @@ use sp_runtime::{
};
use sp_storage::{ChildInfo, StorageData, StorageKey};
use std::sync::Arc;
pub use zeitgeist_primitives::types::{AccountId, Balance, BlockNumber, Hash, Index};
use zeitgeist_primitives::types::{Block, Header};
pub use zeitgeist_primitives::types::{BlockNumber, Hash};
#[cfg(feature = "with-battery-station-runtime")]
use {
super::service::BatteryStationExecutor,
Expand Down
6 changes: 2 additions & 4 deletions node/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2023 Forecasting Technologies LTD.
// Copyright 2022-2024 Forecasting Technologies LTD.
// Copyright 2021-2022 Zeitgeist PM LLC.
//
// This file is part of Zeitgeist.
Expand Down Expand Up @@ -30,9 +30,7 @@ use sc_service::{
error::Error as ServiceError, ChainSpec, Configuration, PartialComponents, TaskManager,
};
#[cfg(feature = "parachain")]
pub use service_parachain::{
new_full, new_partial, FullBackend, FullClient, ParachainPartialComponents,
};
pub use service_parachain::{new_full, new_partial, FullBackend, FullClient};
#[cfg(not(feature = "parachain"))]
pub use service_standalone::{new_full, new_partial, FullBackend, FullClient};
use sp_api::ConstructRuntimeApi;
Expand Down
44 changes: 22 additions & 22 deletions primitives/src/math/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,28 @@ mod tests {

pub(crate) const _1_10: u128 = _1 / 10;

#[macro_export]
macro_rules! assert_approx {
($left:expr, $right:expr, $precision:expr $(,)?) => {
match (&$left, &$right, &$precision) {
(left_val, right_val, precision_val) => {
let diff = if *left_val > *right_val {
*left_val - *right_val
} else {
*right_val - *left_val
};
if diff > *precision_val {
panic!(
"assertion `left approx== right` failed\n left: {}\n right: \
{}\n precision: {}\ndifference: {}",
*left_val, *right_val, *precision_val, diff
);
}
}
}
};
}

#[test_case(0, 0, 0)]
#[test_case(0, _1, 0)]
#[test_case(0, _2, 0)]
Expand Down Expand Up @@ -1075,25 +1097,3 @@ mod tests {
assert_approx!(result, expected, 1);
}
}

#[macro_export]
macro_rules! assert_approx {
($left:expr, $right:expr, $precision:expr $(,)?) => {
match (&$left, &$right, &$precision) {
(left_val, right_val, precision_val) => {
let diff = if *left_val > *right_val {
*left_val - *right_val
} else {
*right_val - *left_val
};
if diff > *precision_val {
panic!(
"assertion `left approx== right` failed\n left: {}\n right: {}\n \
precision: {}\ndifference: {}",
*left_val, *right_val, *precision_val, diff
);
}
}
}
};
}
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2023-08-23"
channel = "nightly-2024-01-31"
components = ["clippy", "rustfmt", "llvm-tools-preview"]
profile = "minimal"
targets = ["wasm32-unknown-unknown"]
4 changes: 2 additions & 2 deletions zrml/authorized/src/mock_storage.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright 2023 Forecasting Technologies LTD.
// Copyright 2022 Forecasting Technologies LTD.
// Copyright 2022-2024 Forecasting Technologies LTD.
//
// This file is part of Zeitgeist.
//
Expand All @@ -18,6 +17,7 @@

#![cfg(test)]
#![allow(dead_code)]
#![allow(unused_imports)]

#[frame_support::pallet]
pub(crate) mod pallet {
Expand Down
2 changes: 1 addition & 1 deletion zrml/court/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ mod pallet {
remainder
);

T::Currency::burn(remainder);
let _ = T::Currency::burn(remainder);
}

T::WeightInfo::handle_inflation(pool_len)
Expand Down
3 changes: 2 additions & 1 deletion zrml/court/src/mock_storage.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Forecasting Technologies LTD.
// Copyright 2023-2024 Forecasting Technologies LTD.
//
// This file is part of Zeitgeist.
//
Expand All @@ -17,6 +17,7 @@

#![cfg(test)]
#![allow(dead_code)]
#![allow(unused_imports)]

pub use pallet::*;
use parity_scale_codec::Encode;
Expand Down
2 changes: 1 addition & 1 deletion zrml/court/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ fn appeal_emits_event() {

let court = Courts::<Runtime>::get(court_id).unwrap();
let new_round_ends = Some(court.round_ends);
let appeal_info = court.appeals.get(0).unwrap().clone();
let appeal_info = court.appeals.first().unwrap().clone();

System::assert_last_event(
Event::CourtAppealed { court_id, appeal_info, new_round_ends }.into(),
Expand Down
14 changes: 7 additions & 7 deletions zrml/global-disputes/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2023 Forecasting Technologies LTD.
// Copyright 2022-2024 Forecasting Technologies LTD.
//
// This file is part of Zeitgeist.
//
Expand Down Expand Up @@ -241,7 +241,7 @@ fn start_global_dispute_fails_if_max_owner_reached() {
ExtBuilder::default().build().execute_with(|| {
let market_id = 0u128;
let market = market_mock::<Runtime>();
Markets::<Runtime>::insert(market_id, &market);
Markets::<Runtime>::insert(market_id, market);

let mut initial_items = Vec::new();
initial_items.push(InitialItem {
Expand Down Expand Up @@ -269,7 +269,7 @@ fn start_global_dispute_fails_if_shared_possession_required() {
ExtBuilder::default().build().execute_with(|| {
let market_id = 0u128;
let market = market_mock::<Runtime>();
Markets::<Runtime>::insert(market_id, &market);
Markets::<Runtime>::insert(market_id, market);

let outcome_info = OutcomeInfo {
outcome_sum: SETUP_AMOUNT,
Expand Down Expand Up @@ -303,7 +303,7 @@ fn start_global_dispute_adds_owners_for_existing_outcome() {
ExtBuilder::default().build().execute_with(|| {
let market_id = 0u128;
let market = market_mock::<Runtime>();
Markets::<Runtime>::insert(market_id, &market);
Markets::<Runtime>::insert(market_id, market);

let mut initial_items = Vec::new();
initial_items.push(InitialItem {
Expand Down Expand Up @@ -334,7 +334,7 @@ fn start_global_dispute_updates_to_highest_winner() {
ExtBuilder::default().build().execute_with(|| {
let market_id = 0u128;
let market = market_mock::<Runtime>();
Markets::<Runtime>::insert(market_id, &market);
Markets::<Runtime>::insert(market_id, market);

let mut initial_items = Vec::new();
initial_items.push(InitialItem {
Expand Down Expand Up @@ -1153,7 +1153,7 @@ fn purge_outcomes_partially_cleaned_works() {
ExtBuilder::default().build().execute_with(|| {
let market_id = 0u128;
let market = market_mock::<Runtime>();
Markets::<Runtime>::insert(market_id, &market);
Markets::<Runtime>::insert(market_id, market);

let mut initial_items = Vec::new();
for i in 0..(2 * RemoveKeysLimit::get()) {
Expand Down Expand Up @@ -1187,7 +1187,7 @@ fn refund_vote_fees_works() {
ExtBuilder::default().build().execute_with(|| {
let market_id = 0u128;
let market = market_mock::<Runtime>();
Markets::<Runtime>::insert(market_id, &market);
Markets::<Runtime>::insert(market_id, market);

let pushed_outcome_1 = 0;
let pushed_outcome_2 = 20;
Expand Down
7 changes: 5 additions & 2 deletions zrml/liquidity-mining/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2023 Forecasting Technologies LTD.
// Copyright 2022-2024 Forecasting Technologies LTD.
// Copyright 2021-2022 Zeitgeist PM LLC.
//
// This file is part of Zeitgeist.
Expand Down Expand Up @@ -145,7 +145,10 @@ mod pallet {
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
T::Currency::deposit_creating(&Pallet::<T>::pallet_account_id(), self.initial_balance);
let _ = T::Currency::deposit_creating(
&Pallet::<T>::pallet_account_id(),
self.initial_balance,
);
<PerBlockIncentive<T>>::put(self.per_block_distribution);
}
}
Expand Down
4 changes: 2 additions & 2 deletions zrml/prediction-markets/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ pub struct DeployPoolArgs {
}

thread_local! {
pub static DEPLOY_POOL_CALL_DATA: RefCell<Vec<DeployPoolArgs>> = RefCell::new(vec![]);
pub static DEPLOY_POOL_RETURN_VALUE: RefCell<DispatchResult> = RefCell::new(Ok(()));
pub static DEPLOY_POOL_CALL_DATA: RefCell<Vec<DeployPoolArgs>> = const { RefCell::new(vec![]) };
pub static DEPLOY_POOL_RETURN_VALUE: RefCell<DispatchResult> = const { RefCell::new(Ok(())) };
}

#[allow(unused)]
Expand Down
Loading
Loading