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

test: tools for sync operations #10171

Merged
merged 1 commit into from
Oct 22, 2024
Merged

Conversation

anilhelvaci
Copy link
Collaborator

refs: Agoric/BytePitchPartnerEng#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.

@anilhelvaci
Copy link
Collaborator Author

cc @LuqiPan

Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like useful tools. Thanks for the PR.

There are a few code changes requested, but the rest are nits and typos.

@anilhelvaci
Copy link
Collaborator Author

Thanks a lot for your comprehensive review. Implemented the changes you requested. @Chris-Hibbert

Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just discovered that the lint checking we have set up in our other repos isn't being applied here. Rather than pointing out individual deviations, I'm going to request that our SRE team add enforcement here.

Once that's in place, I'll ask for a clean-up pass, but it doesn't make sense to request thorough compliance until the tooling is in place.

I'll come back to this review once that has been configured.

@anilhelvaci
Copy link
Collaborator Author

Yep, I'm aware of that. But I thought this was something known. As yarn format forces prettier on a3p-integration.

In this case, other z:acceptance PRs also going to wait for linting tools as well. Anything we can do to help setting up the tooling?

@Chris-Hibbert
Copy link
Contributor

Anything we can do to help setting up the tooling?

Not as I understand the process. I've filed a ticket, which should be fielded by our SRE team. They often are able to address simple issues like this overnight.

anilhelvaci added a commit to bytepitch/agoric-sdk that referenced this pull request Oct 8, 2024
* change `performAction.js` name to `submitBid.js`
* remove `Math.round` from `scale6`
* update indexing of bids and other constants in `config` object to improve readability (`auction.test.js`)
* move helper functions in `auction.test.js` to `test-lib/auction-lib.js`
* move `lib/vaults.mts` to `test-lib/vaults.mts`  and remove empty `lib` directory
* let it be known `sync-tools.js` is a stand-in code for Agoric#10171

Refs: Agoric/BytePitchPartnerEng#8
anilhelvaci added a commit to bytepitch/agoric-sdk that referenced this pull request Oct 8, 2024
* change `performAction.js` name to `submitBid.js`
* remove `Math.round` from `scale6`
* update indexing of bids and other constants in `config` object to improve readability (`auction.test.js`)
* move helper functions in `auction.test.js` to `test-lib/auction-lib.js`
* move `lib/vaults.mts` to `test-lib/vaults.mts`  and remove empty `lib` directory
* let it be known `sync-tools.js` is a stand-in code for Agoric#10171

Refs: Agoric/BytePitchPartnerEng#8
anilhelvaci added a commit that referenced this pull request Oct 8, 2024
…style fixes

* change `performAction.js` name to `submitBid.js`
* remove `Math.round` from `scale6`
* update indexing of bids and other constants in `config` object to improve readability (`auction.test.js`)
* move helper functions in `auction.test.js` to `test-lib/auction-lib.js`
* move `lib/vaults.mts` to `test-lib/vaults.mts`  and remove empty `lib` directory
* let it be known `sync-tools.js` is a stand-in code for #10171

Refs: Agoric/BytePitchPartnerEng#8

fix: style fixes
@turadg turadg mentioned this pull request Oct 11, 2024
mergify bot added a commit that referenced this pull request Oct 15, 2024
closes: #10238

## Description

Lint a3p-integration for consistency and stopping red squiggles in IDEs

Should unblock #10171 once it rebases on this

### Security Considerations
n/a

### Scaling Considerations
n/a


### Documentation Considerations
The config should explain

### Testing Considerations
per se

### Upgrade Considerations
none
@anilhelvaci anilhelvaci force-pushed the anil/sync-tools branch 2 times, most recently from fd37b7c to 3da0fa5 Compare October 16, 2024 18:40
@anilhelvaci anilhelvaci changed the title Set of tools to sync operations that depend on-chain transactions test: tools for sync operations Oct 16, 2024
Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the long delay.

@anilhelvaci
Copy link
Collaborator Author

No worries @Chris-Hibbert. Should I initiate the merge then?

@anilhelvaci anilhelvaci added the automerge:rebase Automatically rebase updates, then merge label Oct 22, 2024
Refs: Agoric/BytePitchPartnerEng#10

fix: formatting fixes and change requests

fix(sync-tools): apply new linting rules and fix rebase conflicts

Refs: Agoric#10238
@mergify mergify bot merged commit 4a33acc into Agoric:master Oct 22, 2024
79 checks passed
@anilhelvaci anilhelvaci deleted the anil/sync-tools branch October 22, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants