I just pulled down this project, npm installed dependencies (using Node 6), and tried to run the test suite. It fails, in a number of ways:
Application Server Tests Fail
The test/app.js tests don't fail to run for me and others I've asked to verify the issue with the following output:
Application Server
GET /
{ MongoError: pool is draining, new operations prohibited
at Pool.write (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/core/connection/pool.js:845:8)
at _command (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/core/wireprotocol/command.js:128:10)
at Object.command (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/core/wireprotocol/command.js:28:5)
at Server.command (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/core/topologies/server.js:632:16)
at Server.command (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/topologies/topology_base.js:296:25)
at DropDatabaseOperation.execute (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/operations/command.js:112:19)
at DropDatabaseOperation.execute (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/operations/drop.js:20:11)
at executeOperation (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/operations/execute_operation.js:77:17)
at Db.dropDatabase (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/db.js:678:10)
at NativeConnection.dropDatabase (/Users/sean/dev/key-recovery-service-v2/node_modules/mongoose/lib/connection.js:459:11)
at immediate (/Users/sean/dev/key-recovery-service-v2/node_modules/mongoose/lib/connection.js:486:14)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9) name: 'MongoError' }
{ MongoError: pool is draining, new operations prohibited
at Pool.write (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/core/connection/pool.js:845:8)
at _command (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/core/wireprotocol/command.js:128:10)
at Object.command (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/core/wireprotocol/command.js:28:5)
at Server.command (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/core/topologies/server.js:632:16)
at Server.command (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/topologies/topology_base.js:296:25)
at DropDatabaseOperation.execute (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/operations/command.js:112:19)
at DropDatabaseOperation.execute (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/operations/drop.js:20:11)
at executeOperation (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/operations/execute_operation.js:77:17)
at Db.dropDatabase (/Users/sean/dev/key-recovery-service-v2/node_modules/mongodb/lib/db.js:678:10)
at NativeConnection.dropDatabase (/Users/sean/dev/key-recovery-service-v2/node_modules/mongoose/lib/connection.js:459:11)
at immediate (/Users/sean/dev/key-recovery-service-v2/node_modules/mongoose/lib/connection.js:486:14)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9) name: 'MongoError' }
/Users/sean/dev/key-recovery-service-v2/node_modules/mocha/lib/runner.js:726
err.uncaught = true;
^
TypeError: Cannot create property 'uncaught' on string 'abort({"name":"MongoError"}). Build with -s ASSERTIONS=1 for more info.'
at Runner.uncaught (/Users/sean/dev/key-recovery-service-v2/node_modules/mocha/lib/runner.js:726:16)
at process.uncaught (/Users/sean/dev/key-recovery-service-v2/node_modules/mocha/lib/runner.js:839:10)
at emitOne (events.js:96:13)
at process.emit (events.js:188:7)
at process._fatalException (bootstrap_node.js:300:26)
npm ERR! Test failed. See above for more details.
Missing EthereumJS Util Dependency
If I comment out/or remove the test/app.js file and re-run tests, I get the following errors (among others):
32 passing (2s)
7 failing
...
6) Offline Signing Tool
half-signs an ETH transaction:
Error: Ethereum library required for operation is not available. Please install "ethereumjs-util".
7) Offline Signing Tool
half-signs an ERC-20 transaction:
Error: Ethereum library required for operation is not available. Please install "ethereumjs-util".
I don't understand how this library is working without ethereujs-util in the project's package.json..
So, if I npm install ethereumjs-util and re-run the tests, I still get 5 errors:
34 passing (2s)
5 failing
1) Offline Signing Tool
cosigns a teth transaction:
TypeError: private key should be a Buffer
at TypeError (native)
at Object.exports.isBuffer (node_modules/secp256k1/lib/assert.js:14:38)
at Object.sign (node_modules/secp256k1/lib/index.js:172:14)
at Object.exports.ecsign (node_modules/ethereumjs-tx/node_modules/ethereumjs-util/dist/index.js:369:23)
at Transaction.sign (node_modules/ethereumjs-tx/es5/index.js:252:23)
at signEthTx (app/sign.js:241:15)
at Object.handleSignEthereum (app/sign.js:209:10)
at Context.<anonymous> (test/sign.js:43:31)
2) Offline Signing Tool
cosigns a txrp transaction:
/Users/sean/dev/krsv2/node_modules/ripple-lib/node_modules/ws/lib/websocket.js:347
...options
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at require (internal/module.js:20:19)
at Object.<anonymous> (node_modules/ripple-lib/node_modules/ws/index.js:3:19)
at require (internal/module.js:20:19)
at Object.<anonymous> (node_modules/ripple-lib/dist/npm/common/connection.js:25:30)
at require (internal/module.js:20:19)
at Object.<anonymous> (node_modules/ripple-lib/dist/npm/common/index.js:40:20)
at require (internal/module.js:20:19)
at Object.<anonymous> (node_modules/ripple-lib/dist/npm/api.js:23:18)
at require (internal/module.js:20:19)
at Object.<anonymous> (node_modules/ripple-lib/dist/npm/index.js:3:13)
at require (internal/module.js:20:19)
at Object.handleSignXrp (app/sign.js:301:21)
at Context.<anonymous> (test/sign.js:51:31)
3) Offline Signing Tool
cosigns an eos transaction:
TypeError: Invalid private key
at PrivateKey (node_modules/eosjs-ecc/lib/key_private.js:53:11)
at Function.Signature.signHash (node_modules/eosjs-ecc/lib/signature.js:240:16)
at Function.Signature.sign (node_modules/eosjs-ecc/lib/signature.js:219:20)
at Object.handleSignEos (app/sign.js:292:35)
at Context.<anonymous> (test/sign.js:75:31)
4) Offline Signing Tool
cosigns a trx transaction:
Error: Failed to sign transaction via helper.
5) Offline Signing Tool
cosigns an erc20 transaction:
TypeError: private key should be a Buffer
at TypeError (native)
at Object.exports.isBuffer (node_modules/secp256k1/lib/assert.js:14:38)
at Object.sign (node_modules/secp256k1/lib/index.js:172:14)
at Object.exports.ecsign (node_modules/ethereumjs-tx/node_modules/ethereumjs-util/dist/index.js:369:23)
at Transaction.sign (node_modules/ethereumjs-tx/es5/index.js:252:23)
at signEthTx (app/sign.js:241:15)
at Object.handleSignErc20 (app/sign.js:372:10)
at Context.<anonymous> (test/sign.js:93:31)
Definition of Done
Let's figure out what it takes to get these tests passing again. My loose interpretation of this is some form of:
Get ethereumjs-util into our package.json
Update tests to leverage new signing APIs from that package.
Figure out what is going on with the tests/app.js test suite.
Perhaps update testing documentation in the README.
I was a bit confused about point 2. I can update app/sign.js to leverage the new signing API from ethereumjs-util, but I am not sure what it implies to update tests.
Context
I just pulled down this project, npm installed dependencies (using Node 6), and tried to run the test suite. It fails, in a number of ways:
Application Server Tests Fail
The
test/app.js
tests don't fail to run for me and others I've asked to verify the issue with the following output:Missing EthereumJS Util Dependency
If I comment out/or remove the
test/app.js
file and re-run tests, I get the following errors (among others):I don't understand how this library is working without
ethereujs-util
in the project'spackage.json.
.So, if I
npm install ethereumjs-util
and re-run the tests, I still get 5 errors:Definition of Done
Let's figure out what it takes to get these tests passing again. My loose interpretation of this is some form of:
ethereumjs-util
into our package.jsontests/app.js
test suite.README
.And there is an outstanding ticket for our BRE team to get some form of automated CI running for this project here: https://bitgoinc.atlassian.net/browse/BG-18658