Skip to content

Commit be3bbd9

Browse files
committed
fix: correct the migrations
1 parent cd5c5d0 commit be3bbd9

File tree

27 files changed

+318
-281
lines changed

27 files changed

+318
-281
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ codegen-units = 1
5151

5252
[workspace.dependencies]
5353
# Build deps
54-
substrate-wasm-builder = { version = "25.0.0" }
54+
substrate-wasm-builder = { version = "25.0.1" }
5555

5656
# Internal pallets (with default disabled)
5757
pallet-dispenser = { path = "pallets/dispenser", default-features = false }
@@ -85,28 +85,28 @@ substrate-fixed = { version = "0.5.9", default-features = false }
8585

8686
# External (without extra features and with default disabled if necessary)
8787
parity-scale-codec = { version = "3.6.12", default-features = false }
88-
clap = { version = "4.5.3" }
88+
clap = { version = "4.5.13" }
8989
futures = { version = "0.3.31" }
90-
scale-info = { version = "2.11.3", default-features = false, features = [
90+
scale-info = { version = "2.11.1", default-features = false, features = [
9191
"derive",
9292
] }
9393
jsonrpsee = { version = "0.24.3", features = ["server"] }
9494
hex-literal = "0.4.1"
9595
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
96-
serde = { version = "1.0.204", default-features = false }
97-
serde_json = "1.0.120"
98-
smallvec = "1.13.2"
96+
serde = { version = "1.0.214", default-features = false }
97+
serde_json = "1.0.132"
98+
smallvec = "1.11.0"
9999
log = { version = "0.4.22", default-features = false }
100100
itertools = { version = "0.11", default-features = false, features = [
101101
"use_alloc",
102102
] }
103-
array-bytes = { version = "6.2.3", default-features = false }
103+
array-bytes = { version = "6.2.2", default-features = false }
104104
serde-json-core = { version = '0.5.1', default-features = false }
105105
heapless = { version = "0.8", default-features = false }
106-
color-print = "0.3.6"
106+
color-print = "0.3.4"
107107
k256 = { version = "0.13.4", default-features = false, features = ["ecdsa"] }
108108
variant_count = "1.1.0"
109-
parking_lot = "0.12.1"
109+
parking_lot = { version = "0.12.1", default-features = false }
110110

111111
# Emulations
112112
xcm-emulator = { version = "0.17.1", default-features = false }
@@ -125,11 +125,10 @@ frame-metadata-hash-extension = { version = "0.7.0", default-features = false }
125125
sp-api = { version = "35.0.0", default-features = false }
126126
sp-debug-derive = { version = "14.0.0", default-features = false }
127127
sp-staking = { version = "37.0.0", default-features = false }
128-
# sp-runtime v38.0.1 takes out core from runtime_string file and calls "alloc" directly which errors out
129128
sp-runtime = { version = "40.1.0", default-features = false }
130129
sp-arithmetic = { version = "26.0.0", default-features = false }
131130
sp-core = { version = "35.0.0", default-features = false, features = ["serde"] }
132-
sp-io = { version = "39.0.0", default-features = false }
131+
sp-io = { version = "39.0.1", default-features = false }
133132
sp-storage = { version = "22.0.0", default-features = false }
134133
sp-blockchain = { version = "38.0.0", default-features = false }
135134
sp-consensus-aura = { version = "0.41.0", default-features = false }
@@ -153,7 +152,7 @@ sp-weights = { version = "31.0.0", default-features = false }
153152
sp-application-crypto = { version = "39.0.0", default-features = false }
154153

155154
# FRAME
156-
assets-common = { version = "0.19.0", default-features = false }
155+
assets-common = { version = "0.19.1", default-features = false }
157156
pallet-aura = { version = "38.1.0", default-features = false }
158157
pallet-balances = { version = "40.1.0", default-features = false }
159158
pallet-assets = { version = "41.1.0", default-features = false }
@@ -168,7 +167,7 @@ pallet-transaction-payment-rpc-runtime-api = { version = "39.0.0", default-featu
168167
pallet-treasury = { version = "38.1.0", default-features = false }
169168
pallet-utility = { version = "39.1.0", default-features = false }
170169
pallet-membership = { version = "39.0.0", default-features = false }
171-
pallet-multisig = { version = "39.1.0", default-features = false }
170+
pallet-multisig = { version = "39.1.1", default-features = false }
172171
pallet-preimage = { version = "39.1.0", default-features = false }
173172
pallet-grandpa = { version = "39.1.0", default-features = false }
174173
pallet-transaction-payment-rpc = { version = "42.0.0", default-features = false }
@@ -184,12 +183,12 @@ pallet-collator-selection = { version = "20.1.0", default-features = false }
184183
polkadot-parachain-primitives = { version = "15.0.0", default-features = false }
185184
polkadot-runtime-parachains = { version = "18.1.0", default-features = false }
186185
polkadot-core-primitives = { version = "16.0.0", default-features = false }
187-
xcm = { version = "15.0.2", package = 'staging-xcm', default-features = false }
188-
xcm-builder = { version = "18.1.0", package = 'staging-xcm-builder', default-features = false }
186+
xcm = { version = "15.0.3", package = 'staging-xcm', default-features = false }
187+
xcm-builder = { version = "18.2.0", package = 'staging-xcm-builder', default-features = false }
189188
xcm-executor = { version = "18.0.2", package = 'staging-xcm-executor', default-features = false }
190189
polkadot-runtime-common = { version = "18.1.0", default-features = false }
191190
polkadot-primitives = { version = "17.1.0", default-features = false }
192-
xcm-runtime-apis = { version = "0.5.1", default-features = false }
191+
xcm-runtime-apis = { version = "0.5.2", default-features = false }
193192

194193
# Cumulus (with default disabled)
195194
cumulus-pallet-aura-ext = { version = "0.18.0", default-features = false }
@@ -229,7 +228,6 @@ sc-executor = { version = "0.41.0" }
229228
sc-keystore = { version = "34.0.0" }
230229
sp-consensus = { version = "0.41.0" }
231230
sp-keyring = { version = "40.0.0" }
232-
sc-rpc = { version = "43.0.0" }
233231
sc-service = { version = "0.49.0" }
234232
sc-sysinfo = { version = "41.0.0" }
235233
sc-telemetry = { version = "28.0.0" }

integration-tests/Cargo.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ default = [ "development-settings", "instant-mode", "std" ]
9393
instant-mode = [ "polimec-runtime/instant-mode" ]
9494
std = [
9595
"assets-common/std",
96+
"cumulus-pallet-parachain-system/std",
9697
"cumulus-pallet-xcm/std",
9798
"cumulus-primitives-core/std",
9899
"frame-metadata-hash-extension/std",
@@ -146,17 +147,15 @@ std = [
146147
"sp-core/std",
147148
"sp-io/std",
148149
"sp-runtime/std",
149-
"rococo-runtime-constants/std",
150-
"rococo-runtime/std",
151150
"xcm-builder/std",
152151
"xcm-executor/std",
153152
"xcm-runtime-apis/std",
154153
"xcm/std",
155-
"cumulus-pallet-parachain-system/std"
156154
]
157155
development-settings = [ "polimec-runtime/development-settings" ]
158156
runtime-benchmarks = [
159157
"assets-common/runtime-benchmarks",
158+
"cumulus-pallet-parachain-system/runtime-benchmarks",
160159
"cumulus-primitives-core/runtime-benchmarks",
161160
"frame-support/runtime-benchmarks",
162161
"frame-system/runtime-benchmarks",
@@ -178,6 +177,7 @@ runtime-benchmarks = [
178177
"pallet-scheduler/runtime-benchmarks",
179178
"pallet-skip-feeless-payment/runtime-benchmarks",
180179
"pallet-staking/runtime-benchmarks",
180+
"pallet-transaction-payment/runtime-benchmarks",
181181
"pallet-treasury/runtime-benchmarks",
182182
"pallet-vesting/runtime-benchmarks",
183183
"pallet-xcm/runtime-benchmarks",
@@ -194,7 +194,4 @@ runtime-benchmarks = [
194194
"xcm-builder/runtime-benchmarks",
195195
"xcm-executor/runtime-benchmarks",
196196
"xcm-runtime-apis/runtime-benchmarks",
197-
"assets-common/runtime-benchmarks",
198-
"pallet-transaction-payment/runtime-benchmarks",
199-
"cumulus-pallet-parachain-system/runtime-benchmarks"
200197
]

integration-tests/src/constants.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ use sp_runtime::{bounded_vec, BuildStorage, Perbill};
3232
pub use xcm;
3333
use xcm_emulator::{Chain, Parachain};
3434

35-
pub const XCM_V2: u32 = 3;
36-
pub const XCM_V3: u32 = 2;
3735
pub const REF_TIME_THRESHOLD: u64 = 33;
3836
pub const PROOF_SIZE_THRESHOLD: u64 = 33;
3937
pub const INITIAL_DEPOSIT: u128 = 420_0_000_000_000;

nodes/parachain/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ sc-consensus.workspace = true
4242
sc-offchain.workspace = true
4343
sc-executor.workspace = true
4444
sc-network.workspace = true
45-
sc-rpc.workspace = true
4645
sc-service.workspace = true
4746
sc-sysinfo.workspace = true
4847
sc-telemetry.workspace = true
@@ -96,15 +95,13 @@ runtime-benchmarks = [
9695
"polkadot-primitives/runtime-benchmarks",
9796
"sc-service/runtime-benchmarks",
9897
"sp-runtime/runtime-benchmarks",
99-
"polimec-common/runtime-benchmarks"
10098
]
10199
try-runtime = [
102100
"pallet-funding/try-runtime",
103101
"polimec-common/try-runtime",
104102
"polimec-runtime/try-runtime",
105103
"polkadot-cli/try-runtime",
106104
"sp-runtime/try-runtime",
107-
"polimec-common/try-runtime"
108105
]
109106
on-chain-release-build = [ "polimec-runtime/on-chain-release-build" ]
110107
development-settings = [ "polimec-runtime/development-settings" ]

nodes/parachain/src/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ fn start_consensus(
228228
relay_chain_slot_duration,
229229
proposer,
230230
collator_service,
231-
authoring_duration: Duration::from_millis(500),
231+
authoring_duration: Duration::from_millis(2000),
232232
reinitialize: false,
233233
};
234234

pallets/funding/Cargo.toml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ frame-system.workspace = true
3333
sp-runtime.workspace = true
3434
sp-arithmetic.workspace = true
3535
polimec-common.workspace = true
36-
parachains-common.workspace = true
3736
sp-core.workspace = true
3837
pallet-balances.workspace = true
3938
xcm.workspace = true
@@ -64,6 +63,8 @@ xcm-executor.workspace = true
6463
[features]
6564
default = [ "sp-core/serde", "std" ]
6665
std = [
66+
"cumulus-pallet-parachain-system/std",
67+
"cumulus-primitives-core/std",
6768
"frame-benchmarking?/std",
6869
"frame-support/std",
6970
"frame-system/std",
@@ -77,7 +78,6 @@ std = [
7778
"pallet-linear-release/std",
7879
"pallet-proxy-bonding/std",
7980
"pallet-timestamp/std",
80-
"parachains-common/std",
8181
"parity-scale-codec/std",
8282
"polimec-common-test-utils",
8383
"polimec-common-test-utils/std",
@@ -94,10 +94,10 @@ std = [
9494
"xcm-builder/std",
9595
"xcm-executor/std",
9696
"xcm/std",
97-
"cumulus-pallet-parachain-system/std",
98-
"cumulus-primitives-core/std"
9997
]
10098
runtime-benchmarks = [
99+
"cumulus-pallet-parachain-system/runtime-benchmarks",
100+
"cumulus-primitives-core/runtime-benchmarks",
101101
"frame-benchmarking/runtime-benchmarks",
102102
"frame-support/runtime-benchmarks",
103103
"frame-system/runtime-benchmarks",
@@ -108,18 +108,16 @@ runtime-benchmarks = [
108108
"pallet-linear-release/runtime-benchmarks",
109109
"pallet-proxy-bonding/runtime-benchmarks",
110110
"pallet-timestamp/runtime-benchmarks",
111-
"parachains-common/runtime-benchmarks",
112111
"polimec-common-test-utils",
113112
"polimec-common-test-utils?/runtime-benchmarks",
114113
"polimec-common/runtime-benchmarks",
115114
"polkadot-parachain-primitives/runtime-benchmarks",
116115
"sp-runtime/runtime-benchmarks",
117116
"xcm-builder/runtime-benchmarks",
118117
"xcm-executor/runtime-benchmarks",
119-
"cumulus-pallet-parachain-system/runtime-benchmarks",
120-
"cumulus-primitives-core/runtime-benchmarks"
121118
]
122119
try-runtime = [
120+
"cumulus-pallet-parachain-system/try-runtime",
123121
"frame-support/try-runtime",
124122
"frame-system/try-runtime",
125123
"pallet-assets/try-runtime",
@@ -130,6 +128,5 @@ try-runtime = [
130128
"polimec-common-test-utils?/try-runtime",
131129
"polimec-common/try-runtime",
132130
"sp-runtime/try-runtime",
133-
"cumulus-pallet-parachain-system/try-runtime"
134131
]
135132
on-chain-release-build = []

pallets/funding/src/migrations/vesting_info.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ mod tests {
106106
mock::{new_test_ext, TestRuntime as Test},
107107
UserMigrations,
108108
};
109+
use frame_support::weights::RuntimeDbWeight;
109110
use polimec_common::migration_types::MigrationOrigin;
110111
use v7::{UncheckedMigrationToV7, MAX_PARTICIPATIONS_PER_USER};
111112
use xcm::v4::Junction;
@@ -136,13 +137,17 @@ mod tests {
136137
let weight = UncheckedMigrationToV7::<Test>::on_runtime_upgrade();
137138
assert_eq!(UserMigrations::<Test>::iter().count(), 1);
138139

139-
for (_, (_, migrations)) in UserMigrations::<Test>::iter() {
140-
for (i, migration) in migrations.iter().enumerate() {
141-
assert_eq!(migration.info.vesting_time, i as u64 * 2);
142-
}
140+
let (_, (_, post_migrations)) = UserMigrations::<Test>::iter().next().unwrap();
141+
assert_eq!(post_migrations.len() as u32, MAX_PARTICIPATIONS_PER_USER); // Verify count matches test items
142+
for (i, migration) in post_migrations.iter().enumerate() {
143+
// Original vesting_time was `i`, expected is `i * 2`
144+
assert_eq!(migration.info.vesting_time, i as u64 * 2, "Vesting time mismatch at index {}", i);
143145
}
144-
145-
assert!(weight.is_zero());
146+
let db_weight: RuntimeDbWeight = <Test as frame_system::Config>::DbWeight::get();
147+
// Weight is based on the number of *individual migration entries* processed
148+
let expected_weight =
149+
db_weight.reads_writes(MAX_PARTICIPATIONS_PER_USER as u64, MAX_PARTICIPATIONS_PER_USER as u64);
150+
assert_eq!(weight, expected_weight, "Weight should match items processed");
146151
});
147152
}
148153
}

pallets/funding/src/tests/misc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ mod helper_functions {
135135
// logic of small functions that extrinsics use to process data or interact with storage
136136
mod inner_functions {
137137
use super::*;
138+
use polimec_common::DAYS;
138139

139140
#[test]
140141
fn calculate_vesting_duration() {

pallets/funding/src/tests/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use frame_support::{
1919
};
2020
use itertools::Itertools;
2121
use pallet_balances::AccountData;
22-
use parachains_common::DAYS;
2322
use polimec_common::{
2423
assets::{
2524
AcceptedFundingAsset,

0 commit comments

Comments
 (0)