Only apply hack if exactly metadata from kusama 1032 (#1695)

This commit is contained in:
Amaury Martiny
2020-01-03 12:05:27 +01:00
committed by GitHub
parent 1ca3b295a4
commit 774f41e6db
5 changed files with 6652 additions and 3 deletions
+3 -2
View File
@@ -6,6 +6,7 @@ import { Registry } from '@polkadot/types/types';
import { bnToU8a, isHex, hexToU8a, u8aConcat } from '@polkadot/util';
import hackKusama1032 from './v10/static.polkadot';
import { MAGIC_NUMBER } from './MagicNumber';
import MetadataVersioned from './MetadataVersioned';
@@ -28,9 +29,9 @@ export default class Metadata extends MetadataVersioned {
* There was a fk-up in the metadata upgrade process: Kusama's metadata got
* updated to a non-backward-compatible way, but the metadata version
* stayed at v9. Then v10 was merged in Substrate but not Kusama. Here,
* we're just saying that if it's a v9 metadata, decode as v10.
* we're just saying that if it's Kusama's metadata, decode as v10.
*/
if (isHex(_value) && _value.startsWith('0x6d65746109')) {
if (isHex(_value) && _value === hackKusama1032) {
return Metadata.decodeMetadata(registry, _value.replace('0x6d65746109', '0x6d6574610a'));
}