From 85434e082b168ff5434e52116e64ca43a536cc51 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 25 Dec 2018 13:58:58 +0100 Subject: [PATCH] Bump util, min compact bitlength (#516) --- packages/rpc-core/package.json | 2 +- packages/rpc-provider/package.json | 6 ++--- packages/type-extrinsics/package.json | 2 +- packages/type-storage/package.json | 6 ++--- packages/types/package.json | 4 ++-- packages/types/src/codec/Compact.spec.ts | 15 ++++-------- yarn.lock | 30 ++++++++++++------------ 7 files changed, 30 insertions(+), 35 deletions(-) diff --git a/packages/rpc-core/package.json b/packages/rpc-core/package.json index 42de00a92a..b47b1bec32 100644 --- a/packages/rpc-core/package.json +++ b/packages/rpc-core/package.json @@ -33,6 +33,6 @@ "@polkadot/jsonrpc": "^0.35.9", "@polkadot/rpc-provider": "^0.35.9", "@polkadot/types": "^0.35.9", - "@polkadot/util": "^0.33.26" + "@polkadot/util": "^0.33.27" } } diff --git a/packages/rpc-provider/package.json b/packages/rpc-provider/package.json index 6f8264d76a..a3a16ecb4d 100644 --- a/packages/rpc-provider/package.json +++ b/packages/rpc-provider/package.json @@ -30,10 +30,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/keyring": "^0.33.26", + "@polkadot/keyring": "^0.33.27", "@polkadot/storage": "^0.35.9", - "@polkadot/util": "^0.33.26", - "@polkadot/util-crypto": "^0.33.26", + "@polkadot/util": "^0.33.27", + "@polkadot/util-crypto": "^0.33.27", "@types/nock": "^9.3.0", "eventemitter3": "^3.1.0", "isomorphic-fetch": "^2.2.1", diff --git a/packages/type-extrinsics/package.json b/packages/type-extrinsics/package.json index 99f761374a..a73509847c 100644 --- a/packages/type-extrinsics/package.json +++ b/packages/type-extrinsics/package.json @@ -12,6 +12,6 @@ "dependencies": { "@babel/runtime": "^7.2.0", "@polkadot/types": "^0.35.9", - "@polkadot/util": "^0.33.26" + "@polkadot/util": "^0.33.27" } } diff --git a/packages/type-storage/package.json b/packages/type-storage/package.json index 50b5babc28..26125dcded 100644 --- a/packages/type-storage/package.json +++ b/packages/type-storage/package.json @@ -30,9 +30,9 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/keyring": "^0.33.26", + "@polkadot/keyring": "^0.33.27", "@polkadot/types": "^0.35.9", - "@polkadot/util": "^0.33.26", - "@polkadot/util-crypto": "^0.33.26" + "@polkadot/util": "^0.33.27", + "@polkadot/util-crypto": "^0.33.27" } } diff --git a/packages/types/package.json b/packages/types/package.json index ec275c29fc..b350a16d6d 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -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" } } diff --git a/packages/types/src/codec/Compact.spec.ts b/packages/types/src/codec/Compact.spec.ts index b176e5edb2..6a22a7127d 100644 --- a/packages/types/src/codec/Compact.spec.ts +++ b/packages/types/src/codec/Compact.spec.ts @@ -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)', () => { diff --git a/yarn.lock b/yarn.lock index 27fc7b33d5..a0f12e8bcb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1417,14 +1417,14 @@ typedoc-plugin-no-inherit "^1.0.2" typescript "^3.2.2" -"@polkadot/keyring@^0.33.26": - version "0.33.26" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.33.26.tgz#b9140a2296a4ba759ce66c0f706499c9aeaaa6e4" - integrity sha512-0Fmdqu+h/vzjstpVlHL76Fn7/AUVXQuPRCSO+QV4oejGPHacsmM/pUMN60P/+TptzcR/g5jFUu8tlPYFf/feaw== +"@polkadot/keyring@^0.33.27": + version "0.33.27" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.33.27.tgz#f8b89bcf5e5a0975e72a7c146e78f4a727ccc697" + integrity sha512-khZe+jNggZ0LY6HA+mEKWXcdsHYDuW6eVNk3JMKK4MjdVfVRJ1Ep7dm2lMiHeJtXknJz57qzPKLelPI4YbQe8A== dependencies: "@babel/runtime" "^7.2.0" - "@polkadot/util" "^0.33.26" - "@polkadot/util-crypto" "^0.33.26" + "@polkadot/util" "^0.33.27" + "@polkadot/util-crypto" "^0.33.27" "@types/bs58" "^3.0.30" bs58 "^4.0.1" @@ -1433,13 +1433,13 @@ resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.44.tgz#2fb28215f10b869bfa544fd8df8fccb4932d64f2" integrity sha512-tor7vSd3ZsRBO9FIuKZQ9hfqEGkNZnanAFVGmoL1iSmdhcoKtYTlQe0BQafjIynqIMOfXdJ7Zes9PlorPtw6yw== -"@polkadot/util-crypto@^0.33.26": - version "0.33.26" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.33.26.tgz#ea8edbdb4d8acf5fa5c09c94ec0a008e7d9c37c2" - integrity sha512-kGtDoRX/xSDG8lQjnrX5qgJOKzlcUoxcSbT/pT+cAtueadMQuDkpUJCD7OeXi6hyTbDc3kkkriFQko+kVBs6+g== +"@polkadot/util-crypto@^0.33.27": + version "0.33.27" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.33.27.tgz#efea792ebe43fa679e924f303bdcb6857c28e6d4" + integrity sha512-ZdlcUnPJOerbgbYJgMQHtGz8SGUr43geZ5/QIE4v8SkdSnwP6MKEvve/G2AkzmXIUZsLMpfW5k3CRsEFNHd1lQ== dependencies: "@babel/runtime" "^7.2.0" - "@polkadot/util" "^0.33.26" + "@polkadot/util" "^0.33.27" "@types/bip39" "^2.4.1" bip39 "^2.5.0" blakejs "^1.1.0" @@ -1447,10 +1447,10 @@ tweetnacl "^1.0.0" xxhashjs "^0.2.2" -"@polkadot/util@^0.33.26": - version "0.33.26" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.33.26.tgz#186ac1f398da8608e693f27cc528df9cbeb8412c" - integrity sha512-ZpbjiUp950RNRDkIXGtnWNWQCbZlMoBQQChByDDuhG6LeVxewszeP1jO+uK4RCrMbwz8aDUI9J/z1ApoLvbAzw== +"@polkadot/util@^0.33.27": + version "0.33.27" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.33.27.tgz#982e9afdd648731c88690ab6208512ca3bcde1ab" + integrity sha512-jLYx8dcTag6ACdYybeGWBkmpQj7DsTZ2mCqInhQFCuYmb1h7P7QK/RRDrCQ+Ai3yHfHol8pq/k/oQrgKXpyt6g== dependencies: "@babel/runtime" "^7.2.0" "@types/bn.js" "^4.11.3"