Skip to content

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

Open
@likuilin

Description

@likuilin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions