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

Handle type clash #271

Closed
h4x3rotab opened this issue Apr 25, 2021 · 4 comments
Closed

Handle type clash #271

h4x3rotab opened this issue Apr 25, 2021 · 4 comments

Comments

@h4x3rotab
Copy link
Contributor

https://polkadot.js.org/docs/api/start/types.extend#type-clashes

As mentioned in the above link from polkadotjs-api, there could be type clashes, and a well known example is Balances::Balance = u128 and Assets::Balance = u64. In the current impl, subxt only handles Balance = u128, and will use this definition to decode Assets::Balance, causing a failure to decode the Assets events.

A simple approach like it in polkadotjs: in the type registry, let's add the pallet name for specific type look up. Usually the type definition don't require change, but for the type clashes, we can register a full type name {pallet}::{type} in the registry.

For example, we call:

event_type_registry.register_type_size::<u64>("Assets::Balance");

And in events.rs, whenever it looks up a type, try {pallet}::{type} before {type}.

@h4x3rotab
Copy link
Contributor Author

@en
Copy link
Contributor

en commented Jun 3, 2021

I'm faced with the same problem.
There might be a solution after this PR is merged.
paritytech/substrate#8615

@ascjones
Copy link
Contributor

ascjones commented Jun 6, 2021

Yes indeed, I'm back next week from holiday to work again on that and that should solve most custom type problems

@ascjones
Copy link
Contributor

ascjones commented Nov 8, 2021

Closed by #294

@ascjones ascjones closed this as completed Nov 8, 2021
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

No branches or pull requests

3 participants