Skip to content

Remove codec::Encode and codec::Decode derives from generated APIs by default #2008

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jsdw
Copy link
Collaborator

@jsdw jsdw commented May 23, 2025

Most APIs in Subxt haven't used codec::Encode or codec::Decode in a while; these traits encode and decode bytes from/to a chain based on the precise shape of our generated types and don't take into account any changes in the chain metadata.

One of the issues we recently hit was #2006, whereby Encode and Decode derives in our generated APIs were not playing nicely with compact encoded generics.

A solution is to migrate our generated APIs away from using codec::Encode or codec::Decode and relying only on EncodeAsType and DecodeAstype, which take the chain metadata into account and handle things like encoding and decoding compact encoded values transparently. This PR takes this path.

Users can still derive Encode and Decode themselves on types that they want these traits on, or on everything, but all of the main Subxt interfaces no longer have any reliance on them, and so they do not need to be derviced by default.

@jsdw jsdw requested a review from a team as a code owner May 23, 2025 14:46
@jsdw jsdw changed the title Remove codec::Encode and codec::Decode from generated APIs by default Remove codec::Encode and codec::Decode derives from generated APIs by default May 23, 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.

1 participant