-
Notifications
You must be signed in to change notification settings - Fork 346
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
Contract including rand or time can be stored in chain #530
Comments
This contract should error. Better yet, it should error on store code (or compilng). The misnamed error message on instantiation is covered by other issues, but this highlights missing static checks on the wasm code before storing it. (I would consider this issue closed if said contracts are rejected by store code) |
Thank you @ethanfrey. I agree with you. |
Contracts try to read files in the local-machine behaves the same. https://github.com/loloicci/cosmwasm-contract-file |
I saw this rust-lang/rust@8fe65da Maybe the wasm_syscall feature flag is somehow being set when compiling? |
I think this problem is unsupported function will panic or just generate a message. For example, System.now() will panic. |
Thank you for looking this up. That was my guess as well. Then #501 would be most important and to make sure the panic's error message is propagated to the user.
What kind of op code should that be? |
I'm sorry if I'm wrong because I'm not familiar with Rust lang. |
This only works for op codes that already exist in the Wasm standard. CosmWasm does not create them. It would be the same for any language that compiles to Wasm. |
This means compiling environment unpatched rust-lang/rust@8fe65da can generate wasm binary including systemcall to get the time, right? |
I don't know what |
i.e. even if you can upload a Wasm that tries to call system functions, it will fail to do so |
Thanks for your reply. It helps me! |
Wasmer has support for WASI, but we are not using it. So no WASI functionality is exposed to contracts. |
Closing this as a duplicate of #501 |
Although contracts compiled from rust code including
rand::Rng.gen()
orSystemTime::now()
are non-deterministic, they can be stored in chain. (They should not)The followings are examples of these contracts.
https://github.com/loloicci/cosmwasm-contract-rand
https://github.com/loloicci/cosmwasm-contract-time
(Executing
rand::Rng.gen()
orSystemTime::now()
issuesout of gas
.The cause of this error is not a lack of gas and it is an error during executing a contract with wasmer.
It is concerned with #501 and #375.)
The text was updated successfully, but these errors were encountered: