livepeer / protocol

Livepeer protocol
MIT License
154 stars 45 forks source link

added tests for lip-83: roundLength change #599

Closed kautukkundan closed 1 year ago

kautukkundan commented 2 years ago

What does this pull request do? Explain your changes. (required)

Specific updates (required)

How did you test each of these updates (required)

ran yarn test:coverage

Does this pull request close any open issues?

closes https://github.com/livepeer/internal-project-tracking/issues/400

Checklist:

kautukkundan commented 2 years ago

reviewing suggestion for latest commit - @yondonfu I moved the entire test into a helper function, hence the diff may seem large. But essentially it just wraps it in a function and changes global variable roundLength with a local variable _roundLength inside the function.

using evm_snapshot and evm_revert because subsequent tests depends on the global state of the contract. Hence repeating same test twice was causing issues with double state update.

Also didn't use scoped "it" to separate the two because it was causing the test suite to break my guess is that it was causing sync issues where one test ran before. So, It was important that this ran sequentially.

The actual changes are between lines 431 and 488