Skip to content
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

Open
anilhelvaci opened this issue Sep 23, 2024 · 3 comments
Open

introducing an alternative to waitForBlock #181

anilhelvaci opened this issue Sep 23, 2024 · 3 comments

Comments

@anilhelvaci
Copy link
Contributor

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 ? @turadg

@dckc
Copy link
Member

dckc commented Sep 23, 2024

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.

@turadg
Copy link
Member

turadg commented Sep 23, 2024

What do you think if we include one of the above

First implement it locally in a proposal test. If it works well then we can incorporate it upstream.

any alternative would address the issue, including one that was functionally identical but refactored in some way

This would be ideal so the existing uses get automatically improved and no tests have to change.

@anilhelvaci
Copy link
Contributor Author

Thanks, I'm clear now.

mergify bot added a commit to Agoric/agoric-sdk that referenced this issue Oct 22, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants