Bump util, min compact bitlength (#516)

This commit is contained in:
Jaco Greeff
2018-12-25 13:58:58 +01:00
committed by GitHub
parent 9e512bd6a0
commit 85434e082b
7 changed files with 30 additions and 35 deletions
+2 -2
View File
@@ -30,8 +30,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/keyring": "^0.33.26",
"@polkadot/util": "^0.33.26",
"@polkadot/keyring": "^0.33.27",
"@polkadot/util": "^0.33.27",
"core-js": "^2.6.1"
}
}
+5 -10
View File
@@ -61,19 +61,14 @@ describe('Compact', () => {
);
});
// FIXME This is _still_ not correct, here it should use the minimum bytes - however, since the
// value fits and the encoding is proper, it _should_ be ok on the decoding side.
it('condes a large balance', () => {
it('encondes a large balance', () => {
expect(
Compact.encodeU8a(new Balance('0x00407a10f35a'))
).toEqual(
new Uint8Array([
// length, as per FIXME, should actually be 6 (as opposed to 16)
3 + ((16 - 4) << 2),
// useful data
0x00, 0x40, 0x7a, 0x10, 0xf3, 0x5a,
// padding, extra space used here :(
0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
3 + ((6 - 4) << 2),
0x00, 0x40, 0x7a, 0x10, 0xf3, 0x5a
])
);
});
});
@@ -120,7 +115,7 @@ describe('Compact', () => {
it('has the correct encodedLength for constructor values (BlockNumber)', () => {
expect(
new Compact(BlockNumber, 0xfffffff9).encodedLength
).toEqual(9);
).toEqual(5);
});
it('has the correct encodedLength for constructor values (u32)', () => {