Skip to content

Commit fbeff8e

Browse files
authored
🚑️ Fix corrupted Linear Release entries (#465)
## What? During a [previous runtime upgrade](https://github.com/Polimec/polimec-node/pull/383/files#diff-bbe1a30f3b7ec00a084641777c8b3da45df415b120b4e205d016c625a77284a0), we simplified the `RuntimeHoldReason`, but we forgot to migrate the `LinearRelease:Vesting` keys to reflect this change. ### Reasoning I tried to `translate` the current entries, but the types were conflicting. Then I started to `drain` the entries and add the new ones, but since I was operating on the same storage I had few non deterministic results. Since we only have 15 entries, I decided to perform a simple migration that removes the current corrupted entries, and create new ones, with the right key. ### Testing Tested via `chopsticks` and via the `try-runtime-cli` ### New Migration: * Implemented a new migration for the Linear Release `Vesting` in `runtimes/polimec/src/custom_migrations/linear_release.rs`. (`runtimes/polimec/src/custom_migrations/linear_release.rs` - [runtimes/polimec/src/custom_migrations/linear_release.rsR1-R110](diffhunk://#diff-c47feabf076eb45e19f973367310bbee30b1b6c39cec965f9a22c5bb0cdb6d0cR1-R110)) * Included the new migration script in the `mod.rs` and `lib.rs` files of the `polimec` runtime. (`runtimes/polimec/src/custom_migrations/mod.rs` - [[1]](diffhunk://#diff-63e5609b322bad6be8ef1b127b8161c52602cff85ab9cf67f6b5ac03be68fc3aR21) `runtimes/polimec/src/lib.rs` - [[2]](diffhunk://#diff-fa44a5ad015c5d189a690374b9164d3a58b7218228b56c151327dd62d143ee1bR178) ### Dependency Updates: * Updated `jwt-compact` and `substrate-fixed` dependencies in `Cargo.toml` to use specific versions instead of git references. (`Cargo.toml` - [Cargo.tomlL76-R84](diffhunk://#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542L76-R84)) ### Integration Tests Configuration: * Added new entries to the `std` array in `integration-tests/Cargo.toml`. (`integration-tests/Cargo.toml` - [integration-tests/Cargo.tomlR152](diffhunk://#diff-ca620c1799a0fbfe846664793344b0d95a4f906636d2fbf307bff69f6ec81849R152)) * Added `.gitignore` and `package.json` files to the `integration-tests/chopsticks/.papi/descriptors` directory. (`integration-tests/chopsticks/.papi/descriptors/.gitignore` - [[1]](diffhunk://#diff-690eb99abc62e8194923cf1778d83fd7d93265fb81da24befdadf202d2136e92R1-R3) `integration-tests/chopsticks/.papi/descriptors/package.json` - [[2]](diffhunk://#diff-6d0112b7a63eb37cb4615006d54aca7b3aabf27e34cb439624e11b66c2a751b8R1-R24) * Added a new `polkadot-api.json` configuration file for integration tests. (`integration-tests/chopsticks/.papi/polkadot-api.json` - [integration-tests/chopsticks/.papi/polkadot-api.jsonR1-R24](diffhunk://#diff-960b223eb17890451aebb5ad607cd709f7bd8ec42023cb94d48e006ad6234ef8R1-R24))
2 parents 22f81ae + 400b6bb commit fbeff8e

File tree

18 files changed

+291
-17
lines changed

18 files changed

+291
-17
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ genesis-wasm
2222
fly.toml
2323
bin/
2424
integration-tests/chopsticks/db/*
25-
/integration-tests/chopsticks/node_modules/*
26-
/integration-tests/chopsticks/.papi/*
25+
integration-tests/chopsticks/node_modules/*
26+
integration-tests/chopsticks/.papi/descriptors/*

Cargo.lock

+102-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ macros-tests = { path = "macros/tests" }
7373
# External pallets (with default disabled)
7474
orml-oracle = { version = "0.13.0", default-features = false }
7575
orml-traits = { version = "0.13.0", default-features = false }
76-
jwt-compact = { git = "https://github.com/lrazovic/jwt-compact", default-features = false }
76+
jwt-compact = { version = "0.9.0-beta.0", package = "jwt-compact-frame", default-features = false }
7777

7878
# Internal support (with default disabled)
7979
shared-configuration = { path = "runtimes/shared-configuration", default-features = false }
8080
polimec-common = { path = "polimec-common/common", default-features = false }
8181
polimec-common-test-utils = { path = "polimec-common/test-utils", default-features = false }
8282

8383
# External support (with default disabled)
84-
substrate-fixed = { git = "https://github.com/encointer/substrate-fixed", default-features = false }
84+
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 }
@@ -247,4 +247,4 @@ cumulus-pallet-session-benchmarking = { version = "16.0.0", default-features = f
247247
# Runtimes
248248
polimec-runtime = { path = "runtimes/polimec" }
249249
rococo-runtime-constants = { version = "14.0.0" }
250-
rococo-runtime = { version = "14.0.0" }
250+
rococo-runtime = { version = "14.0.0" }

integration-tests/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ std = [
149149
"xcm-executor/std",
150150
"xcm-fee-payment-runtime-api/std",
151151
"xcm/std",
152+
"assets-common/std"
152153
]
153154
development-settings = [ "polimec-runtime/development-settings" ]
154155
runtime-benchmarks = [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!.gitignore
3+
!package.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": "0.1.0-autogenerated.16545816865329173211",
3+
"name": "@polkadot-api/descriptors",
4+
"files": [
5+
"dist"
6+
],
7+
"exports": {
8+
".": {
9+
"types": "./dist/index.d.ts",
10+
"module": "./dist/index.mjs",
11+
"import": "./dist/index.mjs",
12+
"require": "./dist/index.js"
13+
},
14+
"./package.json": "./package.json"
15+
},
16+
"main": "./dist/index.js",
17+
"module": "./dist/index.mjs",
18+
"browser": "./dist/index.mjs",
19+
"types": "./dist/index.d.ts",
20+
"sideEffects": false,
21+
"peerDependencies": {
22+
"polkadot-api": "*"
23+
}
24+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": 0,
3+
"descriptorPath": ".papi/descriptors",
4+
"entries": {
5+
"polkadot": {
6+
"wsUrl": "wss://rpc.ibp.network/polkadot",
7+
"metadata": ".papi/metadata/polkadot.scale",
8+
"genesis": "0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3"
9+
},
10+
"bridge": {
11+
"wsUrl": "wss://sys.ibp.network/bridgehub-polkadot",
12+
"metadata": ".papi/metadata/bridge.scale",
13+
"genesis": "0xdcf691b5a3fbe24adc99ddc959c0561b973e329b1aef4c4b22e7bb2ddecb4464"
14+
},
15+
"pah": {
16+
"wsUrl": "wss://sys.ibp.network/statemint",
17+
"metadata": ".papi/metadata/pah.scale",
18+
"genesis": "0x68d56f15f85d3136970ec16946040bc1752654e906147f7e43e9d539d7c3de2f"
19+
},
20+
"polimec": {
21+
"metadata": ".papi/metadata/polimec.scale"
22+
}
23+
}
24+
}

nodes/parachain/Cargo.toml

+15
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,18 @@ try-runtime = [
103103
]
104104
on-chain-release-build = [ "polimec-runtime/on-chain-release-build" ]
105105
development-settings = [ "polimec-runtime/development-settings" ]
106+
std = [
107+
"cumulus-primitives-core/std",
108+
"frame-benchmarking/std",
109+
"log/std",
110+
"pallet-funding/std",
111+
"polimec-common/std",
112+
"polkadot-primitives/std",
113+
"serde/std",
114+
"sp-api/std",
115+
"sp-block-builder/std",
116+
"sp-consensus-aura/std",
117+
"sp-core/std",
118+
"sp-runtime/std",
119+
"xcm/std"
120+
]

pallets/funding/src/mock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ use sp_runtime::{
4747
use sp_std::collections::btree_map::BTreeMap;
4848
use std::{cell::RefCell, marker::PhantomData};
4949
use system::EnsureSigned;
50-
use xcm::v4::PalletInfo as XcmPalletInfo;
5150
use xcm_builder::{ParentIsPreset, SiblingParachainConvertsVia};
5251
use xcm_executor::traits::XcmAssetTransfers;
5352

@@ -153,7 +152,6 @@ parameter_types! {
153152
pub const MetadataDepositBase: Balance = free_deposit();
154153
pub const MetadataDepositPerByte: Balance = free_deposit();
155154
pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT;
156-
157155
}
158156

159157
impl pallet_assets::Config<ContributionTokensInstance> for TestRuntime {
@@ -236,6 +234,7 @@ impl system::Config for TestRuntime {
236234
parameter_types! {
237235
pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
238236
}
237+
239238
impl pallet_balances::Config for TestRuntime {
240239
type AccountStore = System;
241240
type Balance = Balance;
@@ -285,6 +284,7 @@ parameter_types! {
285284
pub const MinVestedTransfer: u64 = 256 * 2;
286285
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
287286
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
287+
}
288288

289289
#[cfg(feature = "runtime-benchmarks")]
290290
parameter_types! {

pallets/linear-release/src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ pub mod pallet {
123123
/// Overarching hold reason.
124124
type RuntimeHoldReason: Parameter + MaxEncodedLen + Copy;
125125

126-
type Currency: InspectHold<AccountIdOf<Self>, Balance = BalanceOf<Self>>
127-
+ MutateHold<AccountIdOf<Self>, Balance = BalanceOf<Self>, Reason = Self::RuntimeHoldReason>
128-
+ BalancedHold<AccountIdOf<Self>, Balance = BalanceOf<Self>>
126+
type Currency: MutateHold<AccountIdOf<Self>, Balance = BalanceOf<Self>, Reason = Self::RuntimeHoldReason>
127+
+ BalancedHold<AccountIdOf<Self>, Balance = BalanceOf<Self>, Reason = Self::RuntimeHoldReason>
129128
+ Mutate<AccountIdOf<Self>, Balance = BalanceOf<Self>>;
130129

131130
/// Convert the block number into a balance.

pallets/proxy-bonding/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ std = [
4646
"serde/std",
4747
"sp-io/std",
4848
"sp-runtime/std",
49+
"xcm/std"
4950
]
5051

5152
try-runtime = [

0 commit comments

Comments
 (0)