fix: correct BitVec length calculation from bytes to bits in codec (#6152)
This commit is contained in:
@@ -90,7 +90,8 @@ describe('BitVec', (): void => {
|
||||
expect(
|
||||
new BitVec(registry, '0x0837').inspect()
|
||||
).toEqual({
|
||||
outer: [new Uint8Array([0]), new Uint8Array([0x08, 0x37])]
|
||||
// For input '0x0837' (yields 16 bits): compactToU8a(16) is 16<<2 = 64.
|
||||
outer: [new Uint8Array([64]), new Uint8Array([0x08, 0x37])]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ function decodeBitVec (value?: AnyU8a): [number, Uint8Array] {
|
||||
if (Array.isArray(value) || isString(value)) {
|
||||
const u8a = u8aToU8a(value);
|
||||
|
||||
return [u8a.length / 8, u8a];
|
||||
return [u8a.length * 8, u8a];
|
||||
}
|
||||
|
||||
return decodeBitVecU8a(value);
|
||||
|
||||
Reference in New Issue
Block a user