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

Tendermint enclave build fails due to duplicate enclave-ffi-types crate in this repo #1439

Open
likuilin opened this issue May 15, 2023 · 2 comments

Comments

@likuilin
Copy link

I'm trying to build tendermint_enclave.signed.so from tm-secret-enclave myself (yes I know the MRSIGNER will be different so it won't work on-chain), and am running into this error:

error[E0432]: unresolved imports `enclave_ffi_types::INPUT_ENCRYPTED_SEED_SIZE`, `enclave_ffi_types::OUTPUT_ENCRYPTED_SEED_SIZE`
 --> /home/kuilin/.cargo/git/checkouts/secretnetwork-321ca7ab73a61848/a3edd66/cosmwasm/enclaves/shared/crypto/src/consts.rs:4:29
  |
4 | pub use enclave_ffi_types::{INPUT_ENCRYPTED_SEED_SIZE, OUTPUT_ENCRYPTED_SEED_SIZE};
  |                             ^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `OUTPUT_ENCRYPTED_SEED_SIZE` in the root
  |                             |
  |                             no `INPUT_ENCRYPTED_SEED_SIZE` in the root
  |
help: a similar name exists in the module
  |
4 | pub use enclave_ffi_types::{ENCRYPTED_SEED_SIZE, OUTPUT_ENCRYPTED_SEED_SIZE};
  |                             ~~~~~~~~~~~~~~~~~~~
help: a similar name exists in the module
  |
4 | pub use enclave_ffi_types::{INPUT_ENCRYPTED_SEED_SIZE, ENCRYPTED_SEED_SIZE};
  |                                                        ~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0432`.
error: could not compile `enclave_crypto` due to previous error

This error happens when building on my machine, but I was able to get the enclave to build successfully using the Dockerfile, so I was able to bisect what the exact issue is by following the xargo execs.

The root cause is that this repo has two enclave-ffi-types crates. On my machine, Cargo finds the one in /seed-service/src/enclaves/ffi-types rather than the correct one in /cosmwasm/enclaves/ffi-types. Both are named enclave-ffi-types with version 0.1.0, but the former (older?) one exports ENCRYPTED_SEED_SIZE, whereas the latter one exports INPUT_ENCRYPTED_SEED_SIZE and OUTPUT_ENCRYPTED_SEED_SIZE.

There's no way to specify the correct one with a local change to Cargo.toml in my checkout of tm-secret-enclave since they have the same version. I'm not sure how best to resolve this issue, but it seems like a clear bug that this repo should not have two crates that are the same name and version, since Cargo will pick one arbitrarily in this case.

@likuilin
Copy link
Author

likuilin commented May 15, 2023

Using the test program whose source is here https://linux.die.net/man/2/getdents64 to get the raw readdir order of ~/.cargo/git/checkouts/secretnetwork-321ca7ab73a61848/a3edd66, I can confirm that seed-service comes before cosmwasm on my machine (non-working), but cosmwasm comes before seed-service in the Docker container on my machine (working).

@Cashmaney
Copy link
Member

Thanks. This is probably due to lockfiles getting messed up somewhere. I'll update the issue when this is resolved

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

No branches or pull requests

2 participants