Skip to content
Snippets Groups Projects
Unverified Commit 37446fcb authored by Serban Iorga's avatar Serban Iorga Committed by GitHub
Browse files

Fix duplicate codec indexes (#7446)

Related to https://github.com/paritytech/polkadot-sdk/issues/7400 and
https://github.com/paritytech/polkadot-sdk/pull/7417

We need this in order to be able to update `parity-scale-codec` to the
latest version after it's released. That's because `parity-scale-codec`
added support for checking for duplicate indexes at compile time.
parent d6aa1578
No related merge requests found
Pipeline #514220 waiting for manual action with stages
in 10 minutes and 21 seconds
...@@ -75,7 +75,7 @@ pub mod dynamic_params { ...@@ -75,7 +75,7 @@ pub mod dynamic_params {
} }
#[dynamic_pallet_params] #[dynamic_pallet_params]
#[codec(index = 3)] #[codec(index = 4)]
pub mod somE_weird_SPElLInG_s { pub mod somE_weird_SPElLInG_s {
#[codec(index = 0)] #[codec(index = 0)]
pub static V: u64 = 0; pub static V: u64 = 0;
......
...@@ -209,6 +209,7 @@ pub fn expand_outer_origin( ...@@ -209,6 +209,7 @@ pub fn expand_outer_origin(
system(#system_path::Origin<#runtime>), system(#system_path::Origin<#runtime>),
#caller_variants #caller_variants
#[allow(dead_code)] #[allow(dead_code)]
#[codec(skip)]
Void(#scrate::__private::Void) Void(#scrate::__private::Void)
} }
......
...@@ -85,6 +85,7 @@ pub mod pallet { ...@@ -85,6 +85,7 @@ pub mod pallet {
T::AccountId: SomeAssociation1 + From<SomeType1>, T::AccountId: SomeAssociation1 + From<SomeType1>,
{ {
#[deprecated = "second"] #[deprecated = "second"]
#[codec(index = 1)]
A, A,
#[deprecated = "first"] #[deprecated = "first"]
#[codec(index = 0)] #[codec(index = 0)]
...@@ -157,20 +158,13 @@ fn pallet_metadata() { ...@@ -157,20 +158,13 @@ fn pallet_metadata() {
// Example pallet events are partially and fully deprecated // Example pallet events are partially and fully deprecated
let meta = example.event.unwrap(); let meta = example.event.unwrap();
assert_eq!( assert_eq!(
// Result should be this, but instead we get the result below DeprecationInfoIR::VariantsDeprecated(BTreeMap::from([
// see: https://github.com/paritytech/parity-scale-codec/issues/507 (codec::Compact(0), DeprecationStatusIR::Deprecated { note: "first", since: None }),
// (
// DeprecationInfoIR::VariantsDeprecated(BTreeMap::from([ codec::Compact(1),
// (codec::Compact(0), DeprecationStatusIR::Deprecated { note: "first", since: None DeprecationStatusIR::Deprecated { note: "second", since: None }
// }), ( )
// codec::Compact(1), ])),
// DeprecationStatusIR::Deprecated { note: "second", since: None }
// )
// ])),
DeprecationInfoIR::VariantsDeprecated(BTreeMap::from([(
codec::Compact(0),
DeprecationStatusIR::Deprecated { note: "first", since: None }
),])),
meta.deprecation_info meta.deprecation_info
); );
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment