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

Sketch integration test framework #130

Merged
merged 33 commits into from
Nov 6, 2020
Merged

Sketch integration test framework #130

merged 33 commits into from
Nov 6, 2020

Conversation

ethanfrey
Copy link
Member

@ethanfrey ethanfrey commented Oct 19, 2020

Handle most of the memory items needed (with Cell and Box<dyn Trait>). However, I hit an issue trying to construct the Extern. Ideally we would only need &mut Storage, so I could use RefCell, but that is acceptable. However, passing in Router as the Querier, which is also the execution environment of the contract itself, is impossible.

I basically need &Router and Router at once! If we could loosen Extern to only require &Querier rather than Querier (which is all it actually uses), then this would be much easier to implement in Rust.

Raised issue CosmWasm/cosmwasm#584 (and maybe this code belongs in cosmwasm to iterate closer with the APIs)


Update: With the 0.12 cosmwasm API this works quite well. More or less code-complete, including bank.

Done:

  • Test bank
  • Test WasmRouter
  • Test Router - move coins, call contract
  • Add Reflect check - contract calling others: success + error
  • Handle rollback on error (transactional) - handled in Router with rollbacks #134
  • Evaluate high level API

This rollback on error is a bit trickier than I thought... it affects cases where one step succeeds (and writes) and a sub-message fails. Maybe I merge this first, then do another PR for that.

@ethanfrey ethanfrey marked this pull request as draft October 19, 2020 09:44
@ethanfrey ethanfrey changed the base branch from master to define-groups October 19, 2020 09:47
Base automatically changed from define-groups to master October 19, 2020 14:26
@ethanfrey
Copy link
Member Author

@webmaster128

Code is (almost) all implemented as I envisioned it. A number of TODOs and of course this needs tests with real contracts, but the Rust compiler is happy with the lifetimes here.

There is one obvious issue about a contract querying it's own address in handle, which leads to a runtime error. I can add tests to trigger with mock contracts and look at handling that better, but let's discuss this on a call Wednesday first.

@ethanfrey ethanfrey added this to the v0.4.0 milestone Nov 4, 2020
@ethanfrey ethanfrey marked this pull request as ready for review November 5, 2020 01:54
@ethanfrey
Copy link
Member Author

I will merge this, as there is quite some work on top #134 and #135 and I haven't gotten a review here. Happy for any comments on this code and I will address it later. But quite some is modified in the other PRs anyway.

@ethanfrey ethanfrey merged commit 695fc09 into master Nov 6, 2020
@ethanfrey ethanfrey deleted the exp-integration-tests branch November 6, 2020 13:30
@ethanfrey ethanfrey mentioned this pull request Nov 6, 2020
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

Successfully merging this pull request may close these issues.

1 participant