Skip to content

Fix TypeInfo generated by impl_common_traits!#45

Merged
georgepisaltu merged 2 commits intomainfrom
cosmin-fix-typeinfo-impl-common-traits
Apr 16, 2026
Merged

Fix TypeInfo generated by impl_common_traits!#45
georgepisaltu merged 2 commits intomainfrom
cosmin-fix-typeinfo-impl-common-traits

Conversation

@csmnprschv
Copy link
Copy Markdown
Contributor

@csmnprschv csmnprschv commented Apr 15, 2026

The TypeInfo impl generated by impl_common_traits! declared the
affected types as a composite struct wrapping Vec<u8>, which tells
metadata-based decoders to expect a Compact<u32> length prefix
followed by bytes.

The Encode impl (via ark_scale::ArkScaleRef) writes raw bytes with
no length prefix, so PJS fails when decoding:
    Compact input is > Number.MAX_SAFE_INTEGER

Delegate to ArkScale's TypeInfo so the type metadata matches the
actual encoding.

The TypeInfo impl generated by impl_common_traits! declared the
affected types as a composite struct wrapping Vec<u8>, which tells
metadata-based decoders to expect a Compact<u32> length prefix
followed by bytes.

The Encode impl (via ark_scale::ArkScaleRef) writes raw bytes with
no length prefix, so PJS fails when decoding:
    Compact input is > Number.MAX_SAFE_INTEGER

Declare their encoded form as [u8; N] so the type metadata matches
the actual encoding.

Signed-off-by: Cosmin Paraschiv <cosmin@parity.io>
@csmnprschv csmnprschv self-assigned this Apr 15, 2026
@csmnprschv
Copy link
Copy Markdown
Contributor Author

csmnprschv commented Apr 15, 2026

Before:

before

After:

after

Comment thread src/ring/mod.rs Outdated
Signed-off-by: Cosmin Paraschiv <cosmin@parity.io>
@georgepisaltu georgepisaltu merged commit cfb9704 into main Apr 16, 2026
8 checks passed
@csmnprschv csmnprschv deleted the cosmin-fix-typeinfo-impl-common-traits branch April 16, 2026 09:53
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.

3 participants