Update dependencies
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/dev": "^0.20.12",
|
||||
"@polkadot/ts": "^0.1.10"
|
||||
"@polkadot/dev": "^0.20.13",
|
||||
"@polkadot/ts": "^0.1.11"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,22 +25,22 @@
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.51",
|
||||
"@babel/runtime": "^7.0.0-rc.1",
|
||||
"@polkadot/trie-hash": "^0.28.2",
|
||||
"@polkadot/util": "^0.28.2",
|
||||
"@polkadot/util-crypto": "^0.28.2",
|
||||
"@polkadot/util-rlp": "^0.28.2",
|
||||
"@types/async": "^2.0.49",
|
||||
"@types/semaphore": "^1.1.0",
|
||||
"async": "^1.4.2",
|
||||
"async": "^2.6.1",
|
||||
"encoding-down": "^5.0.3",
|
||||
"level-ws": "0.1.0",
|
||||
"levelup": "^3.0.1",
|
||||
"levelup": "^3.1.1",
|
||||
"memdown": "^3.0.0",
|
||||
"readable-stream": "^2.2.8",
|
||||
"readable-stream": "^3.0.1",
|
||||
"semaphore": ">=1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ethereumjs-testing": "0.0.1"
|
||||
"ethereumjs-testing": "1.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,10 @@ import toU8a from '@polkadot/util/u8a/toU8a';
|
||||
import u8aToHex from '@polkadot/util/u8a/toHex';
|
||||
|
||||
import Trie from '../src/index';
|
||||
import { tests } from 'ethereumjs-testing';
|
||||
import getTests from '../../../test/getTests';
|
||||
|
||||
const jsonTests = tests.trieTests;
|
||||
const trietest = getTests('TrieTests/trietest.json');
|
||||
const trieanyorder = getTests('TrieTests/trieanyorder.json');
|
||||
|
||||
describe('official tests', () => {
|
||||
let trie;
|
||||
@@ -19,12 +20,12 @@ describe('official tests', () => {
|
||||
});
|
||||
|
||||
describe('ordered tests', () => {
|
||||
const testNames = Object.keys(jsonTests.trietest);
|
||||
const testNames = Object.keys(trietest);
|
||||
|
||||
testNames.forEach((name) => {
|
||||
trietest.forEach(({ name, input, root }) => {
|
||||
it(name, async () => {
|
||||
await Promise.all(
|
||||
jsonTests.trietest[name].in.map((input) =>
|
||||
input.map((input) =>
|
||||
trie.put(toU8a(input[0]), toU8a(input[1]))
|
||||
)
|
||||
);
|
||||
@@ -32,30 +33,29 @@ describe('official tests', () => {
|
||||
expect(
|
||||
u8aToHex(trie.root)
|
||||
).toEqual(
|
||||
jsonTests.trietest[name].root
|
||||
root
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('unordered tests', () => {
|
||||
const testNames = Object.keys(jsonTests.trieanyorder);
|
||||
const testNames = Object.keys(trieanyorder);
|
||||
|
||||
testNames.forEach((name) => {
|
||||
const test = jsonTests.trieanyorder[name];
|
||||
const keys = Object.keys(test.in);
|
||||
trieanyorder.forEach(({ name, input, root }) => {
|
||||
const keys = Object.keys(input);
|
||||
|
||||
it(name, async () => {
|
||||
await Promise.all(
|
||||
keys.map((key) =>
|
||||
trie.put(toU8a(key), toU8a(test.in[key]))
|
||||
trie.put(toU8a(key), toU8a(input[key]))
|
||||
)
|
||||
);
|
||||
|
||||
expect(
|
||||
u8aToHex(trie.root)
|
||||
).toEqual(
|
||||
test.root
|
||||
root
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-hash#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.51",
|
||||
"@babel/runtime": "^7.0.0-rc.1",
|
||||
"@polkadot/util": "^0.28.2",
|
||||
"@polkadot/util-crypto": "^0.28.2",
|
||||
"@polkadot/util-rlp": "^0.28.2"
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.51",
|
||||
"@babel/runtime": "^7.0.0-rc.1",
|
||||
"@polkadot/util": "^0.28.2",
|
||||
"blakejs": "^1.1.0",
|
||||
"js-sha3": "^0.7.0",
|
||||
"js-sha3": "^0.8.0",
|
||||
"tweetnacl": "^1.0.0",
|
||||
"xxhashjs": "^0.2.2"
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/client/tree/master/packages/util-keyring#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.51",
|
||||
"@babel/runtime": "^7.0.0-rc.1",
|
||||
"@polkadot/util": "^0.28.2",
|
||||
"@polkadot/util-crypto": "^0.28.2",
|
||||
"@types/bs58": "^3.0.30",
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-hash#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.51",
|
||||
"@babel/runtime": "^7.0.0-rc.1",
|
||||
"@polkadot/util": "^0.28.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ethereumjs-testing": "^1.0.4"
|
||||
"ethereumjs-testing": "1.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import u8aToHex from '@polkadot/util/u8a/toHex';
|
||||
|
||||
import { decode, encode } from './index';
|
||||
|
||||
import getTests from '../test/getTests';
|
||||
import getTests from '../../../test/getTests';
|
||||
|
||||
const rlptests = getTests('RLPTests/rlptest.json');
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import u8aToHex from '@polkadot/util/u8a/toHex';
|
||||
|
||||
import { encode } from './index';
|
||||
|
||||
import getTests from '../test/getTests';
|
||||
import getTests from '../../../test/getTests';
|
||||
|
||||
const rlptests = getTests('RLPTests/rlptest.json');
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.51",
|
||||
"@babel/runtime": "^7.0.0-rc.1",
|
||||
"@types/bn.js": "^4.11.1",
|
||||
"@types/deasync": "^0.1.0",
|
||||
"@types/ip-regex": "^2.0.0",
|
||||
@@ -36,7 +36,7 @@
|
||||
"bn.js": "^4.11.8",
|
||||
"chalk": "^2.4.1",
|
||||
"deasync": "^0.1.13",
|
||||
"ip-regex": "^2.1.0",
|
||||
"ip-regex": "^3.0.0",
|
||||
"moment": "^2.22.2"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@ declare module 'ethereumjs-testing' {
|
||||
type Tests = {
|
||||
[index: string]: {
|
||||
in: string,
|
||||
out: string
|
||||
out: string,
|
||||
root: string
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,6 +15,9 @@ export default function getTests (file: string) {
|
||||
input: tests[name].in[0] !== '#'
|
||||
? tests[name].in
|
||||
: bnToU8a(new BN(tests[name].in.slice(1)), -1, true),
|
||||
output: `0x${tests[name].out.toLowerCase()}`
|
||||
output: tests[name].out
|
||||
? `0x${tests[name].out.toLowerCase()}`
|
||||
: undefined,
|
||||
root: tests[name].root
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user