ntls-io / nautilus-trusted-compute

Nautilus Trusted Compute
GNU Affero General Public License v3.0
0 stars 3 forks source link

feat: add Vault backend #61

Closed billguo99 closed 2 years ago

billguo99 commented 2 years ago

https://app.clickup.com/t/2r1kcha Moving Nautilus Wallet web-server backend to nautilus-trusted-compute repository.

NW Web Server directory structure

NTC directory structure

Note: I've excluded sgx-wallet-impl, sgx-wallet, sgx-wallet-test from the rust-sgx-workspace as members because they require certain [patch] and I encountered errors with std:

error: duplicate lang item in crate `std` (which `base64` depends on): `f32_runtime`.
  |
  = note: the lang item is first defined in crate `sgx_tstd` (which `sgx_wallet_impl` depends on)
  = note: first definition in `sgx_tstd` loaded from /home/bill/workspace/nautilus-trusted-compute/rust-sgx-workspace/target/debug/deps/libsgx_tstd-283919adadf28e07.rmeta
  = note: second definition in `std` loaded from /home/bill/.rustup/toolchains/nightly-2021-11-01-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8adcca4f1427867b.rlib

error: duplicate lang item in crate `std` (which `base64` depends on): `f64_runtime`.
  |
  = note: the lang item is first defined in crate `sgx_tstd` (which `sgx_wallet_impl` depends on)
  = note: first definition in `sgx_tstd` loaded from /home/bill/workspace/nautilus-trusted-compute/rust-sgx-workspace/target/debug/deps/libsgx_tstd-283919adadf28e07.rmeta
  = note: second definition in `std` loaded from /home/bill/.rustup/toolchains/nightly-2021-11-01-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8adcca4f1427867b.rlib

error: duplicate lang item in crate `std` (which `base64` depends on): `panic_impl`.
  |
  = note: the lang item is first defined in crate `sgx_tstd` (which `sgx_wallet_impl` depends on)
  = note: first definition in `sgx_tstd` loaded from /home/bill/workspace/nautilus-trusted-compute/rust-sgx-workspace/target/debug/deps/libsgx_tstd-283919adadf28e07.rmeta
  = note: second definition in `std` loaded from /home/bill/.rustup/toolchains/nightly-2021-11-01-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8adcca4f1427867b.rlib

error: duplicate lang item in crate `std` (which `base64` depends on): `begin_panic`.
  |
  = note: the lang item is first defined in crate `sgx_tstd` (which `sgx_wallet_impl` depends on)
  = note: first definition in `sgx_tstd` loaded from /home/bill/workspace/nautilus-trusted-compute/rust-sgx-workspace/target/debug/deps/libsgx_tstd-283919adadf28e07.rmeta
  = note: second definition in `std` loaded from /home/bill/.rustup/toolchains/nightly-2021-11-01-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8adcca4f1427867b.rlib

error: duplicate lang item in crate `std` (which `base64` depends on): `oom`.
  |
  = note: the lang item is first defined in crate `sgx_tstd` (which `sgx_wallet_impl` depends on)
  = note: first definition in `sgx_tstd` loaded from /home/bill/workspace/nautilus-trusted-compute/rust-sgx-workspace/target/debug/deps/libsgx_tstd-283919adadf28e07.rmeta
  = note: second definition in `std` loaded from /home/bill/.rustup/toolchains/nightly-2021-11-01-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8adcca4f1427867b.rlib

JP mentioned a possible solution is to use xargo to replace cargo.

binglekruger commented 2 years ago

Update enclave memory to ~2 GB for now

diff --git a/rust-sgx-workspace/projects/ntc-tee-server/enclave/Enclave.config.xml b/rust-sgx-workspace/projects/ntc-tee-server/enclave/Enclave.config.xml
index ee4c3f7..bf34e90 100644
--- a/rust-sgx-workspace/projects/ntc-tee-server/enclave/Enclave.config.xml
+++ b/rust-sgx-workspace/projects/ntc-tee-server/enclave/Enclave.config.xml
@@ -2,8 +2,8 @@
 <EnclaveConfiguration>
   <ProdID>0</ProdID>
   <ISVSVN>0</ISVSVN>
-  <StackMaxSize>0x40000</StackMaxSize>
-  <HeapMaxSize>0x100000</HeapMaxSize>
+  <StackMaxSize>0x8000000</StackMaxSize>
+  <HeapMaxSize>0x80000000</HeapMaxSize>
   <TCSNum>1</TCSNum>
   <TCSPolicy>1</TCSPolicy>
   <DisableDebug>0</DisableDebug>
billguo99 commented 2 years ago

Update enclave memory to ~2 GB for now

That Enclave.config.xml is for ntc-tee-server which I believe will be the Trusted Execution Environment for the WASM runtime in the future. Once we've done with experimentation on wasm-exec-sgx, we can change these files based on the wasm-exec-sgx repo.