klaytn / caver-js

Official caver-js repository
GNU Lesser General Public License v3.0
114 stars 75 forks source link

Error: utils.isBN returns wrong boolean with an fake object #205

Closed skqksh closed 4 years ago

skqksh commented 4 years ago

Describe the bug

caver.utils.isBN returns 'true' but it should have to return 'false'

 const notBn = {}
notBn.constructor = {}
notBn.constructor.name = 'BN'
console.log(caver.utils.isBN(test))

How to reproduce same with above

Expected behavior caver.utils.isBN should work as like as BN.js works

Attachments web3.js already covered that

Environment (please complete the following information)

Additional context NA

jimni1222 commented 4 years ago

Hi :)

Is this issue related with https://github.com/ethereum/web3.js/issues/1777? I will apply this modification to caver-js. And also i will add test case what you describe above.

Thank you for reporting this issue !

jimni1222 commented 4 years ago

@skqksh Hi, PR is uploaded :) https://github.com/klaytn/caver-js/pull/207

If there is any opinion about this change, please feel free to comments on PR.