You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zondax et al. have developed a Ledger app to support generic substrate networks,1 meaning Bittensor will benefit from this app provided we integrate the required changes to our runtime, giving us Ledger support (and other hardware signers).
The changes required involve providing a verification of the chain metadata to consumers, e.g. hardware signers. This change allows hardware signer devices to verify their decoding of transactions, avoiding approvals of maliciously crafted transactions given some unverified metadata.
From the runtime side only the frame_metadata_hash_extension::CheckMetadataHash needs to be added to the list of signed extension[s]
Note:
Adding the signed extension changes the encoding of the transaction and adds one extra byte per transaction!
This signed extension will make sure to decode the requested mode and will add the metadata
hash to the signed data depending on the requested mode. The mode gives the user/wallet
control over deciding if the metadata hash should be verified or not. The metadata hash itself
is drawn from the RUNTIME_METADATA_HASH environment variable. If the environment variable is
not set, any transaction that requires the metadata hash is rejected with the error CannotLookup. This is a security measurement to prevent including invalid transactions.
Warning
The extension does not work with the native runtime, because the RUNTIME_METADATA_HASH environment variable is not set when building the frame-metadata-hash-extension crate.
The metadata-hash feature needs to be enabled for the substrate-wasm-builder to enable the
code for being able to generate the metadata hash. It is also recommended to put the metadata
hash generation behind a feature in the runtime as shown above. The reason behind is that it
adds a lot of code which increases the compile time and the generation itself also increases
the compile time. Thus, it is recommended to enable the feature only when the metadata hash is
required (e.g. for an on-chain build).
The two parameters to enable_metadata_hash are the token symbol and the number of decimals of
the primary token of the chain. These information are included for the wallets to show token
related operations in a more user friendly way.
Ledger App support
Zondax et al. have developed a Ledger app to support generic substrate networks,1 meaning Bittensor will benefit from this app provided we integrate the required changes to our runtime, giving us Ledger support (and other hardware signers).
The changes required involve providing a verification of the chain metadata to consumers, e.g. hardware signers. This change allows hardware signer devices to verify their decoding of transactions, avoiding approvals of maliciously crafted transactions given some unverified metadata.
Background
polkadot-sdk
Upstream PR: ImplementCheckMetadataHash
extension paritytech/polkadot-sdk#4274TODO (from above guide)2:
Footnotes
https://zondax.ch/blog/the-generic-polkadot-ledger-app-proposal ↩
Guide for integration ↩
The text was updated successfully, but these errors were encountered: