This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1073: Problem: duplicate storage between chain-abci and tx-validation app (fixes #866) r=tomtau a=tomtau Solution: as a part of ADR-001: https://github.com/crypto-com/chain/blob/master/architecture-docs/adr-001.md - tx-validation-app moved to chain-abci - chain-abci build process expanded to handle SGX SDK steps for C stubs -- on non-Linux systems, it'd display a warning and compile the mock version - tx-validation-app SGX unit test moved to chain-abci under a "sgx-test" feature flag - tx-query-app test removed (it was a kind of "mini-integration" / functionality test that assumed a lot of old behaviour, and all of this is now tested in integration tests) - enclave-bridge takes "intra enclave" requests that are passed directly to the ecalls and returns the response - ZMQ server started in chain-abci in a separate thread to handle tx-query requests (note: tx-query was out of scope of ADR-001, as it doesn't have any storage -- its future is TBD depending on audit feedback etc.) - redundant enclave protocol variants removed - "readonly" storage version provided for serving tx-query requests -- rocksdb/kvdb is thread-safe... zmq server then takes the latest chain state or sealed transactions directly -- note: some fixes related to fees, enclave protocol etc. (other steps of ADR-001) would be addressed in a separate PR - chain-abci storage expanded with one column for sealed transaction payloads - integration test building and environment preparation updated note: Makefile + chain-docs aren't updated yet / would be addressed in separate PRs Co-authored-by: Tomas Tauber <[email protected]>
- Loading branch information
Showing
48 changed files
with
767 additions
and
1,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
use std::env; | ||
use std::path::Path; | ||
use std::process::Command; | ||
|
||
fn main() { | ||
match env::var("CARGO_CFG_TARGET_OS").as_ref() { | ||
Ok(os) if os == "linux" => { | ||
let sdk_dir = env::var("SGX_SDK").unwrap_or_else(|_| "/opt/intel/sgxsdk".to_string()); | ||
if !Path::new(&sdk_dir).exists() { | ||
println!("cargo:warning=\"SGX SDK not found\""); | ||
} else { | ||
let is_sim = env::var("SGX_MODE").unwrap_or_else(|_| "HW".to_string()); | ||
|
||
#[cfg(target_arch = "x86")] | ||
let edger8r = format!("{}/bin/x86/sgx_edger8r", sdk_dir); | ||
#[cfg(not(target_arch = "x86"))] | ||
let edger8r = format!("{}/bin/x64/sgx_edger8r", sdk_dir); | ||
|
||
Command::new(edger8r) | ||
.args(&[ | ||
"--untrusted", | ||
"../chain-tx-enclave/tx-validation/enclave/Enclave.edl", | ||
"--search-path", | ||
&format!("{}/include", sdk_dir), | ||
"--search-path", | ||
"../chain-tx-enclave/rust-sgx-sdk/edl", | ||
"--untrusted-dir", | ||
".", | ||
]) | ||
.status() | ||
.unwrap(); | ||
|
||
cc::Build::new() | ||
.file("Enclave_u.c") | ||
.include(&format!("{}/include", sdk_dir)) | ||
.include("../chain-tx-enclave/rust-sgx-sdk/edl") | ||
.compile("enclave.a"); | ||
|
||
#[cfg(target_arch = "x86")] | ||
println!("cargo:rustc-link-search=native={}/lib", sdk_dir); | ||
#[cfg(not(target_arch = "x86"))] | ||
println!("cargo:rustc-link-search=native={}/lib64", sdk_dir); | ||
|
||
match is_sim.as_ref() { | ||
"SW" => println!("cargo:rustc-link-lib=dylib=sgx_urts_sim"), | ||
_ => println!("cargo:rustc-link-lib=dylib=sgx_urts"), // default to HW | ||
} | ||
|
||
println!( | ||
"cargo:rerun-if-changed=../chain-tx-enclave/tx-validation/enclave/Enclave.edl" | ||
); | ||
} | ||
} | ||
_ => { | ||
println!( | ||
"cargo:warning=\"Enclave compilation and execution is only supported on Linux\"" | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.