Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix casting usize to u8 at pallet::error macro #1

Open
wants to merge 1 commit into
base: locked/release-polkadot-v1.1.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions substrate/frame/support/procedural/src/pallet/expand/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
{
fn from(err: #error_ident<#type_use_gen>) -> Self {
use #frame_support::__private::codec::Encode;
let index = <
let index: u8 = <
<T as #frame_system::Config>::PalletInfo
as #frame_support::traits::PalletInfo
>::index::<Pallet<#type_use_gen>>()
.expect("Every active module has an index in the runtime; qed") as u8;
.expect("Every active module has an index in the runtime; qed").try_into().expect("Index should fit into u8");
let mut encoded = err.encode();
encoded.resize(#frame_support::MAX_MODULE_ERROR_ENCODED_SIZE, 0);

Expand Down
Loading