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

Synchronous test jigs for zcf and contract testing #1727

Closed
dtribble opened this issue Sep 9, 2020 · 0 comments · Fixed by #1728
Closed

Synchronous test jigs for zcf and contract testing #1727

dtribble opened this issue Sep 9, 2020 · 0 comments · Fixed by #1728
Labels
enhancement New feature or request

Comments

@dtribble
Copy link
Member

dtribble commented Sep 9, 2020

What is the Problem Being Solved?

To enable testing of ZCF and synchronous updates within a contract, contracts launched
by a tester must be able to provide direct access to objects within the contract, including
the zcf contract facet.

Description of the Design

ZCF is extended with the setTestJig operation, to which it can provide a function that will only be invoked when run in a test environment. That function returns an object to the test that launched the contract. The returned "jig" can hold properties for all the relevant access that the test needs.

The test provides a function (called setJig here) that will be invoked with the above testJig, extended
with a zcf argument to provide synchronous access to the contract's zcf contract facet. Typically, the
setJig will simply set a variable in teh test environment. For fancier uses, it could extract or merge the
properties into an overall test jig, allowing multiple contracts to contribute to the overall test access for
integration tests, for example.

Security Considerations
The contract provides access to internal state for testing, but:

  • MUST NOT provide that state in production
  • MUST NOT receive state from the tester

Test Plan

Integrated into the ZCF and Soe test helpers code. Also used with an actual async membrane in the stablecoin dapp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant