paritytech / subxt

Interact with Substrate based nodes in Rust or WebAssembly
Other
424 stars 248 forks source link

Ignore unnecessary Extra and Call types in UncheckedExtrinsic and validation. #1845

Closed jsdw closed 1 month ago

jsdw commented 1 month ago

This isn't necessary for working with pallet_revive's UncheckedExtrinsic any more, but let's not expose/require types that we don't actually need any more to be a little more toelrant and prepare for V16 metadata which won't have an extra type anyway.

Fix number of account IDs from storage tests.

Old description:

  1. Make extracting Call and Extra generic params from the extrinsic type optional.

    Until now, the extrinsic type was basically always UncheckedExtrinsic<Address, Call, Signature, Extra>, and so the TypeInfo of that provided the address, call, signature and extra type IDs, which we'd extract in V14 metadata. (In V15 metadata these Ids are all explicit and we don't need to extract anything from the extrinsic type).

    Now, we only need Address and Signature types, making Subxt compatible with eg pallet_revive::evm::runtime::UncheckedExtrinsic<Address, Signature, E: EthExtra>. Turns out that Subxt didn't really use the other two types anyway.

  2. When generating the Subxt interface from metadata, also find and substitute pallet_revive::evm::runtime::UncheckedExtrinsic<Address, Signature> for our subxt::utile::UncheckedExtrinsic, so that it's still possible to provide bytes as arguments that ask for that type in the generated APIs.

jsdw commented 1 month ago

Am holding off on this PR because there's a chance that the TypeInfo of the new extrinsic type will be updated anyway such that we don't need to actually make any changes here! If that's the case, we may still want to keep (1) above, to make it more likely that custom types will be supported in the future and not require a couple of types that we don't use, but it won't be super important!

jsdw commented 1 month ago

Closing in favour of a smaller fix: #1848