Skip to content

Commit

Permalink
[stable2412] Backport #7446 (#7462)
Browse files Browse the repository at this point in the history
Backport #7446 into `stable2412` from serban300.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Serban Iorga <serban@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 5, 2025
1 parent a1c89a1 commit 4f37964
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
10 changes: 10 additions & 0 deletions prdoc/pr_7462.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: Update SCALE codec indices

doc:
- audience: Runtime Dev
description: |
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.

crates:
- name: frame-support-procedural
bump: patch
2 changes: 1 addition & 1 deletion substrate/frame/parameters/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ pub fn expand_outer_origin(
system(#system_path::Origin<#runtime>),
#caller_variants
#[allow(dead_code)]
#[codec(skip)]
Void(#scrate::__private::Void)
}

Expand Down
22 changes: 8 additions & 14 deletions substrate/frame/support/test/tests/enum_deprecation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ pub mod pallet {
T::AccountId: SomeAssociation1 + From<SomeType1>,
{
#[deprecated = "second"]
#[codec(index = 1)]
A,
#[deprecated = "first"]
#[codec(index = 0)]
Expand Down Expand Up @@ -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
);
}
Expand Down

0 comments on commit 4f37964

Please sign in to comment.