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 {
}
#[dynamic_pallet_params]
#[codec(index = 3)]
#[codec(index = 4)]
pub mod somE_weird_SPElLInG_s {
#[codec(index = 0)]
pub static V: u64 = 0;
......
......@@ -209,6 +209,7 @@ pub fn expand_outer_origin(
system(#system_path::Origin<#runtime>),
#caller_variants
#[allow(dead_code)]
#[codec(skip)]
Void(#scrate::__private::Void)
}
......
......@@ -85,6 +85,7 @@ pub mod pallet {
T::AccountId: SomeAssociation1 + From<SomeType1>,
{
#[deprecated = "second"]
#[codec(index = 1)]
A,
#[deprecated = "first"]
#[codec(index = 0)]
......@@ -157,20 +158,13 @@ fn pallet_metadata() {
// Example pallet events are partially and fully deprecated
let meta = example.event.unwrap();
assert_eq!(
// Result should be this, but instead we get the result below
// see: https://github.com/paritytech/parity-scale-codec/issues/507
//
// DeprecationInfoIR::VariantsDeprecated(BTreeMap::from([
// (codec::Compact(0), DeprecationStatusIR::Deprecated { note: "first", since: None
// }), (
// codec::Compact(1),
// DeprecationStatusIR::Deprecated { note: "second", since: None }
// )
// ])),
DeprecationInfoIR::VariantsDeprecated(BTreeMap::from([(
codec::Compact(0),
DeprecationStatusIR::Deprecated { note: "first", since: None }
),])),
DeprecationInfoIR::VariantsDeprecated(BTreeMap::from([
(codec::Compact(0), DeprecationStatusIR::Deprecated { note: "first", since: None }),
(
codec::Compact(1),
DeprecationStatusIR::Deprecated { note: "second", since: None }
)
])),
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