Enigma Core library. The domain: Trusted and Untrusted App in Rust.

Overview

Enigma Core library

Service Master Develop
CI Badge Build Status Build Status

Pure Rust Enclave && Untrusted in Rust. Core is part of the Enigma node software stack. The Core component as it's name suggests is responsible for the core operations. The core includes Remote Attestation (SGX SDK), Cryptography and execution of WASM secret contracts.

Getting Started (With the Enigma Docker)

Prerequisites

Build and Compile

  • build the enigma docker image
 cd /some/path/enigma-core/dockerfile
 docker build -t enigma_core .

The output should look like that:

Sending build context to Docker daemon  2.048kB
Step 1/7 : FROM baiduxlab/sgx-rust:1.0.0
 ---> 44a7928943e4
Step 2/7 : MAINTAINER enigmampc
 ---> Using cache
 ---> 2a1b994a20f4
Step 3/7 : WORKDIR /root
 ---> Using cache
 ---> 33fc66f979b8
Step 4/7 : RUN rm -rf /root/sgx
 ---> Using cache
 ---> da313d0a4471
Step 5/7 : RUN git clone https://github.com/baidu/rust-sgx-sdk.git sgx -b v1.0.0
 ---> Using cache
 ---> 704631bc2d68
Step 6/7 : RUN apt-get install -y libzmq3-dev
 ---> Using cache
 ---> 141b17bb1564
Step 7/7 : RUN echo '/opt/intel/sgxpsw/aesm/aesm_service &' >> /root/.bashrc
 ---> Using cache
 ---> cd6787969fd1
Successfully built cd6787969fd1
  • run docker:
docker run -v /some/path/enigma-core/:/root/enigma-core -ti -p 5552:5552 --device /dev/isgx enigma_core
  • build the project
cd enigma-core/enigma-core
make 

If the following error occurs then this is an open issue that will be solved.

error[E0463]: can't find crate for `std`
  --> /root/.cargo/git/checkouts/rust-sgx-sdk-fc8771c5c45bde9a/378a4f0/xargo/sgx_tunittest/../../sgx_tunittest/src/lib.rs:88:1
   |
88 | extern crate sgx_tstd as std;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `sgx_tunittest`.

check out Troubleshooting and then make clean && make

Run the tests (inside Docker)

  • Build the project
make
cd app/

Run the tests (no std)

cargo test

Run the test (with std)

cargo test -- --nocapture

Run the project

cd root/enigma-core/enigma-core/bin
./app

Simulation Mode

If you want to run this in a computer that doesn't support SGX you can run both enigma-core and surface in simulation mode.
To do this, run surface with --simulation, then fire up the docker and run:

$ cd enigma-core
$ make full-clean
$ export SGX_MODE=SW
$ make # Here you can add JOBS=N to pass on to cargo the number of jobs to run simultaneously.

Principal Node

Principal Node README.

TBD

Installing

TBD

Deployment

Built With

TBD

Contributing

The master branch always contain the latest release, develop branch is used for continuous developing
Tags will be used to signify releases.

Pull Request

Every new feature or a bug fix will be presented in a pull request while it's a work in progress under the correct label.
When finished change the label to 3 - Ready for reviewing, every pull request is required to pass a code review from at least 1 member before merging.

Issues

Please use the templates accordingly.

Versioning

TBD

Troubleshooting

Errors while building with make

1. wrong sgx_tstd:
error[E0463]: can't find crate for `std`
  --> /root/.cargo/git/checkouts/rust-sgx-sdk-fc8771c5c45bde9a/378a4f0/xargo/sgx_tunittest/../../sgx_tunittest/src/lib.rs:88:1
  • Temp Solution:
rm -rf ~/.cargo/git/checkouts/rust-sgx-sdk-fc8771c5c45bde9a/378a4f0/xargo/
1. wrong wasmi:
error[E0599]: no function or associated item named `new` found for type `std::ops::RangeInclusive<_>` in the current scope
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.76/src/de/impls.rs:2084:12
     |
2084 |         Ok(RangeInclusive::new(start, end))
     |            ^^^^^^^^^^^^^^^^^^^ function or associated item not found in `std::ops::RangeInclusive<_>`

  • Temp Solution:
rm -rf ~/.cargo/git/checkouts/rust-sgx-sdk-fc8771c5c45bde9a/378a4f0/samplecode/wasmi

Authors

License

The Enigma Core is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Acknowledgements

Thanks to Baidu X-Lab for their great work on Rust SGX SDK.

Comments
  • Principal with Key Management

    Principal with Key Management

    Notes:

    • Deploying the Enigma contract does not work. You'll notice that related sections of the code are commented out. I did not completely remove them because we may want to re-enable them or adapt to your integration test framework. There are two reasons why I chose to disable this:

      1. Rust Web3 does not support deploying contracts with linked libraries: https://github.com/tomusdrw/rust-web3/issues/186. We could submit a PR to enable it but I determined that it was not a priority.
      2. New business logic like the worker selection algorithm requires extensive setup (registering multiple workers, crossing epoch, etc).

      Here is what I did to compensate:

      1. Added lower level unit tests with mock data that does not interface with the live contract.
      2. Made the CLI commands more granular (which useful beyond testing) and added a mode to Enigma.specs.js that invokes the live Principal node. This way, we can substitute the mock for live Principal node and without changing the tests. This was the most convenient way for me to test and also a good bridge to the full integration test script.
    • Added a confirmations parameter to the enigma_contract module in addition to supporting the new methods in the contract.

    • I'm using a specific terminology for some of the for the epoch and keys modules. I'm also using the _u and _t but there was still overlap: 1) Provider: Provide external data; 2) Keeper: Store and verify data in the enclave. I'm happy to refactor this if you suggest a different convention.

    • The keys_keeper_types module is copied across: app/src/esgx/keys_keeper_u.rs and enclave/src/keys_keeper_t/keeper_types_t.rs. I tried to make a reusable module that works both in the enclave and out ran into issues and aborted for now.

    • I created enigma-tools-t/src/document_storage_t.rs which is based upon storage_t.rs but supports variable byte array size. It also has improved error handling. I believe that it can replace storage_t.rs.

    TODOs:

    • Seal the epoch data. I have a plan for this to did not have time to finish. Instead of sealing the entire epoch data, I want to seal the nonce + a hash. The epoch_provider will fetch the epoch data and call set_worker_params and pass the nonce. Instead of incrementing the nonce, the epoch_keeper will verify the data against the hash and store in memory.
    • I could not get the Makefile to copy enigma-types.h in the enclave folder. I included a temporary workaround on line 111 of enigma-principal/Makefile. I would appreciate if you could take a look. This causes the build to fail on the CI server.
    • Worker selection is disabled for the time being (it always return the keys). I'm working on testing more thoroughly and will push an update shortly.
    • I cherry picked commit 346a8e40827ee4f9af0f56186d72ac916f26cf6f because I needed a working SPID. Now the attestation_service::service::test tests are failing. The root cause is not obvious to me. I will wait until the related PR is finalized to troubleshoot.
    • Logging is not implemented in the enclave.
    opened by fredfortier 12
  • FIX: Fixed an issue with the `test_write_epoch_state` unit test.

    FIX: Fixed an issue with the `test_write_epoch_state` unit test.

    This test runs before warming up the storage dirs. The fix is temporary. I'm currently working on improving the unit test organization. I will submit a PR that fixes this permanently and handles setup more gracefully. In the meantime, this will fix the test. I did not detect this locally because the test setup did not delete the local storage, which I will remediate in the next PR. I do not know why the CI behaved differently on this branch and develop.

    opened by fredfortier 10
  • Principal Node Error: Error(

    Principal Node Error: Error("missing field `platformInfoBlob`"...

    Describe the bug I'm consistently getting this Error("missing field platformInfoBlob"... when running the principal node. Also, debug messages are being weirdly duplicated. This error occurs with any command. I did some troubleshooting but wasn't able to isolate the root cause. Before creating this issue, I completely re-initialized my environment (see issue #9). The enigma-core unit tests are passing. I can run the SGX Rust SDK sample app so my SGX driver seems to work. My ganache-cli is running and I can see transactions being mined successfully.

    To Reproduce Steps to reproduce the behavior:

    ~/src/enigma-principal# make JOBS=8
    ~/src/enigma-principal/add# cargo test -- --nocapture
    

    Here is the output:

    root@localhost:~/src/enigma-principal/app# cargo test -- --nocapture
        Finished dev [unoptimized + debuginfo] target(s) in 0.68s
         Running target/debug/deps/enigma_principal_app-c63b82cdeec5ac7b
    
    running 4 tests
    [+] Home dir is /root
    [+] Home dir is /root
    [+] Home dir is /root
    [+] Home dir is /root
    [-] Create .enigma folder => AlreadyExists
    [-] Create .enigma folder => AlreadyExists
    [+] Home dir is /root
    [+] Home dir is /root
    The current directory is /root/src/enigma-principal/app
    [+] Home dir is /root
    The current directory is /root/src/enigma-principal/app
    [+] Home dir is /root
    [-] Create .enigma folder => AlreadyExists
    [-] Create .enigma folder => AlreadyExists
    [+] Open token file success!
    [+] Open token file success!
    The current directory is /root/src/enigma-principal/app
    [+] Token file valid!
    [+] Open token file success!
    The current directory is /root/src/enigma-principal/app
    [+] Token file valid!
    [+] Open token file success!
    [+] Token file valid!
    [+] Token file valid!
    [+] Saved updated launch token!
    [+] Init Enclave Successful 2!
    [+] Saved updated launch token!
    [+] Init Enclave Successful 5!
    
    start running tests
    Created file => seal_test.sealed
    success writting to file!
    Created file => seal_test.sealed
    success writting to file!
    testing test_full_sealing_storage ... ok!
    testing test_signing ... ok!
    testing test_ecdh ... ok!
    
    test result ok. 3 tested, 3 passed, 0 failed
    test tests::test_enclave_internal ... ok
    [+] Saved updated launch token!
    [+] Init Enclave Successful 4!
    [+] Saved updated launch token!
    [+] Init Enclave Successful 3!
    [+] Home dir is /root
    Succeeded reading key from file
    -------------------------
    AgAAAPIKAAAHAAYAAAAAABYB+Vw5ueowf+qruQGtw+53NGR00uBFIx/maH4nR7eZCAgCBAECAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAHAAAAAAAAAMYXJwG+NAooXjNU08HSVxCZiQMqJC7KgJPx8+gKR34lAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACD1xnnferKFHD2uvYqTXdDA8iZ22kCD5xw7h38CMfOngAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAweDU3NGUwMjI3MGEzY2U4YzBmN2E5MDUwZDFjMzgxMDVmMTJlMjY3YWMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqAIAAGNPuP0vcn7t+DUgA9wdAUdaDzHhJWH+8gs5ZGS9VM4h6DFy6W4oDi1tlFcVn5CyeQ5mbCzsYLjFX9WDGa8mkPNY5RtHbq9CyRETb/AyAQc1W56lyJ6kJ5tbZnN8p7IhBH0pduqOxSc4LYJCUqGbKgmFwoIVL4q3vsS9UxWQyUI0oEgkDefQEZoQwEFsA8hb1BEfZA6XNpAvIMElbUH3UQSR7qsdXEkaZUl4BuFQh5ZN0gg8r6TYbUcjvbBtzp1hI0PUbqnhMm021j8qmlLVyTpIc4h3CUSdyC+VM/VaeSvlsGIIb7ZinsgGC39/UxNYbADjh/MYDX5ybuK06DguFPQPhf1+Vml8jEWkYIbo70/KzYrhgPyRZk9TVqm5Jy/kJ55HL7927LuGvDbxa2gBAADXsQzDch2GH7PVHeWndkHH2UlOxABQhcYHKOMguT0MivIcbmgqPDOaNqmM+akdYg4lbbxTQBjLQaB2QZbpSoPbzkka0tJPfDbvFgR4VUqbLxqZgu6OHOwifsehRj+zbEboOQJZPAjN/O2B7lpea1jpWWqNG7fsrQxO4ICxhgUVx9YvbKXM74ZTUygnfDWWThFsCdOvhqtBKRlzlgzVbB9Q76Pk0BN//H0jjwyBNPUvFw0TA14lT3Srw+xgALXYzBYvS/w7O93aCIi7rHQIjS2egAWi91xaIHcU5XeZoo3Z1KCqlXfBiRyTayB5GzkLzf/HZcwO1xzGPY0kSEjGyYljaKv63P6MPzwi8CmGVldN17p19SA0tKXyCURhdMxNyzVOHJ2ahqyo/6pZ7awUXokVLvjJbr3MBtu1XDBWziL5o4V1ATA2tCw/h6ZN8YbrKhW1IAMazvwcZxDqlD/FBvhSkC6bcFyiWRsTXPJ5IM6wzAntEaACspJh
    -------------------------
    test esgx::equote::test::test_produce_quote ... ok
    deployed contract at address = 0x3c33…edec
    [+] Home dir is /root
    Succeeded reading key from file
    deployed contract at address = 0xee19…65a1
    [+] Home dir is /root
    Succeeded reading key from file
    deployed contract at address = 0x3365…1412
    deployed contract at address = 0x9c9f…f5fc
    test boot_network::deploy_scripts::test::test_deploy_enigma_contract_environment ... ok
    deployed contract at address = 0x2830…b26d
    deployed dummy contract at address = 0x2830e4110c99c988694f86d737956305f489b26d
    ⚒
    thread 'boot_network::principal_manager::test::test_full_principal_logic' panicked at 'called `Result::unwrap()` on an `Err` value: Error("missing field `platformInfoBlob`", line: 1, column: 719)', libcore/result.rs:1009:5
    note: Run with `RUST_BACKTRACE=1` for a backtrace.
    test boot_network::principal_manager::test::test_full_principal_logic ... FAILED
    
    failures:
    
    failures:
        boot_network::principal_manager::test::test_full_principal_logic
    
    test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
    
    error: test failed, to rerun pass '--bin enigma_principal_app'
    

    Here is the output when running the app:

    [+] Home dir is /root
    [+] Home dir is /root
    [-] Create .enigma folder => AlreadyExists
    The current directory is /root/src/enigma-principal/bin
    [+] Open token file success!
    [+] Token file valid!
    [+] Saved updated launch token!
    [+] Init Enclave Successful 2!
    <>------------------------------------------<>
    
            ╔═╗ ┌┐┌ ┬ ┌─┐ ┌┬┐ ┌─┐
            ║╣  │││ │ │ ┬ │││ ├─┤
            ╚═╝ ┘└┘ ┴ └─┘ ┴ ┴ ┴ ┴
    
            ╔═╗ ┬─┐ ┬ ┌┐┌ ┌─┐ ┬ ┌─┐ ┌─┐ ┬
            ╠═╝ ├┬┘ │ │││ │   │ ├─┘ ├─┤ │
            ╩   ┴└─ ┴ ┘└┘ └─┘ ┴ ┴   ┴ ┴ ┴─┘
    
            ╔╗╔ ┌─┐ ┌┬┐ ┌─┐
            ║║║ │ │  ││ ├┤
            ╝╚╝ └─┘ ─┴┘ └─┘
    <>------------------------------------------<>
    [Mode:] run node NO DEPLOY.
    [+] Home dir is /root
    Succeeded reading key from file
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("missing field `platformInfoBlob`", line: 1, column: 719)', libcore/result.rs:1009:5
    note: Run with `RUST_BACKTRACE=1` for a backtrace.
    
    opened by fredfortier 9
  • Possible typo in array initialization in erc20 secret contract example

    Possible typo in array initialization in erc20 secret contract example

    Describe the bug Referencing dev-help issue: https://github.com/enigmampc/dev-help/issues/9

    User encountered a decryption error during enclave execution which was narrowed down to the line:

    let mut new_sig: [u8; 65] = [0u8; 65];

    that he copied from the verify() method here: enigma-core/examples/eng_wasm_contracts/erc20/src/lib.rs

    It looks like a typo with the 0u8 instead of 0, but I'm not sure. I can't find any examples of initializing an array in Rust that way, but rustc doesn't complain about it.

    To Reproduce Steps to reproduce the behavior:

    1. Use erc20 example SC as a base to create a test SC
    2. Include the verify() function
    3. Compile, migrate and deploy
    4. Write a test to call the verify function
    5. See error

    Expected behavior No decryption error

    Backtrace

    contract_1  | eth_call
    core_1      | Error in deployment of smart contract function: Input Error: Cryptography Error: DecryptionError
    core_1      | 13:14:25 [INFO] Ok(FailedTask { result: FailedTask { output: "6bc1fc2006c30f2df0ab7057c8d0d45470f2fec85b3ca1c31a0a371fc8d5c58333a476edd7306715f65baeb7f9c4f183024b81e1dea0f741e9661e3eadf2a8263ce21deee17f28f9413fef9a", used_gas: 0, signature: "d789928aff806eb8c91357b112cef81529f0edd384fb30eed68ae87362cc857f6368734d725e1646e07482b7c2d9c4078049bb9a312afd845c8c6b97b2d73b881c" } })
    core_1      | building state for 8 contracts
    
    opened by secretchaingirl 8
  • Select Epoch By BlockNumber

    Select Epoch By BlockNumber

    This PR modifies the epoch state management to store N epoch and make them available for worker selection verification.

    Here are some key requirements (also documented in EP-648):

    1. The number of epoch stored should be configurable
    2. The epoch state will be stored in the untrusted module and verified in the enclave. This extends the current sealed EpochState hash model and has been mostly implemented in issue EP-646 .
    3. The JSON-RPC endpoint will contain a new optional blockNumber parameter corresponding to the block number of a Task Record. The Key Mgmt node will select the corresponding epoch if available. If not specified, the last confirmed epoch will be used.
    opened by fredfortier 6
  • FIX: Fixed an issue with using Hash256 in the epoch state and added a…

    FIX: Fixed an issue with using Hash256 in the epoch state and added a…

    It seems like Serde does not automatically serialize Struct HashMap keys so I implemented a custom serializer. I also added a unit test to catch this sort of issue in the future. This was caught be Enigma.spec.js but unit tests did not have sufficient coverage.

    This should resolve issue #110.

    opened by fredfortier 6
  • [Ppal Node]: Retries for connecting to sgx.enigma.co

    [Ppal Node]: Retries for connecting to sgx.enigma.co

    Is your feature request related to a problem? Please describe. I got the following error while launching the Principal Node:

    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Io(Custom { kind: TimedOut, error: StringError("timed out") }), url: Some("https://sgx.enigma.co/api") }
    

    I don't know if this would also be an issue in Core? Cc: @elichai

    https://sgx.enigma.co/api was indeed online at the time, and a subsequent manual request succeeded.

    Describe the solution you'd like I would suggest coding in at least 3 retries for trying this connection, otherwise the Principal Node crashes.

    Describe alternatives you've considered N/A

    Additional context

    backtrace of the error above:

    principal_1   | stack backtrace:
    principal_1   |    0: failure::backtrace::internal::InternalBacktrace::new::h012a694690d84db0 (0x55cb161236fe)
    principal_1   |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/internal.rs:44
    principal_1   |    1: failure::backtrace::Backtrace::new::h1c372c7f484dc91c (0x55cb161231cd)
    principal_1   |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/mod.rs:111
    principal_1   |    2: <failure::error::error_impl::ErrorImpl as core::convert::From<F>>::from::h7e6fd421c5f4b853 (0x55cb15852b2f)
    principal_1   |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/error/error_impl.rs:19
    principal_1   |    3: <failure::error::Error as core::convert::From<F>>::from::h637432e372f33cfc (0x55cb15840122)
    principal_1   |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/error/mod.rs:36
    principal_1   |    4: enigma_tools_u::attestation_service::service::AttestationService::send_request::h043a328328fe84e7 (0x55cb15819ef2)
    principal_1   |              at /root/enigma-core/enigma-tools-u/src/attestation_service/service.rs:118
    principal_1   |    5: enigma_tools_u::attestation_service::service::AttestationService::get_report::{{closure}}::h1da9c57383505c95 (0x55cb15831782)
    principal_1   |              at /root/enigma-core/enigma-tools-u/src/attestation_service/service.rs:97
    principal_1   |    6: enigma_tools_u::attestation_service::service::AttestationService::get_report::h5a07212ab6e43f4c (0x55cb1581ba3c)
    principal_1   |              at /root/enigma-core/enigma-tools-u/src/attestation_service/service.rs:94
    principal_1   |    7: enigma_principal_app::boot_network::principal_manager::ReportManager::get_registration_params::{{closure}}::h1f1c1f4ac90cd80e (0x55cb1539b529)
    principal_1   |              at src/main.rs:1
    principal_1   |    8: enigma_principal_app::boot_network::principal_manager::ReportManager::get_registration_params::h63d34d26d7da11c4 (0x55cb153d20d9)
    principal_1   |              at src/boot_network/principal_manager.rs:77
    principal_1   |    9: <enigma_principal_app::boot_network::principal_manager::PrincipalManager as enigma_principal_app::boot_network::principal_manager::Sampler>::register::h53dc61f57c55e04b (0x55cb15392dbd)
    principal_1   |              at src/boot_network/principal_manager.rs:165
    principal_1   |   10: <enigma_principal_app::boot_network::principal_manager::PrincipalManager as enigma_principal_app::boot_network::principal_manager::Sampler>::verify_identity_or_register::{{closure}}::hb6fc10e55956cb1c (0x55cb1539d6ed)
    principal_1   |              at src/boot_network/principal_manager.rs:187
    principal_1   |   11: <enigma_principal_app::boot_network::principal_manager::PrincipalManager as enigma_principal_app::boot_network::principal_manager::Sampler>::verify_identity_or_register::h9985b4b06fb97672 (0x55cb1539c208)
    principal_1   |              at src/boot_network/principal_manager.rs:178
    principal_1   |   12: <enigma_principal_app::boot_network::principal_manager::PrincipalManager as enigma_principal_app::boot_network::principal_manager::Sampler>::run::{{closure}}::h26edff5a3bbb3269 (0x55cb1539e37a)
    principal_1   |              at src/boot_network/principal_manager.rs:207
    principal_1   |   13: <enigma_principal_app::boot_network::principal_manager::PrincipalManager as enigma_principal_app::boot_network::principal_manager::Sampler>::run::h3517570f4bfe8a65 (0x55cb1539dc5a)
    principal_1   |              at src/boot_network/principal_manager.rs:204
    principal_1   |   14: enigma_principal_app::cli::app::start::{{closure}}::hcb790015458b97f5 (0x55cb153bce64)
    principal_1   |              at src/cli/app.rs:80
    principal_1   |   15: enigma_principal_app::cli::app::start::h34b1500ab6b3c7e1 (0x55cb152a0633)
    principal_1   |              at src/cli/app.rs:17
    principal_1   |   16: enigma_principal_app::main::hd42b6335d59d24d6 (0x55cb1530c644)
    principal_1   |              at src/main.rs:73
    principal_1   |   17: std::rt::lang_start::{{closure}}::h6422b3b451175020 (0x55cb153d2c4f)
    principal_1   |              at libstd/rt.rs:74
    principal_1   |   18: std::rt::lang_start_internal::{{closure}}::hdc2a896aeffb5179 (0x55cb16205ec2)
    principal_1   |              at libstd/rt.rs:59
    principal_1   |       std::panicking::try::do_call::h5a4eb2ce70a501f5
    principal_1   |              at libstd/panicking.rs:310
    principal_1   |   19: __rust_maybe_catch_panic (0x55cb16228789)
    principal_1   |              at libpanic_unwind/lib.rs:102
    principal_1   |   20: std::panicking::try::h97436c380f30f437 (0x55cb162083d5)
    principal_1   |              at libstd/panicking.rs:289
    principal_1   |       std::panic::catch_unwind::h9c28ef6e0c478c5d
    principal_1   |              at libstd/panic.rs:392
    principal_1   |       std::rt::lang_start_internal::h6abd6befa9748e41
    principal_1   |              at libstd/rt.rs:58
    principal_1   |   21: std::rt::lang_start::h9c265978b259098c (0x55cb153d2c27)
    principal_1   |              at libstd/rt.rs:74
    principal_1   |   22: main (0x55cb1530c829)
    principal_1   |   23: __libc_start_main (0x7f50c1ba4b96)
    principal_1   |   24: _start (0x55cb152a0399)
    principal_1   |   25: <unknown> (0x0)', libcore/result.rs:1009:5
    principal_1   | stack backtrace:
    principal_1   |    0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
    principal_1   |              at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
    principal_1   |    1: std::sys_common::backtrace::print
    principal_1   |              at libstd/sys_common/backtrace.rs:71
    principal_1   |              at libstd/sys_common/backtrace.rs:59
    principal_1   |    2: std::panicking::default_hook::{{closure}}
    principal_1   |              at libstd/panicking.rs:211
    principal_1   |    3: std::panicking::default_hook
    principal_1   |              at libstd/panicking.rs:227
    principal_1   |    4: std::panicking::rust_panic_with_hook
    principal_1   |              at libstd/panicking.rs:476
    principal_1   |    5: std::panicking::continue_panic_fmt
    principal_1   |              at libstd/panicking.rs:390
    principal_1   |    6: rust_begin_unwind
    principal_1   |              at libstd/panicking.rs:325
    principal_1   |    7: core::panicking::panic_fmt
    principal_1   |              at libcore/panicking.rs:77
    principal_1   |    8: core::result::unwrap_failed
    principal_1   |              at libcore/macros.rs:26
    principal_1   |    9: <core::result::Result<T, E>>::unwrap
    principal_1   |              at libcore/result.rs:808
    principal_1   |   10: enigma_principal_app::cli::app::start::{{closure}}
    principal_1   |              at src/cli/app.rs:80
    principal_1   |   11: enigma_principal_app::cli::app::start
    principal_1   |              at src/cli/app.rs:17
    principal_1   |   12: enigma_principal_app::main
    principal_1   |              at src/main.rs:73
    principal_1   |   13: std::rt::lang_start::{{closure}}
    principal_1   |              at libstd/rt.rs:74
    principal_1   |   14: std::panicking::try::do_call
    principal_1   |              at libstd/rt.rs:59
    principal_1   |              at libstd/panicking.rs:310
    principal_1   |   15: __rust_maybe_catch_panic
    principal_1   |              at libpanic_unwind/lib.rs:102
    principal_1   |   16: std::rt::lang_start_internal
    principal_1   |              at libstd/panicking.rs:289
    principal_1   |              at libstd/panic.rs:392
    principal_1   |              at libstd/rt.rs:58
    principal_1   |   17: std::rt::lang_start
    principal_1   |              at libstd/rt.rs:74
    principal_1   |   18: main
    principal_1   |   19: __libc_start_main
    principal_1   |   20: _start
    
    enhancement 
    opened by lacabra 6
  • A redeployment of an existing contract fails with Missing State Key

    A redeployment of an existing contract fails with Missing State Key

    Describe the bug A second attempt to redeploy a contract, regardless of whether the first one succeeded or failed (as in #113), errors out with Cryptography Error: MissingKeyError { key_type: "State Key" }. This seems to have nothing to do with core 's ability to request the right state keys from the Key Management node, as this behavior can be observed when the 1st and 2nd deployment happen in the same epoch, when the state keys should be arguably the same.

    To Reproduce

    1. Deploy one valid secret contract, that succeeds.
    2. Attempt to redeploy the very same contract.

    Expected behavior If a contract exists at a given address, it should error out with a relevant message.

    This opens the question on whether two different people cannot deploy the same contract with the same address that is derived from the same preCode

    Backtrace

    core_1        | Error in deployment of smart contract function: Cryptography Error: MissingKeyError { key_type: "State Key" }
    core_1        | 06:42:57 [INFO] LOG DERIVE: Err(EnclaveFailError { err: KeysError, status: SGX_SUCCESS }
    core_1        | 
    core_1        | stack backtrace:
    core_1        |    0: failure::backtrace::internal::InternalBacktrace::new::h0c85aeebdcdd7156 (0x56077d40376e)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/internal.rs:44
    core_1        |    1: failure::backtrace::Backtrace::new::hb2072042fb7e0676 (0x56077d40323d)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/mod.rs:111
    core_1        |    2: <failure::error::error_impl::ErrorImpl as core::convert::From<F>>::from::h884f71c8d4fc0d7b (0x56077ccc4cb2)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/error/error_impl.rs:19
    core_1        |    3: <failure::error::Error as core::convert::From<F>>::from::h2322150188ad4903 (0x56077cc0eac8)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/error/mod.rs:36
    core_1        |    4: <T as core::convert::Into<U>>::into::hae9d1a181fbb5063 (0x56077cc94c38)
    core_1        |              at libcore/convert.rs:456
    core_1        |    5: <enigma_core_app::wasm_u::WasmResult as core::convert::TryFrom<(enigma_types::types::ExecuteResult, enigma_types::hash::Hash256, enigma_types::types::EnclaveReturn, sgx_types::error::sgx_status_t)>>::try_from::hd1482c277b1f2b9a (0x56077ccceffb)
    core_1        |              at src/wasm_u/mod.rs:100
    core_1        |    6: <T as core::convert::TryInto<U>>::try_into::h6619c98f67a049f3 (0x56077cccdace)
    core_1        |              at libcore/convert.rs:474
    core_1        |    7: enigma_core_app::wasm_u::wasm::deploy::{{closure}}::hc2f875e7975caada (0x56077ccd552c)
    core_1        |              at src/wasm_u/wasm.rs:49
    core_1        |    8: enigma_core_app::wasm_u::wasm::deploy::h051d82273f6610b3 (0x56077cca4530)
    core_1        |              at src/wasm_u/wasm.rs:27
    core_1        |    9: enigma_core_app::networking::ipc_listener::handling::deploy_contract::{{closure}}::he9bae77b29db796c (0x56077cc1e4f1)
    core_1        |              at src/networking/ipc_listener.rs:307
    core_1        |   10: enigma_core_app::networking::ipc_listener::handling::deploy_contract::h2667e8963674a2af (0x56077cccad0d)
    core_1        |              at src/networking/ipc_listener.rs:307
    core_1        |   11: enigma_core_app::networking::ipc_listener::handle_message::h1750df4bf26872f3 (0x56077cc0fb10)
    core_1        |              at src/networking/ipc_listener.rs:48
    core_1        |   12: enigma_core_app::main::{{closure}}::hf35b7eb5da2211fb (0x56077cba7814)
    core_1        |              at src/main.rs:35
    core_1        |   13: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once::h0a1b12463a3b99c4 (0x56077cba76da)
    core_1        |              at libcore/ops/function.rs:286
    core_1        |   14: <core::option::Option<T>>::map::h32de77ba92ca6014 (0x56077cba5fbc)
    core_1        |              at libcore/option.rs:424
    core_1        |   15: <futures::stream::map::Map<S, F> as futures::stream::Stream>::poll::h020ec7812c81f167 (0x56077cbc7d8a)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/stream/map.rs:79
    core_1        |   16: <futures::stream::forward::Forward<T, U> as futures::future::Future>::poll::h9f24ac433f8d0533 (0x56077cbb5433)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/stream/forward.rs:94
    core_1        |   17: <futures::future::map::Map<A, F> as futures::future::Future>::poll::hedf6c26bce1e517a (0x56077cbbf4cd)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/future/map.rs:30
    core_1        |   18: <futures::future::chain::Chain<A, B, C>>::poll::h9a56683a803d98e6 (0x56077cbcbca5)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/future/chain.rs:32
    core_1        |   19: <futures::future::and_then::AndThen<A, B, F> as futures::future::Future>::poll::h476e6dd9a7af70c0 (0x56077cbb27f9)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/future/and_then.rs:32
    core_1        |   20: <futures::task_impl::Spawn<T>>::poll_future_notify::{{closure}}::h8aac65f6c2b28787 (0x56077cba3769)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:329
    core_1        |   21: <futures::task_impl::Spawn<T>>::enter::{{closure}}::h0dcbd4cb7cf055a1 (0x56077cba38e6)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:399
    core_1        |   22: futures::task_impl::std::set::h42825b196f346936 (0x56077cbc6fec)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:78
    core_1        |   23: <futures::task_impl::Spawn<T>>::enter::h73545ec010aa3483 (0x56077cba3872)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:399
    core_1        |   24: <futures::task_impl::Spawn<T>>::poll_fn_notify::hbab32881f8f24cdd (0x56077cba3694)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:291
    core_1        |   25: <futures::task_impl::Spawn<T>>::poll_future_notify::h7d6ea848a1928f74 (0x56077cba373d)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:329
    core_1        |   26: futures::task_impl::std::<impl futures::task_impl::Spawn<F>>::wait_future::{{closure}}::h007f83165af89296 (0x56077cbc70c8)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:231
    core_1        |   27: futures::task_impl::std::ThreadNotify::with_current::{{closure}}::h2a26e648c9ac6231 (0x56077cbc6efe)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:478
    core_1        |   28: <std::thread::local::LocalKey<T>>::try_with::h2a5cc9a7429097dd (0x56077cba58f3)
    core_1        |              at libstd/thread/local.rs:294
    core_1        |   29: <std::thread::local::LocalKey<T>>::with::hc1a5d9c54e7a9872 (0x56077cba56f0)
    core_1        |              at libstd/thread/local.rs:248
    core_1        |   30: futures::task_impl::std::ThreadNotify::with_current::hd3630610c1e4cdc4 (0x56077cbc6ebd)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:478
    core_1        |   31: futures::task_impl::std::<impl futures::task_impl::Spawn<F>>::wait_future::h9b449006e78c92e2 (0x56077cba3913)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:228
    core_1        |   32: futures::future::Future::wait::h65ec1379a489e9f4 (0x56077cbb29f1)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/future/mod.rs:299
    core_1        |   33: enigma_core_app::main::h51e5e13b67620211 (0x56077cbb0034)
    core_1        |              at src/main.rs:34
    core_1        |   34: std::rt::lang_start::{{closure}}::hf50adf6ebd355f61 (0x56077cbb93bf)
    core_1        |              at libstd/rt.rs:74
    core_1        |   35: std::rt::lang_start_internal::{{closure}}::hdc2a896aeffb5179 (0x56077d5447d2)
    core_1        |              at libstd/rt.rs:59
    core_1        |       std::panicking::try::do_call::h5a4eb2ce70a501f5
    core_1        |              at libstd/panicking.rs:310
    core_1        |   36: __rust_maybe_catch_panic (0x56077d565729)
    core_1        |              at libpanic_unwind/lib.rs:102
    core_1        |   37: std::panicking::try::h97436c380f30f437 (0x56077d546c95)
    core_1        |              at libstd/panicking.rs:289
    core_1        |       std::panic::catch_unwind::h9c28ef6e0c478c5d
    core_1        |              at libstd/panic.rs:392
    core_1        |       std::rt::lang_start_internal::h6abd6befa9748e41
    core_1        |              at libstd/rt.rs:58
    core_1        |   38: std::rt::lang_start::h28de98d2c46239d3 (0x56077cbb9397)
    core_1        |              at libstd/rt.rs:74
    core_1        |   39: main (0x56077cbb01c9)
    core_1        |   40: __libc_start_main (0x7f68da613b96)
    core_1        |   41: _start (0x56077cba29d9)
    core_1        |   42: <unknown> (0x0))
    core_1        | 06:42:57 [ERROR] Unwrapped p2p Message failed: EnclaveFailError { err: KeysError, status: SGX_SUCCESS }
    core_1        | 
    core_1        | stack backtrace:
    core_1        |    0: failure::backtrace::internal::InternalBacktrace::new::h0c85aeebdcdd7156 (0x56077d40376e)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/internal.rs:44
    core_1        |    1: failure::backtrace::Backtrace::new::hb2072042fb7e0676 (0x56077d40323d)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/mod.rs:111
    core_1        |    2: <failure::error::error_impl::ErrorImpl as core::convert::From<F>>::from::h884f71c8d4fc0d7b (0x56077ccc4cb2)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/error/error_impl.rs:19
    core_1        |    3: <failure::error::Error as core::convert::From<F>>::from::h2322150188ad4903 (0x56077cc0eac8)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/error/mod.rs:36
    core_1        |    4: <T as core::convert::Into<U>>::into::hae9d1a181fbb5063 (0x56077cc94c38)
    core_1        |              at libcore/convert.rs:456
    core_1        |    5: <enigma_core_app::wasm_u::WasmResult as core::convert::TryFrom<(enigma_types::types::ExecuteResult, enigma_types::hash::Hash256, enigma_types::types::EnclaveReturn, sgx_types::error::sgx_status_t)>>::try_from::hd1482c277b1f2b9a (0x56077ccceffb)
    core_1        |              at src/wasm_u/mod.rs:100
    core_1        |    6: <T as core::convert::TryInto<U>>::try_into::h6619c98f67a049f3 (0x56077cccdace)
    core_1        |              at libcore/convert.rs:474
    core_1        |    7: enigma_core_app::wasm_u::wasm::deploy::{{closure}}::hc2f875e7975caada (0x56077ccd552c)
    core_1        |              at src/wasm_u/wasm.rs:49
    core_1        |    8: enigma_core_app::wasm_u::wasm::deploy::h051d82273f6610b3 (0x56077cca4530)
    core_1        |              at src/wasm_u/wasm.rs:27
    core_1        |    9: enigma_core_app::networking::ipc_listener::handling::deploy_contract::{{closure}}::he9bae77b29db796c (0x56077cc1e4f1)
    core_1        |              at src/networking/ipc_listener.rs:307
    core_1        |   10: enigma_core_app::networking::ipc_listener::handling::deploy_contract::h2667e8963674a2af (0x56077cccad0d)
    core_1        |              at src/networking/ipc_listener.rs:307
    core_1        |   11: enigma_core_app::networking::ipc_listener::handle_message::h1750df4bf26872f3 (0x56077cc0fb10)
    core_1        |              at src/networking/ipc_listener.rs:48
    core_1        |   12: enigma_core_app::main::{{closure}}::hf35b7eb5da2211fb (0x56077cba7814)
    core_1        |              at src/main.rs:35
    core_1        |   13: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once::h0a1b12463a3b99c4 (0x56077cba76da)
    core_1        |              at libcore/ops/function.rs:286
    core_1        |   14: <core::option::Option<T>>::map::h32de77ba92ca6014 (0x56077cba5fbc)
    core_1        |              at libcore/option.rs:424
    core_1        |   15: <futures::stream::map::Map<S, F> as futures::stream::Stream>::poll::h020ec7812c81f167 (0x56077cbc7d8a)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/stream/map.rs:79
    core_1        |   16: <futures::stream::forward::Forward<T, U> as futures::future::Future>::poll::h9f24ac433f8d0533 (0x56077cbb5433)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/stream/forward.rs:94
    core_1        |   17: <futures::future::map::Map<A, F> as futures::future::Future>::poll::hedf6c26bce1e517a (0x56077cbbf4cd)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/future/map.rs:30
    core_1        |   18: <futures::future::chain::Chain<A, B, C>>::poll::h9a56683a803d98e6 (0x56077cbcbca5)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/future/chain.rs:32
    core_1        |   19: <futures::future::and_then::AndThen<A, B, F> as futures::future::Future>::poll::h476e6dd9a7af70c0 (0x56077cbb27f9)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/future/and_then.rs:32
    core_1        |   20: <futures::task_impl::Spawn<T>>::poll_future_notify::{{closure}}::h8aac65f6c2b28787 (0x56077cba3769)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:329
    core_1        |   21: <futures::task_impl::Spawn<T>>::enter::{{closure}}::h0dcbd4cb7cf055a1 (0x56077cba38e6)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:399
    core_1        |   22: futures::task_impl::std::set::h42825b196f346936 (0x56077cbc6fec)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:78
    core_1        |   23: <futures::task_impl::Spawn<T>>::enter::h73545ec010aa3483 (0x56077cba3872)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:399
    core_1        |   24: <futures::task_impl::Spawn<T>>::poll_fn_notify::hbab32881f8f24cdd (0x56077cba3694)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:291
    core_1        |   25: <futures::task_impl::Spawn<T>>::poll_future_notify::h7d6ea848a1928f74 (0x56077cba373d)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/mod.rs:329
    core_1        |   26: futures::task_impl::std::<impl futures::task_impl::Spawn<F>>::wait_future::{{closure}}::h007f83165af89296 (0x56077cbc70c8)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:231
    core_1        |   27: futures::task_impl::std::ThreadNotify::with_current::{{closure}}::h2a26e648c9ac6231 (0x56077cbc6efe)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:478
    core_1        |   28: <std::thread::local::LocalKey<T>>::try_with::h2a5cc9a7429097dd (0x56077cba58f3)
    core_1        |              at libstd/thread/local.rs:294
    core_1        |   29: <std::thread::local::LocalKey<T>>::with::hc1a5d9c54e7a9872 (0x56077cba56f0)
    core_1        |              at libstd/thread/local.rs:248
    core_1        |   30: futures::task_impl::std::ThreadNotify::with_current::hd3630610c1e4cdc4 (0x56077cbc6ebd)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:478
    core_1        |   31: futures::task_impl::std::<impl futures::task_impl::Spawn<F>>::wait_future::h9b449006e78c92e2 (0x56077cba3913)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/task_impl/std/mod.rs:228
    core_1        |   32: futures::future::Future::wait::h65ec1379a489e9f4 (0x56077cbb29f1)
    core_1        |              at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.26/src/future/mod.rs:299
    core_1        |   33: enigma_core_app::main::h51e5e13b67620211 (0x56077cbb0034)
    core_1        |              at src/main.rs:34
    core_1        |   34: std::rt::lang_start::{{closure}}::hf50adf6ebd355f61 (0x56077cbb93bf)
    core_1        |              at libstd/rt.rs:74
    core_1        |   35: std::rt::lang_start_internal::{{closure}}::hdc2a896aeffb5179 (0x56077d5447d2)
    core_1        |              at libstd/rt.rs:59
    core_1        |       std::panicking::try::do_call::h5a4eb2ce70a501f5
    core_1        |              at libstd/panicking.rs:310
    core_1        |   36: __rust_maybe_catch_panic (0x56077d565729)
    core_1        |              at libpanic_unwind/lib.rs:102
    core_1        |   37: std::panicking::try::h97436c380f30f437 (0x56077d546c95)
    core_1        |              at libstd/panicking.rs:289
    core_1        |       std::panic::catch_unwind::h9c28ef6e0c478c5d
    core_1        |              at libstd/panic.rs:392
    core_1        |       std::rt::lang_start_internal::h6abd6befa9748e41
    core_1        |              at libstd/rt.rs:58
    core_1        |   38: std::rt::lang_start::h28de98d2c46239d3 (0x56077cbb9397)
    core_1        |              at libstd/rt.rs:74
    core_1        |   39: main (0x56077cbb01c9)
    core_1        |   40: __libc_start_main (0x7f68da613b96)
    core_1        |   41: _start (0x56077cba29d9)
    core_1        |   42: <unknown> (0x0)
    
    opened by lacabra 5
  • BUG: updating rust

    BUG: updating rust

    Today @fredfortier reported build errors appearing seemingly out of the blue from a dependency, that we checked were system independent but related to an older version of rust that this image was running. If we updated to a much newer version other errors would appear, so "locking" Rust to this version nightly-2018-11-01 fixed these build errors.

    For the record, this is a failed build before this fix:

    ~/src/enigma-core# make JOBS=1 DEBUG=1
    mkdir -p ./lib
    make -C ./enclave/ CARGO_FLAGS=-j1 Rust_target_dir=debug
    make[1]: Entering directory '/root/src/enigma-core/enclave'
    cargo build -j1
        Updating git repository `https://github.com/enigmampc/error-chain.git`
        Updating crates.io index                                                                                                                                                                                     
        Updating git repository `https://github.com/enigmampc/ethabi.git`                                                                                                                                            
        Updating git repository `https://github.com/enigmampc/json-patch.git`                                                                                                                                        
        Updating git repository `https://github.com/enigmampc/parity-wasm.git`                                                                                                                                       
        Updating git repository `https://github.com/enigmampc/wasm-utils.git`                                                                                                                                        
        Updating git repository `https://github.com/enigmampc/rustc-hex.git`                                                                                                                                         
        Updating git repository `https://github.com/baidu/rust-sgx-sdk.git`                                                                                                                                          
        Updating git repository `https://github.com/enigmampc/sputnikvm.git`                                                                                                                                         
        Updating git repository `https://github.com/enigmampc/wasmi`                                                                                                                                                 
        Updating git repository `https://github.com/elichai/ring.git`                                                                                                                                                
        Updating git repository `https://github.com/enigmampc/msgpack-rust.git`                                                                                                                                      
        Updating git repository `https://github.com/enigmampc/treediff-rs.git`                                                                                                                                       
        Updating git repository `https://github.com/enigmampc/primitives.git`                                                                                                                                        
       Compiling proc-macro2 v0.4.27                                                                                                                                                                                 
       Compiling unicode-xid v0.1.0                                                                                                                                                                                  
       Compiling autocfg v0.1.2                                                                                                                                                                                      
       Compiling libc v0.2.49                                                                                                                                                                                        
       Compiling rand_core v0.4.0                                                                                                                                                                                    
       Compiling typenum v1.10.0                                                                                                                                                                                     
       Compiling ryu v0.2.7                                                                                                                                                                                          
       Compiling serde v1.0.88                                                                                                                                                                                       
       Compiling unicode-width v0.1.5                                                                                                                                                                                
       Compiling sgx_build_helper v0.1.0 (https://github.com/baidu/rust-sgx-sdk.git?rev=v1.0.4#212d9f4b)                                                                                                             
       Compiling sgx_unwind v0.0.1 (https://github.com/baidu/rust-sgx-sdk.git?rev=v1.0.4#212d9f4b)                                                                                                                   
       Compiling sgx_types v1.0.4 (https://github.com/baidu/rust-sgx-sdk.git?rev=v1.0.4#212d9f4b)                                                                                                                    
       Compiling strsim v0.7.0                                                                                                                                                                                       
       Compiling ansi_term v0.11.0                                                                                                                                                                                   
       Compiling vec_map v0.8.1                                                                                                                                                                                      
       Compiling remove_dir_all v0.5.1                                                                                                                                                                               
       Compiling nodrop v0.1.13                                                                                                                                                                                      
       Compiling bitflags v1.0.4                                                                                                                                                                                     
       Compiling cfg-if v0.1.6                                                                                                                                                                                       
       Compiling itoa v0.4.3                                                                                                                                                                                         
       Compiling byteorder v1.3.1                                                                                                                                                                                    
       Compiling constant_time_eq v0.1.3                                                                                                                                                                             
       Compiling serde v1.0.71 (https://github.com/baidu/rust-sgx-sdk.git?rev=v1.0.4#212d9f4b)                                                                                                                       
       Compiling failure_derive v0.1.5                                                                                                                                                                               
       Compiling byte-tools v0.2.0                                                                                                                                                                                   
       Compiling cc v1.0.29                                                                                                                                                                                          
       Compiling byte-tools v0.3.1                                                                                                                                                                                   
       Compiling arrayvec v0.4.10                                                                                                                                                                                    
       Compiling crunchy v0.1.6                                                                                                                                                                                      
       Compiling spin v0.5.0                                                                                                                                                                                         
    error[E0658]: const fn is unstable (see issue #53555)                                                                                                                                                            
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/spin-0.5.0/src/mutex.rs:109:5                                                                                                                       
        |                                                                                                                                                                                                            
    109 | /     pub const fn new(user_data: T) -> Mutex<T>                                                                                                                                                           
    110 | |     {                                                                                                                                                                                                    
    111 | |         Mutex                                                                                                                                                                                            
    112 | |         {                                                                                                                                                                                                
    ...   |                                                                                                                                                                                                          
    115 | |         }                                                                                                                                                                                                
    116 | |     }                                                                                                                                                                                                    
        | |_____^                                                                                                                                                                                                    
        |                                                                                                                                                                                                            
        = help: add #![feature(min_const_fn)] to the crate attributes to enable                                                                                                                                      
                                                                                                                                                                                                                     
    error[E0658]: const fn is unstable (see issue #53555)                                                                                                                                                            
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/spin-0.5.0/src/rw_lock.rs:96:5                                                                                                                      
        |                                                                                                                                                                                                            
    96  | /     pub const fn new(user_data: T) -> RwLock<T>                                                                                                                                                          
    97  | |     {                                                                                                                                                                                                    
    98  | |         RwLock                                                                                                                                                                                           
    99  | |         {                                                                                                                                                                                                
    ...   |                                                                                                                                                                                                          
    102 | |         }                                                                                                                                                                                                
    103 | |     }                                                                                                                                                                                                    
        | |_____^                                                                                                                                                                                                    
        |                                                                                                                                                                                                            
        = help: add #![feature(min_const_fn)] to the crate attributes to enable                                                                                                                                      
                                                                                                                                                                                                                     
    error[E0658]: const fn is unstable (see issue #53555)                                                                                                                                                            
      --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/spin-0.5.0/src/once.rs:59:5                                                                                                                          
       |                                                                                                                                                                                                             
    59 | /     pub const fn new() -> Once<T> {                                                                                                                                                                       
    60 | |         Self::INIT                                                                                                                                                                                        
    61 | |     }                                                                                                                                                                                                     
       | |_____^                                                                                                                                                                                                     
       |                                                                                                                                                                                                             
       = help: add #![feature(min_const_fn)] to the crate attributes to enable                                                                                                                                       
                                                                                                                                                                                                                     
    error: aborting due to 3 previous errors                                                                                                                                                                         
                                                                                                                                                                                                                     
    For more information about this error, try `rustc --explain E0658`.                                                                                                                                              
    error: Could not compile `spin`.                                                                                                                                                                                 
    
    To learn more, run the command again with --verbose.
    Makefile:14: recipe for target 'libenclave.a' failed
    make[1]: *** [libenclave.a] Error 101
    make[1]: Leaving directory '/root/src/enigma-core/enclave'
    Makefile:143: recipe for target 'enclave' failed
    make: *** [enclave] Error 2
              
    
    opened by lacabra 5
  • Update rust-toolchain to nightly-2019-05-22

    Update rust-toolchain to nightly-2019-05-22

    rust-toolchain file doesn't match baidu's toolchain https://github.com/baidu/rust-sgx-sdk/commit/e0fa56e7deca38fdba3797b345a0a46b696edd8b

    This should also fix the annoying no_mangle warnings https://github.com/rust-lang/rust/issues/60050

    opened by elichai 4
  • Move  code output from verbosity level 2 to 3

    Move code output from verbosity level 2 to 3

    Is your feature request related to a problem? Please describe. When running the the integration integration test on Travis (and trying to integrate the integration tests with other repos on Travis), Travis reports Log Length exceeded and aborts before the tests finish.

    In the current setup core runs with -vv. If I change the verbosity level to -v the tests succeed, but I don't have enough visibility to what core does to be able to troubleshoot.

    Describe the solution you'd like When you choose verbosity level 2 with -vv, when deploying a contract (message Ok(DeploySecretContract...) would not include the output field that contains the bytecode of the deployed contract, but would include all other fields.

    The, to display the field above with all others, you would choose -vvv.

    opened by lacabra 4
  • ENG:SCRT swap ratio

    ENG:SCRT swap ratio

    A selected few validators have suggested that the large community wants a 1:1 swap between ENG:SCRT. I believe this to be a false narrative. In order to quantify my gut feeling, I have created a simple poll to get an idea of what the community wants.

    Please cast your vote here.

    opened by edlanes 2
  • Refactoring the KM

    Refactoring the KM

    Changed naming. Error Handling. Removed unnecessary structs. made the code a bit more rustic. The Integration tests are failing, work is needed to be done in order to locate the cause and fix it.

    opened by AvishaiW 0
  • Upgraded baidu/apache to 0.1.1

    Upgraded baidu/apache to 0.1.1

    • Renamed Baidu to apache.
    • Upgraded all crates depended on Apache crates.
    • Changed the order of flags in the makefile according to the apache release notes.
    • removed some warnings.
    Not Ready 
    opened by AvishaiW 0
  • Undocument Prefix After Decrypting Outputs of a computation

    Undocument Prefix After Decrypting Outputs of a computation

    Describe the bug Decrypting the output of a computation includes a prefix, at least when he results are Vec<u8>. What is it used for?

    To Reproduce See example here: https://github.com/enigmampc/coinjoin-poc/blob/65350409f4dbf43eeb178904cec3ca25e7e5070e/enigma-coinjoin-operator/src/secretContractClient.js#L86

    Let me know if you need more contexts. Hackaton participants have observed the same thing. They also had trailing zeros which weren't in the returned Vec<u8> variable.

    Expected behavior No prefix or an explanation of what the prefix means.

    opened by fredfortier 0
  • Compilation Error `bytes32` type in Eth Contracts

    Compilation Error `bytes32` type in Eth Contracts

    I'm getting a compilation error when compiling a secret contract that references a smart contract. I followed an elimination process to determine what in the smart contract abi causes the error and bytes32 seems to be the culprit.

    Smart Contracts:
    Compiling your contracts...
    ===========================
    > Artifacts written to /home/fredfortier/Code/Mixer/enigma-mixer/build/smart_contracts
    > Compiled successfully using:
       - solc: 0.5.8+commit.23d335f2.Emscripten.clang
    
    Compiling Secret Contract "mixer"...
       Compiling contract v0.1.0 (/home/fredfortier/Code/Mixer/enigma-mixer/secret_contracts/mixer)
    error: custom attribute panicked
      --> src/lib.rs:26:1
       |
    26 | #[eth_contract("Mixer.json")]
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: message: called `Result::unwrap()` on an `Err` value: TokenParseError { error: "unexpected token" }
    
    error: aborting due to previous error
    
    error: Could not compile `contract`.
    
    To learn more, run the command again with --verbose.
    Something went wrong compiling secret contract mixer, aborting.
    

    See https://github.com/enigmampc/discovery-cli/issues/4 for context.

    opened by fredfortier 2
Owner
SCRT Labs
Solving for privacy
SCRT Labs
Diem’s mission is to build a trusted and innovative financial network that empowers people and businesses around the world.

Note to readers: On December 1, 2020, the Libra Association was renamed to Diem Association. The project repos are in the process of being migrated. A

Diem 16.7k Jan 9, 2023
Spartan: High-speed zkSNARKs without trusted setup

Spartan: High-speed zkSNARKs without trusted setup Spartan is a high-speed zero-knowledge proof system, a cryptographic primitive that enables a prove

Microsoft 435 Jan 4, 2023
Noir is a domain specific language for zero knowledge proofs

The Noir Programming Language Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving sy

null 404 Jan 1, 2023
An API and test-app that exposes zcash functionality for app consumption

Zingolib This repo provides both a library for zingoproxyclient and zingo-mobile, as well as an included cli application to interact with zcashd via l

ZingoLabs 5 Dec 15, 2022
Dexios-Core is a library used for managing cryptographic functions and headers that adhere to the Dexios format.

What is it? Dexios-Core is a library used for managing cryptographic functions and headers that adhere to the Dexios format. Security Dexios-Core uses

brxken 3 Jul 4, 2022
Opendp - The core library of differential privacy algorithms powering the OpenDP Project.

OpenDP The OpenDP Library is a modular collection of statistical algorithms that adhere to the definition of differential privacy. It can be used to b

OpenDP 176 Dec 27, 2022
Daemon and tools to control your ASUS ROG laptop. Supersedes rog-core.

asusctl for ASUS ROG - Asus Linux Website asusd is a utility for Linux to control many aspects of various ASUS laptops but can also be used with non-a

Luke Jones 46 Jan 8, 2023
EXPERIMENTAL: Bitcoin Core Prometheus exporter based on User-Space, Statically Defined Tracing and eBPF.

bitcoind-observer An experimental Prometheus metric exporter for Bitcoin Core based on Userspace, Statically Defined Tracing and eBPF. This demo is ba

0xB10C 24 Nov 8, 2022
Aptos-core strives towards being the safest and most scalable layer one blockchain solution.

Aptos-core strives towards being the safest and most scalable layer one blockchain solution. Today, this powers the Aptos Devnet, tomorrow Mainnet in order to create universal and fair access to decentralized assets for billions of people.

Aptos Labs 4.7k Jan 6, 2023
Core Rust-C FFI for Stackmate Wallet.

STACKMATE-CORE A Rust-C FFI library exposing composite functionality from rust-bitcoin & bdk; to create cross-platform descriptor wallets. Currently u

Vishal Menon 5 May 31, 2022
A rust implementation of the ABCI protocol for tendermint core

?? DEPRECATED ?? This repo has been deprecated. Development work continues as the "abci" crate of informalsystems/tendermint-rs. Please reference that

Tendermint 117 Dec 12, 2022
Core contracts for Suberra Protocol.

Suberra Core Contracts Core contracts for Suberra. Contract Description product-factory Factory that handles the instantiation and creation of the pro

Suberra Protocol 4 Dec 12, 2022
Matt's ASCII Game Engine core crate

MAGE Engine Core crate A 100% safe Rust ASCII game engine for writing text-based tools or tile-based games similar to traditional Rogue-likes. This cr

null 29 May 25, 2023
The Mullvad VPN client app for desktop and mobile

Mullvad VPN desktop and mobile app Welcome to the Mullvad VPN client app. This repository contains all the source code for the desktop and mobile vers

Mullvad VPN 3k Jan 2, 2023
NFT & Marketplace Contracts with royalties and fungible token support. Sample React app included.

NFT Market Reference Implementation A PoC backbone for NFT Marketplaces on NEAR Protocol. Reference Changelog Changelog Progress: basic purchase of NF

NEAR App Examples 156 Apr 28, 2022
All the data an IC app needs to make seamless experiences, accessible directly on the IC. DAB is an open internet service for NFT, Token, Canister, and Dapp registries.

DAB ?? Overview An Internet Computer open internet service for data. All the data an IC app needs to make a seamless experience, accessible directly o

Psychedelic 58 Oct 6, 2022
A simple frontend web app in the seed.rs Rust framework.

Seed Quickstart Basic Rust-only template for your new Seed app. 1. Create a new project You can use cargo generate to use this template. $ cargo gener

null 0 Dec 24, 2021
A demo app covering building an eBPF load-balancer in Rust

eBPF Rust UDP LoadBalancer Demo This is an example of creating a UDP load-balancer in Rust as an eXpress Data Path (XDP) type eBPF program using the a

Shane Utt 17 Jan 5, 2023
Notabena, the pure Rust open-source note-taking app.

Notabena About Notabena is the free and open source note-taking app, written in pure Rust. Features These are our current planned features. (Most feat

Mart Zielman 7 Jun 22, 2023