-
Notifications
You must be signed in to change notification settings - Fork 351
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
Failure on optimized build of codebase for Ethereum address recovery from signature #1551
Comments
The secp256k1-sys crate is "FFI for Pieter Wuille's In this particular case however, I wonder if you are better off using the CosmWasm crypto APIs instead of compiling secp256k1 verification into the contract. In https://github.com/CosmWasm/cosmwasm/blob/main/contracts/crypto-verify/src/ethereum.rs you see how you can do secp256k1 verfication using those APIs.
I don't understand how this related to Cosmos or Ethereum and which implementation is used. If a contract should do a verification, this is a public operation and the public has access to the public key. You can either store it in the contract or pass it as an argument as part of the transaction. Either way it will be public. |
I had a brief look into the web3 codebase. In https://github.com/tomusdrw/rust-web3/blob/0a32ab5a0ca0a8943157174c702069b22f166f08/Cargo.toml#L72 you see that the |
We will try to use another mechanism natively supported by cosmwasm. Thanks for sharing this link. |
The project https://github.com/CosmWasm/cosmwasm/blob/main/contracts/crypto-verify is an example contract already. Nothing live and suitable for production but this is how the contract code looks like. In https://github.com/CosmWasm/cosmwasm/blob/v1.1.9/contracts/crypto-verify/src/ethereum.rs#L30 and https://github.com/CosmWasm/cosmwasm/blob/v1.1.9/contracts/crypto-verify/src/ethereum.rs#L35 you see where the secp256k1 APIs are called. |
I have modified the contract codebase to cargo.toml
Optimized build succeed, but when I try to deploy - I get following issue.
Can you share me the cause of the issue? FYI, I am trying to deploy on cudos testnet. (Used the reference you have shared) At the moment, cudos testnet is using |
As a workaround you can try to deactivate the |
I see, we have raised an issue ticket on Cudos to upgrade the chain, cudoventures/cudos-node#69 |
you need to deactivate the abort feature of cosmwasm-std. Something like this. |
Made following changes
And when I am trying to upload to the chain after optimized build, same issue persists.
Btw, what I have detected is cargo.lock is still using 1.1.9 though I wanted to use 1.1.0 with just "staking" feature.
This issue didn't use to exist even though it's an old version of cosmwasm chain when we don't use the ethereum signature related package from cosmwasm, only when it's used, this issue exists. |
1.1.9 vs. 1.1.0 should not make any difference. If you really need to pin to a patch version, you need to use cosmwasm-std = { version = "=1.0.0", default-features = false, features = ["staking"] } Most likely the issue is that some other dependency enables the |
Here's the tree, when I run the command
After updating to use
|
Thanks for your support @webmaster128 |
Glad it works. In 1.0.0 the "about" feature is not enabled by default, which explains why this works. I think cw2 or cw-utils enables default features, which they should not do in order to allow contract developers to disable things like abort. That's one issue we should solve. And then you should push your chain developers to upgrade CosmWasm since the abort feature is very useful. |
We are running this command to generated optimized version of wasm file for cosmwasm chain upload.
Following issue is being reported consistently
This issue started to happen when
web3
package is added for Ethereum signature verification.https://github.com/tomusdrw/rust-web3
web3 has dependency of
secp256k1
which is not able to be installed using the docker image.Here's one of the relevant research that was answering what could be the issue.
https://substrate.stackexchange.com/questions/1098/how-to-use-sp-core-in-libraries-that-target-wasm-for-the-web?rq=1
But for optimized build, clang version on docker image won't be able to be used.
It would be nice to get docker image updated to get this working on next release or at least provide alternative of signature verification method.
We are not using Cosmos signature as we believe storing pubkey for signer is not ideal to be put on the contract.
https://docs.cosmwasm.com/docs/0.14/CHANGELOG/
It would be nice to provide optimized direction for the issue. We can provide more details if there's more input. Since our codebase is open-source, the link can be provided as well for reproduction.
The text was updated successfully, but these errors were encountered: