Skip to content

Commit 8f0893a

Browse files
zjb0807xlc
andauthored
Bump rust 1.88.0 (#2909)
* update RUST 1.88.0 * fix --------- Co-authored-by: Xiliang Chen <[email protected]>
1 parent f51f175 commit 8f0893a

File tree

37 files changed

+171
-331
lines changed

37 files changed

+171
-331
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ jobs:
134134
with:
135135
node-version: 18.x
136136
- name: Install deps
137-
run: cargo +1.88.0 install staging-chain-spec-builder --force # base64ct 1.8.0 requires the Cargo feature called `edition2024`
137+
run: cargo install staging-chain-spec-builder --force
138138
- name: Run ts tests
139139
run: |
140140
npm install -g yarn
141-
make test-ts
141+
# TODO: update bodhi & enable this
142+
# make test-ts

evm-tests

modules/asset-registry/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ where
572572
if let Some(asset_metadata) = Pallet::<T>::asset_metadatas(AssetIds::ForeignAssetId(foreign_asset_id)) {
573573
let minimum_balance = asset_metadata.minimal_balance.into();
574574
let rate = FixedU128::saturating_from_rational(minimum_balance, T::Currency::minimum_balance().into());
575-
log::debug!(target: "asset-registry::weight", "ForeignAsset: {}, MinimumBalance: {}, rate:{:?}", foreign_asset_id, minimum_balance, rate);
575+
log::debug!(target: "asset-registry::weight", "ForeignAsset: {foreign_asset_id}, MinimumBalance: {minimum_balance}, rate: {rate:?}");
576576
return Some(rate);
577577
}
578578
}
@@ -596,7 +596,7 @@ where
596596
let minimum_balance = asset_metadata.minimal_balance.into();
597597
let rate =
598598
FixedU128::saturating_from_rational(minimum_balance, T::Currency::minimum_balance().into());
599-
log::debug!(target: "asset-registry::weight", "LiquidCrowdloan: {}, MinimumBalance: {}, rate:{:?}", lease, minimum_balance, rate);
599+
log::debug!(target: "asset-registry::weight", "LiquidCrowdloan: {lease}, MinimumBalance: {minimum_balance}, rate: {rate:?}");
600600
Some(rate)
601601
} else {
602602
None
@@ -621,7 +621,7 @@ where
621621
let minimum_balance = asset_metadata.minimal_balance.into();
622622
let rate =
623623
FixedU128::saturating_from_rational(minimum_balance, T::Currency::minimum_balance().into());
624-
log::debug!(target: "asset-registry::weight", "StableAsset: {}, MinimumBalance: {}, rate:{:?}", pool_id, minimum_balance, rate);
624+
log::debug!(target: "asset-registry::weight", "StableAsset: {pool_id}, MinimumBalance: {minimum_balance}, rate: {rate:?}");
625625
Some(rate)
626626
} else {
627627
None
@@ -646,7 +646,7 @@ where
646646
let minimum_balance = asset_metadata.minimal_balance.into();
647647
let rate =
648648
FixedU128::saturating_from_rational(minimum_balance, T::Currency::minimum_balance().into());
649-
log::debug!(target: "asset-registry::weight", "Erc20: {}, MinimumBalance: {}, rate:{:?}", address, minimum_balance, rate);
649+
log::debug!(target: "asset-registry::weight", "Erc20: {address}, MinimumBalance: {minimum_balance}, rate: {rate:?}");
650650
Some(rate)
651651
} else {
652652
None

modules/auction-manager/src/lib.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,12 @@ pub mod module {
268268
if let Err(e) = Self::_offchain_worker() {
269269
log::info!(
270270
target: "auction-manager",
271-
"offchain worker: cannot run offchain worker at {:?}: {:?}",
272-
now, e,
271+
"offchain worker: cannot run offchain worker at {now:?}: {e:?}",
273272
);
274273
} else {
275274
log::debug!(
276275
target: "auction-manager",
277-
"offchain worker: offchain worker start at block: {:?} already done!",
278-
now,
276+
"offchain worker: offchain worker start at block: {now:?} already done!",
279277
);
280278
}
281279
}
@@ -342,8 +340,7 @@ impl<T: Config> Pallet<T> {
342340
if let Err(err) = SubmitTransaction::<T, Call<T>>::submit_transaction(xt) {
343341
log::info!(
344342
target: "auction-manager",
345-
"offchain worker: submit unsigned auction cancel tx for AuctionId {:?} failed: {:?}",
346-
auction_id, err,
343+
"offchain worker: submit unsigned auction cancel tx for AuctionId {auction_id:?} failed: {err:?}",
347344
);
348345
}
349346
}
@@ -368,8 +365,7 @@ impl<T: Config> Pallet<T> {
368365

369366
log::debug!(
370367
target: "auction-manager",
371-
"offchain worker: max iterations is {:?}",
372-
max_iterations
368+
"offchain worker: max iterations is {max_iterations:?}",
373369
);
374370

375371
// start iterations to cancel collateral auctions
@@ -696,9 +692,9 @@ impl<T: Config> Pallet<T> {
696692
if let Err(e) = res {
697693
log::warn!(
698694
target: "auction-manager",
699-
"issue_debit: failed to issue stable {:?} to {:?}: {:?}. \
695+
"issue_debit: failed to issue stable {:?} to {bidder:?}: {e:?}. \
700696
This is unexpected but should be safe",
701-
collateral_auction.payment_amount(bid_price), bidder, e
697+
collateral_auction.payment_amount(bid_price)
702698
);
703699
debug_assert!(false);
704700
}
@@ -714,9 +710,8 @@ impl<T: Config> Pallet<T> {
714710
if let Err(e) = res {
715711
log::warn!(
716712
target: "auction-manager",
717-
"withdraw_collateral: failed to withdraw {:?} {:?} from CDP treasury to {:?}: {:?}. \
713+
"withdraw_collateral: failed to withdraw {refund_collateral:?} {collateral_type:?} from CDP treasury to {refund_recipient:?}: {e:?}. \
718714
This is unexpected but should be safe",
719-
refund_collateral, collateral_type, refund_recipient, e
720715
);
721716
debug_assert!(false);
722717
}

modules/cdp-engine/src/lib.rs

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#![cfg_attr(not(feature = "std"), no_std)]
2828
#![allow(clippy::unused_unit)]
2929
#![allow(clippy::upper_case_acronyms)]
30+
#![allow(clippy::useless_conversion)]
3031

3132
use frame_support::{
3233
pallet_prelude::*, traits::ExistenceRequirement, traits::UnixTime, transactional, BoundedVec, PalletId,
@@ -420,15 +421,12 @@ pub mod module {
420421
if let Err(e) = Self::_offchain_worker() {
421422
log::info!(
422423
target: "cdp-engine offchain worker",
423-
"cannot run offchain worker at {:?}: {:?}",
424-
now,
425-
e,
424+
"cannot run offchain worker at {now:?}: {e:?}",
426425
);
427426
} else {
428427
log::debug!(
429428
target: "cdp-engine offchain worker",
430-
"offchain worker start at block: {:?} already done!",
431-
now,
429+
"offchain worker start at block: {now:?} already done!",
432430
);
433431
}
434432
}
@@ -651,9 +649,8 @@ impl<T: Config> Pallet<T> {
651649
Err(e) => {
652650
log::warn!(
653651
target: "cdp-engine",
654-
"on_system_surplus: failed to on system surplus {:?}: {:?}. \
652+
"on_system_surplus: failed to on system surplus {issued_stable_coin_balance:?}: {e:?}. \
655653
This is unexpected but should be safe",
656-
issued_stable_coin_balance, e
657654
);
658655
}
659656
}
@@ -678,8 +675,7 @@ impl<T: Config> Pallet<T> {
678675
if SubmitTransaction::<T, Call<T>>::submit_transaction(xt).is_err() {
679676
log::info!(
680677
target: "cdp-engine offchain worker",
681-
"submit unsigned liquidation tx for \nCDP - AccountId {:?} CurrencyId {:?} \nfailed!",
682-
who, currency_id,
678+
"submit unsigned liquidation tx for \nCDP - AccountId {who:?} CurrencyId {currency_id:?} \nfailed!",
683679
);
684680
}
685681
}
@@ -694,8 +690,7 @@ impl<T: Config> Pallet<T> {
694690
if SubmitTransaction::<T, Call<T>>::submit_transaction(xt).is_err() {
695691
log::info!(
696692
target: "cdp-engine offchain worker",
697-
"submit unsigned settlement tx for \nCDP - AccountId {:?} CurrencyId {:?} \nfailed!",
698-
who, currency_id,
693+
"submit unsigned settlement tx for \nCDP - AccountId {who:?} CurrencyId {currency_id:?} \nfailed!",
699694
);
700695
}
701696
}
@@ -739,9 +734,7 @@ impl<T: Config> Pallet<T> {
739734
None => {
740735
log::debug!(
741736
target: "cdp-engine offchain worker",
742-
"collateral_currency was removed, need to reset the offchain worker: collateral_position is {:?}, collateral_currency_ids: {:?}",
743-
collateral_position,
744-
collateral_currency_ids
737+
"collateral_currency was removed, need to reset the offchain worker: collateral_position is {collateral_position:?}, collateral_currency_ids: {collateral_currency_ids:?}",
745738
);
746739
to_be_continue.set(&(0, Option::<Vec<u8>>::None));
747740
return Ok(());
@@ -786,13 +779,7 @@ impl<T: Config> Pallet<T> {
786779
let iteration_end_time = sp_io::offchain::timestamp();
787780
log::debug!(
788781
target: "cdp-engine offchain worker",
789-
"iteration info:\n max iterations is {:?}\n currency id: {:?}, start key: {:?}, iterate count: {:?}\n iteration start at: {:?}, end at: {:?}, execution time: {:?}\n",
790-
max_iterations,
791-
currency_id,
792-
start_key,
793-
iteration_count,
794-
iteration_start_time,
795-
iteration_end_time,
782+
"iteration info:\n max iterations is {max_iterations:?}\n currency id: {currency_id:?}, start key: {start_key:?}, iterate count: {iteration_count:?}\n iteration start at: {iteration_start_time:?}, end at: {iteration_end_time:?}, execution time: {:?}\n",
796783
iteration_end_time.diff(&iteration_start_time)
797784
);
798785

@@ -1467,9 +1454,8 @@ impl<T: Config> LiquidateCollateral<T::AccountId> for LiquidateViaContracts<T> {
14671454
log::error!(
14681455
target: "cdp-engine",
14691456
"LiquidateViaContracts: transfer collateral to contract failed. \
1470-
Collateral: {:?}, amount: {:?} contract: {:?}, error: {:?}. \
1457+
Collateral: {currency_id:?}, amount: {collateral_supply:?} contract: {contract:?}, error: {e:?}. \
14711458
This is unexpected, need extra action.",
1472-
currency_id, collateral_supply, contract, e,
14731459
);
14741460
} else {
14751461
// notify liquidation success
@@ -1494,9 +1480,8 @@ impl<T: Config> LiquidateCollateral<T::AccountId> for LiquidateViaContracts<T> {
14941480
log::error!(
14951481
target: "cdp-engine",
14961482
"LiquidateViaContracts: refund rest collateral to CDP owner failed. \
1497-
Collateral: {:?}, amount: {:?} error: {:?}. \
1483+
Collateral: {currency_id:?}, amount: {refund_collateral_amount:?} error: {e:?}. \
14981484
This is unexpected, need extra action.",
1499-
currency_id, refund_collateral_amount, e,
15001485
);
15011486
}
15021487
}

modules/cdp-treasury/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#![cfg_attr(not(feature = "std"), no_std)]
2929
#![allow(clippy::unused_unit)]
3030
#![allow(clippy::needless_range_loop)]
31+
#![allow(clippy::useless_conversion)]
3132

3233
use frame_support::{pallet_prelude::*, traits::ExistenceRequirement, transactional, PalletId};
3334
use frame_system::pallet_prelude::*;
@@ -338,8 +339,7 @@ impl<T: Config> Pallet<T> {
338339
Err(e) => {
339340
log::warn!(
340341
target: "cdp-treasury",
341-
"get_swap_supply_amount: Attempt to burn surplus {:?} failed: {:?}, this is unexpected but should be safe",
342-
offset_amount, e
342+
"get_swap_supply_amount: Attempt to burn surplus {offset_amount:?} failed: {e:?}, this is unexpected but should be safe",
343343
);
344344
}
345345
}

modules/collator-selection/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#![allow(clippy::into_iter_on_ref)]
6262
#![allow(clippy::try_err)]
6363
#![allow(clippy::let_and_return)]
64+
#![allow(clippy::useless_conversion)]
6465

6566
pub use pallet::*;
6667

@@ -551,8 +552,8 @@ pub mod pallet {
551552
if let Err(why) = outcome {
552553
log::warn!(
553554
target: "collator-selection",
554-
"Failed to remove candidate {:?}", why);
555-
debug_assert!(false, "failed to remove candidate {:?}", why);
555+
"Failed to remove candidate {why:?}");
556+
debug_assert!(false, "failed to remove candidate {why:?}");
556557
} else {
557558
<NonCandidates<T>>::insert(
558559
who,

modules/evm-utility/macro/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ pub fn generate_function_selector(_: TokenStream, input: TokenStream) -> TokenSt
4747
attrs: Default::default(),
4848
}));
4949
} else {
50-
panic!("Not method string: `{:?}`", lit);
50+
panic!("Not method string: `{lit:?}`");
5151
}
5252
} else {
53-
panic!("Not enum: `{:?}`", variant);
53+
panic!("Not enum: `{variant:?}`");
5454
}
5555
}
5656

modules/evm/src/lib.rs

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#![allow(clippy::or_fun_call)]
2222
#![allow(clippy::unused_unit)]
2323
#![allow(clippy::upper_case_acronyms)]
24+
#![allow(clippy::useless_conversion)]
2425

2526
pub use crate::runner::{
2627
stack::SubstrateStackState,
@@ -445,8 +446,7 @@ pub mod module {
445446

446447
assert!(
447448
reason.is_succeed(),
448-
"Genesis contract failed to execute, error: {:?}",
449-
reason
449+
"Genesis contract failed to execute, error: {reason:?}",
450450
);
451451

452452
let out = runtime.machine().return_value();
@@ -1323,8 +1323,8 @@ pub mod module {
13231323
} else {
13241324
log::debug!(
13251325
target: "evm",
1326-
"batch_call failed: [from: {:?}, contract: {:?}, exit_reason: {:?}, output: {:?}, logs: {:?}, used_gas: {:?}]",
1327-
source, target, info.exit_reason, info.value, info.logs, used_gas
1326+
"batch_call failed: [from: {source:?}, contract: {target:?}, exit_reason: {:?}, output: {:?}, logs: {:?}, used_gas: {used_gas:?}]",
1327+
info.exit_reason, info.value, info.logs
13281328
);
13291329
Err(DispatchErrorWithPostInfo {
13301330
post_info: PostDispatchInfo {
@@ -1370,9 +1370,8 @@ impl<T: Config> Pallet<T> {
13701370
return false;
13711371
}
13721372

1373-
Self::accounts(address).map_or(true, |account_info| {
1374-
account_info.contract_info.is_none() && account_info.nonce.is_zero()
1375-
})
1373+
Self::accounts(address)
1374+
.is_none_or(|account_info| account_info.contract_info.is_none() && account_info.nonce.is_zero())
13761375
}
13771376

13781377
/// Remove an account if its empty.
@@ -1460,8 +1459,7 @@ impl<T: Config> Pallet<T> {
14601459
// so this should never happen
14611460
log::warn!(
14621461
target: "evm",
1463-
"remove_account: removed account {:?} while is still linked to contract info",
1464-
address
1462+
"remove_account: removed account {address:?} while is still linked to contract info",
14651463
);
14661464
debug_assert!(false, "removed account while is still linked to contract info");
14671465
}
@@ -1812,8 +1810,7 @@ impl<T: Config> Pallet<T> {
18121810

18131811
log::debug!(
18141812
target: "evm",
1815-
"reserve_storage: [from: {:?}, account: {:?}, limit: {:?}, amount: {:?}]",
1816-
caller, user, limit, amount
1813+
"reserve_storage: [from: {caller:?}, account: {user:?}, limit: {limit:?}, amount: {amount:?}]",
18171814
);
18181815

18191816
T::ChargeTransactionPayment::reserve_fee(&user, amount, Some(RESERVE_ID_STORAGE_DEPOSIT))?;
@@ -1832,8 +1829,7 @@ impl<T: Config> Pallet<T> {
18321829

18331830
log::debug!(
18341831
target: "evm",
1835-
"unreserve_storage: [from: {:?}, account: {:?}, used: {:?}, refunded: {:?}, unused: {:?}, amount: {:?}]",
1836-
caller, user, used, refunded, unused, amount
1832+
"unreserve_storage: [from: {caller:?}, account: {user:?}, used: {used:?}, refunded: {refunded:?}, unused: {unused:?}, amount: {amount:?}]",
18371833
);
18381834

18391835
// should always be able to unreserve the amount
@@ -1854,8 +1850,7 @@ impl<T: Config> Pallet<T> {
18541850

18551851
log::debug!(
18561852
target: "evm",
1857-
"charge_storage: [from: {:?}, account: {:?}, contract: {:?}, contract_acc: {:?}, storage: {:?}, amount: {:?}]",
1858-
caller, user, contract, contract_acc, storage, amount
1853+
"charge_storage: [from: {caller:?}, account: {user:?}, contract: {contract:?}, contract_acc: {contract_acc:?}, storage: {storage:?}, amount: {amount:?}]",
18591854
);
18601855

18611856
if storage.is_positive() {
@@ -1893,8 +1888,7 @@ impl<T: Config> Pallet<T> {
18931888

18941889
log::debug!(
18951890
target: "evm",
1896-
"refund_storage: [from: {:?}, account: {:?}, contract: {:?}, contract_acc: {:?}, maintainer: {:?}, maintainer_acc: {:?}, amount: {:?}]",
1897-
caller, user, contract, contract_acc, maintainer, maintainer_acc, amount
1891+
"refund_storage: [from: {caller:?}, account: {user:?}, contract: {contract:?}, contract_acc: {contract_acc:?}, maintainer: {maintainer:?}, maintainer_acc: {maintainer_acc:?}, amount: {amount:?}]",
18981892
);
18991893

19001894
// user can't be a dead account
@@ -2272,8 +2266,7 @@ impl<T: Config> DispatchableTask for EvmTask<T> {
22722266
);
22732267
log::debug!(
22742268
target: "evm",
2275-
"EvmTask remove: [from: {:?}, contract: {:?}, maintainer: {:?}, count: {:?}]",
2276-
caller, contract, maintainer, count
2269+
"EvmTask remove: [from: {caller:?}, contract: {contract:?}, maintainer: {maintainer:?}, count: {count:?}]",
22772270
);
22782271
if r.maybe_cursor.is_none() {
22792272
// AllRemoved
@@ -2282,8 +2275,7 @@ impl<T: Config> DispatchableTask for EvmTask<T> {
22822275
debug_assert!(result.is_ok());
22832276
log::debug!(
22842277
target: "evm",
2285-
"EvmTask refund_storage: [from: {:?}, contract: {:?}, maintainer: {:?}, result: {:?}]",
2286-
caller, contract, maintainer, result
2278+
"EvmTask refund_storage: [from: {caller:?}, contract: {contract:?}, maintainer: {maintainer:?}, result: {result:?}]",
22872279
);
22882280

22892281
// Remove account after all of the storages are cleared.

modules/evm/src/precompiles/modexp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub trait ModexpImpl {
246246
// output of length and value 1.
247247
if bytes.len() as u64 <= mod_len {
248248
let mut ret = Vec::with_capacity(mod_len as usize);
249-
ret.extend(core::iter::repeat(0).take(mod_len as usize - bytes.len()));
249+
ret.extend(core::iter::repeat_n(0, mod_len as usize - bytes.len()));
250250
ret.extend_from_slice(&bytes[..]);
251251
ret.to_vec()
252252
} else {

0 commit comments

Comments
 (0)