Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
use new @trufflesuite/bigint-buffer (#1414)
Browse files Browse the repository at this point in the history
* use new @trufflesuite/bigint-buffer

* temporarily disable windows tools install

* temporarily revert to previous bigint-buffer lib

* remove msbuild tools

* remove line

* add basic test for bigint-buffer library

* force warning to test

* update warn message for test

* fix tests

* use sinon in test

* trying to force failure in CI

* unforce failed tests

* npm ci to install on PR

* update setup-node action version

* some logging and uninstalling

* correct spelling

* add back msbuild

* removed unnecessary installations

* use trufflesuite's bigint-buffer lib

* update package-lock

* correct bigint-buffer import

* Remove .only from test

Co-authored-by: David Murdoch <[email protected]>

* revert to windows-2019 version for tests

Co-authored-by: David Murdoch <[email protected]>
  • Loading branch information
MicaiahReid and davidmurdoch committed Nov 3, 2021
1 parent 0346754 commit 94e9572
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 81 deletions.
27 changes: 2 additions & 25 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,15 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Add msbuild to PATH
# we need msbuild tools for the `bigint-buffer` module
# we need msbuild tools for the `bcrypto` module
if: startsWith(matrix.os, 'windows-')
uses: microsoft/[email protected]

- name: install node tools
# we don't need to install the windows-build-tools package, as we
# already have almost everything we need. We only need to install
# python 2.7. Also windows-build-tools@4 fails to install because some
# resources it downloads no longer exist, and windows-build-tools@5
# fails to install Python (it will wait on the python installer forever)
if: startsWith(matrix.os, 'windows-')
uses: actions/setup-python@v2
with:
python-version: "2.7"

- name: install node-gyp
if: startsWith(matrix.os, 'windows-')
run: npm install --global [email protected]

- name: Set node config to use python2.7
if: startsWith(matrix.os, 'windows-')
run: npm config set python python2.7

- name: Set node config to set msvs_version to 2019
if: startsWith(matrix.os, 'windows-')
run: npm config set msvs_version 2019 --global

- run: npm ci
- run: npm run tsc
- run: npm test
Expand Down
38 changes: 16 additions & 22 deletions src/packages/ganache/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/packages/ganache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"webpack-cli": "4.5.0"
},
"dependencies": {
"bigint-buffer": "1.1.5",
"@trufflesuite/bigint-buffer": "1.1.9",
"bufferutil": "4.0.3",
"keccak": "3.0.1",
"leveldown": "5.6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/packages/ganache/webpack/webpack.node.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const config: webpack.Configuration = merge({}, base, {
},
externals: [
//#region dependencies that have the potential to compile something at install time
"bigint-buffer",
"@trufflesuite/bigint-buffer",
"leveldown",
"secp256k1",
"keccak",
Expand Down
147 changes: 123 additions & 24 deletions src/packages/utils/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
},
"scripts": {
"tsc": "ttsc --build",
"test": "echo 'no tests'"
"test": "npm run mocha",
"mocha": "cross-env TS_NODE_COMPILER=ttypescript TS_NODE_FILES=true mocha -s 0 -t 0 --exit --check-leaks --throw-deprecation --trace-warnings --require ts-node/register 'tests/**/*.test.ts'"
},
"bugs": {
"url": "https://github.com/trufflesuite/ganache/issues"
Expand Down Expand Up @@ -56,11 +57,12 @@
"@types/seedrandom": "3.0.1",
"cross-env": "7.0.3",
"mocha": "8.4.0",
"sinon": "11.1.2",
"ts-node": "9.1.1",
"ttypescript": "1.5.12",
"typescript": "4.1.3"
},
"optionalDependencies": {
"bigint-buffer": "1.1.5"
"@trufflesuite/bigint-buffer": "1.1.9"
}
}
2 changes: 1 addition & 1 deletion src/packages/utils/src/common.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { toBufferBE, toBigIntBE } from "bigint-buffer";
export { toBufferBE, toBigIntBE } from "@trufflesuite/bigint-buffer";
2 changes: 1 addition & 1 deletion src/packages/utils/src/utils/buffer-to-bigint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toBigIntBE } from "bigint-buffer";
import { toBigIntBE } from "@trufflesuite/bigint-buffer";
/**
* note: this doesn't handle negative values
* @param value Buffer representation of a bigint, most-significant bit first (Big-endian)
Expand Down
Loading

0 comments on commit 94e9572

Please sign in to comment.