Skip to content

Commit

Permalink
add feature flags for dcap, use pallets fork
Browse files Browse the repository at this point in the history
  • Loading branch information
OverOrion committed Feb 20, 2023
1 parent 02de806 commit 0b5bb49
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 10 deletions.
31 changes: 27 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2668,7 +2668,7 @@ dependencies = [
"serde 1.0.152",
"serde_derive 1.0.152",
"serde_json 1.0.93",
"sgx-verify",
"sgx-verify 0.1.4 (git+https://github.com/OverOrion/pallets.git?branch=szp/extract-tcb-info)",
"sgx_crypto_helper",
"sgx_types",
"sgx_urts",
Expand All @@ -2678,7 +2678,7 @@ dependencies = [
"sp-keyring",
"sp-runtime",
"substrate-api-client",
"teerex-primitives 0.1.0 (git+https://github.com/integritee-network/pallets.git?branch=polkadot-v0.9.37)",
"teerex-primitives 0.1.0 (git+https://github.com/OverOrion/pallets.git?branch=szp/extract-tcb-info)",
"thiserror 1.0.38",
"tokio",
"warp",
Expand Down Expand Up @@ -5206,7 +5206,7 @@ dependencies = [
[[package]]
name = "pallet-parentchain"
version = "0.9.0"
source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v0.9.37#50cac490de02a6484751c193da9f8080477b885c"
source = "git+https://github.com/OverOrion/pallets.git?branch=szp/extract-tcb-info#fb57261d1d6e4b2da12e90f563a5a3f5e6a50b88"
dependencies = [
"frame-support",
"frame-system",
Expand Down Expand Up @@ -5368,7 +5368,7 @@ dependencies = [
"parity-scale-codec",
"scale-info",
"serde 1.0.152",
"sgx-verify",
"sgx-verify 0.1.4 (git+https://github.com/integritee-network/pallets.git?branch=polkadot-v0.9.37)",
"sp-core",
"sp-io 7.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.37)",
"sp-runtime",
Expand Down Expand Up @@ -6835,6 +6835,29 @@ dependencies = [
"x509-cert",
]

[[package]]
name = "sgx-verify"
version = "0.1.4"
source = "git+https://github.com/OverOrion/pallets.git?branch=szp/extract-tcb-info#fb57261d1d6e4b2da12e90f563a5a3f5e6a50b88"
dependencies = [
"base64 0.13.1",
"chrono 0.4.23",
"der",
"frame-support",
"hex",
"parity-scale-codec",
"ring 0.16.20 (git+https://github.com/Niederb/ring-xous.git?branch=0.16.20-cleanup)",
"scale-info",
"serde 1.0.152",
"serde_json 1.0.93",
"sp-core",
"sp-io 7.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.37)",
"sp-std",
"teerex-primitives 0.1.0 (git+https://github.com/OverOrion/pallets.git?branch=szp/extract-tcb-info)",
"webpki 0.21.0",
"x509-cert",
]

[[package]]
name = "sgx_alloc"
version = "1.1.6"
Expand Down
2 changes: 1 addition & 1 deletion app-libs/sgx-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ sp-version = { default-features = false, git = "https://github.com/paritytech/su

# Integritee dependencies
pallet-evm = { default-features = false, optional = true, git = "https://github.com/integritee-network/frontier.git", branch = "polkadot-v0.9.37" }
pallet-parentchain = { default-features = false, git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v0.9.37" }
pallet-parentchain = { default-features = false, git = "https://github.com/OverOrion/pallets.git", branch = "szp/extract-tcb-info" }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion app-libs/stf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ sp-runtime = { default-features = false, git = "https://github.com/paritytech/su

# scs / integritee
my-node-runtime = { package = "integritee-node-runtime", optional = true, git = "https://github.com/integritee-network/integritee-node.git", branch = "polkadot-v0.9.37" }
pallet-parentchain = { default-features = false, git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v0.9.37" }
pallet-parentchain = { default-features = false, git = "https://github.com/OverOrion/pallets.git", branch = "szp/extract-tcb-info" }


[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion enclave-runtime/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,7 @@ dependencies = [
[[package]]
name = "pallet-parentchain"
version = "0.9.0"
source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v0.9.37#50cac490de02a6484751c193da9f8080477b885c"
source = "git+https://github.com/OverOrion/pallets.git?branch=szp/extract-tcb-info#fb57261d1d6e4b2da12e90f563a5a3f5e6a50b88"
dependencies = [
"frame-support",
"frame-system",
Expand Down
2 changes: 1 addition & 1 deletion enclave-runtime/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ pub unsafe extern "C" fn generate_dcap_ra_quote(
Err(e) => return e.into(),
};

let mut dcap_quote_slice = slice::from_raw_parts_mut(dcap_quote_p, dcap_quote_size as usize);
let dcap_quote_slice = slice::from_raw_parts_mut(dcap_quote_p, dcap_quote_size as usize);

if let Err(e) = write_slice_and_whitespace_pad(dcap_quote_slice, dcap_quote) {
return EnclaveError::Other(Box::new(e)).into()
Expand Down
5 changes: 3 additions & 2 deletions service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ its-rpc-handler = { path = "../sidechain/rpc-handler" }
its-storage = { path = "../sidechain/storage" }

# scs / integritee

my-node-runtime = { package = "integritee-node-runtime", git = "https://github.com/integritee-network/integritee-node.git", branch = "polkadot-v0.9.37" }
substrate-api-client = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.37-tag-v0.7.0" }
teerex-primitives = { git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v0.9.37" }
sgx-verify = { git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v0.9.37" }
teerex-primitives = { git = "https://github.com/OverOrion/pallets.git", branch = "szp/extract-tcb-info" }
sgx-verify = { git = "https://github.com/OverOrion/pallets.git", branch = "szp/extract-tcb-info" }

# Substrate dependencies
frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37" }
Expand Down
3 changes: 3 additions & 0 deletions service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ use its_storage::{interface::FetchBlocks, BlockPruner, SidechainStorageLock};
use log::*;
use my_node_runtime::{Hash, Header, RuntimeEvent};
use sgx_types::*;

#[cfg(feature = "dcap")]
use sgx_verify::extract_tcb_info_from_raw_dcap_quote;

use sp_core::crypto::{AccountId32, Ss58Codec};
Expand Down Expand Up @@ -432,6 +434,7 @@ fn start_worker<E, T, D, InitializationHandler, WorkerModeProvider>(
register_collateral(&node_api, &*enclave, &tee_accountid, is_development_mode, skip_ra);

let trusted_url = config.trusted_worker_url_external();
#[cfg(feature = "dcap")]
let marblerun_base_url =
run_config.marblerun_base_url.unwrap_or("http://localhost:9944".to_owned());

Expand Down
5 changes: 5 additions & 0 deletions service/src/prometheus_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ use crate::{
error::{Error, ServiceResult},
};
use async_trait::async_trait;
#[cfg(feature = "dcap")]
use core::time::Duration;
#[cfg(feature = "dcap")]
use itc_rest_client::{
http_client::{DefaultSend, HttpClient},
rest_client::{RestClient, Url as URL},
Expand Down Expand Up @@ -183,12 +185,14 @@ impl ReceiveEnclaveMetrics for EnclaveMetricsReceiver {
#[derive(Serialize, Deserialize, Debug)]
struct PrometheusMarblerunEvents(pub Vec<PrometheusMarblerunEvent>);

#[cfg(feature = "dcap")]
impl RestPath<&str> for PrometheusMarblerunEvents {
fn get_path(path: &str) -> Result<String, itc_rest_client::error::Error> {
Ok(format!("{}", path))
}
}

#[cfg(feature = "dcap")]
pub fn fetch_marblerun_events(base_url: &str) -> Result<Vec<PrometheusMarblerunEvent>, Error> {
let base_url = URL::parse(&base_url).map_err(|e| {
Error::Custom(
Expand Down Expand Up @@ -216,6 +220,7 @@ pub struct PrometheusMarblerunEvent {
pub activation: PrometheusMarblerunEventActivation,
}

#[cfg(feature = "dcap")]
impl PrometheusMarblerunEvent {
pub fn get_quote_without_prepended_bytes(&self) -> &[u8] {
let marblerun_magic_prepended_header_size = 16usize;
Expand Down

0 comments on commit 0b5bb49

Please sign in to comment.