simulators/portal: fix race condition in beacon-sync
suite
#1243
+10
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The issue:
The
portal/beacon-sync
test suite currently pulls test data from a live beacon node in order to test syncing the Portal beacon light clients.The bridge client that retrieves the finalized and optimistic updates continues to pull new updates from the beacon client as long as the test is running.
This can be an issue in the
optimistic update
test where a new optimistic update is produced every slot.Only one optimistic update is pushed into the network and the simulator then retrieves a new update from the bridge to compare to when validating the test results.
The solution
Add a parameter to the
start
method in theBridgeService
that tells the bridge whether to continue to retrive new updates from the Beacon Node provider or not. In the theoptimistic update
test, setting this parameter tofalse
will ensure that we don't accidentally pull a new optimistic update when validating the test result since this is current test only tests for a single update.