thehubbleproject / hubble-contracts

Hubble optimistic rollup
https://thehubbleproject.github.io/docs/
MIT License
133 stars 28 forks source link

Full test run fails #603

Open jacque006 opened 3 years ago

jacque006 commented 3 years ago

What's wrong

When running the full test suite via npm run test, some tests will fail.

$ npm run test

...

  145 passing (6m)
  2 pending
  5 failing

  1) Integration Test
       Coordinator bid the first auction:

      AssertionError: expected 2 to equal 0
      + expected - actual

      -2
      +0

      at Context.<anonymous> (test/integration.test.ts:111:16)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at runNextTicks (internal/process/task_queues.js:64:3)
      at listOnTimeout (internal/timers.js:524:9)
      at processTimers (internal/timers.js:498:7)

  2) Integration Test
       Deposit some users:
     Error: VM Exception while processing transaction: revert Rollup: Invalid proposer
      at Rollup.onlyCoordinator (contracts/rollup/Rollup.sol:103)
      at Rollup.submitDeposits (contracts/rollup/Rollup.sol:318)
      at Rollup.submitDeposits (contracts/rollup/Rollup.sol:318)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at runNextTicks (internal/process/task_queues.js:64:3)
      at listOnTimeout (internal/timers.js:524:9)
      at processTimers (internal/timers.js:498:7)
      at EthModule._estimateGasAction (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:421:9)
      at HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:101:18)

  3) Integration Test
       Users doing Transfers:
     TypeError: Cannot read property 'tokenID' of undefined
      at StateTree._processTransferCommit (ts/stateTree.ts:163:55)
      at _processTransferCommit.next (<anonymous>)
      at Function.from (<anonymous>)
      at StateTree.processTransferCommit (ts/stateTree.ts:191:36)
      at Context.<anonymous> (test/integration.test.ts:203:23)

  4) Integration Test
       Getting new users via Create to transfer:
     TypeError: Cannot read property 'tokenID' of undefined
      at StateTree._processCreate2TransferCommit (ts/stateTree.ts:200:55)
      at _processCreate2TransferCommit.next (<anonymous>)
      at Function.from (<anonymous>)
      at StateTree.processCreate2TransferCommit (ts/stateTree.ts:231:36)
      at Context.<anonymous> (test/integration.test.ts:257:23)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at runNextTicks (internal/process/task_queues.js:64:3)
      at listOnTimeout (internal/timers.js:524:9)
      at processTimers (internal/timers.js:498:7)

  5) Integration Test
       Exit via mass migration:
     TypeError: Cannot read property 'tokenID' of undefined
      at StateTree._processMassMigrationCommit (ts/stateTree.ts:240:55)
      at _processMassMigrationCommit.next (<anonymous>)
      at Function.from (<anonymous>)
      at StateTree.processMassMigrationCommit (ts/stateTree.ts:264:36)
      at Context.<anonymous> (test/integration.test.ts:290:23)

How can we fix it?

This is likely due to global state bleeding over between test(s)/suite(s). Will need to track down and update points in tests where this occurs and find a better testing pattern.

kautukkundan commented 3 years ago

The same tests sometimes succeed when ran again.