-
Notifications
You must be signed in to change notification settings - Fork 15
Uncaught TypeError: this.removeListener is not a function #4
Comments
Even with restarting geth, I'm still seeing occasional errors. This time there is more to them.
Where do I add |
I'm also getting the same problem when I run |
This seems like a mocha error. I would suggest looking here: Truffle might be just using an old version of mocha |
If I change my truffle-config.js to be just a simple I did a |
Opened trufflesuite/truffle#1705 to figure out why truffle is on mocha v4. I also changed my truffle-config.js to connect to the devnet geth and the tests ran to completion without any errors. I'm thinking it's more likely that the error is in web3-provider-engine or how truffle is trying to use it. Considering there is already one comment saying "HACK," I'm guessing we will need another. I wish async code had more useful tracebacks. Does anyone know how to get better logs out of mocha? |
I switched to using the websocket provider at https://github.com/MetaMask/provider-engine/blob/master/subproviders/websocket.js instead of the rpc provider and I think it's working. Truffle need this for subscribing to events. https://hanezu.github.io/posts/Enable-WebSocket-support-of-Ganache-CLI-and-Subscribe-to-Events.html |
Well the tests got further, but they got stuck somewhere in the middle of one that was minting gastoken. If I turn on debug logging, this is what I see:
I could let it run longer, but it doesn't look like it is doing anything. This is the test that passes fine against ganache:
|
@wysenynja After trufflesuite/ganache#280 got fixed - you can use dev-tools with Ganache (except for sol-profiler). Could you try that? I've updated an example repo. |
That certainly seems to be working better. It runs several passing tests, but then gives this error:
My problem is that I have artifacts from sol-compiler and also from truffle. Is there some way to have 2 artifact adapters? I also see |
At first I was thinking I could write a custom artifact adapter that tried truffle and then sol-compiler artifacts, but that won't be enough. I need to change https://github.com/0xProject/0x-monorepo/blob/development/packages/sol-tracing-utils/src/artifact_adapters/truffle_artifact_adapter.ts#L80 otherwise it won't let me get that far. |
Do I understand correctly that you have two types of artifacts in the same folder and truffleArtifactAdapter consumes artifacts from sol-compiler that have different version? |
More details at trufflesuite/truffle#1607 (comment) |
What if you just use |
I'll try going back to that. I liked having eth-gas-reporter's output though. |
Can we jump on a call to discuss that? |
I think there is a way to achieve all you need. I just need to understand it better |
I moved my contracts into the directory that sol-compiler is configured to build, but ran into another issue (one I had forgotten about: trufflesuite/truffle#1607 (comment)). For some reason truffle is able to compile contracts with
I'm too busy for a call today, but tomorrow afternoon (PST) works for me. I can go back to removing the experimental encoder from this contract, but I think I am going to need it for another contract later on. |
This definitely doesn't seem like the dev tools error. More like the one in truffle or converting script |
That error is something to do with the abi that sol-compiler outputs being different in some way than what the same contract under truffle outputs. I just mentioned it here since it's blocking. It should be easy to get a diff. The conversion script (trufflesuite/truffle#1607 (comment)) is very short and essentially just copies whats in one json file into another slightly different file. I'm not modifying any of the fields, so I would be really surprised if the bug is there. I got rid of the function that uses |
Sol-compiler outputs exactly the ABI it's getting from solidity compiler. It's dependent on the version of the solidity compiler you use. Solc-js has functions to migrate old ABI formats to new ones |
That's why I assumed that simply copy/paste of the abi from sol-compiler's output would be identical to truffle's. Both sol-compiler and my truffle-config.js are set to use 0.5.4. How would I be getting an older ABI format? And how I can tell what format I even have? sol-compiler says:
truffle-config.js:
Truffle's Migration.sol leads to a json artifact with:
While sol-compiler's output has an artifact with:
|
I would not be able to answer that without further research into the topic |
It could be that truffle is using native solc. Sol-compiler uses solcjs by default. You can tell it to |
I’ll try to use docker just to see what changes. My code is already in a docker container though haha.
Thanks for your help!
… On Feb 26, 2019, at 3:24 PM, Leonid Logvinov ***@***.***> wrote:
It could be that truffle is using native solc. Sol-compiler uses solcjs by default. You can tell it to useDockerisedSolc. It will speed up compilation of huge projects, but will require your env to have docker.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
You most probably will also be affected by that issue: 0xProject/0x-monorepo#1650 |
Interesting. Thanks. I'll try dropping everything to 0.5.0 and see what changes, too. |
Downgrading to 0.5.0 made no change. Neither did disabling solc optimizer. I started looking at solc-js' helper functions, but I'm not actually updating the abi (Both sides are 0.5.4) and so calling that doesn't look like it would do anything. Interestingly, I do have a contract written in 0.4.16, and the abi generated for it passes truffle's validation without any issue. truffle's IZrxExchange.json: https://gist.github.com/WyseNynja/bc809498444cb93fd52f93105ec40c58 sol-compiler's IZrxExchange.json: https://gist.github.com/WyseNynja/6dedecd5bf15904689951523bb182ee7 sol-compiler's IZrxExchange.json converted to a truffle artifact (fails to parse): https://gist.github.com/WyseNynja/693133309719362ec25792b05212913a As expected, the JSON is sorted differently. I'm not having much luck seeing why it thinks there are invalid "additionalProperties" though. AFAICT, the properties are the same for both json files. Who should I open a ticket about this with? Parse error:
|
Well this is really weird. I copy/pasted the abi out of the gists, sorted them with http://novicelab.org/jsonabc/, and compared them at https://jsoncompare.com/#!/diff/. AFAICT, they are identical after being sorted. This makes me think the bug must be in truffle's validation. It must do the validation slightly differently for artifacts generated the "normal" way. |
And here is the interface I'm trying to compile: https://gist.github.com/WyseNynja/e3a5eeee8e11983b603dc7e28243c0f2 It isn't finished and won't actually work fully against an actual exchange project, but it compiles under truffle without issue. |
Ok. This is weird. If I let truffle compile the artifact, copy the bin out of it and into a seperate file, remove the contract, and then add an external target like this:
Truffle fails to validate. I'm 99% sure this is a bug with truffle. It doesn't seem to want to validate contracts with ABIEncoderV2 even though it compiles them just fine. I'll make a simple test case and open the issue with them |
I've made a simple repo that fails with this same error and created an issue at trufflesuite/truffle#1774 |
So after upgrading to the latest versions of everything, using GancheProvider, and removing the contracts with ABIEncoderV2, my tests are able to run to completion without giving "this.removeListener is not a function" Also, I switched from using GanacheProvider to WebsocketProvider and it also works:
One of my tests is failing though. I am checking |
As per 0xProject#4, Truffle needs to be able to use subscriptions, and thus a websocket connection is needed.
Just seeing this now myself. Thanks to all previous commenters who figured out the issues! Raised PR #12 |
I also see this error in truffle 5.0.44 |
Because of #3, I had a test fail. I noticed the test after it failed with this short error:
The test succeeded on the first run, so I think this is something about test cleanup.
The text was updated successfully, but these errors were encountered: