getwax / bls-wallet

Core components to use layer 2 smart contract wallets with the BLS signature scheme
MIT License
177 stars 45 forks source link

Integration tests intermittent failing tests #569

Closed JohnGuilding closed 1 year ago

JohnGuilding commented 1 year ago

Observed a specific test failing in the integration tests periodically. It normally seems to cause a few other tests to fail.

Example workflow: https://github.com/web3well/bls-wallet/actions/runs/4553006969/jobs/8029178312

Notice the first failing test: BlsSigner should sign a transaction to create a bundleDto and serialize the result.

The subsequent failing tests I haven't seen fail in isolation, only after the above test fails first. I've observed this issue 4/5 times.

JohnGuilding commented 1 year ago

Further example: https://github.com/web3well/bls-wallet/actions/runs/4744325931/jobs/8425083020?pr=580

JohnGuilding commented 1 year ago

Believe the reason other tests are failing is because the sinon fake in should sign a transaction to create a bundleDto and serialize the result is not restored after the test when it fails, which results in the incorrect nonce error for the subsequent tests. This is because sinon.restore is run at the end of the test which obviously doesn't run when the test fails beforehand.

This doesn't solve why the test fails periodically, but does explain why the other tests are failing afterwards. The fix is to run sinon.restore() in an afterEach. I made this change in #592