question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting a typeError when running `truffle test` after update

See original GitHub issue

Coming back from vacations, I just updated my truffle install from v5.1.4 to v5.1.7.

When running truffle tests (that used to work) I’m now getting:

  "before all" hook: prepare suite:
     TypeError: Cannot read property 'typeClass' of undefined
      at abiSizeAndAllocate (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:91:1)
      at abiSizeAndAllocate (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:199:65)
      at allocateMembers (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:60:63)
      at allocateDataArguments (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:370:1)
      at allocateCalldataAndReturndata (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:301:60)
      at getCalldataAllocationsForContract (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:525:1)
      at Object.getCalldataAllocations (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:563:1)
      at new WireDecoder (node_modules/truffle/build/webpack:/packages/decoder/dist/decoders.js:189:1)
      at Object.<anonymous> (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:213:1)
      at step (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:164:1)
      at Object.next (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:145:45)
      at /home/amxx/Work/iExec/code/PoCo-dev/node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:139:1
      at new Promise (<anonymous>)
      at __awaiter (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:135:1)
      at Object.forProject (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:211:1)
      at TestRunner.initialize (node_modules/truffle/build/webpack:/packages/core/lib/testing/testrunner.js:80:1)
      at process._tickCallback (internal/process/next_tick.js:68:7)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
Amxxcommented, Feb 17, 2020

Using 5.1.4 was ok for now, but it’s looking like it’s not going to support my transition to ^0.6.0.

@gnidan The code that triggers that is not public, but I could send you an archive with it

0reactions
haltman-atcommented, Apr 1, 2020

Well, I mentioned it to them on their Gitter, but I didn’t open an issue because I’d be missing one key thing: A reproduction example! (I couldn’t use Amxx’s because his was sent to us privately.) So, it would be better if you could open the issue. But if you have a reproduction example, I suppose I could do it.

As for telling the two errors apart… yeah, they don’t really belong in the same thread; sometimes unrelated errors just end up grouped like that. 😕 They don’t actually resemble each other, just the new error message (from the ID clash) never got posted here because some of this discussion was conducted with Amxx in email.

The error that resulted from the ID clash – copying it in from Amxx’s email – looked like this:

     TypeError: Cannot read property 'find' of undefined
      at linearizedBaseContracts.reduce (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:263:1)
      at Array.reduce (<anonymous>)
      at allocateCalldataAndReturndata (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:253:1)
      at getCalldataAllocationsForContract (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:530:1)
      at Object.getCalldataAllocations (node_modules/truffle/build/webpack:/packages/codec/dist/lib/abi-data/allocate/index.js:568:1)
      at new WireDecoder (node_modules/truffle/build/webpack:/packages/decoder/dist/decoders.js:203:1)
      at Object.<anonymous> (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:223:1)
      at step (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:164:1)
      at Object.next (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:145:45)
      at /home/amxx/Work/iExec/code/_archive/node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:139:1
      at new Promise (<anonymous>)
      at __awaiter (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:135:1)
      at Object.forProject (node_modules/truffle/build/webpack:/packages/decoder/dist/index.js:219:1)
      at TestRunner.initialize (node_modules/truffle/build/webpack:/packages/core/lib/testing/testrunner.js:84:1)
      at process._tickCallback (internal/process/next_tick.js:68:7)

So, if you were getting the first of these errors, rather than the second, it’s more likely a bad ABI.

Anyway, I would encourage you to submit the issue yourself (or @Amxx, I would still encourage you to do so, with both issues!) but if you can send us a reproduction example I might have time to inspect it and submit the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Some Truffle tests not running after truffle init (Mac OSX ...
I have installed Testrpc and Truffle globally with NPM. I ran testrpc in a terminal window and ran truffle test. I get 2...
Read more >
Truffle test fails with TypeError - solidity - Stack Overflow
I initiated an empty truffle project, placed the contract and get that compiled successfully. however truffle test gives below error.
Read more >
ConsenSys/truffle - Gitter
It was working before, but after adding one more function in my smart contract and it stopped working. Gas limit is max.
Read more >
Write JavaScript tests - Truffle Suite
Before each contract() function is run, your contracts are redeployed to the ... { from: accountOne }); // Get balances of first and...
Read more >
Migrating from Truffle | Ethereum development environment ...
Using these you can run your existing tests with Hardhat. If you want to learn the details of writing Truffle tests to run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found