Skip to content

Commit

Permalink
chore: upgrade to polkadot 0.9.40
Browse files Browse the repository at this point in the history
  • Loading branch information
sander2 committed May 22, 2023
1 parent 19df9c3 commit 9c61a2d
Show file tree
Hide file tree
Showing 54 changed files with 1,463 additions and 1,381 deletions.
1,912 changes: 989 additions & 923 deletions Cargo.lock

Large diffs are not rendered by default.

446 changes: 224 additions & 222 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions crates/annuity/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ pub mod benchmarks {

// only one account with stake so they get all of the rewards
assert_eq!(T::Currency::free_balance(&caller), rewards_before + balance);

Ok(())
}

#[benchmark]
Expand Down
4 changes: 2 additions & 2 deletions crates/btc-relay/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ where
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<Result<(), DispatchError>> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let at = at.unwrap_or_else(|| self.client.info().best_hash);

api.verify_block_header_inclusion(&at, block_hash)
api.verify_block_header_inclusion(at, block_hash)
.map_err(|e| internal_err(format!("execution error: Unable to dry run extrinsic {:?}", e)))
}
}
1 change: 0 additions & 1 deletion crates/btc-relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ pub mod pallet {
use frame_system::pallet_prelude::*;

#[pallet::pallet]
#[pallet::generate_store(trait Store)]
pub struct Pallet<T>(_);

#[pallet::config]
Expand Down
1 change: 0 additions & 1 deletion crates/clients-info/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub mod pallet {
use frame_system::pallet_prelude::*;

#[pallet::pallet]
#[pallet::generate_store(trait Store)]
pub struct Pallet<T>(_);

#[pallet::config]
Expand Down
1 change: 0 additions & 1 deletion crates/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ pub mod pallet {
}

#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(_);

/// The invulnerable, fixed collators.
Expand Down
22 changes: 18 additions & 4 deletions crates/democracy/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ pub mod benchmarks {
p as usize,
"Proposals not created."
);

Ok(())
}

#[benchmark]
Expand Down Expand Up @@ -117,7 +119,7 @@ pub mod benchmarks {
}

#[benchmark]
pub fn vote_new() {
pub fn vote_new() -> Result<(), BenchmarkError> {
let caller = funded_account::<T>("caller", 0);
let account_vote = account_vote::<T>(100u32.into());

Expand All @@ -141,10 +143,12 @@ pub mod benchmarks {

let Voting { votes, .. } = VotingOf::<T>::get(&caller);
assert_eq!(votes.len(), T::MaxVotes::get() as usize, "Vote was not recorded.");

Ok(())
}

#[benchmark]
pub fn vote_existing() {
pub fn vote_existing() -> Result<(), BenchmarkError> {
let caller = funded_account::<T>("caller", 0);
let account_vote = account_vote::<T>(100u32.into());

Expand Down Expand Up @@ -177,6 +181,8 @@ pub mod benchmarks {
_ => panic!("referendum not ongoing"),
};
assert_eq!(tally.nays, 1000u32.into(), "changed vote was not recorded");

Ok(())
}

#[benchmark]
Expand Down Expand Up @@ -220,6 +226,8 @@ pub mod benchmarks {

#[extrinsic_call]
_(RawOrigin::Signed(proposer), 0);

Ok(())
}

#[benchmark]
Expand All @@ -228,12 +236,13 @@ pub mod benchmarks {

#[extrinsic_call]
_(RawOrigin::Root, ref_index);

Ok(())
}

// This measures the path of `launch_next` public. Not currently used as we simply
// assume the weight is `MaxBlockWeight` when executing.
#[extra]
#[benchmark]
#[benchmark(extra)]
pub fn on_initialize_public(r: Linear<0, 99>) -> Result<(), BenchmarkError> {
for i in 0..r {
add_referendum::<T>(i);
Expand Down Expand Up @@ -262,6 +271,7 @@ pub mod benchmarks {
}
}
}
Ok(())
}

// No launch no maturing referenda.
Expand Down Expand Up @@ -294,6 +304,7 @@ pub mod benchmarks {
}
}
}
Ok(())
}

#[benchmark]
Expand Down Expand Up @@ -327,6 +338,7 @@ pub mod benchmarks {
}
}
}
Ok(())
}

#[benchmark]
Expand All @@ -335,6 +347,7 @@ pub mod benchmarks {

#[extrinsic_call]
_(RawOrigin::Root);
Ok(())
}

#[benchmark]
Expand All @@ -358,6 +371,7 @@ pub mod benchmarks {

let Voting { votes, .. } = VotingOf::<T>::get(&caller);
assert_eq!(votes.len(), (r - 1) as usize, "Vote was not removed");
Ok(())
}

#[benchmark]
Expand Down
5 changes: 2 additions & 3 deletions crates/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ pub mod pallet {
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);

#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(_);

Expand Down Expand Up @@ -365,7 +364,7 @@ pub mod pallet {
fn on_initialize(n: T::BlockNumber) -> Weight {
Self::begin_block(n).unwrap_or_else(|e| {
sp_runtime::print(e);
Weight::from_ref_time(0 as u64)
Weight::from_parts(0 as u64, 0u64)
})
}
}
Expand Down Expand Up @@ -931,7 +930,7 @@ impl<T: Config> Pallet<T> {
/// # </weight>
fn begin_block(now: T::BlockNumber) -> Result<Weight, DispatchError> {
let max_block_weight = T::BlockWeights::get().max_block;
let mut weight = Weight::from_ref_time(0 as u64);
let mut weight = Weight::from_parts(0 as u64, 0u64);

let next = Self::lowest_unbaked();
let last = Self::referendum_count();
Expand Down
20 changes: 10 additions & 10 deletions crates/dex-general/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ where
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<NumberOrHex> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let at = at.unwrap_or_else(|| self.client.info().best_hash);

api.get_amount_in_price(&at, supply, path)
api.get_amount_in_price(at, supply, path)
.map(|price| price.into())
.map_err(runtime_error_into_rpc_err)
}
Expand All @@ -117,9 +117,9 @@ where
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<NumberOrHex> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let at = at.unwrap_or_else(|| self.client.info().best_hash);

api.get_amount_out_price(&at, supply, path)
api.get_amount_out_price(at, supply, path)
.map(|price| price.into())
.map_err(runtime_error_into_rpc_err)
}
Expand All @@ -135,10 +135,10 @@ where
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<NumberOrHex> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let at = at.unwrap_or_else(|| self.client.info().best_hash);

api.get_estimate_lptoken(
&at,
at,
asset_0,
asset_1,
amount_0_desired,
Expand All @@ -157,9 +157,9 @@ where
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<Option<PairInfo<AccountId, NumberOrHex, AssetId>>> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let at = at.unwrap_or_else(|| self.client.info().best_hash);

api.get_pair_by_asset_id(&at, asset_0, asset_1)
api.get_pair_by_asset_id(at, asset_0, asset_1)
.map(|pairs| {
pairs.map(|pair| PairInfo {
asset_0: pair.asset_0,
Expand All @@ -184,9 +184,9 @@ where
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<Option<(AssetBalance, AssetBalance)>> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let at = at.unwrap_or_else(|| self.client.info().best_hash);

api.calculate_remove_liquidity(&at, asset_0, asset_1, amount)
api.calculate_remove_liquidity(at, asset_0, asset_1, amount)
.map_err(runtime_error_into_rpc_err)
}
}
Expand Down
1 change: 0 additions & 1 deletion crates/dex-general/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ pub mod pallet {
}

#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(_);

#[pallet::storage]
Expand Down
Loading

0 comments on commit 9c61a2d

Please sign in to comment.