Skip to content

Commit

Permalink
hardcode data provider config into prod enclave (#2291)
Browse files Browse the repository at this point in the history
* hardcode dataprovider configuration for prod build

* docker enclave config

* fix evm build

* add missing config

* read config from env for new properties

* config for multiworker setup

* remove running mode arg

* use shielding key repo instead of shielding key

* fix local env files
  • Loading branch information
kziemianek committed Jan 22, 2024
1 parent dd8d3cb commit ff22b32
Show file tree
Hide file tree
Showing 82 changed files with 965 additions and 1,225 deletions.
25 changes: 24 additions & 1 deletion tee-worker/.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,27 @@ TrustedWorkerPort=2000
UntrustedWorkerPort=2001
MuRaPort=3443
UntrustedHttpPort=4545
NODE_ENV=local
NODE_ENV=local
# tee-worker dataproviders config
TWITTER_OFFICIAL_URL=http://localhost:19527
TWITTER_LITENTRY_URL=http://localhost:19527
TWITTER_AUTH_TOKEN_V2=
DISCORD_OFFICIAL_URL=http://localhost:19527
DISCORD_LITENTRY_URL=http://localhost:19527
DISCORD_AUTH_TOKEN=
ACHAINABLE_URL=http://localhost:19527
ACHAINABLE_AUTH_KEY=
CREDENTIAL_ENDPOINT=http://localhost:9933
ONEBLOCK_NOTION_KEY=ABCDEFGHIJKLMNOPQRSTUVWXYZ
ONEBLOCK_NOTION_URL=https://abc.com
SORA_QUIZ_MASTER_ID=SORA_QUIZ_MASTER_ID
SORA_QUIZ_ATTENDEE_ID=SORA_QUIZ_ATTENDEE_ID
NODEREAL_API_KEY=NODEREAL_API_KEY
NODEREAL_API_URL=https://open-platform.nodereal.io/
NODEREAL_API_CHAIN_NETWORK_URL=
CONTEST_LEGEND_DISCORD_ROLE_ID=CONTEST_LEGEND_DISCORD_ROLE_ID
CONTEST_POPULARITY_DISCORD_ROLE_ID=CONTEST_POPULARITY_DISCORD_ROLE_ID
CONTEST_PARTICIPANT_DISCORD_ROLE_ID=CONTEST_PARTICIPANT_DISCORD_ROLE_ID
VIP3_URL=https://dappapi.vip3.io/
GENIIDATA_URL=https://api.geniidata.com/api/1/brc20/balance?
GENIIDATA_API_KEY=142cf1b0-1ca7-11ee-bb5e-9d74c2e854ac
16 changes: 2 additions & 14 deletions tee-worker/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions tee-worker/app-libs/stf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ sp-std = { default-features = false, git = "https://github.com/paritytech/substr
# litentry
itp-node-api-metadata-provider = { path = "../../core-primitives/node-api/metadata-provider", default-features = false }
lc-stf-task-sender = { path = "../../litentry/core/stf-task/sender", default-features = false }
lc-vc-task-sender = { path = "../../litentry/core/vc-issuance/lc-vc-task-sender", default-features = false }
litentry-primitives = { path = "../../litentry/primitives", default-features = false }
pallet-parentchain = { path = "../../../pallets/parentchain", default-features = false }

Expand All @@ -60,7 +59,6 @@ sgx = [
# litentry
"litentry-primitives/sgx",
"lc-stf-task-sender/sgx",
"lc-vc-task-sender/sgx",
"itp-node-api-metadata-provider/sgx",
]
std = [
Expand Down Expand Up @@ -89,7 +87,6 @@ std = [
# litentry
"litentry-primitives/std",
"lc-stf-task-sender/std",
"lc-vc-task-sender/std",
"itp-node-api-metadata-provider/std",
]
test = []
1 change: 0 additions & 1 deletion tee-worker/core-primitives/enclave-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ itp-storage = { path = "../storage" }
itp-types = { path = "../types" }

# litentry
lc-data-providers = { path = "../../litentry/core/data-providers" }
teerex-primitives = { path = "../../../primitives/teerex", default-features = false }

[features]
Expand Down
13 changes: 0 additions & 13 deletions tee-worker/core-primitives/enclave-api/ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,4 @@ extern "C" {
until: *const u32,
) -> sgx_status_t;

pub fn run_stf_task_handler(
eid: sgx_enclave_id_t,
retval: *mut sgx_status_t,
data_provider_config: *const u8,
data_provider_config_size: usize,
) -> sgx_status_t;

pub fn run_vc_issuance(
eid: sgx_enclave_id_t,
retval: *mut sgx_status_t,
data_provider_config: *const u8,
data_provider_config_size: usize,
) -> sgx_status_t;
}
5 changes: 0 additions & 5 deletions tee-worker/core-primitives/enclave-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ pub mod sidechain;
pub mod teeracle_api;
pub mod utils;

#[cfg(feature = "implement-ffi")]
pub mod stf_task_handler;
#[cfg(feature = "implement-ffi")]
pub mod vc_issuance;

#[cfg(feature = "implement-ffi")]
pub use sgx_urts::SgxEnclave;

Expand Down
49 changes: 0 additions & 49 deletions tee-worker/core-primitives/enclave-api/src/stf_task_handler.rs

This file was deleted.

49 changes: 0 additions & 49 deletions tee-worker/core-primitives/enclave-api/src/vc_issuance.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ use sgx_crypto_helper::{rsa3072::Rsa3072KeyPair, RsaKeyPair};
use sp_core::ed25519::Pair as Ed25519Pair;
use std::vec::Vec;

/// Crypto key mock
///
/// mock implementation that does not encrypt
/// encrypt/decrypt return the input as is
#[derive(Clone)]
pub struct ShieldingCryptoMock {
key: Rsa3072KeyPair,
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ services:
retries: 20
entrypoint:
"/usr/local/bin/litentry-worker --clean-reset --ws-external -M litentry-worker-1 -T wss://litentry-worker-1
-u ws://litentry-node -U ws://litentry-worker-1 -P 2011 -w 2101 -p 9912 -h 4645 --enable-mock-server --running-mode mock
-u ws://litentry-node -U ws://litentry-worker-1 -P 2011 -w 2101 -p 9912 -h 4645 --enable-mock-server
run --dev --skip-ra"
restart: "no"
volumes:
Expand Down
43 changes: 40 additions & 3 deletions tee-worker/docker/multiworker-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ services:
- --execution=wasm
environment:
RUST_LOG: sc_basic_authorship=trace,cumulus-consensus=trace,cumulus-collator=trace,collator_protocol=trace,collation_generation=trace,aura=debug

ulimits: *a1
litentry-worker-1:
image: litentry/litentry-worker:latest
Expand Down Expand Up @@ -144,7 +145,7 @@ services:
retries: 20
entrypoint:
"/usr/local/bin/litentry-worker --clean-reset --ws-external -M litentry-worker-1 -T wss://litentry-worker-1
-u ws://litentry-node -U ws://litentry-worker-1 -P 2011 -w 2101 -p 9912 -h 4645 --enable-mock-server --running-mode mock
-u ws://litentry-node -U ws://litentry-worker-1 -P 2011 -w 2101 -p 9912 -h 4645 --enable-mock-server
run --dev --skip-ra"
restart: "no"
litentry-worker-2:
Expand All @@ -167,6 +168,24 @@ services:
- "${SGX_QCNL:-/dev/null}:/etc/sgx_default_qcnl.conf"
environment:
- RUST_LOG=info,litentry_worker=debug,ws=warn,sp_io=error,substrate_api_client=warn,itc_parentchain_light_client=info,jsonrpsee_ws_client=warn,jsonrpsee_ws_server=warn,enclave_runtime=debug,ita_stf=debug,its_rpc_handler=warn,itc_rpc_client=warn,its_consensus_common=debug,its_state=warn,its_consensus_aura=warn,aura*=warn,its_consensus_slots=warn,itp_attestation_handler=debug,http_req=debug,lc_mock_server=warn,itc_rest_client=debug,lc_credentials=debug,lc_identity_verification=debug,lc_stf_task_receiver=debug,lc_stf_task_sender=debug,lc_data_providers=debug,itp_top_pool=debug,itc_parentchain_indirect_calls_executor=debug,
- TWITTER_OFFICIAL_URL=http://localhost:19527
- TWITTER_LITENTRY_URL=http://localhost:19527
- TWITTER_AUTH_TOKEN_V2=
- DISCORD_OFFICIAL_URL=http://localhost:19527
- DISCORD_LITENTRY_URL=http://localhost:19527
- DISCORD_AUTH_TOKEN=
- ACHAINABLE_URL=http://localhost:19527
- ACHAINABLE_AUTH_KEY=
- CREDENTIAL_ENDPOINT=http://localhost:9933
- ONEBLOCK_NOTION_KEY=ABCDEFGHIJKLMNOPQRSTUVWXYZ
- ONEBLOCK_NOTION_URL=https://abc.com
- SORA_QUIZ_MASTER_ID=SORA_QUIZ_MASTER_ID
- SORA_QUIZ_ATTENDEE_ID=SORA_QUIZ_ATTENDEE_ID
- NODEREAL_API_KEY=NODEREAL_API_KEY
- NODEREAL_API_URL=https://open-platform.nodereal.io/
- CONTEST_LEGEND_DISCORD_ROLE_ID=CONTEST_LEGEND_DISCORD_ROLE_ID
- CONTEST_POPULARITY_DISCORD_ROLE_ID=CONTEST_POPULARITY_DISCORD_ROLE_ID
- CONTEST_PARTICIPANT_DISCORD_ROLE_ID=CONTEST_PARTICIPANT_DISCORD_ROLE_ID
networks:
- litentry-test-network
healthcheck:
Expand All @@ -176,7 +195,7 @@ services:
retries: 20
entrypoint:
"/usr/local/bin/litentry-worker --clean-reset --ws-external -M litentry-worker-2 -T wss://litentry-worker-2
-u ws://litentry-node -U ws://litentry-worker-2 -P 2011 -w 2101 -p 9912 -h 4645 --enable-mock-server --running-mode mock
-u ws://litentry-node -U ws://litentry-worker-2 -P 2011 -w 2101 -p 9912 -h 4645 --enable-mock-server
run --dev --skip-ra --request-state"
restart: "no"
litentry-worker-3:
Expand All @@ -199,6 +218,24 @@ services:
- "${SGX_QCNL:-/dev/null}:/etc/sgx_default_qcnl.conf"
environment:
- RUST_LOG=info,litentry_worker=debug,ws=warn,sp_io=error,substrate_api_client=warn,itc_parentchain_light_client=info,jsonrpsee_ws_client=warn,jsonrpsee_ws_server=warn,enclave_runtime=debug,ita_stf=debug,its_rpc_handler=warn,itc_rpc_client=warn,its_consensus_common=debug,its_state=warn,its_consensus_aura=warn,aura*=warn,its_consensus_slots=warn,itp_attestation_handler=debug,http_req=debug,lc_mock_server=warn,itc_rest_client=debug,lc_credentials=debug,lc_identity_verification=debug,lc_stf_task_receiver=debug,lc_stf_task_sender=debug,lc_data_providers=debug,itp_top_pool=debug,itc_parentchain_indirect_calls_executor=debug,
- TWITTER_OFFICIAL_URL=http://localhost:19527
- TWITTER_LITENTRY_URL=http://localhost:19527
- TWITTER_AUTH_TOKEN_V2=
- DISCORD_OFFICIAL_URL=http://localhost:19527
- DISCORD_LITENTRY_URL=http://localhost:19527
- DISCORD_AUTH_TOKEN=
- ACHAINABLE_URL=http://localhost:19527
- ACHAINABLE_AUTH_KEY=
- CREDENTIAL_ENDPOINT=http://localhost:9933
- ONEBLOCK_NOTION_KEY=ABCDEFGHIJKLMNOPQRSTUVWXYZ
- ONEBLOCK_NOTION_URL=https://abc.com
- SORA_QUIZ_MASTER_ID=SORA_QUIZ_MASTER_ID
- SORA_QUIZ_ATTENDEE_ID=SORA_QUIZ_ATTENDEE_ID
- NODEREAL_API_KEY=NODEREAL_API_KEY
- NODEREAL_API_URL=https://open-platform.nodereal.io/
- CONTEST_LEGEND_DISCORD_ROLE_ID=CONTEST_LEGEND_DISCORD_ROLE_ID
- CONTEST_POPULARITY_DISCORD_ROLE_ID=CONTEST_POPULARITY_DISCORD_ROLE_ID
- CONTEST_PARTICIPANT_DISCORD_ROLE_ID=CONTEST_PARTICIPANT_DISCORD_ROLE_ID
networks:
- litentry-test-network
healthcheck:
Expand All @@ -208,7 +245,7 @@ services:
retries: 20
entrypoint:
"/usr/local/bin/litentry-worker --clean-reset --ws-external -M litentry-worker-3 -T wss://litentry-worker-3
-u ws://litentry-node -U ws://litentry-worker-3 -P 2011 -w 2101 -p 9912 -h 4645 --enable-mock-server --running-mode mock
-u ws://litentry-node -U ws://litentry-worker-3 -P 2011 -w 2101 -p 9912 -h 4645 --enable-mock-server
run --dev --skip-ra --request-state"
restart: "no"
volumes:
Expand Down
Loading

0 comments on commit ff22b32

Please sign in to comment.