Output BitVec toHuman to LSB (limit support) (#4676)

This commit is contained in:
Jaco
2022-03-22 09:41:17 +02:00
committed by GitHub
parent 798e5fcc78
commit 9399c8d24f
4 changed files with 55 additions and 17 deletions
@@ -47,7 +47,9 @@ const PATHS_SET = splitNamespace([
]);
// These are the set namespaces for BitVec definitions (the last 2 appear in types as well)
const BITVEC_NS = ['bitvec::order::Lsb0', 'bitvec::order::Msb0', 'BitOrderLsb0', 'BitOrderMsb0'];
const BITVEC_NS_LSB = ['bitvec::order::Lsb0', 'BitOrderLsb0'];
const BITVEC_NS_MSB = ['bitvec::order::Msb0', 'BitOrderMsb0'];
const BITVEC_NS = [...BITVEC_NS_LSB, ...BITVEC_NS_MSB];
// These we never use these as top-level names, they are wrappers
const WRAPPERS = ['BoundedBTreeMap', 'BoundedVec', 'Box', 'BTreeMap', 'Cow', 'Result', 'Option', 'WeakBoundedVec', 'WrapperKeepOpaque', 'WrapperOpaque'];
@@ -527,8 +529,8 @@ export class PortableRegistry extends Struct implements ILookup {
// NOTE: Currently the BitVec type is one-way only, i.e. we only use it to decode, not
// re-encode stuff. As such we ignore the msb/lsb identifier given by bitOrderType, or rather
// we don't pass it though at all
assert(BITVEC_NS.includes(bitOrder.namespace || ''), () => `Unexpected bitOrder found as ${bitOrder.namespace || '<unknown>'}`);
// we don't pass it though at all, however we only currently cater for the default Lsb
assert(BITVEC_NS_LSB.includes(bitOrder.namespace || ''), () => `Unexpected bitOrder found as ${bitOrder.namespace || '<unknown>'}`);
assert(bitStore.info === TypeDefInfo.Plain && bitStore.type === 'u8', () => `Only u8 bitStore is currently supported, found ${bitStore.type}`);
return {