Skip to content

Commit e205664

Browse files
committed
Upgrade to stable2412-2
1 parent 0e41263 commit e205664

File tree

92 files changed

+5491
-3777
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+5491
-3777
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 127 additions & 124 deletions
Large diffs are not rendered by default.

integration-tests/Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ sp-arithmetic.workspace = true
2929
frame-system.workspace = true
3030
frame-support.workspace = true
3131
pallet-balances.workspace = true
32-
sp-std.workspace = true
3332
sp-core.workspace = true
33+
sp-keyring.workspace = true
3434
sp-runtime.workspace = true
3535
sp-io.workspace = true
3636
pallet-dispenser.workspace = true
@@ -78,7 +78,7 @@ pallet-aura.workspace = true
7878
pallet-session.workspace = true
7979
pallet-proxy-bonding.workspace = true
8080
pallet-skip-feeless-payment.workspace = true
81-
xcm-fee-payment-runtime-api.workspace = true
81+
xcm-runtime-apis.workspace = true
8282
hex-literal.workspace = true
8383
hex.workspace = true
8484
assets-common.workspace = true
@@ -145,10 +145,11 @@ std = [
145145
"sp-core/std",
146146
"sp-io/std",
147147
"sp-runtime/std",
148-
"sp-std/std",
148+
"rococo-runtime-constants/std",
149+
"rococo-runtime/std",
149150
"xcm-builder/std",
150151
"xcm-executor/std",
151-
"xcm-fee-payment-runtime-api/std",
152+
"xcm-runtime-apis/std",
152153
"xcm/std",
153154
]
154155
development-settings = [ "polimec-runtime/development-settings" ]
@@ -190,5 +191,7 @@ runtime-benchmarks = [
190191
"sp-runtime/runtime-benchmarks",
191192
"xcm-builder/runtime-benchmarks",
192193
"xcm-executor/runtime-benchmarks",
193-
"xcm-fee-payment-runtime-api/runtime-benchmarks",
194+
"xcm-runtime-apis/runtime-benchmarks",
195+
"assets-common/runtime-benchmarks",
196+
"pallet-transaction-payment/runtime-benchmarks"
194197
]
File renamed without changes.

integration-tests/src/constants.rs

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ use sp_arithmetic::{FixedU128, Percent};
2727
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
2828
use sp_consensus_babe::AuthorityId as BabeId;
2929
use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId;
30-
use sp_core::{sr25519, storage::Storage, Pair, Public};
30+
use sp_core::{crypto::get_public_from_string_or_panic, sr25519, storage::Storage};
3131
use sp_runtime::{bounded_vec, BuildStorage, Perbill};
3232
pub use xcm;
33-
use xcm_emulator::{helpers::get_account_id_from_seed, Chain, Parachain};
33+
use xcm_emulator::{Chain, Parachain};
3434

3535
pub const XCM_V2: u32 = 3;
3636
pub const XCM_V3: u32 = 2;
@@ -60,11 +60,6 @@ fn polimec_inflation_config() -> polimec_runtime::pallet_parachain_staking::Infl
6060
}
6161
}
6262

63-
/// Helper function to generate a crypto pair from seed
64-
fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
65-
TPublic::Pair::from_string(&format!("//{}", seed), None).expect("static values are valid; qed").public()
66-
}
67-
6863
pub struct Prices {
6964
pub dot: FixedU128,
7065
pub usdc: FixedU128,
@@ -153,20 +148,7 @@ pub mod accounts {
153148
pub const FERDIE_STASH: &str = "Ferdie//stash";
154149

155150
pub fn init_balances() -> Vec<AccountId> {
156-
vec![
157-
get_account_id_from_seed::<sr25519::Public>(ALICE),
158-
get_account_id_from_seed::<sr25519::Public>(BOB),
159-
get_account_id_from_seed::<sr25519::Public>(CHARLIE),
160-
get_account_id_from_seed::<sr25519::Public>(DAVE),
161-
get_account_id_from_seed::<sr25519::Public>(EVE),
162-
get_account_id_from_seed::<sr25519::Public>(FERDIE),
163-
get_account_id_from_seed::<sr25519::Public>(ALICE_STASH),
164-
get_account_id_from_seed::<sr25519::Public>(BOB_STASH),
165-
get_account_id_from_seed::<sr25519::Public>(CHARLIE_STASH),
166-
get_account_id_from_seed::<sr25519::Public>(DAVE_STASH),
167-
get_account_id_from_seed::<sr25519::Public>(EVE_STASH),
168-
get_account_id_from_seed::<sr25519::Public>(FERDIE_STASH),
169-
]
151+
sp_keyring::AccountKeyring::iter().map(|a| a.to_account_id()).collect()
170152
}
171153
}
172154

@@ -175,22 +157,34 @@ pub mod collators {
175157

176158
pub fn invulnerables_asset_hub() -> Vec<(AccountId, AssetHubPolkadotAuraId)> {
177159
vec![
178-
(get_account_id_from_seed::<sr25519::Public>("Alice"), get_from_seed::<AssetHubPolkadotAuraId>("Alice")),
179-
(get_account_id_from_seed::<sr25519::Public>("Bob"), get_from_seed::<AssetHubPolkadotAuraId>("Bob")),
160+
(
161+
sp_keyring::AccountKeyring::Alice.to_account_id(),
162+
get_public_from_string_or_panic::<AssetHubPolkadotAuraId>("Alice"),
163+
),
164+
(
165+
sp_keyring::AccountKeyring::Bob.to_account_id(),
166+
get_public_from_string_or_panic::<AssetHubPolkadotAuraId>("Bob"),
167+
),
180168
]
181169
}
182170

183171
pub fn invulnerables() -> Vec<(AccountId, AuraId)> {
184172
vec![
185-
(get_account_id_from_seed::<sr25519::Public>("Alice"), get_from_seed::<AuraId>("Alice")),
186-
(get_account_id_from_seed::<sr25519::Public>("Bob"), get_from_seed::<AuraId>("Bob")),
173+
(sp_keyring::AccountKeyring::Alice.to_account_id(), get_public_from_string_or_panic::<AuraId>("Alice")),
174+
(sp_keyring::AccountKeyring::Bob.to_account_id(), get_public_from_string_or_panic::<AuraId>("Bob")),
187175
]
188176
}
189177

190178
pub fn initial_authorities() -> Vec<(AccountId, AuraId)> {
191179
vec![
192-
(get_account_id_from_seed::<sr25519::Public>("COLL_1"), get_from_seed::<AuraId>("COLL_1")),
193-
(get_account_id_from_seed::<sr25519::Public>("COLL_2"), get_from_seed::<AuraId>("COLL_2")),
180+
(
181+
get_public_from_string_or_panic::<sr25519::Public>("COLL_1").into(),
182+
get_public_from_string_or_panic::<AuraId>("COLL_1"),
183+
),
184+
(
185+
get_public_from_string_or_panic::<sr25519::Public>("COLL_2").into(),
186+
get_public_from_string_or_panic::<AuraId>("COLL_2"),
187+
),
194188
]
195189
}
196190
}
@@ -212,15 +206,15 @@ pub mod validators {
212206
)> {
213207
let seed = "Alice";
214208
vec![(
215-
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", seed)),
216-
get_account_id_from_seed::<sr25519::Public>(seed),
217-
get_from_seed::<BabeId>(seed),
218-
get_from_seed::<GrandpaId>(seed),
219-
get_from_seed::<ImOnlineId>(seed),
220-
get_from_seed::<ValidatorId>(seed),
221-
get_from_seed::<AssignmentId>(seed),
222-
get_from_seed::<AuthorityDiscoveryId>(seed),
223-
get_from_seed::<BeefyId>(seed),
209+
sp_keyring::AccountKeyring::AliceStash.to_account_id(),
210+
sp_keyring::AccountKeyring::Alice.to_account_id(),
211+
get_public_from_string_or_panic::<BabeId>(seed),
212+
get_public_from_string_or_panic::<GrandpaId>(seed),
213+
get_public_from_string_or_panic::<ImOnlineId>(seed),
214+
get_public_from_string_or_panic::<ValidatorId>(seed),
215+
get_public_from_string_or_panic::<AssignmentId>(seed),
216+
get_public_from_string_or_panic::<AuthorityDiscoveryId>(seed),
217+
get_public_from_string_or_panic::<BeefyId>(seed),
224218
)]
225219
}
226220
}
@@ -282,6 +276,7 @@ pub mod polkadot {
282276
)
283277
})
284278
.collect::<Vec<_>>(),
279+
..Default::default()
285280
},
286281
babe: rococo_runtime::BabeConfig {
287282
authorities: Default::default(),
@@ -301,7 +296,7 @@ pub mod polimec {
301296
use super::*;
302297
use crate::{PolimecNet, PolimecOrigin, PolimecRuntime};
303298
use polimec_runtime::{BlockchainOperationTreasury, TreasuryAccount};
304-
use xcm::v4::{Location, Parent};
299+
use xcm::v5::{Location, Parent};
305300
use xcm_emulator::TestExt;
306301

307302
pub const PARA_ID: u32 = 3344;
@@ -393,6 +388,7 @@ pub mod polimec {
393388
(eth_asset_id, "Local ETH".as_bytes().to_vec(), "ETH".as_bytes().to_vec(), 18),
394389
],
395390
accounts: vec![],
391+
next_asset_id: None,
396392
},
397393
parachain_info: polimec_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into(), ..Default::default() },
398394
session: polimec_runtime::SessionConfig {
@@ -406,6 +402,7 @@ pub mod polimec {
406402
)
407403
})
408404
.collect(),
405+
..Default::default()
409406
},
410407
aura: Default::default(),
411408
aura_ext: Default::default(),

integration-tests/src/tests/credentials.rs

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

1717
use crate::*;
18-
use frame_support::{assert_ok, dispatch::GetDispatchInfo, traits::tokens::currency::VestingSchedule};
18+
use frame_support::{
19+
assert_ok, dispatch::GetDispatchInfo, pallet_prelude::TransactionSource, traits::tokens::currency::VestingSchedule,
20+
};
21+
use pallet_asset_tx_payment::Val;
22+
use pallet_skip_feeless_payment::Intermediate;
1923
use polimec_common::credentials::{Did, InvestorType};
2024
use polimec_common_test_utils::{get_fake_jwt, get_mock_jwt_with_cid, get_test_jwt};
2125
use polimec_runtime::PLMC;
22-
use sp_runtime::{generic::Era, traits::SignedExtension, AccountId32, DispatchError};
26+
use sp_runtime::{
27+
generic::Era,
28+
traits::{TransactionExtension, TxBaseImplication},
29+
AccountId32, DispatchError,
30+
};
2331
use tests::defaults::*;
2432

2533
#[test]
@@ -64,7 +72,7 @@ fn dispenser_signed_extensions_pass_for_new_account() {
6472
let jwt = get_test_jwt(who.clone(), InvestorType::Retail);
6573
let free_call = PolimecCall::Dispenser(pallet_dispenser::Call::dispense { jwt: jwt.clone() });
6674
let paid_call = PolimecCall::System(frame_system::Call::remark { remark: vec![69, 69] });
67-
let extra: polimec_runtime::SignedExtra = (
75+
let extra: polimec_runtime::TxExtension = (
6876
frame_system::CheckNonZeroSender::<PolimecRuntime>::new(),
6977
frame_system::CheckSpecVersion::<PolimecRuntime>::new(),
7078
frame_system::CheckTxVersion::<PolimecRuntime>::new(),
@@ -76,15 +84,57 @@ fn dispenser_signed_extensions_pass_for_new_account() {
7684
PolimecRuntime,
7785
pallet_asset_tx_payment::ChargeAssetTxPayment<PolimecRuntime>,
7886
>::from(pallet_asset_tx_payment::ChargeAssetTxPayment::<PolimecRuntime>::from(0u64.into(), None)),
79-
frame_metadata_hash_extension::CheckMetadataHash::<PolimecRuntime>::new(true),
87+
frame_metadata_hash_extension::CheckMetadataHash::<PolimecRuntime>::new_with_custom_hash([0u8; 32]),
8088
);
8189

8290
// `InitialPayment` struct from pallet_asset_tx_payment doesn't implement Debug and PartialEq to compare to a specific Error or use assert_ok!
83-
assert!(extra.validate(&who, &paid_call, &paid_call.get_dispatch_info(), 0).is_err());
84-
assert!(extra.clone().pre_dispatch(&who, &paid_call, &paid_call.get_dispatch_info(), 0).is_err());
91+
assert!(extra
92+
.validate(
93+
polimec_runtime::RuntimeOrigin::signed(who.clone()),
94+
&paid_call,
95+
&paid_call.get_dispatch_info(),
96+
0,
97+
extra.implicit().unwrap(),
98+
&TxBaseImplication(()),
99+
TransactionSource::External
100+
)
101+
.is_err());
102+
assert!(extra
103+
.clone()
104+
.prepare(
105+
(
106+
(),
107+
(),
108+
(),
109+
(),
110+
(),
111+
pallet_dispenser::extensions::Val::CheckNonce((who.clone(), 0)),
112+
0,
113+
Intermediate::Apply(Val::Charge { tip: 0, who: who.clone(), fee: 0 }),
114+
(),
115+
),
116+
&polimec_runtime::RuntimeOrigin::signed(who.clone()),
117+
&paid_call,
118+
&paid_call.get_dispatch_info(),
119+
0
120+
)
121+
.is_err());
122+
123+
let val = extra
124+
.validate(
125+
polimec_runtime::RuntimeOrigin::signed(who.clone()),
126+
&free_call,
127+
&free_call.get_dispatch_info(),
128+
0,
129+
extra.implicit().unwrap(),
130+
&TxBaseImplication(()),
131+
TransactionSource::External,
132+
)
133+
.unwrap();
85134

86-
assert!(extra.validate(&who, &free_call, &free_call.get_dispatch_info(), 0).is_ok());
87-
assert!(extra.pre_dispatch(&who, &free_call, &free_call.get_dispatch_info(), 0).is_ok());
135+
assert!(extra
136+
.prepare(val.1, &polimec_runtime::RuntimeOrigin::signed(who), &free_call, &free_call.get_dispatch_info(), 0)
137+
.is_ok());
88138
});
89139
}
90140

integration-tests/src/tests/evaluator_slash_sideffects.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use polimec_common::USD_UNIT;
99
use polimec_runtime::PLMC;
1010
use sp_arithmetic::Perquintill;
1111
use sp_runtime::{FixedU128, MultiAddress::Id};
12-
use xcm::v4::Junction;
12+
use xcm::v5::Junction;
1313

1414
generate_accounts!(STASH, ALICE, BOB, CHARLIE, DAVE, ISSUER);
1515

0 commit comments

Comments
 (0)