Skip to content

Keep codec attrs even when Encode/Decode not used#2023

Merged
jsdw merged 3 commits into
masterfrom
jsdw-keep-codec-attrs
Jun 18, 2025
Merged

Keep codec attrs even when Encode/Decode not used#2023
jsdw merged 3 commits into
masterfrom
jsdw-keep-codec-attrs

Conversation

@jsdw

@jsdw jsdw commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

scale-typegen inserts some __ignore fields when it needs to represent some generic type that isn't used in a field, so that it can add a PhantomData<T> to make this valid.

Perhaps (probably, I think) wrongly, scale-typegen only adds #[codec(skip)] if insert_codec_attributes: true. So, let's just always set this to true for now to avoid issues decoding things into structs with __ignore fields. This also adds #[codec(index = N)] attrs, but these are harmless anyway.

The failing example in #2021 no longer fails with this change.

Closes #2021

@jsdw
jsdw requested a review from a team June 16, 2025 14:35
@jsdw
jsdw force-pushed the jsdw-keep-codec-attrs branch from 9fc7b8c to fc84f89 Compare June 16, 2025 14:48
@jsdw
jsdw merged commit a78f52b into master Jun 18, 2025
13 checks passed
@jsdw
jsdw deleted the jsdw-keep-codec-attrs branch June 18, 2025 09:32
@jsdw jsdw mentioned this pull request Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error decoding type on AH Westend

2 participants