-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
introducing an alternative to waitForBlock
#181
Comments
I suggest that the title should be something like: waitForBlock(N) is unreliable for synchronization As stated, any alternative would address the issue, including one that was functionally identical but refactored in some way. |
First implement it locally in a proposal test. If it works well then we can incorporate it upstream.
This would be ideal so the existing uses get automatically improved and no tests have to change. |
Thanks, I'm clear now. |
refs: https://github.com/Agoric/BytePitchPartnerEng/issues/10 refs: Agoric/agoric-3-proposals#181 ## Description Currently the way to make sure a transaction sent to agoric chain has been executed is to use a method from `@agoric/synthetic-chain` called `waitForBlock` which stops the execution flow of a given ava test until N number of blocks are produced. This is not as deterministic as we'd like it to be but so far it worked fine. However, it could still end up in a race condition in some extreme cases. In this PR we introduce a set of tools to sync operations carried out in a test. Currently this PR supports operations like; * Making sure a core-eval resulted successfully deploying a contract * Making sure a core-eval successfully sent zoe invitations to committee members for governance * Making sure an account is successfully funded with vbank assets like IST, BLD etc. * Making sure an offer resulted successfully See Agoric/agoric-3-proposals#181 for further discussion. ### Security Considerations This is merely a testing tool, so no security considerations. ### Scaling Considerations This is merely a testing tool, so no scaling considerations. ### Documentation Considerations If this ends up getting in to `@agoric/synthetic-chain` then we might need more extensive explanation of what we do. But for now, I don't think any documentation is needed. ### Testing Considerations Have confirmed that this works fine with existing a3p tests locally but to keep the scope tighter I will update those tests one this PR lands. The coverage of the unit tests in `sync-tools.test.js` seems fine but I'm open to suggestions, of course.
Context
@dckc has raised in here that
waitForBlock
might be racy and pointed some good implementations for an alternative:Considerations
What do you think if we include one of the above to
@agoric/synthetic-chain
? @turadgThe text was updated successfully, but these errors were encountered: