-
Notifications
You must be signed in to change notification settings - Fork 42
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
implement store_code_with_id
helper
#22
Comments
Hi @Art3miX, is your case still relevant? If yes, would it be possible to take a look at your tests? Thanks in advance. |
Hi @Art3miX, could you provide a link to your tests where you use this technique, just to have better understanding of your use-case? Maybe we can provide more general solution? Thanks in advance. |
Hey @DariuszDepta, sorry for the late reply, totally missed this. Here is the contract in question: https://github.com/DA0-DA0/dao-contracts/tree/development/contracts/external/dao-migrator Allowing setting a code id in test can make it possible to test those cases. |
I'm working on a migrator contract which handles migrations of different contracts from V1 to V2, the V1 code ids are known and can be static inside the contract and I need to compare those with the given contracts to make sure im talking only with our modules, but with current
store_code
I can't test it with multi-test. (as a work around I am providing both code id sets from the front-end)It can be done in 2 ways, either create another function
store_code_with_id
that will handle it specifically, or add an optional field of id to currentstore_code
.pub fn store_code_with_id(code, id)
We can store the highest provided code id in
self.last_code_id
, so "original"store_code()
will be able to work, instead of usingself.codes.len()
, it will use thelast_code_id
.Add a test that will check if the provided code id already exists results in an error.
It will cater to a specific use cases of testing contract code id against a static code id provided inside the contract, but those cases might increase as time pass on.
The text was updated successfully, but these errors were encountered: