mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 01:41:03 +00:00
Finish migration to v2 primitives (#5037)
* remove v0 primitives from polkadot-primitives * first pass: remove v0 * fix fallout in erasure-coding * remove v1 primitives, consolidate to v2 * the great import update * update runtime_api_impl_v1 to v2 as well * guide: add `Version` request for runtime API * add version query to runtime API * reintroduce OldV1SessionInfo in a limited way
This commit is contained in:
committed by
GitHub
parent
3394cbb142
commit
49f7e5cce4
@@ -39,7 +39,7 @@ pub fn migrate_to_latest<T: Config>() -> Weight {
|
||||
|
||||
pub mod v1 {
|
||||
use super::*;
|
||||
use primitives::v1::{Balance, SessionIndex};
|
||||
use primitives::v2::{Balance, SessionIndex};
|
||||
|
||||
// Copied over from configuration.rs @ 656dd280f266dc56bd0cf1dbe3ca232960912f34 and removed
|
||||
// all the comments.
|
||||
@@ -246,7 +246,7 @@ mod tests {
|
||||
// doesn't need to be read and also leaving it as one line allows to easily copy it.
|
||||
let raw_config = hex_literal::hex!["0000a000005000000a00000000c8000000c800000a0000000a00000040380000580200000000500000c8000000e87648170000000a00000000000000005039278c0400000000000000000000005039278c0400000000000000000000e8030000009001000a00000000000000009001008070000000000000000000000a0000000a0000000a00000001000000010500000001c8000000060000005802000002000000580200000200000059000000000000001e0000002800000000c817a804000000"];
|
||||
|
||||
let v1 = v1::HostConfiguration::<primitives::v1::BlockNumber>::decode(&mut &raw_config[..])
|
||||
let v1 = v1::HostConfiguration::<primitives::v2::BlockNumber>::decode(&mut &raw_config[..])
|
||||
.unwrap();
|
||||
|
||||
// We check only a sample of the values here. If we missed any fields or messed up data types
|
||||
@@ -270,7 +270,7 @@ mod tests {
|
||||
// We specify only the picked fields and the rest should be provided by the `Default`
|
||||
// implementation. That implementation is copied over between the two types and should work
|
||||
// fine.
|
||||
let v1 = v1::HostConfiguration::<primitives::v1::BlockNumber> {
|
||||
let v1 = v1::HostConfiguration::<primitives::v2::BlockNumber> {
|
||||
ump_max_individual_weight: 0x71616e6f6e0au64,
|
||||
needed_approvals: 69,
|
||||
thread_availability_period: 55,
|
||||
@@ -282,21 +282,21 @@ mod tests {
|
||||
let pending_configs_v1 = vec![
|
||||
(
|
||||
1,
|
||||
v1::HostConfiguration::<primitives::v1::BlockNumber> {
|
||||
v1::HostConfiguration::<primitives::v2::BlockNumber> {
|
||||
n_delay_tranches: 150,
|
||||
..v1.clone()
|
||||
},
|
||||
),
|
||||
(
|
||||
2,
|
||||
v1::HostConfiguration::<primitives::v1::BlockNumber> {
|
||||
v1::HostConfiguration::<primitives::v2::BlockNumber> {
|
||||
max_validators_per_core: Some(33),
|
||||
..v1.clone()
|
||||
},
|
||||
),
|
||||
(
|
||||
3,
|
||||
v1::HostConfiguration::<primitives::v1::BlockNumber> {
|
||||
v1::HostConfiguration::<primitives::v2::BlockNumber> {
|
||||
parathread_retries: 11,
|
||||
..v1.clone()
|
||||
},
|
||||
@@ -337,8 +337,8 @@ mod tests {
|
||||
// The same motivation as for the migration code. See `migrate_to_v2`.
|
||||
#[rustfmt::skip]
|
||||
fn assert_correct_translation(
|
||||
v1: v1::HostConfiguration<primitives::v1::BlockNumber>,
|
||||
v2: configuration::HostConfiguration<primitives::v1::BlockNumber>
|
||||
v1: v1::HostConfiguration<primitives::v2::BlockNumber>,
|
||||
v2: configuration::HostConfiguration<primitives::v2::BlockNumber>
|
||||
) {
|
||||
assert_eq!(v1.max_code_size , v2.max_code_size);
|
||||
assert_eq!(v1.max_head_data_size , v2.max_head_data_size);
|
||||
|
||||
Reference in New Issue
Block a user