Skip to content

Commit 65f2e01

Browse files
authored
Update to RUST-1.81.0 (AcalaNetwork#2814)
* Update to RUST-1.81.0 * update orml * update TARPAULIN_VERSION * update
1 parent d89054f commit 65f2e01

File tree

15 files changed

+36
-45
lines changed

15 files changed

+36
-45
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
env:
21-
TARPAULIN_VERSION: 0.27.3
21+
TARPAULIN_VERSION: 0.31.2
2222
CARGO_INCREMENTAL: 0
2323
jobs:
2424
test:

modules/aggregated-dex/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,8 @@ impl<T: Config> Pallet<T> {
282282
match path {
283283
SwapPath::Dex(dex_path) => {
284284
// calculate the supply amount
285-
let (supply_amount, _) = T::DEX::get_swap_amount(
286-
dex_path,
287-
SwapLimit::ExactTarget(Balance::max_value(), input_amount),
288-
)?;
285+
let (supply_amount, _) =
286+
T::DEX::get_swap_amount(dex_path, SwapLimit::ExactTarget(Balance::MAX, input_amount))?;
289287

290288
input_amount = supply_amount;
291289
}

modules/dex/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,12 +818,10 @@ impl<T: Config> Pallet<T> {
818818
LiquidityPool::<T>::try_mutate(trading_pair, |(pool_0, pool_1)| -> sp_std::result::Result<R, E> {
819819
let old_pool_0 = *pool_0;
820820
let old_pool_1 = *pool_1;
821-
f((pool_0, pool_1)).map(move |result| {
821+
f((pool_0, pool_1)).inspect(move |_result| {
822822
if *pool_0 != old_pool_0 || *pool_1 != old_pool_1 {
823823
T::OnLiquidityPoolUpdated::happened(&(*trading_pair, *pool_0, *pool_1));
824824
}
825-
826-
result
827825
})
828826
})
829827
}

modules/evm/src/runner/stack.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,8 @@ impl<'config> SubstrateStackSubstate<'config> {
469469
let target = self.metadata().target().expect("Storage target is none");
470470
let storage = exited.metadata().storage_meter().used_storage();
471471

472-
self.metadata.swallow_commit(exited.metadata).map_err(|e| {
472+
self.metadata.swallow_commit(exited.metadata).inspect_err(|_e| {
473473
sp_io::storage::rollback_transaction();
474-
e
475474
})?;
476475
self.logs.append(&mut exited.logs);
477476
self.deletes.append(&mut exited.deletes);
@@ -486,9 +485,8 @@ impl<'config> SubstrateStackSubstate<'config> {
486485
pub fn exit_revert(&mut self) -> Result<(), ExitError> {
487486
let mut exited = *self.parent.take().expect("Cannot discard on root substate");
488487
mem::swap(&mut exited, self);
489-
self.metadata.swallow_revert(exited.metadata).map_err(|e| {
488+
self.metadata.swallow_revert(exited.metadata).inspect_err(|_e| {
490489
sp_io::storage::rollback_transaction();
491-
e
492490
})?;
493491

494492
sp_io::storage::rollback_transaction();
@@ -498,9 +496,8 @@ impl<'config> SubstrateStackSubstate<'config> {
498496
pub fn exit_discard(&mut self) -> Result<(), ExitError> {
499497
let mut exited = *self.parent.take().expect("Cannot discard on root substate");
500498
mem::swap(&mut exited, self);
501-
self.metadata.swallow_discard(exited.metadata).map_err(|e| {
499+
self.metadata.swallow_discard(exited.metadata).inspect_err(|_e| {
502500
sp_io::storage::rollback_transaction();
503-
e
504501
})?;
505502

506503
sp_io::storage::rollback_transaction();

modules/evm/src/runner/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet> StackExecu
811811
let mut stream = rlp::RlpStream::new_list(2);
812812
stream.append(&caller);
813813
stream.append(&nonce);
814-
H256::from_slice(Keccak256::digest(&stream.out()).as_slice()).into()
814+
H256::from_slice(Keccak256::digest(stream.out()).as_slice()).into()
815815
}
816816
CreateScheme::Fixed(naddress) => naddress,
817817
};

modules/homa/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ pub mod module {
714714
let mut ledger = maybe_ledger.take().unwrap_or_default();
715715
let old_bonded_amount = ledger.bonded;
716716

717-
f(&mut ledger).map(move |result| {
717+
f(&mut ledger).inspect(move |_result| {
718718
*maybe_ledger = if ledger == Default::default() {
719719
TotalStakingBonded::<T>::mutate(|staking_balance| {
720720
*staking_balance = staking_balance.saturating_sub(old_bonded_amount)
@@ -728,7 +728,6 @@ pub mod module {
728728
});
729729
Some(ledger)
730730
};
731-
result
732731
})
733732
})
734733
}

modules/incentives/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
//!
3333
//! Rewards accumulation:
3434
//! 1. Incentives: periodicly(AccumulatePeriod), accumulate fixed amount according to Incentive.
35-
//! Rewards come from RewardsSource, please transfer enough tokens to RewardsSource before
36-
//! start incentive plan.
35+
//! Rewards come from RewardsSource, please transfer enough tokens to RewardsSource before start
36+
//! incentive plan.
3737
3838
#![cfg_attr(not(feature = "std"), no_std)]
3939
#![allow(clippy::unused_unit)]

modules/loans/src/mock.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ impl ExtBuilder {
277277
}
278278
.assimilate_storage(&mut t)
279279
.unwrap();
280-
t.into()
280+
281+
let mut ext = sp_io::TestExternalities::new(t);
282+
ext.execute_with(|| System::set_block_number(1));
283+
ext
281284
}
282285
}

modules/loans/src/tests.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ fn check_update_loan_underflow_work() {
5757
#[test]
5858
fn adjust_position_should_work() {
5959
ExtBuilder::default().build().execute_with(|| {
60-
System::set_block_number(1);
6160
assert_eq!(Currencies::free_balance(BTC, &ALICE), 1000);
6261

6362
// balance too low
@@ -166,7 +165,6 @@ fn update_loan_should_work() {
166165
#[test]
167166
fn transfer_loan_should_work() {
168167
ExtBuilder::default().build().execute_with(|| {
169-
System::set_block_number(1);
170168
assert_ok!(LoansModule::update_loan(&ALICE, BTC, 400, 500));
171169
assert_ok!(LoansModule::update_loan(&BOB, BTC, 100, 600));
172170
assert_eq!(LoansModule::positions(BTC, &ALICE).debit, 500);
@@ -190,7 +188,6 @@ fn transfer_loan_should_work() {
190188
#[test]
191189
fn confiscate_collateral_and_debit_work() {
192190
ExtBuilder::default().build().execute_with(|| {
193-
System::set_block_number(1);
194191
assert_ok!(LoansModule::update_loan(&BOB, BTC, 5000, 1000));
195192
assert_eq!(Currencies::free_balance(BTC, &LoansModule::account_id()), 0);
196193

0 commit comments

Comments
 (0)