Truffle - test: Cannot create property 'negative' on number '1'
See original GitHub issueIssue
There seems to be some terrible bugs on the current big number implementation, and it’s breaking tests.
Steps to Reproduce
My case was during a test, but i can also do it using truffle develop
with a simpler case:
> n = new web3.utils.BN('1'); n.sub('1')
/workspace/node_modules/truffle/build/cli.bundled.js:1315
num.negative = 0;
^
TypeError: Cannot create property 'negative' on string '1'
Seems to be some crazy internal error. Possible reference
Expected Behavior
Not an internal error
Environment
- Operating System: MacOS
- Ethereum client: ?
- Truffle version (
truffle version
): 5.0.12 - node version (
node --version
): v11.4.0 - npm version (
npm --version
):
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Calling web3.utils.BN.add gives error: Cannot create property ...
At truffle test, I am trying to add ...
Read more >Can't log struct member in truffle test - Ethereum Stack Exchange
You can fix it by adding parenthesis: let myMemberResult = (await this.contract.myMapping(id)).myMember;.
Read more >Test A Smart Contract With Truffle | by arjuna sky kok - Medium
So I'll show you how to write a smart contract with a normal text editor. Truffle is like a framework to build the...
Read more >web3.utils — web3.js 1.0.0 documentation
If all of the bits are 1, then the element might be in the data set, but we need to actually query the...
Read more >Unit Tests Fail Miserably - Contracts - OpenZeppelin Forum
I am now in the process of thoroughly testing my token before ... total supply: TypeError: Cannot set property 'negative' of undefined at...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @eggplantzzz , the workaround I’m using currently is to cast the string also into BN. Example:
@flockonus Thanks for the heads up! We’ll keep this in mind and follow the BN issue that you linked above.