Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit ec40eff

Browse files
author
parity-processbot
committed
Merge remote-tracking branch 'origin/master' into at/contract-env
2 parents 107db5c + 30998d1 commit ec40eff

File tree

14 files changed

+97
-65
lines changed

14 files changed

+97
-65
lines changed

Cargo.lock

Lines changed: 62 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frame/asset-conversion/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ pub mod pallet {
147147

148148
/// Type that identifies either the native currency or a token class from `Assets`.
149149
/// `Ord` is added because of `get_pool_id`.
150+
///
151+
/// The pool's `AccountId` is derived from this type. Any changes to the type may
152+
/// necessitate a migration.
150153
type MultiAssetId: AssetId + Ord + From<Self::AssetId>;
151154

152155
/// Type to convert an `AssetId` into `MultiAssetId`.
@@ -1193,7 +1196,9 @@ pub mod pallet {
11931196
()
11941197
);
11951198
} else {
1196-
let MultiAssetIdConversionResult::Converted(asset_id) = T::MultiAssetIdConverter::try_convert(asset) else {
1199+
let MultiAssetIdConversionResult::Converted(asset_id) =
1200+
T::MultiAssetIdConverter::try_convert(asset)
1201+
else {
11971202
return Err(())
11981203
};
11991204
let minimal = T::Assets::minimum_balance(asset_id);

frame/asset-conversion/src/tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ fn pool_assets() -> Vec<u32> {
6666

6767
fn create_tokens(owner: u128, tokens: Vec<NativeOrAssetId<u32>>) {
6868
for token_id in tokens {
69-
let MultiAssetIdConversionResult::Converted(asset_id) = NativeOrAssetIdConverter::try_convert(&token_id) else { unreachable!("invalid token") };
69+
let MultiAssetIdConversionResult::Converted(asset_id) =
70+
NativeOrAssetIdConverter::try_convert(&token_id)
71+
else {
72+
unreachable!("invalid token")
73+
};
7074
assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, owner, false, 1));
7175
}
7276
}

frame/asset-conversion/src/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ use codec::{Decode, Encode, MaxEncodedLen};
2121
use scale_info::TypeInfo;
2222
use sp_std::{cmp::Ordering, marker::PhantomData};
2323

24+
/// Pool ID.
25+
///
26+
/// The pool's `AccountId` is derived from this type. Any changes to the type may necessitate a
27+
/// migration.
2428
pub(super) type PoolIdOf<T> = (<T as Config>::MultiAssetId, <T as Config>::MultiAssetId);
2529

2630
/// Stores the lp_token asset id a particular pool has been assigned.

frame/nfts/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ pub mod pallet {
662662
///
663663
/// The origin must be Signed and the sender must have sufficient funds free.
664664
///
665-
/// `ItemDeposit` funds of sender are reserved.
665+
/// `CollectionDeposit` funds of sender are reserved.
666666
///
667667
/// Parameters:
668668
/// - `admin`: The admin of this collection. The admin is the initial address of each
@@ -844,6 +844,7 @@ pub mod pallet {
844844
MintType::HolderOf(collection_id) => {
845845
let MintWitness { owned_item, .. } =
846846
witness_data.clone().ok_or(Error::<T, I>::WitnessRequired)?;
847+
let owned_item = owned_item.ok_or(Error::<T, I>::BadWitness)?;
847848

848849
let owns_item = Account::<T, I>::contains_key((
849850
&caller,

frame/nfts/src/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ fn mint_should_work() {
427427
1,
428428
42,
429429
account(2),
430-
Some(MintWitness { owned_item: 42, ..Default::default() })
430+
Some(MintWitness { owned_item: Some(42), ..Default::default() })
431431
),
432432
Error::<Test>::BadWitness
433433
);
@@ -436,7 +436,7 @@ fn mint_should_work() {
436436
1,
437437
42,
438438
account(2),
439-
Some(MintWitness { owned_item: 43, ..Default::default() })
439+
Some(MintWitness { owned_item: Some(43), ..Default::default() })
440440
));
441441

442442
// can't mint twice
@@ -446,7 +446,7 @@ fn mint_should_work() {
446446
1,
447447
46,
448448
account(2),
449-
Some(MintWitness { owned_item: 43, ..Default::default() })
449+
Some(MintWitness { owned_item: Some(43), ..Default::default() })
450450
),
451451
Error::<Test>::AlreadyClaimed
452452
);

frame/nfts/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<AccountId, DepositBalance> CollectionDetails<AccountId, DepositBalance> {
133133
#[derive(Clone, Encode, Decode, Default, Eq, PartialEq, RuntimeDebug, TypeInfo)]
134134
pub struct MintWitness<ItemId, Balance> {
135135
/// Provide the id of the item in a required collection.
136-
pub owned_item: ItemId,
136+
pub owned_item: Option<ItemId>,
137137
/// The price specified in mint settings.
138138
pub mint_price: Option<Balance>,
139139
}

frame/support/procedural/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ proc-macro = true
1717
[dependencies]
1818
derive-syn-parse = "0.1.5"
1919
Inflector = "0.11.4"
20-
cfg-expr = "0.15.1"
20+
cfg-expr = "0.15.4"
2121
itertools = "0.10.3"
2222
proc-macro2 = "1.0.56"
2323
quote = "1.0.28"

frame/support/src/traits/hooks.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ impl OnRuntimeUpgrade for Tuple {
164164
/// that occur.
165165
#[cfg(feature = "try-runtime")]
166166
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, TryRuntimeError> {
167-
let mut weight = Weight::zero();
167+
let mut cumulative_weight = Weight::zero();
168168

169169
let mut errors = Vec::new();
170170

171171
for_tuples!(#(
172172
match Tuple::try_on_runtime_upgrade(checks) {
173-
Ok(weight) => { weight.saturating_add(weight); },
173+
Ok(weight) => { cumulative_weight.saturating_accrue(weight); },
174174
Err(err) => { errors.push(err); },
175175
}
176176
)*);
@@ -194,7 +194,7 @@ impl OnRuntimeUpgrade for Tuple {
194194
return Err("Detected multiple errors while executing `try_on_runtime_upgrade`, check the logs!".into())
195195
}
196196

197-
Ok(weight)
197+
Ok(cumulative_weight)
198198
}
199199

200200
/// [`OnRuntimeUpgrade::pre_upgrade`] should not be used on a tuple.

primitives/io/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ tracing = { version = "0.1.29", default-features = false }
3333
tracing-core = { version = "0.1.28", default-features = false}
3434

3535
# Required for backwards compatibility reason, but only used for verifying when `UseDalekExt` is set.
36-
ed25519-dalek = { version = "1.0.1", default-features = false, optional = true }
37-
# Force the usage of ed25519, this is being used in `ed25519-dalek`.
38-
ed25519 = { version = "1.5.2", optional = true }
36+
ed25519-dalek = { version = "2.0.0", default-features = false, optional = true }
3937

4038
[build-dependencies]
4139
rustversion = "1.0.6"
@@ -58,7 +56,6 @@ std = [
5856
"tracing-core/std",
5957
"log",
6058
"ed25519-dalek",
61-
"ed25519",
6259
"sp-keystore/std"
6360
]
6461

0 commit comments

Comments
 (0)