-
Notifications
You must be signed in to change notification settings - Fork 353
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
Atomic swap #52
Atomic swap #52
Conversation
Integration tests done. Except for
The error is precisely when calling the Update: I'm assuming I'm doing something wrong, but cannot find the issue. Here's PoC code for the error: https://github.com/CosmWasm/cosmwasm-plus/tree/atomic-swap-integ_test_query The error is only with the I had to add the "iterator" feature to |
You have to add the iterator feature to both cosmwasm-vm and cosmwasm-storage, but I assume you did. This seems to show you are trying to send an enormous buffer or one with negative size. Can you link to the exact line that returns this error? I will eyeball it and see if I see anything obvious before digging down. You should never be able to create such an error with the higher-level APIs you use |
Yes.
There's now PoC code in the atomic-swap-integ_test_query branch. The last line of integ_test_query() produces the error. To reproduce:
Thanks. |
Interesting. Two points: I don't see the equivalent test here: https://github.com/CosmWasm/cosmwasm-plus/blob/atomic-swap-integ_test_query/contracts/atomic-swap/src/contract.rs rather just a details query. Can you make a unit test on the ListQuery to see what it says? It will give you more detail info on any error. Looking at this https://github.com/CosmWasm/cosmwasm-examples/blob/master/erc20/tests/integration.rs#L378 it seems you do the same thing (unless you want to just |
Also, I have been removing integration tests in this repo, as I hadn't found a bug with them before (besides the cosmwasm contracts that were there to debug it). I would like to hunt down what happens here, but if we figure out why this is broken, I would generally, just focus on the unit tests and maybe remove all these. Also, good to add your contract to |
I converted it to a minimal test, just to show / pinpoint the issue. I have the full integ test for query, and I can commit it if you like, for example in the original branch (it will break the build, though). Anyway, the unit test for
If I add the |
OK.
Will do. |
Huh, I ran this code and played with unit tests and get the same issue. The Update: I did update the test to List a non-empty bucket and the same issue. |
I am off for a bit, but if you want to dig deeper, can you try to add an equivalent test to https://github.com/CosmWasm/cosmwasm/blob/master/contracts/queue/tests/integration.rs (which uses the iterator a bunch). You may just want to add a new query that works like you current List one here: https://github.com/CosmWasm/cosmwasm/blob/master/contracts/queue/src/contract.rs#L115-L124 and then test it with unit test and integration test. If you get that to fail, then we are much closer to a fix - iterating in one repo. You can also import cosmwasm-storage for the same prefix store approach if it doesn't fail without it. |
Will do. |
OK, I've created unit and integration tests under the queue contract in cosmwasm, and the integration test fails. The error is similar, but not exactly the same:
(Numbers are always the same). I cannot push the branch as I don't have permission. I'll create an issue to track this, and document stuff there. |
Created issue: CosmWasm/cosmwasm#508 |
Pushing the Will remove integrations tests later as agreed. |
Thanks, I will review tomorrow... been super busy the last days - sorry. Can you rebase on master since I did merge a lot recently? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for building this out. I have also made some enhancements to the patterns in cosmwasm-plus the last week: pagination, new Expiration type, version calculation, etc. And make a lot of references to update to those newer specs. I think I only see one bug, and a few missing tests (and a few types that can be adjusted).
Please make the requested updates and this should be good to merge.
Implement init(), try_release(), try_refund()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. A few minor nitpics, I will merge this and you can address those in your next PR if you wish.
Also note #69 which you can gladly take on if you wish.
Implementation of atomic swaps, for native tokens.