-
Notifications
You must be signed in to change notification settings - Fork 254
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
Types duplicated when upgrading to subxt 0.36.0 #1599
Comments
Oh interesting; thanks for the issue and steps to reproduce; we'll look into it! The logic to decide when to de-duplicate types (so that there is one |
Just to give an update; this basically boils down to this issue: paritytech/scale-typegen#19 The way we used to de-duplicate types was just by looking at their path, but that was found to break in some cases (eg see #1247 (comment); basically when multiple pallets exist that have generic types but the generics are associated types that we don't capture in the metadata IIRC, it all sortof breaks). To counter this, we stopped looking at just the paths and instead at the shapes of types to determine whether they were duplicates or eachother or not (which basically happens in this line of code: https://github.com/paritytech/scale-typegen/blob/e22a9850bbfa6d6faceed27e5d74ed5199922fd8/typegen/src/utils.rs#L44). An effect of the current approach is that types like: struct BoundedVec<T> {
inner: Vec<T>
} Are an issue, because the generic type T isn't directly used on a field, but instead is used in a child type, and our logic doesn't currently recurse in such a way as to track that sort of thing. So, TL;DR the current approach is more conservative about which types to merge together (deduplicate) to avoid bugs, but the result is that you end up with multiple of some types even though in theory you could have just 1. The previous version of Subxt was less conservative, but that broke in a couple of edge cases. We'll look into improving this logic in paritytech/scale-typegen#19! |
@simonsso have a go at updating to Subxt 0.36.1 and see whether that resolves your issue! |
With subxt
0.35.3
codegen generates one type calledBoundedVec
when upgrading to0.36.0
over 20 different types are generatedExample
BoundedVec19
Types generated by 0.35.3 and earlier versions of subxt
Example of duplicated code.
Steps to reproduce
git checkout OK ; cargo doc --open
search forBoundedVec
BoundedVec
is foundgit checkout BROKEN ; cargo doc --open
search forBoundedVec
BoundedVec
is foundThe text was updated successfully, but these errors were encountered: