Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Don't mutate the elliptic curve prototype with get* additions #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Empact
Copy link

@Empact Empact commented May 3, 2018

Point's prototype is set to the prototype of ec('secp256k1').curve.point(), which means the library itself is global state, and mutation to it is shared across users of 'elliptic'.

This is not generally a problem, for example, with validate it's a simple set, so the greatest risk is that it will be directly overwritten.

But in the case of getX and getY, both methods are overwritten with others that depend on the prior implementation as stored in _get*. If this happens twice, then the implementation of _getX is replaced with something that depends on a call to _getX, and the callers is stuck in an infinite loop.

Here's an example of the infinite loop, which I came across by interaction between bitcore-lib-dash and zcash-bitcore-lib, but by inspection it seems they are both downstream of this code.

at Point.getX [as _getX] (/bitcore-lib/lib/crypto/point.js:75:22)
    at Point.getX [as _getX] (/bitcore-lib/lib/crypto/point.js:75:22)
    at Point.getX [as _getX] (/bitcore-lib/lib/crypto/point.js:75:22)
    at Point.getX [as _getX] (/bitcore-lib/lib/crypto/point.js:75:22)
    at Point.getX (/zcash-bitcore-lib/lib/crypto/point.js:75:22)
    at Point.validate (/zcash-bitcore-lib/lib/crypto/point.js:105:12)
    at Function.fromX (/bitcore-lib/lib/crypto/point.js:40:9)
    at Function.PublicKey._transformX (/bitcore-lib/lib/publickey.js:192:22)
    at Function.PublicKey._transformDER (/bitcore-lib/lib/publickey.js:168:22)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:83:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at HDPublicKey._buildFromBuffers (/bitcore-lib/lib/hdpublickey.js:321:19)
    at HDPublicKey._buildFromSerialized (/bitcore-lib/lib/hdpublickey.js:273:15)
    at new HDPublicKey (/bitcore-lib/lib/hdpublickey.js:45:21)

Point's prototype is set to the prototype of ec('secp256k1').curve.point(), which means mutation to it is shared across users of 'elliptic' via the in-memory representation of those objects.

This is not generally a problem, for example, with `validate` it's a simple set, so the greatest risk is that it will be directly overwritten.

But in the case of `getX` and `getY`, both methods are overwritten with others that depend on the prior implementation as stored in `_get*`. If this happens twice, then the implementation of `_getX` is replaced with something that depends on a call to `_getX`, and the callers is stuck in an infinite loop.
@Empact
Copy link
Author

Empact commented May 3, 2018

I would like to also remove the validate set, but if I do tests fail for reasons I don't understand, so I'm punting this to you.

1) PublicKey validating errors on creation errors if an invalid point is provided:
     AssertionError: expected [Function] to throw an error
      at Context.<anonymous> (test/publickey.js:31:22)

  2) PublicKey validating errors on creation errors if a point not on the secp256k1 curve is provided:
     AssertionError: expected [Function] to throw an error
      at Context.<anonymous> (test/publickey.js:37:22)

  3) PublicKey #getValidationError should recieve an invalid point error:
     AssertionError: expected undefined to exist
  

  4) PublicKey #getValidationError should recieve a boolean as false:

      AssertionError: expected true to equal false
      + expected - actual

      -true
      +false
      
      at Context.<anonymous> (test/publickey.js:140:20)

  5) PublicKey #validate should throw an error if pubkey is invalid:
     AssertionError: expected [Function] to throw an error
      at Context.<anonymous> (test/publickey.js:412:22)

  6) PublicKey #validate should throw an error if pubkey is invalid:
     AssertionError: expected [Function] to throw an error
      at Context.<anonymous> (test/publickey.js:419:22)

  7) PublicKey #validate should throw an error if pubkey is infinity:
     AssertionError: expected [Function] to throw an error
      at Context.<anonymous> (test/publickey.js:425:22)

  8) Point #validate should describe this point as invalid because of zero y:
     AssertionError: expected [Function] to throw an error
      at Context.<anonymous> (test/crypto/point.js:135:22)

  9) Point #validate should describe this point as invalid because of invalid y:
     AssertionError: expected [Function] to throw an error
      at Context.<anonymous> (test/crypto/point.js:144:22)

  10) Point #validate should describe this point as invalid because out of curve bounds:
     AssertionError: expected [Function] to throw an error
      at Context.<anonymous> (test/crypto/point.js:158:22)

@Empact
Copy link
Author

Empact commented May 3, 2018

I also tried adding an intermediate object into the prototype chain, by wrapping prototype = Object.getPrototypeOf( like so: prototype = Object.create(Object.getPrototypeOf(, but that fails as follows:

$ yarn test
yarn run v1.6.0
$ gulp test
[01:15:29] Using gulpfile /bitcore-lib/gulpfile.js
[01:15:29] Starting 'test'...
[01:15:29] Starting 'test:node'...
/bitcore-lib/node_modules/bn.js/lib/bn.js:1036
  var comb10MulTo = function comb10MulTo (self, num, out) {
                                         ^

RangeError: Maximum call stack size exceeded
    at comb10MulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1036:42)
    at BN.mulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1664:13)
    at BN.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:1876:17)
    at Red.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:3211:24)
    at Red.sqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:3219:17)
    at BN.redSqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:2895:21)
    at ShortCurve.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/short.js:215:15)
    at Point.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/base.js:261:21)
    at new Point (/bitcore-lib/lib/crypto/point.js:29:9)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:206:15)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyA[01:15:30] 'test:node' errored after 855 ms
[01:15:30] Error in plugin 'gulp-mocha'
Message:
    Command failed: mocha /bitcore-lib/test/address.js /bitcore-lib/test/docs.js /bitcore-lib/test/hdkeys.js /bitcore-lib/test/hdprivatekey.js /bitcore-lib/test/hdpublickey.js /bitcore-lib/test/index.js /bitcore-lib/test/networks.js /bitcore-lib/test/opcode.js /bitcore-lib/test/privatekey.js /bitcore-lib/test/publickey.js /bitcore-lib/test/unit.js /bitcore-lib/test/uri.js /bitcore-lib/test/block/block.js /bitcore-lib/test/block/blockheader.js /bitcore-lib/test/block/merkleblock.js /bitcore-lib/test/crypto/bn.js /bitcore-lib/test/crypto/ecdsa.js /bitcore-lib/test/crypto/hash.js /bitcore-lib/test/crypto/point.js /bitcore-lib/test/crypto/random.js /bitcore-lib/test/crypto/signature.js /bitcore-lib/test/data/blk86756-testnet.js /bitcore-lib/test/data/merkleblocks.js /bitcore-lib/test/encoding/base58.js /bitcore-lib/test/encoding/base58check.js /bitcore-lib/test/encoding/bufferreader.js /bitcore-lib/test/encoding/bufferwriter.js /bitcore-lib/test/encoding/varint.js /bitcore-lib/test/script/interpreter.js /bitcore-lib/test/script/script.js /bitcore-lib/test/transaction/deserialize.js /bitcore-lib/test/transaction/output.js /bitcore-lib/test/transaction/sighash.js /bitcore-lib/test/transaction/sighashwitness.js /bitcore-lib/test/transaction/signature.js /bitcore-lib/test/transaction/transaction.js /bitcore-lib/test/transaction/unspentoutput.js /bitcore-lib/test/util/buffer.js /bitcore-lib/test/util/js.js /bitcore-lib/test/util/preconditions.js /bitcore-lib/test/transaction/input/input.js /bitcore-lib/test/transaction/input/multisig.js /bitcore-lib/test/transaction/input/multisigscripthash.js /bitcore-lib/test/transaction/input/publickey.js /bitcore-lib/test/transaction/input/publickeyhash.js --colors --reporter=spec
/bitcore-lib/node_modules/bn.js/lib/bn.js:1036
  var comb10MulTo = function comb10MulTo (self, num, out) {
                                         ^

RangeError: Maximum call stack size exceeded
    at comb10MulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1036:42)
    at BN.mulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1664:13)
    at BN.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:1876:17)
    at Red.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:3211:24)
    at Red.sqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:3219:17)
    at BN.redSqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:2895:21)
    at ShortCurve.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/short.js:215:15)
    at Point.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/base.js:261:21)
    at new Point (/bitcore-lib/lib/crypto/point.js:29:9)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:206:15)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyA
Details:
    code: 1
    killed: false
    stdout: 
    stderr: /bitcore-lib/node_modules/bn.js/lib/bn.js:1036
  var comb10MulTo = function comb10MulTo (self, num, out) {
                                         ^

RangeError: Maximum call stack size exceeded
    at comb10MulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1036:42)
    at BN.mulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1664:13)
    at BN.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:1876:17)
    at Red.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:3211:24)
    at Red.sqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:3219:17)
    at BN.redSqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:2895:21)
    at ShortCurve.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/short.js:215:15)
    at Point.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/base.js:261:21)
    at new Point (/bitcore-lib/lib/crypto/point.js:29:9)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:206:15)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyA
    failed: true
    signal: null
    cmd: mocha /bitcore-lib/test/address.js /bitcore-lib/test/docs.js /bitcore-lib/test/hdkeys.js /bitcore-lib/test/hdprivatekey.js /bitcore-lib/test/hdpublickey.js /bitcore-lib/test/index.js /bitcore-lib/test/networks.js /bitcore-lib/test/opcode.js /bitcore-lib/test/privatekey.js /bitcore-lib/test/publickey.js /bitcore-lib/test/unit.js /bitcore-lib/test/uri.js /bitcore-lib/test/block/block.js /bitcore-lib/test/block/blockheader.js /bitcore-lib/test/block/merkleblock.js /bitcore-lib/test/crypto/bn.js /bitcore-lib/test/crypto/ecdsa.js /bitcore-lib/test/crypto/hash.js /bitcore-lib/test/crypto/point.js /bitcore-lib/test/crypto/random.js /bitcore-lib/test/crypto/signature.js /bitcore-lib/test/data/blk86756-testnet.js /bitcore-lib/test/data/merkleblocks.js /bitcore-lib/test/encoding/base58.js /bitcore-lib/test/encoding/base58check.js /bitcore-lib/test/encoding/bufferreader.js /bitcore-lib/test/encoding/bufferwriter.js /bitcore-lib/test/encoding/varint.js /bitcore-lib/test/script/interpreter.js /bitcore-lib/test/script/script.js /bitcore-lib/test/transaction/deserialize.js /bitcore-lib/test/transaction/output.js /bitcore-lib/test/transaction/sighash.js /bitcore-lib/test/transaction/sighashwitness.js /bitcore-lib/test/transaction/signature.js /bitcore-lib/test/transaction/transaction.js /bitcore-lib/test/transaction/unspentoutput.js /bitcore-lib/test/util/buffer.js /bitcore-lib/test/util/js.js /bitcore-lib/test/util/preconditions.js /bitcore-lib/test/transaction/input/input.js /bitcore-lib/test/transaction/input/multisig.js /bitcore-lib/test/transaction/input/multisigscripthash.js /bitcore-lib/test/transaction/input/publickey.js /bitcore-lib/test/transaction/input/publickeyhash.js --colors --reporter=spec
    timedOut: false
[01:15:30] 'test' errored after 858 ms
[01:15:30] Error in plugin 'run-sequence(test:node)'
Message:
    Command failed: mocha /bitcore-lib/test/address.js /bitcore-lib/test/docs.js /bitcore-lib/test/hdkeys.js /bitcore-lib/test/hdprivatekey.js /bitcore-lib/test/hdpublickey.js /bitcore-lib/test/index.js /bitcore-lib/test/networks.js /bitcore-lib/test/opcode.js /bitcore-lib/test/privatekey.js /bitcore-lib/test/publickey.js /bitcore-lib/test/unit.js /bitcore-lib/test/uri.js /bitcore-lib/test/block/block.js /bitcore-lib/test/block/blockheader.js /bitcore-lib/test/block/merkleblock.js /bitcore-lib/test/crypto/bn.js /bitcore-lib/test/crypto/ecdsa.js /bitcore-lib/test/crypto/hash.js /bitcore-lib/test/crypto/point.js /bitcore-lib/test/crypto/random.js /bitcore-lib/test/crypto/signature.js /bitcore-lib/test/data/blk86756-testnet.js /bitcore-lib/test/data/merkleblocks.js /bitcore-lib/test/encoding/base58.js /bitcore-lib/test/encoding/base58check.js /bitcore-lib/test/encoding/bufferreader.js /bitcore-lib/test/encoding/bufferwriter.js /bitcore-lib/test/encoding/varint.js /bitcore-lib/test/script/interpreter.js /bitcore-lib/test/script/script.js /bitcore-lib/test/transaction/deserialize.js /bitcore-lib/test/transaction/output.js /bitcore-lib/test/transaction/sighash.js /bitcore-lib/test/transaction/sighashwitness.js /bitcore-lib/test/transaction/signature.js /bitcore-lib/test/transaction/transaction.js /bitcore-lib/test/transaction/unspentoutput.js /bitcore-lib/test/util/buffer.js /bitcore-lib/test/util/js.js /bitcore-lib/test/util/preconditions.js /bitcore-lib/test/transaction/input/input.js /bitcore-lib/test/transaction/input/multisig.js /bitcore-lib/test/transaction/input/multisigscripthash.js /bitcore-lib/test/transaction/input/publickey.js /bitcore-lib/test/transaction/input/publickeyhash.js --colors --reporter=spec
/bitcore-lib/node_modules/bn.js/lib/bn.js:1036
  var comb10MulTo = function comb10MulTo (self, num, out) {
                                         ^

RangeError: Maximum call stack size exceeded
    at comb10MulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1036:42)
    at BN.mulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1664:13)
    at BN.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:1876:17)
    at Red.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:3211:24)
    at Red.sqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:3219:17)
    at BN.redSqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:2895:21)
    at ShortCurve.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/short.js:215:15)
    at Point.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/base.js:261:21)
    at new Point (/bitcore-lib/lib/crypto/point.js:29:9)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:206:15)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyA
Details:
    code: 1
    killed: false
    stdout: 
    stderr: /bitcore-lib/node_modules/bn.js/lib/bn.js:1036
  var comb10MulTo = function comb10MulTo (self, num, out) {
                                         ^

RangeError: Maximum call stack size exceeded
    at comb10MulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1036:42)
    at BN.mulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1664:13)
    at BN.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:1876:17)
    at Red.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:3211:24)
    at Red.sqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:3219:17)
    at BN.redSqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:2895:21)
    at ShortCurve.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/short.js:215:15)
    at Point.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/base.js:261:21)
    at new Point (/bitcore-lib/lib/crypto/point.js:29:9)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:206:15)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyA
    failed: true
    signal: null
    cmd: mocha /bitcore-lib/test/address.js /bitcore-lib/test/docs.js /bitcore-lib/test/hdkeys.js /bitcore-lib/test/hdprivatekey.js /bitcore-lib/test/hdpublickey.js /bitcore-lib/test/index.js /bitcore-lib/test/networks.js /bitcore-lib/test/opcode.js /bitcore-lib/test/privatekey.js /bitcore-lib/test/publickey.js /bitcore-lib/test/unit.js /bitcore-lib/test/uri.js /bitcore-lib/test/block/block.js /bitcore-lib/test/block/blockheader.js /bitcore-lib/test/block/merkleblock.js /bitcore-lib/test/crypto/bn.js /bitcore-lib/test/crypto/ecdsa.js /bitcore-lib/test/crypto/hash.js /bitcore-lib/test/crypto/point.js /bitcore-lib/test/crypto/random.js /bitcore-lib/test/crypto/signature.js /bitcore-lib/test/data/blk86756-testnet.js /bitcore-lib/test/data/merkleblocks.js /bitcore-lib/test/encoding/base58.js /bitcore-lib/test/encoding/base58check.js /bitcore-lib/test/encoding/bufferreader.js /bitcore-lib/test/encoding/bufferwriter.js /bitcore-lib/test/encoding/varint.js /bitcore-lib/test/script/interpreter.js /bitcore-lib/test/script/script.js /bitcore-lib/test/transaction/deserialize.js /bitcore-lib/test/transaction/output.js /bitcore-lib/test/transaction/sighash.js /bitcore-lib/test/transaction/sighashwitness.js /bitcore-lib/test/transaction/signature.js /bitcore-lib/test/transaction/transaction.js /bitcore-lib/test/transaction/unspentoutput.js /bitcore-lib/test/util/buffer.js /bitcore-lib/test/util/js.js /bitcore-lib/test/util/preconditions.js /bitcore-lib/test/transaction/input/input.js /bitcore-lib/test/transaction/input/multisig.js /bitcore-lib/test/transaction/input/multisigscripthash.js /bitcore-lib/test/transaction/input/publickey.js /bitcore-lib/test/transaction/input/publickeyhash.js --colors --reporter=spec
    timedOut: false
Stack:
Error: Command failed: mocha /bitcore-lib/test/address.js /bitcore-lib/test/docs.js /bitcore-lib/test/hdkeys.js /bitcore-lib/test/hdprivatekey.js /bitcore-lib/test/hdpublickey.js /bitcore-lib/test/index.js /bitcore-lib/test/networks.js /bitcore-lib/test/opcode.js /bitcore-lib/test/privatekey.js /bitcore-lib/test/publickey.js /bitcore-lib/test/unit.js /bitcore-lib/test/uri.js /bitcore-lib/test/block/block.js /bitcore-lib/test/block/blockheader.js /bitcore-lib/test/block/merkleblock.js /bitcore-lib/test/crypto/bn.js /bitcore-lib/test/crypto/ecdsa.js /bitcore-lib/test/crypto/hash.js /bitcore-lib/test/crypto/point.js /bitcore-lib/test/crypto/random.js /bitcore-lib/test/crypto/signature.js /bitcore-lib/test/data/blk86756-testnet.js /bitcore-lib/test/data/merkleblocks.js /bitcore-lib/test/encoding/base58.js /bitcore-lib/test/encoding/base58check.js /bitcore-lib/test/encoding/bufferreader.js /bitcore-lib/test/encoding/bufferwriter.js /bitcore-lib/test/encoding/varint.js /bitcore-lib/test/script/interpreter.js /bitcore-lib/test/script/script.js /bitcore-lib/test/transaction/deserialize.js /bitcore-lib/test/transaction/output.js /bitcore-lib/test/transaction/sighash.js /bitcore-lib/test/transaction/sighashwitness.js /bitcore-lib/test/transaction/signature.js /bitcore-lib/test/transaction/transaction.js /bitcore-lib/test/transaction/unspentoutput.js /bitcore-lib/test/util/buffer.js /bitcore-lib/test/util/js.js /bitcore-lib/test/util/preconditions.js /bitcore-lib/test/transaction/input/input.js /bitcore-lib/test/transaction/input/multisig.js /bitcore-lib/test/transaction/input/multisigscripthash.js /bitcore-lib/test/transaction/input/publickey.js /bitcore-lib/test/transaction/input/publickeyhash.js --colors --reporter=spec
/bitcore-lib/node_modules/bn.js/lib/bn.js:1036
  var comb10MulTo = function comb10MulTo (self, num, out) {
                                         ^

RangeError: Maximum call stack size exceeded
    at comb10MulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1036:42)
    at BN.mulTo (/bitcore-lib/node_modules/bn.js/lib/bn.js:1664:13)
    at BN.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:1876:17)
    at Red.mul (/bitcore-lib/node_modules/bn.js/lib/bn.js:3211:24)
    at Red.sqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:3219:17)
    at BN.redSqr (/bitcore-lib/node_modules/bn.js/lib/bn.js:2895:21)
    at ShortCurve.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/short.js:215:15)
    at Point.validate (/bitcore-lib/node_modules/elliptic/lib/elliptic/curve/base.js:261:21)
    at new Point (/bitcore-lib/lib/crypto/point.js:29:9)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:206:15)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyArgs (/bitcore-lib/lib/publickey.js:79:22)
    at new PublicKey (/bitcore-lib/lib/publickey.js:50:19)
    at Function.PublicKey._transformObject (/bitcore-lib/lib/publickey.js:207:10)
    at PublicKey._classifyA
    at Promise.all.then.arr (/bitcore-lib/node_modules/execa/index.js:210:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
error Command failed with exit code 1.

@matiu
Copy link
Contributor

matiu commented May 3, 2018

Hi,

thanks a lot for the insight.

I think I have hit this problem before when bundling bitcore-lib and bitcore-lib-cash on the same JS using webpack.

we will review the PR soon. Thanks again!

@oxfn
Copy link

oxfn commented Sep 17, 2018

Greate improvement, thank you, @Empact! Currently using of bitcore-lib and it's forks simultaneously in multi-currency wallet becomes hell because of this problem.

@mohammadrafigh
Copy link

mohammadrafigh commented Oct 19, 2018

I think the same should also apply to bn.js

I hope all other forks merge this one rapidly.

@Empact
Copy link
Author

Empact commented Oct 20, 2018

Yeah, ideally we should make upstream libraries completely isolated / independent. Could do that by using composition instead of inheritance.

@mohammadrafigh
Copy link

mohammadrafigh commented Oct 20, 2018 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants