Skip to content

Commit f0e46be

Browse files
Transform scalar markets from integer to fixed point numbers (#838)
* Remove previous migrations * Migrate scalar markets to fixed point numbers * Fix clippy issues * Remove debug info * Apply suggestions from code review Co-authored-by: Chralt <chralt.developer@gmail.com> * Add note about scalar market transformation to docs * Add explicit test for `range.start() != range.end()` * Make noop test clearer * Migrate `zrml_authorized` * Remove comments * Remove EOL from info string * Revert unnecessary change & clean up * Migrate votes in court * Fix info string * Add additional tests * Fix migration benchmarks Co-authored-by: Chralt <chralt.developer@gmail.com> * Fix the count of reads on `Votes` Co-authored-by: Chralt <chralt.developer@gmail.com>
1 parent fa3dbaa commit f0e46be

File tree

7 files changed

+390
-543
lines changed

7 files changed

+390
-543
lines changed

docs/changelog_for_devs.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# v0.3.7
22

3+
- Transformed integer scalar markets to fixed point with ten digits after the
4+
decimal point. As soon as this update is deployed, the interpretation of the
5+
scalar values must be changed.
36
- `reject_market` extrinsic now requires `reject_reason` parameter which is
47
`Vec<u8>`. The config constant `MaxRejectReasonLen` defines maximum length of
58
above parameter. `MarketRejected` event also contains `reject_reason` so that

runtime/common/src/lib.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,7 @@ macro_rules! decl_common_types {
5858
frame_system::ChainContext<Runtime>,
5959
Runtime,
6060
AllPalletsWithSystem,
61-
(
62-
pallet_author_mapping::migrations::AddKeysToRegistrationInfo<Runtime>,
63-
pallet_author_mapping::migrations::AddAccountIdToNimbusLookup<Runtime>,
64-
pallet_parachain_staking::migrations::SplitDelegatorStateIntoDelegationScheduledRequests<Runtime>,
65-
zrml_prediction_markets::migrations::UpdateMarketsForDeadlines<Runtime>,
66-
zrml_prediction_markets::migrations::MigrateMarketIdsPerBlockStorage<Runtime>,
67-
)
61+
zrml_prediction_markets::migrations::TransformScalarMarketsToFixedPoint<Runtime>,
6862
>;
6963

7064
#[cfg(not(feature = "parachain"))]
@@ -74,10 +68,7 @@ macro_rules! decl_common_types {
7468
frame_system::ChainContext<Runtime>,
7569
Runtime,
7670
AllPalletsWithSystem,
77-
(
78-
zrml_prediction_markets::migrations::UpdateMarketsForDeadlines<Runtime>,
79-
zrml_prediction_markets::migrations::MigrateMarketIdsPerBlockStorage<Runtime>,
80-
)
71+
zrml_prediction_markets::migrations::TransformScalarMarketsToFixedPoint<Runtime>,
8172
>;
8273

8374
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;

zrml/authorized/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mod pallet {
5050
use zrml_market_commons::MarketCommonsPalletApi;
5151

5252
/// The current storage version.
53-
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
53+
const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
5454

5555
pub(crate) type BalanceOf<T> =
5656
<CurrencyOf<T> as Currency<<T as frame_system::Config>::AccountId>>::Balance;

zrml/court/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ mod pallet {
7373
const INITIAL_JURORS_NUM: usize = 3;
7474
const MAX_RANDOM_JURORS: usize = 13;
7575
/// The current storage version.
76-
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
76+
const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
7777
// Weight used to increase the number of jurors for subsequent disputes
7878
// of the same market
7979
const SUBSEQUENT_JURORS_FACTOR: usize = 2;

zrml/market-commons/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mod pallet {
4848
use zeitgeist_primitives::types::{Market, PoolId};
4949

5050
/// The current storage version.
51-
const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
51+
const STORAGE_VERSION: StorageVersion = StorageVersion::new(3);
5252

5353
pub type MomentOf<T> = <<T as Config>::Timestamp as frame_support::traits::Time>::Moment;
5454

zrml/prediction-markets/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ mod pallet {
6767
use zrml_market_commons::MarketCommonsPalletApi;
6868

6969
/// The current storage version.
70-
const STORAGE_VERSION: StorageVersion = StorageVersion::new(5);
70+
const STORAGE_VERSION: StorageVersion = StorageVersion::new(6);
7171

7272
pub(crate) type BalanceOf<T> = <<T as Config>::AssetManager as MultiCurrency<
7373
<T as frame_system::Config>::AccountId,

0 commit comments

Comments
 (0)