ScopeLift / endaoment

🍶An Interest Earning, Money Streaming, DeFi Enabled DAO
https://endaoment-app.web.app/
MIT License
14 stars 8 forks source link

Initial Contract & Testing Setup #14

Closed apbendi closed 4 years ago

apbendi commented 4 years ago

As a starting point for the contract setup, I imported the Moloch sources with OZ imports (as we did previously) and set up testing based on the OpenZepplin helpers from a forked ganache. Let me know what you think!

apbendi commented 4 years ago

Oh boy, here we go again! Yes, works for me. What version of ganache-cli are you using? You have an Infura id defined in your .env?

On Apr 20, 2020, at 5:43 PM, Matt notifications@github.com wrote:

 @mds1 commented on this pull request.

Do the tests pass for you? When I pull down the repo and run npm test it exits with the error below. Says it timed out so I bumped it up from 10000 to 100000 but get the same error

Moloch (node:57713) UnhandledPromiseRejectionWarning: Error: Unhandled server error at Object.default_1 [as default] (/Users/mds/Documents/projects/endaoment/node_modules/@openzeppelin/test-environment/src/setup-ganache.ts:68:13) at process._tickCallback (internal/process/next_tick.js:68:7) (node:57713) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:57713) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 1) "before all" hook for "should see the deployed Moloch contract"

0 passing (10s) 1 failing

1) Moloch "before all" hook for "should see the deployed Moloch contract": Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/mds/Documents/projects/endaoment/test/endaoment-test.js) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

mds1 commented 4 years ago

Yep, INFURA_ID is defined, using Ganache CLI v6.9.1 (ganache-core: 2.10.2)

abcoathup commented 4 years ago

Test passes with timeout disabled or increased.

See details in the forum: https://forum.openzeppelin.com/t/tests-are-failing-using-ganache-fork-with-openzeppelin-test-environment-with-a-timeout-error/2704/4?u=abcoathup

mds1 commented 4 years ago

@apbendi Ok got everything working now. Made some changes to the package.json scripts to help prevent some of the issues I was having

@abcoathup Thanks again for your help!

apbendi commented 4 years ago

Thanks @abcoathup, huge help! I wonder what the bottleneck is and why it's so different across systems. Mine takes ~4s on a 4 year old macbook pro, though I do have fast broadband. Wonder if that's the issue as it relates to forking and pulling state from the network. Anyway appreciate it! 🍻

ylv-io commented 4 years ago

@mds1 out of curiosity what it was?

mds1 commented 4 years ago

@ylv-io I'm not sure what the root cause was, but the only changes between the initial failing version and the working version are that I (1) deleted the contract build directory and re-compiled, and (2) deleted the node_modules directory and reinstalled packages. But now the tests pass after taking ~6s to start up