-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor onchain settlement updater to use block stream (#1972)
# Description The added e2e test adds ~10s in unnecessary total time to the test suite, because the onchain settlement updater runs on its own schedule (which is hardcoded at 10s). My first thought was to make this schedule configurable (and set it to 1s in the test), but it seems more correct for this to also be driven by new blocks incoming. This PR refactors the component to use `CurrentBlockStream` instead of its own polling. # Changes - Use CurrentBlockStream instead of hardcoded polling loop One subtlety is that the SettlementUpdater is not reading the tx_hash from the onchain settlement event, but from the DB instead. This means that the Settlement has to be processed first (and then the competition data may only be updated in the next run since it doesn't yet see the settlement when it runs). This is not an issue in practice (submission data will be written to the DB once the next block arrives). For the For the e2e test, we now add extra `evm_mine` in the `wait_for_condition_block` to simulate the chain advancing. I was thinking to either add a concept of dependencies into the different jobs that run when a new block arrive, or put the settlement updating code on the same codepath that processes the original settlement events, but both seem to be involved refactorings for fairly little benefit imo. ## How to test e2e tests now run faster ## Related Issues Improves test from #1959
- Loading branch information
Showing
5 changed files
with
40 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters