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

FxDAO test #23

Merged
merged 13 commits into from
Sep 4, 2024
Merged

FxDAO test #23

merged 13 commits into from
Sep 4, 2024

Conversation

bbyalcinkaya
Copy link
Member

@bbyalcinkaya bbyalcinkaya commented Aug 7, 2024

This PR implements a simple FxDAO test contract and updates the test runner to support its execution.

Test Contract

The test contract has the following endpoints:

  1. init: Takes a hash: Bytes as an argument, deploys a new FxDAO/vaults contract using this hash, and calls its init function. The FxDAO contract Wasm module must already be registered with this hash.
  2. test_deposit_ratio: Calls the FxDAO contract that was deployed during the init function.
  3. test_get_core_state: Calls the FxDAO contract’s get_core_state endpoint to retrieve and verify the contract state.

Test Runner Updates

The test runner has been updated to support init functions and the deployment of child contracts, such as FxDAO.

If the test involves a child contract, a kasmer.json config file should be present in the root directory of the test contract. This config file lists the paths to the Wasm files for the child contracts. Upon deploying the test contract, the child contract Wasm modules are automatically registered using uploadWasm.

If the test contract has an init function, it will be called with the hashes of the uploaded Wasm modules as arguments.

With these updates, the FxDAO test runs in the following steps:

  1. Deploy the test contract.
  2. Upload the FxDAO Wasm module using uploadWasm.
  3. Call the test contract's init function with the hash used in step 2.
  4. Call test_deposit_ratio with random or symbolic input.

@bbyalcinkaya bbyalcinkaya marked this pull request as ready for review August 21, 2024 14:06
@bbyalcinkaya bbyalcinkaya requested a review from gtrepta August 21, 2024 14:06
@bbyalcinkaya
Copy link
Member Author

For now, child contracts need to be precompiled. Maybe in a future PR, I can add a compilation step for child contracts.

Copy link
Contributor

@gtrepta gtrepta left a comment

Choose a reason for hiding this comment

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

Aside from the merge conflicts, looks good.

@rv-jenkins rv-jenkins merged commit 80640c4 into master Sep 4, 2024
3 checks passed
@rv-jenkins rv-jenkins deleted the fxdao-test branch September 4, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants