Skip to content

Commit

Permalink
12.0.1 (#1815)
Browse files Browse the repository at this point in the history
* 12.0.1

* Inline xxhash single-use

* Adjust comments
  • Loading branch information
jacogr authored Apr 22, 2023
1 parent db4dde0 commit 2d2a1a5
Show file tree
Hide file tree
Showing 19 changed files with 191 additions and 192 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

## master
## 12.0.1 Apr 22, 2023

Contributed:

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"versions": {
"git": "11.1.4-19-x",
"npm": "11.1.4-12"
Expand All @@ -37,7 +37,7 @@
"test:one": "polkadot-dev-run-test --env browser"
},
"devDependencies": {
"@polkadot/dev": "^0.73.1",
"@polkadot/dev": "^0.73.2",
"@types/node": "^18.15.13"
},
"resolutions": {
Expand Down
4 changes: 2 additions & 2 deletions packages/hw-ledger-transports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@ledgerhq/hw-transport": "^6.28.2",
"@ledgerhq/hw-transport-webhid": "^6.27.13",
"@ledgerhq/hw-transport-webusb": "^6.27.13",
"@polkadot/util": "11.1.4-19-x",
"@polkadot/util": "12.0.0",
"tslib": "^2.5.0"
},
"optionalDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/hw-ledger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"main": "index.js",
"dependencies": {
"@polkadot/hw-ledger-transports": "11.1.4-19-x",
"@polkadot/util": "11.1.4-19-x",
"@polkadot/hw-ledger-transports": "12.0.0",
"@polkadot/util": "12.0.0",
"@zondax/ledger-substrate": "^0.40.7",
"tslib": "^2.5.0"
}
Expand Down
10 changes: 5 additions & 5 deletions packages/keyring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"main": "index.js",
"dependencies": {
"@polkadot/util": "11.1.4-19-x",
"@polkadot/util-crypto": "11.1.4-19-x",
"@polkadot/util": "12.0.0",
"@polkadot/util-crypto": "12.0.0",
"tslib": "^2.5.0"
},
"peerDependencies": {
"@polkadot/util": "11.1.4-19-x",
"@polkadot/util-crypto": "11.1.4-19-x"
"@polkadot/util": "12.0.0",
"@polkadot/util-crypto": "12.0.0"
}
}
6 changes: 3 additions & 3 deletions packages/networks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"main": "index.js",
"dependencies": {
"@polkadot/util": "11.1.4-19-x",
"@polkadot/util": "12.0.0",
"@substrate/ss58-registry": "^1.39.0",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/hw-ledger": "11.1.4-19-x"
"@polkadot/hw-ledger": "12.0.0"
}
}
15 changes: 8 additions & 7 deletions packages/util-crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"browser": {
"crypto": false,
"stream": false
Expand All @@ -29,15 +29,16 @@
"dependencies": {
"@noble/curves": "1.0.0",
"@noble/hashes": "1.3.0",
"@polkadot/networks": "11.1.4-19-x",
"@polkadot/util": "11.1.4-19-x",
"@polkadot/wasm-crypto": "^7.0.3",
"@polkadot/x-bigint": "11.1.4-19-x",
"@polkadot/x-randomvalues": "11.1.4-19-x",
"@polkadot/networks": "12.0.0",
"@polkadot/util": "12.0.0",
"@polkadot/wasm-crypto": "^7.1.1",
"@polkadot/wasm-util": "^7.1.1",
"@polkadot/x-bigint": "12.0.0",
"@polkadot/x-randomvalues": "12.0.0",
"@scure/base": "1.1.1",
"tslib": "^2.5.0"
},
"peerDependencies": {
"@polkadot/util": "11.1.4-19-x"
"@polkadot/util": "12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/util-crypto/src/nacl/tweetnacl-secretbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//
// Changes made:
// - Jest-like test environment (not tape)
// - Combine quite and random tests into single file
// - Combine "quick" and "random" tests into single file
//
// Original headers:
//
Expand Down
34 changes: 14 additions & 20 deletions packages/util-crypto/src/xxhash/xxhash64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { BigInt } from '@polkadot/x-bigint';
// - support only for Uint8Array inputs
// - no constructor function, straight fill & digest
// - update code removed, only called once, no streams
// - inline single-use functions

interface State {
seed: bigint;
Expand Down Expand Up @@ -74,22 +75,8 @@ function fromU8a (u8a: Uint8Array, p: number, count: 2 | 4): bigint {
return result;
}

function toU8a (h64: bigint): Uint8Array {
const result = new Uint8Array(8);

for (let i = 7; i >= 0; i--) {
result[i] = Number(h64 % _256n);

h64 = h64 / _256n;
}

return result;
}

function state (initSeed: bigint | number): State {
const seed = BigInt(initSeed);

return {
function init (seed: bigint, input: Uint8Array): State {
const state = {
seed,
u8a: new Uint8Array(32),
u8asize: 0,
Expand All @@ -98,9 +85,7 @@ function state (initSeed: bigint | number): State {
v3: seed,
v4: seed - P64_1
};
}

function init (state: State, input: Uint8Array): State {
if (input.length < 32) {
state.u8a.set(input);
state.u8asize = input.length;
Expand Down Expand Up @@ -132,7 +117,7 @@ function init (state: State, input: Uint8Array): State {
}

export function xxhash64 (input: Uint8Array, initSeed: bigint | number): Uint8Array {
const { seed, u8a, u8asize, v1, v2, v3, v4 } = init(state(initSeed), input);
const { seed, u8a, u8asize, v1, v2, v3, v4 } = init(BigInt(initSeed), input);
let p = 0;
let h64 = U64 & (BigInt(input.length) + (
input.length >= 32
Expand All @@ -156,6 +141,15 @@ export function xxhash64 (input: Uint8Array, initSeed: bigint | number): Uint8Ar

h64 = U64 & (P64_2 * (h64 ^ (h64 >> _33n)));
h64 = U64 & (P64_3 * (h64 ^ (h64 >> _29n)));
h64 = U64 & (h64 ^ (h64 >> _32n));

const result = new Uint8Array(8);

return toU8a(U64 & (h64 ^ (h64 >> _32n)));
for (let i = 7; i >= 0; i--) {
result[i] = Number(h64 % _256n);

h64 = h64 / _256n;
}

return result;
}
12 changes: 6 additions & 6 deletions packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"main": "index.js",
"exports": {
"./hex/toU8a": {
Expand All @@ -35,15 +35,15 @@
}
},
"dependencies": {
"@polkadot/x-bigint": "11.1.4-19-x",
"@polkadot/x-global": "11.1.4-19-x",
"@polkadot/x-textdecoder": "11.1.4-19-x",
"@polkadot/x-textencoder": "11.1.4-19-x",
"@polkadot/x-bigint": "12.0.0",
"@polkadot/x-global": "12.0.0",
"@polkadot/x-textdecoder": "12.0.0",
"@polkadot/x-textencoder": "12.0.0",
"@types/bn.js": "^5.1.1",
"bn.js": "^5.2.1",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/x-randomvalues": "11.1.4-19-x"
"@polkadot/x-randomvalues": "12.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/x-bigint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"./shim.cjs"
],
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"dependencies": {
"@polkadot/x-global": "11.1.4-19-x",
"@polkadot/x-global": "12.0.0",
"tslib": "^2.5.0"
}
}
4 changes: 2 additions & 2 deletions packages/x-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"main": "index.js",
"dependencies": {
"@polkadot/util": "11.1.4-19-x",
"@polkadot/util": "12.0.0",
"buffer-es6": "^4.9.3",
"tslib": "^2.5.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/x-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/x-global": "11.1.4-19-x",
"@polkadot/x-global": "12.0.0",
"node-fetch": "^3.3.1",
"tslib": "^2.5.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/x-global/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"main": "index.js",
"dependencies": {
"tslib": "^2.5.0"
Expand Down
11 changes: 6 additions & 5 deletions packages/x-randomvalues/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/wasm-util": "^7.0.3",
"@polkadot/x-global": "11.1.4-19-x",
"@polkadot/x-global": "12.0.0",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/util": "11.1.4-19-x",
"@polkadot/util": "12.0.0",
"@polkadot/wasm-util": "^7.1.1",
"@types/react-native": "^0.71.6"
},
"peerDependencies": {
"@polkadot/util": "11.1.4-19-x"
"@polkadot/util": "12.0.0",
"@polkadot/wasm-util": "*"
}
}
4 changes: 2 additions & 2 deletions packages/x-textdecoder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/x-global": "11.1.4-19-x",
"@polkadot/x-global": "12.0.0",
"tslib": "^2.5.0"
}
}
4 changes: 2 additions & 2 deletions packages/x-textencoder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/x-global": "11.1.4-19-x",
"@polkadot/x-global": "12.0.0",
"tslib": "^2.5.0"
}
}
4 changes: 2 additions & 2 deletions packages/x-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"sideEffects": false,
"type": "module",
"version": "11.1.4-19-x",
"version": "12.0.0",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/x-global": "11.1.4-19-x",
"@polkadot/x-global": "12.0.0",
"tslib": "^2.5.0",
"ws": "^8.13.0"
},
Expand Down
Loading

0 comments on commit 2d2a1a5

Please sign in to comment.