Skip to content

Commit

Permalink
Merge branch 'mkl-update-toolchain' into mkl-fix-workflows-combined
Browse files Browse the repository at this point in the history
  • Loading branch information
maltekliemann committed Feb 27, 2024
2 parents 0863c67 + 41643d8 commit 2617851
Show file tree
Hide file tree
Showing 26 changed files with 94 additions and 131 deletions.
4 changes: 2 additions & 2 deletions node/src/benchmarking.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.
//
// This file is part of Zeitgeist.
Expand Down Expand Up @@ -283,7 +283,7 @@ pub fn inherent_benchmark_data() -> Result<InherentData> {
let timestamp = sp_timestamp::InherentDataProvider::new(d.into());

futures::executor::block_on(timestamp.provide_inherent_data(&mut inherent_data))
.map_err(|e| format!("creating inherent data: {:?}", e))?;
.map_err(|e| format!("creating inherent data: {e:?}"))?;

Ok(inherent_data)
}
4 changes: 2 additions & 2 deletions node/src/chain_spec/mod.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 @@ -207,7 +207,7 @@ where

#[cfg(feature = "with-battery-station-runtime")]
fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
TPublic::Pair::from_string(&format!("//{seed}"), None)
.expect("static values are valid; qed")
.public()
}
Expand Down
12 changes: 6 additions & 6 deletions node/src/command.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.
// Copyright 2019-2022 PureStake Inc.
//
Expand Down Expand Up @@ -299,7 +299,7 @@ pub fn run() -> sc_cli::Result<()> {
BlockId::Number(number) => match client.block_hash(number) {
Ok(Some(hash)) => hash,
Ok(None) => return Err("Unknown block".into()),
Err(e) => return Err(format!("Error reading block: {:?}", e).into()),
Err(e) => return Err(format!("Error reading block: {e:?}").into()),
},
};

Expand All @@ -309,7 +309,7 @@ pub fn run() -> sc_cli::Result<()> {
Ok(())
}
Ok(None) => Err("Unknown block".into()),
Err(e) => Err(format!("Error reading block: {:?}", e).into()),
Err(e) => Err(format!("Error reading block: {e:?}").into()),
}
})
}
Expand Down Expand Up @@ -414,7 +414,7 @@ pub fn run() -> sc_cli::Result<()> {
&polkadot_cli,
config.tokio_handle.clone(),
)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
.map_err(|err| format!("Relay chain argument error: {err}"))?;

cmd.run(config, polkadot_config)
})
Expand Down Expand Up @@ -521,13 +521,13 @@ fn none_command(cli: Cli) -> sc_cli::Result<()> {
let state_version = Cli::native_runtime_version(chain_spec).state_version();
let block: zeitgeist_runtime::Block =
cumulus_client_cli::generate_genesis_block(&**chain_spec, state_version)
.map_err(|e| format!("{:?}", e))?;
.map_err(|e| format!("{e:?}"))?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));

let tokio_handle = parachain_config.tokio_handle.clone();
let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
.map_err(|err| format!("Relay chain argument error: {err}"))?;

log::info!("Parachain id: {:?}", parachain_id);
log::info!("Parachain Account: {}", parachain_account);
Expand Down
2 changes: 1 addition & 1 deletion primitives/src/math/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl<F: Fixed + ToString, N: TryFrom<u128>> FromFixedToDecimal<F> for N {
Ordering::Equal => frac_part.to_string(),
};

let mut fixed_decimal: u128 = format!("{}{}", int_part, new_frac_part)
let mut fixed_decimal: u128 = format!("{int_part}{new_frac_part}")
.parse::<u128>()
.map_err(|_| "Failed to parse the fixed decimal representation into u128")?;
if increment_int_part {
Expand Down
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-2023-02-01"
components = ["clippy", "rustfmt", "llvm-tools-preview"]
profile = "minimal"
targets = ["wasm32-unknown-unknown"]
9 changes: 3 additions & 6 deletions zrml/court/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,8 +1068,7 @@ mod pallet {
let (imbalance, missing) = T::Currency::slash(ai, slashable);
debug_assert!(
missing.is_zero(),
"Could not slash all of the amount for juror {:?}.",
ai
"Could not slash all of the amount for juror {ai:?}.",
);
T::Currency::resolve_creating(&reward_pot, imbalance);
};
Expand Down Expand Up @@ -2018,8 +2017,7 @@ mod pallet {
total_imb.subsume(imb);
debug_assert!(
missing.is_zero(),
"Could not slash all of the amount for delegator {:?}.",
delegator
"Could not slash all of the amount for delegator {delegator:?}.",
);
}
total_imb
Expand Down Expand Up @@ -2047,8 +2045,7 @@ mod pallet {
total_incentives.subsume(imb);
debug_assert!(
missing.is_zero(),
"Could not slash all of the amount for juror {:?}.",
juror
"Could not slash all of the amount for juror {juror:?}.",
);

let imb = slash_all_delegators(delegations.as_slice());
Expand Down
6 changes: 3 additions & 3 deletions zrml/global-disputes/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.
//
// This file is part of Zeitgeist.
//
Expand Down Expand Up @@ -733,8 +733,8 @@ mod pallet {
} else {
log::error!(
target: LOG_TARGET,
"There should be always at least one owner for a voting \
outcome. This can also happen if reward is smaller than owners_len."
"There should be always at least one owner for a voting outcome. This can \
also happen if reward is smaller than owners_len."
);
debug_assert!(false);
}
Expand Down
18 changes: 7 additions & 11 deletions zrml/neo-swaps/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ where
complete_set_amount,
));
assert_ok!(NeoSwaps::<T>::join(
RawOrigin::Signed(caller.clone()).into(),
RawOrigin::Signed(caller).into(),
market_id,
pool_shares_amount,
vec![u128::MAX.saturated_into(); pool.assets().len()]
Expand Down Expand Up @@ -334,7 +334,7 @@ mod benchmarks {
let base_asset = Asset::Ztg;
let asset_count = n.try_into().unwrap();
let market_id = create_market_and_deploy_pool::<T>(
alice.clone(),
alice,
base_asset,
asset_count,
_10.saturated_into(),
Expand Down Expand Up @@ -366,7 +366,7 @@ mod benchmarks {
let base_asset = Asset::Ztg;
let asset_count = n.try_into().unwrap();
let market_id = create_market_and_deploy_pool::<T>(
alice.clone(),
alice,
base_asset,
asset_count,
_10.saturated_into(),
Expand Down Expand Up @@ -398,7 +398,7 @@ mod benchmarks {
let base_asset = Asset::Ztg;
let asset_count = n.try_into().unwrap();
let market_id = create_market_and_deploy_pool::<T>(
alice.clone(),
alice,
base_asset,
asset_count,
_10.saturated_into(),
Expand Down Expand Up @@ -436,7 +436,7 @@ mod benchmarks {
let base_asset = Asset::Ztg;
let asset_count = n.try_into().unwrap();
let market_id = create_market_and_deploy_pool::<T>(
alice.clone(),
alice,
base_asset,
asset_count,
_10.saturated_into(),
Expand All @@ -460,12 +460,8 @@ mod benchmarks {
#[benchmark]
fn withdraw_fees() {
let alice: T::AccountId = whitelisted_caller();
let market_id = create_market_and_deploy_pool::<T>(
alice.clone(),
Asset::Ztg,
2u16,
_10.saturated_into(),
);
let market_id =
create_market_and_deploy_pool::<T>(alice, Asset::Ztg, 2u16, _10.saturated_into());
let helper = BenchmarkHelper::<T>::new();
let bob = helper.accounts().next().unwrap();
helper.populate_liquidity_tree_until_full(market_id, bob.clone());
Expand Down
3 changes: 1 addition & 2 deletions zrml/neo-swaps/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)]

use crate as zrml_neo_swaps;
use crate::{consts::*, AssetOf, MarketIdOf};
use crate::{consts::*, AssetOf, BalanceOf, MarketIdOf};
use core::marker::PhantomData;
use frame_support::{
construct_runtime, ord_parameter_types, parameter_types,
Expand Down Expand Up @@ -65,7 +65,6 @@ use zeitgeist_primitives::{
Hash, Index, MarketId, Moment, UncheckedExtrinsicTest,
},
};
use zrml_neo_swaps::BalanceOf;

pub const ALICE: AccountIdTest = 0;
#[allow(unused)]
Expand Down
2 changes: 1 addition & 1 deletion zrml/neo-swaps/src/tests/buy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn buy_works() {
BASE_ASSET,
MarketType::Categorical(2),
liquidity,
spot_prices.clone(),
spot_prices,
swap_fee,
);
let pool = Pools::<Runtime>::get(market_id).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions zrml/neo-swaps/src/tests/liquidity_tree_interactions.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 Down Expand Up @@ -27,7 +27,7 @@ fn withdraw_fees_interacts_correctly_with_join() {
BASE_ASSET,
MarketType::Categorical(category_count),
_10,
spot_prices.clone(),
spot_prices,
CENT,
);

Expand Down
4 changes: 2 additions & 2 deletions zrml/neo-swaps/src/tests/mod.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 Down Expand Up @@ -92,7 +92,7 @@ fn create_market_and_deploy_pool(
RuntimeOrigin::signed(ALICE),
market_id,
amount,
spot_prices.clone(),
spot_prices,
swap_fee,
));
market_id
Expand Down
2 changes: 1 addition & 1 deletion zrml/neo-swaps/src/tests/sell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn sell_works() {
BASE_ASSET,
MarketType::Scalar(0..=1),
liquidity,
spot_prices.clone(),
spot_prices,
swap_fee,
);
let pool = Pools::<Runtime>::get(market_id).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions zrml/orderbook/src/benchmarks.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.
//
// This file is part of Zeitgeist.
Expand Down Expand Up @@ -52,7 +52,7 @@ fn order_common_parameters<T: Config>(
let acc = generate_funded_account::<T>(seed, maker_asset)?;
let maker_amount: BalanceOf<T> = BASE.saturating_mul(1_000).saturated_into();
let taker_amount: BalanceOf<T> = BASE.saturating_mul(1_000).saturated_into();
T::MarketCommons::push_market(market.clone()).unwrap();
T::MarketCommons::push_market(market).unwrap();
let market_id: MarketIdOf<T> = 0u32.into();
Ok((market_id, acc, maker_asset, maker_amount, taker_amount))
}
Expand Down
2 changes: 1 addition & 1 deletion zrml/orderbook/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ mod pallet {
Self::deposit_event(Event::OrderFilled {
order_id,
maker,
taker: taker.clone(),
taker,
filled_maker_amount: taker_fill,
filled_taker_amount: maker_fill,
unfilled_maker_amount: order_data.maker_amount,
Expand Down
2 changes: 1 addition & 1 deletion zrml/orderbook/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ fn place_order_fails_if_market_base_asset_not_present() {
ExtBuilder::default().build().execute_with(|| {
let market_id = 0u128;
let market = market_mock::<Runtime>();
Markets::<Runtime>::insert(market_id, market.clone());
Markets::<Runtime>::insert(market_id, market);

let maker_asset = Asset::CategoricalOutcome(0, 1);
let taker_asset = Asset::CategoricalOutcome(0, 2);
Expand Down
4 changes: 2 additions & 2 deletions zrml/parimutuel/src/benchmarking.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 Down Expand Up @@ -36,7 +36,7 @@ fn setup_market<T: Config>(market_type: MarketType) -> MarketIdOf<T> {
let mut market = market_mock::<T>(market_creator);
market.market_type = market_type;
market.status = MarketStatus::Active;
T::MarketCommons::push_market(market.clone()).unwrap();
T::MarketCommons::push_market(market).unwrap();
market_id
}

Expand Down
17 changes: 9 additions & 8 deletions zrml/parimutuel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,16 @@ mod pallet {
if payoff < winning_balance {
log::debug!(
target: LOG_TARGET,
"The payoff in base asset should be greater than or equal to the winning outcome \
balance."
"The payoff in base asset should be greater than or equal to the winning \
outcome balance."
);
debug_assert!(false);
}
if pot_total < payoff {
log::debug!(
target: LOG_TARGET,
"The payoff in base asset should not exceed the total amount of the base asset!"
"The payoff in base asset should not exceed the total amount of the base \
asset!"
);
debug_assert!(false);
}
Expand Down Expand Up @@ -415,7 +416,7 @@ mod pallet {
asset: winning_asset,
withdrawn_asset_balance,
base_asset_payoff,
sender: who.clone(),
sender: who,
});

Ok(())
Expand All @@ -439,9 +440,9 @@ mod pallet {
if refund_asset == winning_asset {
log::debug!(
target: LOG_TARGET,
"Since we were checking the total issuance of the winning asset to be zero, if \
the refund balance is non-zero, then the winning asset can't be the refund \
asset!"
"Since we were checking the total issuance of the winning asset to be zero, \
if the refund balance is non-zero, then the winning asset can't be the \
refund asset!"
);
debug_assert!(false);
}
Expand All @@ -465,7 +466,7 @@ mod pallet {
market_id,
asset: refund_asset,
refunded_balance: refund_balance,
sender: who.clone(),
sender: who,
});

Ok(())
Expand Down
Loading

0 comments on commit 2617851

Please sign in to comment.