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

make a functional testing package #10369

Closed
turadg opened this issue Oct 30, 2024 · 2 comments · Fixed by #10396
Closed

make a functional testing package #10369

turadg opened this issue Oct 30, 2024 · 2 comments · Fixed by #10396
Assignees

Comments

@turadg
Copy link
Member

turadg commented Oct 30, 2024

What is the Problem Being Solved?

The tests in /a3p-integration tests the functionality of a running chain. It happens to be synthetic but the essential aspect is it performs operations through RPC.

There are two key problems.

Most of the utilities are in another repo
https://github.com/Agoric/agoric-3-proposals/tree/main/packages/synthetic-chain#design has the tools to support testing with a synthetic chain, but the synthetic part really only has to do with how the chain gets started and managed. Interacting with the chain is a concern of agoric-sdk. We see this over and over writing tests in a3p-integration that some improvement is devised and it has to make a cumbersome round-trip to the a3p repo to get back into the test through the @agoric/synthetic-chain library. (example)

Many of the calls go through agoric-cli

Functions like follow and run are implemented in JS by the agoric package but it doesn't export the functionality as JS modules. It only provides a CLI, which has required that something like follow which could be a function call has a complex CLI presentation within the tests,

For example:

      agoric
        .follow(
          '-lF',
          `:published.wallet.${longLivingBidderAddr}`,
          '-o',
          'text',
        )
        .then(res => marshaller.fromCapData(JSON.parse(res))),

Description of the Design

Make a new package, perhaps @agoric/functional-testing.

Move much of the utilities in @agoric/synthetic-chain into it.

Make JS interfaces to the functionality in agoric-cli. E.g.
Be able to follow with something like,

const published = makeFollower(agoricConfig, marshaller);

const stream = published.follow(`wallet.${longLivingBidderAddr}`;

related issues

That one is about abstractions that can be used in agoric-cli and this is about packaging things for A3P testing. There will likely be PRs that make progress on both at once but their "done" criteria are different.

Abstractions that can also be used in dapps.

That one is about testing abstractions that can be re-used across functional tests and bootstrap tests. We might want to design the solution to this issue in a way that would satisfy 8963 but that would be a bigger lift. We could deliver this issue and come back to 8963 later.

Security Considerations

Scaling Considerations

Test Plan

Everything in https://github.com/Agoric/agoric-3-proposals/blob/main/packages/synthetic-chain/src/lib/cliHelper.ts should be available without synthetic-chain or spawning

Upgrade Considerations

@turadg
Copy link
Member Author

turadg commented Oct 30, 2024

@dckc thanks for linking those. I thought I had made something like 10168 but couldn't find it.

I'll update the description to clarify how these each relate.

@LuqiPan LuqiPan self-assigned this Oct 30, 2024
@turadg turadg changed the title functional testing packing make a functional testing package Oct 31, 2024
mergify bot added a commit that referenced this issue Nov 6, 2024
closes: #10168

## Description
Provide a new package, `client-utils`, as a home for utilities that are useful to clients of an Agoric chain. This doesn't currently use `@agoric/rpc` but over time some of it may be pushed down into that package. 

Related work…

- #9200 
This will be where those client factories are kept.

- #10369

This will solve most of what we need for functional testing. Some aspects are specific to the A3P synthetic chain (like account addresses and references to history) but most of what the tests are doing with the chain are operations that any client might do.

- #9109
- #8963

This will contribute to those goals.


### Security Considerations

Reduces authority needed to query chain (from child_process to fetch)

### Scaling Considerations
This is a big package, but it's not to be run on chain. Most client apps use some form of code shaking so they'll only take what they need.

### Documentation Considerations
Once this settles down it ought to be a part of docs.agoric.com

### Testing Considerations
The only test yet is a live one to make sure a query to Emerynet for Swingset params succeeds as expected, even under SES.

No package CI yet. Mostly it's refactoring of existing code so those uses serve as coverage. I do think this would benefit from some additional testing.

### Upgrade Considerations
Will never be on chain
@mergify mergify bot closed this as completed in #10396 Nov 8, 2024
mergify bot added a commit that referenced this issue Nov 8, 2024
closes: #10369

## Description

Many of the imports from `@agoric/synthetic-chain` are not about synthetics per se. They should be possible with the code in agoric-sdk.

This brings the new `@agoric/client-utils` into functional testing in a3p-integration. It makes the canonical source for `sync-tool.js` that was duplicated in different proposal tests.

This also demonstrates a style of smart-wallet offer execution without the `@agoric/synthetic-chain` package. See `OpenVault`. It still goes through `execSwingsetTransaction` spawning `agd` but that could also be optimized with an RPC client lib for SwingSet that does signing (see #9200). That's out of scope for this effort to simply stop reliable in another repo for testing utilities.

Review by commit is recommended

### Security Considerations
n/a, tests

### Scaling Considerations
n/a, tests

### Documentation Considerations
When these patterns stabilize more we may want to write them down. For now I think let's keep it flexible.

### Testing Considerations
per se

### Upgrade Considerations
One impact to the upgrade process is that when moving a proposal from a3p-integration to agoric-3-proposals, the dependencies may have to be updated. Though it's likely they'll work on the `/usr/src/agoric-sdk` in the image
@turadg turadg self-assigned this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants