This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into promisify/proof
- Loading branch information
Showing
51 changed files
with
3,495 additions
and
1,504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '*' | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v1 | ||
- uses: actions/checkout@v1 | ||
- run: npm install | ||
- run: npm run lint | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v1 | ||
- uses: actions/checkout@v1 | ||
- run: npm install | ||
- run: npm run coverage | ||
- name: Upload coverage to Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [10.x, 12.x, 13.x] | ||
steps: | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- uses: actions/checkout@v1 | ||
- run: npm install | ||
- run: npm run test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import * as async from 'async' | ||
import * as crypto from 'crypto' | ||
const Trie = require('../dist/index.js').CheckpointTrie | ||
|
||
let iterations = 500 | ||
let samples = 20 | ||
let i = 0 | ||
|
||
function iterTest(numOfIter: number, cb: Function) { | ||
let vals = [] as any | ||
let keys = [] as any | ||
|
||
for (i = 0; i <= numOfIter; i++) { | ||
vals.push(crypto.pseudoRandomBytes(32)) | ||
keys.push(crypto.pseudoRandomBytes(32)) | ||
} | ||
|
||
let hrstart = process.hrtime() | ||
let numOfOps = 0 | ||
let trie = new Trie() | ||
|
||
for (i = 0; i < numOfIter; i++) { | ||
trie.put(vals[i], keys[i], function () { | ||
trie.checkpoint() | ||
trie.get(Buffer.from('test'), function () { | ||
numOfOps++ | ||
if (numOfOps === numOfIter) { | ||
const hrend = process.hrtime(hrstart) | ||
cb(hrend) | ||
} | ||
}) | ||
}) | ||
} | ||
} | ||
|
||
i = 0 | ||
let avg = [0, 0] | ||
|
||
async.whilst( | ||
function () { | ||
i++ | ||
return i <= samples | ||
}, | ||
function (done) { | ||
iterTest(iterations, function (hrend: Array<number>) { | ||
avg[0] += hrend[0] | ||
avg[1] += hrend[1] | ||
|
||
console.info('Execution time (hr): %ds %dms', hrend[0], hrend[1] / 1000000) | ||
done() | ||
}) | ||
}, | ||
function () { | ||
console.info( | ||
'Average Execution time (hr): %ds %dms', | ||
avg[0] / samples, | ||
avg[1] / 1000000 / samples, | ||
) | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require('./checkpointing') | ||
require('./random') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[merkle-patricia-tree](README.md) | ||
|
||
# merkle-patricia-tree | ||
|
||
## Index | ||
|
||
### Modules | ||
|
||
* ["baseTrie"](modules/_basetrie_.md) | ||
* ["checkpointTrie"](modules/_checkpointtrie_.md) | ||
* ["secure"](modules/_secure_.md) |
Oops, something went wrong.