0

Nodle has upgraded its testnet to 3.1.13-M which is built on top of polkadot-sdk 1.1.13. One of the motivations behind this upgrade was to allow Polkadot Generic App on Ledger to work with Nodle's parachain. All the instructions mentioned in this guideline has been followed. Here is the definition of the SignedExtra for reference. The runtime is built using the latest version of SRTool with the following flag: BUILD_OPTS: "--features on-chain-release-build". The runtime build also enables metadata hash for the runtime wasm. Despite all these, if I use a wallet like Talisman and upgrade my network settings there to hint that my networks supports CheckMetadataHash, then upon any transactions signed by Talisman (for Ledger and non Ledger accounts), I get:

RPC-CORE: submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus:: 1010: Invalid Transaction: Transaction has a bad signature

If I turn off the option "This network supports CheckMetadataHash sign extension" in Talisman then the transactions will become valid though I cannot keep it off and interact with Ledger too.

There is another report of a similar issue here which I could not verify if they are the same due to limited information.

I appreciate any help for either solving the issue or using a method other than Talisman to verify if the support for CheckMetadataHash is sound on a test or local net.

1 Answer 1

0

When metadata-hash is enabled for a wasm you would need to specify a token name and decimals. This extra info will then become part of the metadata digest and impact the hash that the runtime stores. The runtime would then use this hash to validate the wallet signatures.

Wallets like Talisman and polkadot-js would also need to retrieve this token name and decimals from a chain and create their signatures based on that. Any mismatch would lead to the "bad signature" problem. The problem in the original question was that the name of the token for Nodle's mainnet was NODL but for the testnet and the local chain different names had been used. Nodle would use the exact same runtime but with different specs for these different chains. This PR is attempting to fix this issue by creating different wasm files out of the same base but with different token names. The following snippet showcases the gist of the approach:

    substrate_wasm_builder::WasmBuilder::init_with_defaults()
        .enable_metadata_hash("NODL", 11)
        .build();
    // Since token name is different for our testnet, we need to build a separate binary
    substrate_wasm_builder::WasmBuilder::init_with_defaults()
        .set_file_name("wasm_binary_test.rs")
        .enable_metadata_hash("notNodl", 11)
        .build();
    // Since token name is different for our local/dev chain, we need to build a separate binary
    substrate_wasm_builder::WasmBuilder::init_with_defaults()
        .set_file_name("wasm_binary_dev.rs")
        .enable_metadata_hash("DevNODL", 11)
        .build();

If you want to be certain what a wallet would use as a token name, initiate a transfer from your ledger account in your wallet, make sure that the wallet settings for your destination network considers CheckMetadtaHash as enabled (currently I only of Talisman allowing you to change it under network&tokens settings > Polkadot > edit network/custom network), when your wallet sends the metadata to your Ledger to be approved, you can see what actual token name is used. Keep in mind the name is cap sensitive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.