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

Dynamic call indices for sudo and utility batch #356

Closed
ascjones opened this issue Dec 6, 2021 · 4 comments
Closed

Dynamic call indices for sudo and utility batch #356

ascjones opened this issue Dec 6, 2021 · 4 comments

Comments

@ascjones
Copy link
Contributor

ascjones commented Dec 6, 2021

Currently the Sudo::sudo and Utility::batch dispatchables generate code which accepts statically constructed instances of the top level Call enum. This means that if there is a mismatch of pallet/dispatchable composition between the static metadata used to generate API, and the target node runtime, then the node will fail to decode the calls.

When making a Call directly, the API will use the metadata of the running node to prepend the pallet index and the call index. We should consider making this available when constructing these composite dispatchables.

Extracted from #309

@wischli
Copy link

wischli commented Dec 9, 2022

Any update on this matter? I am trying to execute dynamic batch calls and assume it not to be working in 0.25.0 due to this issue?

@ascjones
Copy link
Contributor Author

ascjones commented Dec 9, 2022

See the latest thinking in #716.

I think pure dynamic calls might be working, e.g. see the multisig example: https://github.com/paritytech/subxt/blob/master/examples/examples/dynamic_multisig.rs#L61.

Note if you are running e.g. one off scripts where you can guarantee the metadata is synced with the target node you can use the statically generated types e.g. https://github.com/ascjones/seeding/blob/main/src/main.rs#L47

@jsdw
Copy link
Collaborator

jsdw commented Dec 9, 2022

This is something that scale-encode aims to solve, once it's integrated into Subxt. I'm off until Jan though so unless somebody else picks that up, it'll happen next month :)

@jsdw
Copy link
Collaborator

jsdw commented Apr 6, 2023

This is resolved now on master (soon to be released as 0.28); the RuntimeCall types will now be encoded with the help of metadata and matched on variant names, not indexes, however nested they are.

@jsdw jsdw closed this as completed Apr 6, 2023
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