Error: failed to run custom build command for `ring v0.14.6 ...`

I believe the culprit is here.
I am wondering whether somebody else had a similar issue.

terminal output

Compiling Secret Contract “demonstration”…
Compiling ring v0.14.6 (https://github.com/elichai/ring.git?rev=sgx-0.14.6#1454e91f)
Compiling syn v1.0.5
Compiling syn v0.15.44
Compiling fixed-hash v0.2.5
error: failed to run custom build command for ring v0.14.6 (https://github.com/elichai/ring.git?rev=sgx-0.14.6#1454e91f)

Caused by:
process didn’t exit successfully: /home/nioni/Documents/work/enigma-identity/secret_contracts/demonstration/target/release/build/ring-0d086a7a10b6132f/build-script-build (exit code: 101)
— stdout
AMD_ENTRYPOINT: vs/server/remoteExtensionHostProcess
CARGO: /home/nioni/.rustup/toolchains/nightly-2019-05-20-x86_64-unknown-linux-gnu/bin/cargo
CARGO_CFG_DEBUG_ASSERTIONS:
CARGO_CFG_PROC_MACRO:
CARGO_CFG_TARGET_ARCH: wasm32
CARGO_CFG_TARGET_ENDIAN: little
CARGO_CFG_TARGET_ENV:
CARGO_CFG_TARGET_HAS_ATOMIC: 16,32,64,8,cas,ptr
CARGO_CFG_TARGET_OS: unknown
CARGO_CFG_TARGET_POINTER_WIDTH: 32
CARGO_CFG_TARGET_VENDOR: unknown
CARGO_FEATURE_DEFAULT: 1
CARGO_FEATURE_DEV_URANDOM_FALLBACK: 1
CARGO_FEATURE_USE_HEAP: 1
CARGO_HOME: /home/nioni/.cargo
CARGO_MAKEFLAGS: --jobserver-fds=3,4 -j --jobserver-auth=3,4 -j
CARGO_MANIFEST_DIR: /home/nioni/.cargo/git/checkouts/ring-8edb69512cc299ec/1454e91
CARGO_MANIFEST_LINKS: ring-asm
CARGO_PKG_AUTHORS: Brian Smith brian@briansmith.org
CARGO_PKG_DESCRIPTION: Safe, fast, small crypto using Rust.
CARGO_PKG_HOMEPAGE:
CARGO_PKG_NAME: ring
CARGO_PKG_REPOSITORY: https://github.com/briansmith/ring
CARGO_PKG_VERSION: 0.14.6
CARGO_PKG_VERSION_MAJOR: 0
CARGO_PKG_VERSION_MINOR: 14
CARGO_PKG_VERSION_PATCH: 6
CARGO_PKG_VERSION_PRE:
COLORTERM: truecolor
DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1000/bus
DEBUG: false
DOCKER_HOST: 127.0.0.1:2375
HOME: /home/nioni
HOST: x86_64-unknown-linux-gnu
LANG: en_US.UTF-8
LC_ADDRESS: el_CY.UTF-8
LC_IDENTIFICATION: el_CY.UTF-8
LC_MEASUREMENT: el_CY.UTF-8
LC_MONETARY: el_CY.UTF-8
LC_NAME: el_CY.UTF-8
LC_NUMERIC: el_CY.UTF-8
LC_PAPER: el_CY.UTF-8
LC_TELEPHONE: el_CY.UTF-8
LC_TIME: el_CY.UTF-8
LD_LIBRARY_PATH: /home/nioni/Documents/work/enigma-identity/secret_contracts/demonstration/target/release/deps:/home/nioni/.rustup/toolchains/nightly-2019-05-20-x86_64-unknown-linux-gnu/lib:/home/nioni/.rustup/toolchains/nightly-2019-05-20-x86_64-unknown-linux-gnu/lib
LESSCLOSE: /usr/bin/lesspipe %s %s
LESSOPEN: | /usr/bin/lesspipe %s
LOGNAME: nioni
LS_COLORS: rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:*.xspf=00;36:
MAIL: /var/mail/nioni
NUM_JOBS: 4
NVM_BIN: /home/nioni/.nvm/versions/node/v11.15.0/bin
NVM_CD_FLAGS:
NVM_DIR: /home/nioni/.nvm
OLDPWD: /home/nioni/Documents/work/enigma-identity/secret_contracts/enigma-identity
OPT_LEVEL: z
OUT_DIR: /home/nioni/Documents/work/enigma-identity/secret_contracts/demonstration/target/wasm32-unknown-unknown/release/build/ring-2232fcfaf7f4e023/out
PATH: /home/nioni/.cargo/bin:/home/nioni/.vscode-server/bin/f06011ac164ae4dc8e753a3fe7f9549844d15e35/bin:/home/nioni/.cargo/bin:/home/nioni/.nvm/versions/node/v11.15.0/bin:/home/nioni/.vscode-server/bin/f06011ac164ae4dc8e753a3fe7f9549844d15e35/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PIPE_LOGGING: true
PROFILE: release
PWD: /home/nioni/Documents/work/enigma-identity
RUSTC: rustc
RUSTDOC: rustdoc
RUSTUP_HOME: /home/nioni/.rustup
RUSTUP_TOOLCHAIN: nightly-2019-05-20-x86_64-unknown-linux-gnu
RUST_RECURSION_COUNT: 1
SHELL: /bin/bash
SHLVL: 1
SSH_CLIENT: 172.17.137.177 51952 22
SSH_CONNECTION: 172.17.137.177 51952 172.17.137.187 22
SSL_CERT_DIR: /usr/lib/ssl/certs
SSL_CERT_FILE: /usr/lib/ssl/certs/ca-certificates.crt
TARGET: wasm32-unknown-unknown
TERM: xterm-256color
TERM_PROGRAM: vscode
TERM_PROGRAM_VERSION: 1.37.1
USER: nioni
VERBOSE_LOGGING: true
VSCODE_IPC_HOOK_CLI: /tmp/vscode-ipc-74174feb-f62a-4cb0-8ec7-fac08e076d47.sock
XDG_DATA_DIRS: /usr/local/share:/usr/share:/var/lib/snapd/desktop
XDG_RUNTIME_DIR: /run/user/1000
XDG_SESSION_CLASS: user
XDG_SESSION_ID: 4
XDG_SESSION_TYPE: tty
_: /home/nioni/.nvm/versions/node/v11.15.0/bin/discovery

— stderr
thread ‘main’ panicked at ‘called Option::unwrap() on a None value’, src/libcore/option.rs:347:21
note: Run with RUST_BACKTRACE=1 environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish…
error: build failed
Something went wrong compiling secret contract demonstration, aborting.
(node:26059) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, copyfile ‘/home/nioni/Documents/work/enigma-identity/secret_contracts/demonstration/target/wasm32-unknown-unknown/release/contract.wasm’ -> ‘/home/nioni/Documents/work/enigma-identity/build/secret_contracts/demonstration.wasm’
at Object.copyFileSync (fs.js:1743:3)
at Object.module.exports.compile (/home/nioni/.nvm/versions/node/v11.15.0/lib/node_modules/@enigmampc/discovery-cli/src/deps.js:139:8)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
(node:26059) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:26059) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

1 Like

I’m seeing the same thing @nioni. I can’t figure it out :-P. I see how you’re trying to use the enigma-crypto interface in your demonstration code. Pretty cool. I’ll follow-up with the team tomorrow to see if we can resolve this!

1 Like

@nioni I was able to resolve the build error by making a modification to the enigma-crypto dependency in your Cargo.toml file. I used the example Enigma encryption secret contract as a reference to try to fix your build error: https://github.com/enigmampc/enigma-core/tree/develop/examples/eng_wasm_contracts/encryption

enigma-crypto = { git = "https://github.com/enigmampc/enigma-core.git", default-features = false, features = ["asymmetric", "hash"] }

And in your lib.rs I used eng_wasm::generate_key() instead of KeyPair::new() to generate the random encryption key. Then used KeyPair::from_slice(...) to create the KeyPair.

The modified demonstration secret contract looks like this:

pub struct Contract;
impl ContractInterface for Contract {
  fn construct() -> () {
    write_state!(STATE => State {
      private_key: generate_key(),
      nonce: U256::from(0)
    });
  }

  fn get_public_key() -> String {
    let private_key = Self::get_state().private_key;
    let key_pair = KeyPair::from_slice(&private_key).unwrap();
    let public_key = key_pair.get_pubkey();

    return public_key.to_hex::<String>();
  }

  fn get_nonce() -> U256 {
    return Self::get_state().nonce;
  }
}

I wasn’t able to get it to build using KeyPair::new() like you had because that’s only available for SGX environments.

1 Like

Thank you for helping out again!, my bad for not following the example.
I got a little bit confused because on the docs.rs for eng_wasm I couldn’t find generate_key, and I thought it was something still in development.

1 Like

No problem! Glad to help :smiley:

hi @nioni the docs maybe built failed but i can find the source here

hi @ainsley the eng_wasm ver 0.1.4 built failed already. Can you guys take a look?

Just checking in on this-- is this issue still open, or were you able to resolve @nioni ?

Yes! thank you @laura :slight_smile:

I’ve had to make some small changes to cargo.toml.

Versions have to be exactly 0.1.4 hence the = 0.1.4 or else generate_key() is not available.

2 Likes