paritytech / subxt

Interact with Substrate based nodes in Rust or WebAssembly
Other
391 stars 236 forks source link

Add `CheckMetadataHash` extension #1585

Open jsdw opened 1 month ago

jsdw commented 1 month ago

The new merkalized metadata stuff means that signers will be able to attach a hash of the metadata to the signer payload prior to signing. This ensures that the metadata that they are using to display a TX to the user matches the actual metadata on chain.

The PR for the substrate extension is here: https://github.com/paritytech/polkadot-sdk/pull/4274

The easy solution for now is just to pass None (0u8) to the extension to disable any metadata hash checking.

Since we have the full metadata, we should be able to do better and hash it on first load and pass this hash to the signed extension to be included in any signer payload. We could do this as a step 2, since we'll want to check that we are hashing it properly or whatever.

bkchr commented 1 month ago

Since we have the full metadata, we should be able to do better and hash it on first load and pass this hash to the signed extension to be included in any signer payload. We could do this as a step 2, since we'll want to check that we are hashing it properly or whatever.

You can just use my crate to do the hashing for you.